Browse Source

mayaegg: fix various compilation warnings

rdb 7 years ago
parent
commit
044d84c8fd

+ 9 - 9
pandatool/src/mayaegg/mayaEggLoader.cxx

@@ -837,12 +837,12 @@ int MayaEggGeom::GetVert(EggVertex *vert, EggGroup *context)
 void MayaEggGeom::AssignNames(void)
 {
   string name = _pool->get_name();
-  int nsize = name.size();
-  if ((nsize > 6) && (name.rfind(".verts")==(nsize-6))) {
-    name.resize(nsize-6);
+  size_t nsize = name.size();
+  if (nsize > 6 && name.rfind(".verts") == (nsize - 6)) {
+    name.resize(nsize - 6);
   }
-  if ((nsize > 4) && (name.rfind(".cvs")==(nsize-4))) {
-    name.resize(nsize-4);
+  if (nsize > 4 && name.rfind(".cvs") == (nsize - 4)) {
+    name.resize(nsize - 4);
   }
 
   MFnDependencyNode dnshape(_shapeNode);
@@ -913,7 +913,7 @@ void MayaEggGeom::AddEggFlag(MString fieldName) {
 typedef phash_map<LTexCoordd, int>             TVertTable;
 typedef phash_map<LColor, int>                CVertTable;
 
-class MayaEggMesh : public MayaEggGeom
+class MayaEggMesh final : public MayaEggGeom
 {
 public:
   MColorArray         _faceColorArray;
@@ -937,7 +937,7 @@ public:
   int GetCVert(const LColor &col);
   int AddFace(unsigned numVertices, MIntArray mvertIndices, MIntArray mtvertIndices, MayaEggTex *tex);
 
-  void ConnectTextures(void);
+  void ConnectTextures(void) override;
 };
 
 int MayaEggMesh::GetTVert(const LTexCoordd &uv)
@@ -2012,7 +2012,7 @@ void MayaEggLoader::PrintData(MayaEggMesh *mesh)
 
 void MayaEggLoader::ParseFrameInfo(string comment)
 {
-  int pos, ls, le;
+  size_t pos, ls, le;
 
   pos = comment.find("-fri");
   if (pos != string::npos) {
@@ -2143,7 +2143,7 @@ bool MayaEggLoader::ConvertEggFile(const char *name, bool merge, bool model, boo
 MObject MayaEggLoader::GetDependencyNode(string givenName)
 {
   MObject node = MObject::kNullObj;
-  int pos;
+  size_t pos;
   string name;
 
   pos = givenName.find(":");

+ 2 - 2
pandatool/src/mayaegg/mayaToEggConverter.cxx

@@ -2742,7 +2742,7 @@ set_shader_legacy(EggPrimitive &primitive, const MayaShader &shader,
           // shader on the list is the base one, which should always pick up
           // the alpha from the texture file.  But the top textures may have
           // to strip the alpha
-          if (i!=shader._color.size()-1) {
+          if ((size_t)i != shader._color.size() - 1) {
             if (!i && is_interpolate) {
               // this is the grass path mode where alpha on this texture
               // determines whether to show layer1 or layer2. Since by now
@@ -2846,7 +2846,7 @@ set_shader_legacy(EggPrimitive &primitive, const MayaShader &shader,
         _textures.create_unique_texture(tex, ~0);
 
       if (mesh) {
-        if (uvset_name.find("not found") == -1) {
+        if (uvset_name.find("not found") == string::npos) {
           primitive.add_texture(new_tex);
           color_def->_uvset_name.assign(uvset_name.c_str());
           if (uvset_name != "map1") {