diff --git a/Numeric/Numeric.cpp b/Numeric/Numeric.cpp
index f636204b39c611b322346003007ff0c0e28ea72b..d38bd96e3781fb526266271136958fc9da8445ad 100644
--- a/Numeric/Numeric.cpp
+++ b/Numeric/Numeric.cpp
@@ -825,19 +825,19 @@ void signedDistancesPointsTriangle(std::vector<double>&distances,
   SVector3 t3 = p3 - p2;
   SVector3 n = crossprod(t1, t2);
   n.normalize();
-
+	
   double mat[3][3] = {{t1.x(), t2.x(), -n.x()},
                       {t1.y(), t2.y(), -n.y()},
                       {t1.z(), t2.z(), -n.z()}};
   double inv[3][3];
   double det = inv3x3(mat, inv);
-  
+  const unsigned pts_size=pts.size();
   distances.clear();
-  distances.resize(pts.size());
+  distances.resize(pts_size);
   closePts.clear();
-  closePts.resize(pts.size());
+  closePts.resize(pts_size);
 
-  for (unsigned int i = 0; i < pts.size(); i++)
+  for (unsigned int i = 0; i < pts_size; ++i)
     distances[i] = 1.e22;
 
   if(det == 0.0) return;
@@ -847,7 +847,7 @@ void signedDistancesPointsTriangle(std::vector<double>&distances,
   const double n2t3 = dot(t3, t3);
 
   double u, v, d;
-  for (unsigned int i = 0; i < pts.size();i++){
+  for (unsigned int i = 0; i < pts_size;++i){
     const SPoint3 &p = pts[i];
     SVector3 pp1 = p - p1;
     u = (inv[0][0] * pp1.x() + inv[0][1] * pp1.y() + inv[0][2] * pp1.z());
@@ -909,14 +909,15 @@ void signedDistancesPointsLine (std::vector<double>&distances,
 
   SVector3 t1 = p2 - p1;
   const double n2t1 = dot(t1, t1);
-  
+
+  const unsigned pts_size=pts.size();
   distances.clear();
-  distances.resize(pts.size());
+  distances.resize(pts_size);
   closePts.clear();
-  closePts.resize(pts.size());
+  closePts.resize(pts_size);
 
   double d;
-  for (unsigned int i = 0; i < pts.size();i++){
+  for (unsigned int i = 0; i <pts_size;++i){
     const SPoint3 &p = pts[i];
     SVector3 pp1 = p - p1;
     const double t12 = dot(pp1, t1) / n2t1;
diff --git a/Solver/function.cpp b/Solver/function.cpp
index 5c603d903f7db2d39e2aa370b531650232fafcea..1f175c6c4e5f9a388d6f640c6739dd8c0d9d7f32 100644
--- a/Solver/function.cpp
+++ b/Solver/function.cpp
@@ -32,12 +32,12 @@ void function::setArgument(fullMatrix<double> &v, const function *f, int iMap) {
     throw;
   arguments.push_back(argument(v, iMap, f));
   dependencies.insert(dependency(iMap, f));
-  for(std::set<dependency>::iterator it = f->dependencies.begin(); it != f->dependencies.end(); it++) {
+  for(std::set<dependency>::const_iterator it = f->dependencies.begin(); it != f->dependencies.end(); it++) {
     if (it->iMap> 0 && iMap >0)
       Msg::Error("consecutive secondary caches");
     dependencies.insert(dependency(iMap + it->iMap, it->f));
   }
-  for (int i = 0; i < _functionReplaces.size(); i++) {
+  for (double i = 0; i < _functionReplaces.size(); i++) {
     functionReplace &replace = *_functionReplaces[i];
     for (std::set<dependency>::iterator it = replace._fromParent.begin(); it != replace._fromParent.end(); it++) {
       if (it->iMap> 0 && iMap >0)
@@ -80,7 +80,7 @@ dataCacheDouble &dataCacheMap::get(const function *f, dataCacheDouble *caller) {
   // can I use the cache of my parent ?
   if(_parent && r==NULL) {
     bool okFromParent = true;
-    for (std::set<function::dependency>::iterator it = f->dependencies.begin(); it != f->dependencies.end(); it++) {
+    for (std::set<function::dependency>::const_iterator it = f->dependencies.begin(); it != f->dependencies.end(); it++) {
       if (it->iMap > _parent->_secondaryCaches.size())
         okFromParent=false;
       dataCacheMap *m = getSecondaryCache(it->iMap);
@@ -152,9 +152,9 @@ void functionReplace::replace(fullMatrix<double> &v, const function *f, int iMap
 
 void functionReplace::get(fullMatrix<double> &v, const function *f, int iMap) {
   bool allDepFromParent = true;
-  for (std::set<function::dependency>::iterator itDep = f->dependencies.begin(); itDep != f->dependencies.end(); itDep++){
+  for (std::set<function::dependency>::const_iterator itDep = f->dependencies.begin(); itDep != f->dependencies.end(); itDep++){
     bool depFromParent = (_replaced.count(*itDep)==0);
-    for (std::set<function::dependency>::iterator itDep2 = itDep->f->dependencies.begin(); itDep2 != itDep->f->dependencies.end() && depFromParent; itDep2++)
+    for (std::set<function::dependency>::const_iterator itDep2 = itDep->f->dependencies.begin(); itDep2 != itDep->f->dependencies.end() && depFromParent; itDep2++)
       depFromParent &= (_replaced.count(*itDep2)==0);
     if(depFromParent)
       _master->dependencies.insert(*itDep);
diff --git a/Solver/function.h b/Solver/function.h
index 09d433ef4a142d5b8e7b4fbe0e1fe1b983a3eae8..b341fcce31fe3408860af32dbf8a845d9bc13417 100644
--- a/Solver/function.h
+++ b/Solver/function.h
@@ -16,7 +16,7 @@ class dataCacheDouble;
 
 class functionConstant;
 class functionReplace;
-class functionReplaceCache;
+struct functionReplaceCache;
 
 // An abstract interface to functions 
 // more explanation at the head of this file
@@ -26,7 +26,7 @@ class function {
   bool _invalidatedOnElement;
   std::vector<functionReplace*> _functionReplaces;
   class dependency {
-    public : int iMap; const function *f;
+    public : unsigned iMap; const function *f;
     dependency(int iMap_, const function *f_){iMap = iMap_; f = f_; }
     bool operator < (const dependency &d) const {
       return (d.iMap <iMap || d.f < f);
diff --git a/contrib/mpeg_encode/rgbtoycc.cpp b/contrib/mpeg_encode/rgbtoycc.cpp
index c6a9829085bf8664735110a6191bea6d76efac78..54c59a1cab20cbe8c279c5d0d3b7e23379d2cfda 100644
--- a/contrib/mpeg_encode/rgbtoycc.cpp
+++ b/contrib/mpeg_encode/rgbtoycc.cpp
@@ -89,9 +89,9 @@ PNMtoYUV(MpegFrame *frame)
     register xel *src0, *src1;
     register int ydivisor, cdivisor;
     static boolean  first = TRUE;
-    static float  mult299[1024], mult587[1024], mult114[1024];
-    static float  mult16874[1024], mult33126[1024], mult5[1024];
-    static float mult41869[1024], mult08131[1024];
+    static double  mult299[1024], mult587[1024], mult114[1024];
+    static double  mult16874[1024], mult33126[1024], mult5[1024];
+    static double mult41869[1024], mult08131[1024];
 
     if ( first ) {
         register int index;
@@ -256,9 +256,9 @@ PPMtoYUV(MpegFrame *frame)
     register uint8 *src0, *src1;
     register int cdivisor;
     static boolean  first = TRUE;
-    static float  mult299[1024], mult587[1024], mult114[1024];
-    static float  mult16874[1024], mult33126[1024], mult5[1024];
-    static float mult41869[1024], mult08131[1024];
+    static double  mult299[1024], mult587[1024], mult114[1024];
+    static double  mult16874[1024], mult33126[1024], mult5[1024];
+    static double mult41869[1024], mult08131[1024];
 
     if ( first ) {
         register int index;