prevented cast/unused/uninitialized warnings and some indentation work.

This commit is contained in:
Marco Di Benedetto 2009-12-01 17:37:45 +00:00
parent 939da657a9
commit 08f9b6a4b3
3 changed files with 692 additions and 690 deletions

View File

@ -691,6 +691,8 @@ static Matrix44f getTransfMatrixFromNode(const QDomElement parentNode)
static int Open(OpenMeshType& m,const char* filename, InfoDAE& info, CallBackPos *cb=0) static int Open(OpenMeshType& m,const char* filename, InfoDAE& info, CallBackPos *cb=0)
{ {
(void)cb;
QDEBUG("----- Starting the processing of %s ------",filename); QDEBUG("----- Starting the processing of %s ------",filename);
//AdditionalInfoDAE& inf = new AdditionalInfoDAE(); //AdditionalInfoDAE& inf = new AdditionalInfoDAE();
//info = new InfoDAE(); //info = new InfoDAE();

View File

@ -22,7 +22,7 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.19 2008/01/17 18:02:02 cignoni Revision 1.19 2008/01/17 18:02:02 cignoni
@ -112,17 +112,17 @@ class ImporterOBJ
{ {
public: public:
typedef typename OpenMeshType::VertexPointer VertexPointer; typedef typename OpenMeshType::VertexPointer VertexPointer;
typedef typename OpenMeshType::ScalarType ScalarType; typedef typename OpenMeshType::ScalarType ScalarType;
typedef typename OpenMeshType::VertexType VertexType; typedef typename OpenMeshType::VertexType VertexType;
typedef typename OpenMeshType::FaceType FaceType; typedef typename OpenMeshType::FaceType FaceType;
typedef typename OpenMeshType::VertexIterator VertexIterator; typedef typename OpenMeshType::VertexIterator VertexIterator;
typedef typename OpenMeshType::FaceIterator FaceIterator; typedef typename OpenMeshType::FaceIterator FaceIterator;
typedef typename OpenMeshType::CoordType CoordType; typedef typename OpenMeshType::CoordType CoordType;
class Info class Info
{ {
public: public:
Info() Info()
{ {
@ -146,19 +146,19 @@ public:
/// number of texture coords indexes /// number of texture coords indexes
int numTexCoords; int numTexCoords;
}; // end class }; // end class
//struct OBJFacet //struct OBJFacet
//{ //{
// CoordType n; // CoordType n;
// CoordType t; // CoordType t;
// CoordType v[3]; // CoordType v[3];
// //
// short attr; // material index // short attr; // material index
//}; //};
struct ObjIndexedFace struct ObjIndexedFace
{ {
void set(const int & num){v.resize(num);n.resize(num); t.resize(num);} void set(const int & num){v.resize(num);n.resize(num); t.resize(num);}
std::vector<int> v; std::vector<int> v;
std::vector<int> n; std::vector<int> n;
@ -166,15 +166,15 @@ struct ObjIndexedFace
int tInd; int tInd;
bool edge[3];// useless if the face is a polygon, no need to have variable length array bool edge[3];// useless if the face is a polygon, no need to have variable length array
Color4b c; Color4b c;
}; };
struct ObjTexCoord struct ObjTexCoord
{ {
float u; float u;
float v; float v;
}; };
enum OBJError { enum OBJError {
// Successfull opening // Successfull opening
E_NOERROR = 0x000, // 0 (position of correspondig string in the array) E_NOERROR = 0x000, // 0 (position of correspondig string in the array)
@ -198,17 +198,17 @@ enum OBJError {
E_BAD_VERT_INDEX = 0x01C, // 14 E_BAD_VERT_INDEX = 0x01C, // 14
E_BAD_VERT_TEX_INDEX = 0x01E, // 15 E_BAD_VERT_TEX_INDEX = 0x01E, // 15
E_BAD_VERT_NORMAL_INDEX = 0x020 // 16 E_BAD_VERT_NORMAL_INDEX = 0x020 // 16
}; };
// to check if a given error is critical or not. // to check if a given error is critical or not.
static bool ErrorCritical(int err) static bool ErrorCritical(int err)
{ {
if(err<0x00A && err>=0) return false; if(err<0x00A && err>=0) return false;
return true; return true;
} }
static const char* ErrorMsg(int error) static const char* ErrorMsg(int error)
{ {
static const char* obj_error_msg[] = static const char* obj_error_msg[] =
{ {
"No errors", // 0 "No errors", // 0
@ -238,13 +238,13 @@ static const char* ErrorMsg(int error)
if(error>15 || error<0) return "Unknown error"; if(error>15 || error<0) return "Unknown error";
else return obj_error_msg[error]; else return obj_error_msg[error];
}; };
// Helper functions that checks the range of indexes // Helper functions that checks the range of indexes
// putting them in the correct range if less than zero (as in the obj style) // putting them in the correct range if less than zero (as in the obj style)
static bool GoodObjIndex(int &index, const int maxVal) static bool GoodObjIndex(int &index, const int maxVal)
{ {
if (index > maxVal) return false; if (index > maxVal) return false;
if (index < 0) if (index < 0)
{ {
@ -252,27 +252,27 @@ static bool GoodObjIndex(int &index, const int maxVal)
if (index<0 || index > maxVal) return false; if (index<0 || index > maxVal) return false;
} }
return true; return true;
} }
static int Open(OpenMeshType &mesh, const char *filename, int &loadmask, CallBackPos *cb=0) static int Open(OpenMeshType &mesh, const char *filename, int &loadmask, CallBackPos *cb=0)
{ {
Info oi; Info oi;
oi.mask=-1; oi.mask=-1;
oi.cb=cb; oi.cb=cb;
int ret=Open(mesh,filename,oi); int ret=Open(mesh,filename,oi);
loadmask=oi.mask; loadmask=oi.mask;
return ret; return ret;
} }
/*! /*!
* Opens an object file (in ascii format) and populates the mesh passed as first * Opens an object file (in ascii format) and populates the mesh passed as first
* accordingly to read data * accordingly to read data
* \param m The mesh model to be populated with data stored into the file * \param m The mesh model to be populated with data stored into the file
* \param filename The name of the file to be opened * \param filename The name of the file to be opened
* \param oi A structure containing infos about the object to be opened * \param oi A structure containing infos about the object to be opened
*/ */
static int Open( OpenMeshType &m, const char * filename, Info &oi) static int Open( OpenMeshType &m, const char * filename, Info &oi)
{ {
int result = E_NOERROR; int result = E_NOERROR;
m.Clear(); m.Clear();
@ -677,17 +677,17 @@ static int Open( OpenMeshType &m, const char * filename, Info &oi)
} }
return result; return result;
} // end of Open } // end of Open
/*! /*!
* Read the next valid line and parses it into "tokens", allowing * Read the next valid line and parses it into "tokens", allowing
* the tokens to be read one at a time. * the tokens to be read one at a time.
* \param stream The object providing the input stream * \param stream The object providing the input stream
* \param tokens The "tokens" in the next line * \param tokens The "tokens" in the next line
*/ */
inline static const void TokenizeNextLine(std::ifstream &stream, std::vector< std::string > &tokens) inline static const void TokenizeNextLine(std::ifstream &stream, std::vector< std::string > &tokens)
{ {
if(stream.eof()) return; if(stream.eof()) return;
std::string line; std::string line;
do do
@ -715,10 +715,10 @@ inline static const void TokenizeNextLine(std::ifstream &stream, std::vector< st
} }
} }
while (from<length); while (from<length);
} // end TokenizeNextLine } // end TokenizeNextLine
inline static const void SplitToken(std::string token, int &vId, int &nId, int &tId, int mask) inline static const void SplitToken(std::string token, int &vId, int &nId, int &tId, int mask)
{ {
std::string vertex; std::string vertex;
std::string texcoord; std::string texcoord;
std::string normal; std::string normal;
@ -731,15 +731,15 @@ inline static const void SplitToken(std::string token, int &vId, int &nId, int &
vId = atoi(vertex.c_str()) - 1; vId = atoi(vertex.c_str()) - 1;
if(mask & Mask::IOM_WEDGTEXCOORD) tId = atoi(texcoord.c_str()) - 1; if(mask & Mask::IOM_WEDGTEXCOORD) tId = atoi(texcoord.c_str()) - 1;
if(mask & Mask::IOM_WEDGNORMAL) nId = atoi(normal.c_str()) - 1; if(mask & Mask::IOM_WEDGNORMAL) nId = atoi(normal.c_str()) - 1;
} }
inline static const void SplitVToken(std::string token, std::string &vertex) inline static const void SplitVToken(std::string token, std::string &vertex)
{ {
vertex = token; vertex = token;
} }
inline static const void SplitVVTToken(std::string token, std::string &vertex, std::string &texcoord) inline static const void SplitVVTToken(std::string token, std::string &vertex, std::string &texcoord)
{ {
vertex.clear(); vertex.clear();
texcoord.clear(); texcoord.clear();
@ -765,10 +765,10 @@ inline static const void SplitVVTToken(std::string token, std::string &vertex, s
++to; ++to;
} }
} }
} // end of SplitVVTToken } // end of SplitVVTToken
inline static const void SplitVVNToken(std::string token, std::string &vertex, std::string &normal) inline static const void SplitVVNToken(std::string token, std::string &vertex, std::string &normal)
{ {
vertex.clear(); vertex.clear();
normal.clear(); normal.clear();
@ -795,10 +795,10 @@ inline static const void SplitVVNToken(std::string token, std::string &vertex, s
++to; ++to;
} }
} }
} // end of SplitVVNToken } // end of SplitVVNToken
inline static const void SplitVVTVNToken(std::string token, std::string &vertex, std::string &texcoord, std::string &normal) inline static const void SplitVVTVNToken(std::string token, std::string &vertex, std::string &texcoord, std::string &normal)
{ {
vertex.clear(); vertex.clear();
texcoord.clear(); texcoord.clear();
normal.clear(); normal.clear();
@ -831,7 +831,7 @@ inline static const void SplitVVTVNToken(std::string token, std::string &vertex,
++to; ++to;
} }
} }
} // end of SplitVVTVNToken } // end of SplitVVTVNToken
/*! /*!
* Retrieves infos about kind of data stored into the file and fills a mask appropriately * Retrieves infos about kind of data stored into the file and fills a mask appropriately
@ -840,8 +840,8 @@ inline static const void SplitVVTVNToken(std::string token, std::string &vertex,
* \param oi A structure which will be filled with infos about the object to be opened * \param oi A structure which will be filled with infos about the object to be opened
*/ */
static bool LoadMask(const char * filename, Info &oi) static bool LoadMask(const char * filename, Info &oi)
{ {
std::ifstream stream(filename); std::ifstream stream(filename);
if (stream.fail()) return false; if (stream.fail()) return false;
@ -893,15 +893,15 @@ static bool LoadMask(const char * filename, Info &oi)
if (bHasNormals) oi.mask |= vcg::tri::io::Mask::IOM_WEDGNORMAL; if (bHasNormals) oi.mask |= vcg::tri::io::Mask::IOM_WEDGNORMAL;
return true; return true;
} }
static bool LoadMask(const char * filename, int &mask) static bool LoadMask(const char * filename, int &mask)
{ {
Info oi; Info oi;
bool ret=LoadMask(filename, oi); bool ret=LoadMask(filename, oi);
mask= oi.mask; mask= oi.mask;
return ret; return ret;
} }
static bool LoadMaterials(const char * filename, std::vector<Material> &materials, std::vector<std::string> &textures) static bool LoadMaterials(const char * filename, std::vector<Material> &materials, std::vector<std::string> &textures)
{ {
@ -916,7 +916,7 @@ static bool LoadMask(const char * filename, int &mask)
materials.clear(); materials.clear();
Material currentMaterial; Material currentMaterial;
currentMaterial.index = -1; currentMaterial.index = (unsigned int)(-1);
bool first = true; bool first = true;
while (!stream.eof()) while (!stream.eof())
@ -935,7 +935,7 @@ static bool LoadMask(const char * filename, int &mask)
{ {
materials.push_back(currentMaterial); materials.push_back(currentMaterial);
currentMaterial = Material(); currentMaterial = Material();
currentMaterial.index = -1; currentMaterial.index = (unsigned int)(-1);
} }
else else
first = false; first = false;

View File

@ -638,7 +638,7 @@ namespace io {
if(fnameV != nameV) return VMI_INCOMPATIBLE_VERTEX_TYPE; if(fnameV != nameV) return VMI_INCOMPATIBLE_VERTEX_TYPE;
if(fnameF != nameF) return VMI_INCOMPATIBLE_FACE_TYPE; if(fnameF != nameF) return VMI_INCOMPATIBLE_FACE_TYPE;
int offsetV,offsetF; int offsetV=0,offsetF=0;
if(vertSize!=0) if(vertSize!=0)
/* read the address of the first vertex */ /* read the address of the first vertex */