Some warnings corrected, most are conversions between int's and unsigned int's. Thanks to @jimmyskull

This commit is contained in:
lgfischer committed 2012-12-12 22:42:21 -02:00
1 parent 907922fdee
commit 3eac5bfa85
3 files changed
+16 -16

No files matched your search

+5 -8
View File
@@ -41,11 +41,9 @@ public:
template<class MeshT, class MeshT2> template<class MeshT, class MeshT2>
static void copyDcelData(const MeshT& source, MeshT2& target ) static void copyDcelData(const MeshT& source, MeshT2& target )
{ {
const MeshT::Vertex* vertex = NULL;
const unsigned int numVertices = source.getNumVertices();
const MeshT::Face* face = NULL; const MeshT::Face* face = NULL;
const unsigned int numVertices = source.getNumVertices();
const unsigned int numFaces = source.getNumFaces(); const unsigned int numFaces = source.getNumFaces();
const MeshT::HalfEdge* edge = NULL;
const unsigned int numEdges = source.getNumHalfEdges(); const unsigned int numEdges = source.getNumHalfEdges();
target.clear(); target.clear();
@@ -134,10 +132,9 @@ template <class MeshT>
void DCELStream<MeshT>::write(const MeshT& mesh, std::ostream &stream) void DCELStream<MeshT>::write(const MeshT& mesh, std::ostream &stream)
{ {
const MeshT::Vertex* vertex = NULL; const MeshT::Vertex* vertex = NULL;
const unsigned int numVertices = mesh.getNumVertices();
const MeshT::Face* face = NULL; const MeshT::Face* face = NULL;
const unsigned int numVertices = mesh.getNumVertices();
const unsigned int numFaces = mesh.getNumFaces(); const unsigned int numFaces = mesh.getNumFaces();
const MeshT::HalfEdge* edge = NULL;
const unsigned int numEdges = mesh.getNumHalfEdges(); const unsigned int numEdges = mesh.getNumHalfEdges();
stream << "version 1" << std::endl; stream << "version 1" << std::endl;
@@ -229,19 +226,19 @@ void DCELStream<MeshT>::read_v1(MeshT& mesh, std::istream &stream)
else if( str=="vc" ) else if( str=="vc" )
{ {
unsigned int vc = -1; unsigned int vc = std::numeric_limits<unsigned int>::max();
stream >> vc; stream >> vc;
mesh.getVertices().reserve( vc*5 ); mesh.getVertices().reserve( vc*5 );
} }
else if( str=="fc" ) else if( str=="fc" )
{ {
unsigned int fc = -1; unsigned int fc = std::numeric_limits<unsigned int>::max();
stream >> fc; stream >> fc;
mesh.getFaces().reserve( fc*5 ); mesh.getFaces().reserve( fc*5 );
} }
else if( str=="ec" ) else if( str=="ec" )
{ {
unsigned int ec = -1; unsigned int ec = std::numeric_limits<unsigned int>::max();
stream >> ec; stream >> ec;
mesh.getHalfEdges().reserve( ec*5 ); mesh.getHalfEdges().reserve( ec*5 );
} }
+10 -7
View File
@@ -12,6 +12,7 @@
#include <vector> #include <vector>
#include <list> #include <list>
#include <limits>
#include "Vertex.h" #include "Vertex.h"
#include "Face.h" #include "Face.h"
@@ -20,6 +21,8 @@
#include "Exception.h" #include "Exception.h"
#define MESH_NULL_ID (std::numeric_limits<unsigned int>::max())
/** /**
A class that stores the mesh structure. It the list of the vertices, edges and faces. A class that stores the mesh structure. It the list of the vertices, edges and faces.
Also, it has some methods for simplify the mesh manipulation. Also, it has some methods for simplify the mesh manipulation.
@@ -250,7 +253,7 @@ private:
std::vector<HalfEdge> edges; std::vector<HalfEdge> edges;
std::list<int> unhandledTriangles; std::list<int> unhandledTriangles;
int unhandledTrianglesCount; unsigned int unhandledTrianglesCount;
}; };
@@ -334,7 +337,7 @@ unsigned int Mesh<Vdt,Hdt,Fdt>::createTriangularFace(unsigned int vId1, unsigned
if (e2!=NULL) readyEdges++; if (e2!=NULL) readyEdges++;
if (e3!=NULL) readyEdges++; if (e3!=NULL) readyEdges++;
unsigned int nullFaceId = (unsigned int)-1; unsigned int nullFaceId = MESH_NULL_ID;
unsigned int faceId = nullFaceId; unsigned int faceId = nullFaceId;
Face* face = NULL; Face* face = NULL;
@@ -734,7 +737,7 @@ unsigned int Mesh<Vdt,Hdt,Fdt>::getVertexId(const Vertex* vertex) const
if( &(this->vertices[id]) == vertex ) if( &(this->vertices[id]) == vertex )
return id; return id;
} }
return -1; return MESH_NULL_ID;
} }
template<class Vdt, class Hdt, class Fdt> template<class Vdt, class Hdt, class Fdt>
@@ -772,7 +775,7 @@ unsigned int Mesh<Vdt,Hdt,Fdt>::getFaceId(const Face* face) const
if( &(this->faces[id]) == face ) if( &(this->faces[id]) == face )
return id; return id;
} }
return -1; return MESH_NULL_ID;
}; };
template<class Vdt, class Hdt, class Fdt> template<class Vdt, class Hdt, class Fdt>
@@ -832,7 +835,7 @@ unsigned int Mesh<Vdt,Hdt,Fdt>::getHalfEdgeId( HalfEdge* halfEdge) const
if( &(this->edges[id]) == halfEdge ) if( &(this->edges[id]) == halfEdge )
return id; return id;
} }
return -1; return MESH_NULL_ID;
} }
template<class Vdt, class Hdt, class Fdt> template<class Vdt, class Hdt, class Fdt>
@@ -960,12 +963,12 @@ void Mesh<Vdt,Hdt,Fdt>::manageUnhandledTriangles()
throw cpp::Exception("The number of unhandled triangles should be equal to the number of unhandled vertices*3!"); throw cpp::Exception("The number of unhandled triangles should be equal to the number of unhandled vertices*3!");
} }
int curTriangle = 0; unsigned int curTriangle = 0;
while( !this->unhandledTriangles.empty() ) while( !this->unhandledTriangles.empty() )
{ {
if( curTriangle==unhandledTrianglesCount ) if( curTriangle==unhandledTrianglesCount )
{ {
int remainingTriangles = this->unhandledTriangles.size() / 3; unsigned int remainingTriangles = this->unhandledTriangles.size() / 3;
if( remainingTriangles<unhandledTrianglesCount ) if( remainingTriangles<unhandledTrianglesCount )
{ {
unhandledTrianglesCount = remainingTriangles; unhandledTrianglesCount = remainingTriangles;
+1 -1
View File
@@ -374,7 +374,7 @@ void convertBetweenMeshes(MyMeshUsingVector* meshUsingVector, MyMesh* mesh)
} }
} }
int main(int argc, char* argv[]) int main(int, char*[])
{ {
try try
{ {