Xcos MVC: fix windows std::copy warnings 05/15205/2
Antoine ELIAS [Thu, 11 Sep 2014 14:27:52 +0000 (16:27 +0200)]
Change-Id: I4a4b3dd113917749cbf6f0a9184bd5fd932aedb1

scilab/modules/scicos/src/cpp/view_scilab/DiagramAdapter.cpp
scilab/modules/scicos/src/cpp/view_scilab/LinkAdapter.cpp
scilab/modules/scicos/src/cpp/view_scilab/ModelAdapter.cpp
scilab/modules/scicos/src/cpp/view_scilab/ParamsAdapter.cpp

index 7f77968..e2fe547 100644 (file)
@@ -76,7 +76,7 @@ struct objs
 
         types::List* o = new types::List();
 
-        for (size_t i = 0; i < children.size(); ++i)
+        for (int i = 0; i < (int)children.size(); ++i)
         {
             model::BaseObject* item = Controller().getObject(children[i]);
             switch (item->kind())
index 1ad6acb..b8369c5 100644 (file)
@@ -46,9 +46,14 @@ struct xx
         controller.getObjectProperty(adaptee->id(), adaptee->kind(), CONTROL_POINTS, controlPoints);
 
         double* data;
-        types::Double* o = new types::Double((int)controlPoints.size() / 2, 1, &data);
-
-        std::copy(controlPoints.begin(), controlPoints.begin() + controlPoints.size() / 2, data);
+        int size = (int)controlPoints.size() / 2;
+        types::Double* o = new types::Double(size, 1, &data);
+
+#ifdef _MSC_VER
+        std::copy(controlPoints.begin(), controlPoints.begin() + size, stdext::checked_array_iterator<double*>(data, size));
+#else
+        std::copy(controlPoints.begin(), controlPoints.begin() + size, data);
+#endif
         return o;
     }
 
@@ -89,9 +94,14 @@ struct yy
         controller.getObjectProperty(adaptee->id(), adaptee->kind(), CONTROL_POINTS, controlPoints);
 
         double* data;
-        types::Double* o = new types::Double((int)controlPoints.size() / 2, 1, &data);
-
-        std::copy(controlPoints.begin() + controlPoints.size() / 2, controlPoints.end(), data);
+        int size = (int)controlPoints.size() / 2;
+        types::Double* o = new types::Double(size, 1, &data);
+
+#ifdef _MSC_VER
+        std::copy(controlPoints.begin(), controlPoints.begin() + size, stdext::checked_array_iterator<double*>(data, size));
+#else
+        std::copy(controlPoints.begin(), controlPoints.begin() + size, data);
+#endif
         return o;
     }
 
index 54c49f8..de91f3f 100644 (file)
@@ -261,8 +261,11 @@ struct state
         double* data;
         types::Double* o = new types::Double((int)state.size(), 1, &data);
 
+#ifdef _MSC_VER
+        std::copy(state.begin(), state.end(), stdext::checked_array_iterator<double*>(data, state.size()));
+#else
         std::copy(state.begin(), state.end(), data);
-
+#endif
         return o;
     }
 
@@ -303,8 +306,11 @@ struct dstate
         double* data;
         types::Double* o = new types::Double((int)dstate.size(), 1, &data);
 
+#ifdef _MSC_VER
+        std::copy(dstate.begin(), dstate.end(), stdext::checked_array_iterator<double*>(data, dstate.size()));
+#else
         std::copy(dstate.begin(), dstate.end(), data);
-
+#endif
         return o;
     }
 
@@ -390,8 +396,11 @@ struct rpar
 
             double *data;
             types::Double* o = new types::Double((int)rpar.size(), 1, &data);
+#ifdef _MSC_VER
+            std::copy(rpar.begin(), rpar.end(), stdext::checked_array_iterator<double*>(data, rpar.size()));
+#else
             std::copy(rpar.begin(), rpar.end(), data);
-
+#endif
             return o;
         }
         else
@@ -457,8 +466,11 @@ struct ipar
         double *data;
         types::Double* o = new types::Double((int)ipar.size(), 1, &data);
 
+#ifdef _MSC_VER
+        std::transform(ipar.begin(), ipar.end(), stdext::checked_array_iterator<double*>(data, ipar.size()), toDouble);
+#else
         std::transform(ipar.begin(), ipar.end(), data, toDouble);
-
+#endif
         return o;
     }
 
index 764d1f1..865b149 100644 (file)
@@ -129,8 +129,11 @@ struct tol
 
         std::vector<double> tol;
         controller.getObjectProperty(adaptee->id(), adaptee->kind(), PROPERTIES, tol);
-
+#ifdef _MSC_VER
+        std::copy(tol.begin() + 1, tol.end(), stdext::checked_array_iterator<double*>( data, 7 ));
+#else
         std::copy(tol.begin() + 1, tol.end(), data);
+#endif
 
         return o;
     }