diff --git a/Geo/MElement.h b/Geo/MElement.h
index 42453aa53bf2832d73ac8b6b4c0c21fba994ad65..3398db6092787798e196b0b513b12fb28940a47e 100644
--- a/Geo/MElement.h
+++ b/Geo/MElement.h
@@ -485,7 +485,7 @@ public:
   // Return the number of nodes that this element must have with the other in
   // order to put an edge between them in the dual graph used during the
   // partitioning.
-  virtual int numCommonNodesInDualGraph(const MElement *const other) const = 0;
+  virtual unsigned int numCommonNodesInDualGraph(const MElement *const other) const = 0;
 };
 
 class MElementFactory {
diff --git a/Geo/MElementCut.h b/Geo/MElementCut.h
index af41bc2f054c7df0761d0b83851da61d0caa35ee..68b6574385fc94fc366e2203b9f890e32ece0370 100644
--- a/Geo/MElementCut.h
+++ b/Geo/MElementCut.h
@@ -176,7 +176,7 @@ class MPolyhedron : public MElement {
       for(int j = 0; j < 4; j++)
         verts[i * 4 + j] = _parts[i]->getVertex(j)->getIndex();
   }
-  virtual int numCommonNodesInDualGraph(const MElement *const other) const
+  virtual unsigned int numCommonNodesInDualGraph(const MElement *const other) const
   {
     return 1;
   }
@@ -325,7 +325,7 @@ class MPolygon : public MElement {
       for(int j = 0; j < 3; j++)
         verts[i * 3 + j] = _parts[i]->getVertex(j)->getIndex();
   }
-  virtual int numCommonNodesInDualGraph(const MElement *const other) const
+  virtual unsigned int numCommonNodesInDualGraph(const MElement *const other) const
   {
     return 1;
   }
diff --git a/Geo/MHexahedron.cpp b/Geo/MHexahedron.cpp
index f3859b099e6df9f282c13b4a7926338f4a5f2dba..98d7b8f2fc9a968b73c4cdf2546d57348a6bf01d 100644
--- a/Geo/MHexahedron.cpp
+++ b/Geo/MHexahedron.cpp
@@ -94,7 +94,7 @@ bool MHexahedron::getFaceInfo(const MFace &face, int &ithFace, int &sign, int &r
   return false;
 }
 
-int MHexahedron::numCommonNodesInDualGraph(const MElement *const other) const
+unsigned int MHexahedron::numCommonNodesInDualGraph(const MElement *const other) const
 {
   switch (other->getType())
   {
diff --git a/Geo/MHexahedron.h b/Geo/MHexahedron.h
index bdf17719da03ffa1eea9d3a0615c2d636e633858..ba48774f2c8ade92f8ef2ee936b8ce9a055f08e2 100644
--- a/Geo/MHexahedron.h
+++ b/Geo/MHexahedron.h
@@ -185,7 +185,7 @@ class MHexahedron : public MElement {
     };
     return e[face][edge];
   }
-  virtual int numCommonNodesInDualGraph(const MElement *const other) const;
+  virtual unsigned int numCommonNodesInDualGraph(const MElement *const other) const;
 };
 
 /*
diff --git a/Geo/MLine.h b/Geo/MLine.h
index 6a7ea1f918856f95cc546bcce8d605958a452fe0..b3d6edd5b3459a9823485dcc34a29d4fde65de0a 100644
--- a/Geo/MLine.h
+++ b/Geo/MLine.h
@@ -97,7 +97,7 @@ class MLine : public MElement {
   }
   virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts);
   virtual void discretize(double tol, std::vector<SPoint3> &dpts, std::vector<double> &ts);
-  virtual int numCommonNodesInDualGraph(const MElement *const other) const
+  virtual unsigned int numCommonNodesInDualGraph(const MElement *const other) const
   {
     return ((other->getType() == TYPE_LIN || other->getType() == TYPE_PNT) ? 1 : 2);
   }
diff --git a/Geo/MPoint.h b/Geo/MPoint.h
index 8be73fedd5b1edfe2adb741186eb55e99fbacdd9..d359e843730c7c3e09b30f8aace8687f765cb264 100644
--- a/Geo/MPoint.h
+++ b/Geo/MPoint.h
@@ -82,7 +82,7 @@ class MPoint : public MElement {
     *npts = 1;
     *pts = GQL;
   }
-  virtual int numCommonNodesInDualGraph(const MElement *const other) const
+  virtual unsigned int numCommonNodesInDualGraph(const MElement *const other) const
   {
     return 1;
   }
diff --git a/Geo/MPrism.cpp b/Geo/MPrism.cpp
index db02237ca6f9a37a668c4f84489c3aeafae1ec18..6f3199cabafae909b068ca9d8f716d40c2478ee3 100644
--- a/Geo/MPrism.cpp
+++ b/Geo/MPrism.cpp
@@ -77,7 +77,7 @@ bool MPrism::getFaceInfo(const MFace &face, int &ithFace, int &sign, int &rot) c
   return false;
 }
 
-int MPrism::numCommonNodesInDualGraph(const MElement *const other) const
+unsigned int MPrism::numCommonNodesInDualGraph(const MElement *const other) const
 {
   switch (other->getType())
   {
diff --git a/Geo/MPrism.h b/Geo/MPrism.h
index a5cf14e600ee80606f07a171869afad8a53236e5..df4f03a1db81b15826b816a308d9bec8dd42155b 100644
--- a/Geo/MPrism.h
+++ b/Geo/MPrism.h
@@ -196,7 +196,7 @@ class MPrism : public MElement {
     };
     return f[face][edge];
   }
-  virtual int numCommonNodesInDualGraph(const MElement *const other) const;
+  virtual unsigned int numCommonNodesInDualGraph(const MElement *const other) const;
 };
 
 /*
diff --git a/Geo/MPyramid.cpp b/Geo/MPyramid.cpp
index 6781ddca1355f061ca911d1a3a360e9797eff059..7f90bf1507177b6404b7a73d059d4639742db663 100644
--- a/Geo/MPyramid.cpp
+++ b/Geo/MPyramid.cpp
@@ -370,7 +370,7 @@ void MPyramid::getFaceRep(bool curved, int num,
               x, y, z, n);
 }
 
-int MPyramid::numCommonNodesInDualGraph(const MElement *const other) const
+unsigned int MPyramid::numCommonNodesInDualGraph(const MElement *const other) const
 {
   switch (other->getType()) {
     case TYPE_PNT: return 1;
diff --git a/Geo/MPyramid.h b/Geo/MPyramid.h
index 8c58eb734526c590df196bd6faaf6293b66ec6f4..7f2653a79ad0168e534bd02572cae8be4577ece4 100644
--- a/Geo/MPyramid.h
+++ b/Geo/MPyramid.h
@@ -182,7 +182,7 @@ class MPyramid : public MElement {
     };
     return e[face][edge];
   }
-  virtual int numCommonNodesInDualGraph(const MElement *const other) const;
+  virtual unsigned int numCommonNodesInDualGraph(const MElement *const other) const;
 };
 
 /*
diff --git a/Geo/MQuadrangle.cpp b/Geo/MQuadrangle.cpp
index 13133829f80d5272805f5d2240ee584271a87497..c7ca69635f69c626152fe2d872547d1e582486c2 100644
--- a/Geo/MQuadrangle.cpp
+++ b/Geo/MQuadrangle.cpp
@@ -69,7 +69,7 @@ double MQuadrangle::getVolume()
   return sqrt( mn*mn - abcd*abcd ) / 4.;
 }
 
-int MQuadrangle::numCommonNodesInDualGraph(const MElement *const other) const
+unsigned int MQuadrangle::numCommonNodesInDualGraph(const MElement *const other) const
 {
   switch (other->getType())
   {
diff --git a/Geo/MQuadrangle.h b/Geo/MQuadrangle.h
index 3d87c3875f2505988a745f9f2a43d2771ade7a9b..6547e9f672edbeaeca79c3c899d287230ce7770d 100644
--- a/Geo/MQuadrangle.h
+++ b/Geo/MQuadrangle.h
@@ -150,7 +150,7 @@ class MQuadrangle : public MElement {
     };
     return e[edge][vert];
   }
-  virtual int numCommonNodesInDualGraph(const MElement *const other) const;
+  virtual unsigned int numCommonNodesInDualGraph(const MElement *const other) const;
 };
 
 /*
diff --git a/Geo/MTetrahedron.cpp b/Geo/MTetrahedron.cpp
index ec9f1c81d91339e438ec395c4f3dd33c5c9683e6..c82e2743acebfe43447c3f1516b1952cc1076f7c 100644
--- a/Geo/MTetrahedron.cpp
+++ b/Geo/MTetrahedron.cpp
@@ -124,7 +124,7 @@ void MTetrahedron::xyz2uvw(double xyz[3], double uvw[3]) const
   sys3x3(mat, b, uvw, &det);
 }
 
-int MTetrahedron::numCommonNodesInDualGraph(const MElement *const other) const
+unsigned int MTetrahedron::numCommonNodesInDualGraph(const MElement *const other) const
 {
   switch (other->getType())
   {
diff --git a/Geo/MTetrahedron.h b/Geo/MTetrahedron.h
index 2536cc88f559be6119eb03d18c29567e32a26e8e..14b25ac8035a62765eaa48ab77ee3f71aae1f4cf 100644
--- a/Geo/MTetrahedron.h
+++ b/Geo/MTetrahedron.h
@@ -186,7 +186,7 @@ class MTetrahedron : public MElement {
     };
     return e[face][edge];
   }
-  virtual int numCommonNodesInDualGraph(const MElement *const other) const;
+  virtual unsigned int numCommonNodesInDualGraph(const MElement *const other) const;
 };
 
 /*
diff --git a/Geo/MTriangle.cpp b/Geo/MTriangle.cpp
index bdef6f1bd0147c4f55f0284a1c65cf684fbd8177..f2cd5669050307f9b993a6dbba5befd80245205f 100644
--- a/Geo/MTriangle.cpp
+++ b/Geo/MTriangle.cpp
@@ -157,7 +157,7 @@ void MTriangle::xyz2uvw(double xyz[3], double uvw[3]) const
   uvw[2] = 0.0;
 }
 
-int MTriangle::numCommonNodesInDualGraph(const MElement *const other) const
+unsigned int MTriangle::numCommonNodesInDualGraph(const MElement *const other) const
 {
   switch (other->getType())
   {
diff --git a/Geo/MTriangle.h b/Geo/MTriangle.h
index a040a5a26e6fccc7775fcb0a462c5baa6296b429..fe6acbb3a375761d29c7611f95206656ba4ff770 100644
--- a/Geo/MTriangle.h
+++ b/Geo/MTriangle.h
@@ -152,7 +152,7 @@ class MTriangle : public MElement {
     };
     return e[edge][vert];
   }
-  virtual int numCommonNodesInDualGraph(const MElement *const other) const;
+  virtual unsigned int numCommonNodesInDualGraph(const MElement *const other) const;
 };
 
 /*
diff --git a/Geo/MTrihedron.cpp b/Geo/MTrihedron.cpp
index d08ca230427818a940a5b8018ae19312d91a7812..0d046a58f036dfd8760c46fe6d184cb8014d1169 100644
--- a/Geo/MTrihedron.cpp
+++ b/Geo/MTrihedron.cpp
@@ -1,7 +1,7 @@
 #include "GmshConfig.h"
 #include "MTrihedron.h"
 
-int MTrihedron::numCommonNodesInDualGraph(const MElement *const other) const
+unsigned int MTrihedron::numCommonNodesInDualGraph(const MElement *const other) const
 {
   switch (other->getType()) {
     case TYPE_PNT: return 1;
diff --git a/Geo/MTrihedron.h b/Geo/MTrihedron.h
index 936699a2ecc4dda582810d534406c116a22cd2ce..9894de80c6bd1ef13cb32da9a3647b5b22269bd6 100644
--- a/Geo/MTrihedron.h
+++ b/Geo/MTrihedron.h
@@ -159,7 +159,7 @@ class MTrihedron : public MElement {
   }
 
   // Return the number of nodes that this element must have with the other in order to put an edge between them in the dual graph used during the partitioning.
-  virtual int numCommonNodesInDualGraph(const MElement *const other) const;
+  virtual unsigned int numCommonNodesInDualGraph(const MElement *const other) const;
 };
 
 #endif
diff --git a/Mesh/meshPartition.cpp b/Mesh/meshPartition.cpp
index 3d01c4465acfb3b7d50a8a277ce598cf4c513160..c186b7daa17b256b1eb7930df2ae66f6bb8c4076 100644
--- a/Mesh/meshPartition.cpp
+++ b/Mesh/meshPartition.cpp
@@ -295,7 +295,7 @@ class Graph
       unsigned int l = 0;
       for(unsigned int j = _eptr[i]; j < _eptr[i+1]; ++j){
         for(unsigned int k = nptr[_eind[j]]; k < nptr[_eind[j]+1]; ++k){
-          if(nind[k] != (int)i){
+          if(nind[k] != i){
             if(marker[nind[k]] == 0) nbrs[l++] = nind[k];
             marker[nind[k]]++;
           }
@@ -325,7 +325,7 @@ class Graph
       unsigned int l = 0;
       for(unsigned int j = _eptr[i]; j < _eptr[i+1]; ++j){
         for(unsigned int k = nptr[_eind[j]]; k < nptr[_eind[j]+1]; ++k){
-          if(nind[k] != (int)i){
+          if(nind[k] != i){
             if (marker[nind[k]] == 0) nbrs[l++] = nind[k];
             marker[nind[k]]++;
           }