Browse Source

NFF: Reduce scope of a variable

Turo Lamminen 7 years ago
parent
commit
2b93a210c9
1 changed files with 5 additions and 6 deletions
  1. 5 6
      code/NFFLoader.cpp

+ 5 - 6
code/NFFLoader.cpp

@@ -243,8 +243,6 @@ void NFFImporter::InternReadFile( const std::string& pFile,
     if( !file.get())
     if( !file.get())
         throw DeadlyImportError( "Failed to open NFF file " + pFile + ".");
         throw DeadlyImportError( "Failed to open NFF file " + pFile + ".");
 
 
-    unsigned int m = (unsigned int)file->FileSize();
-
     // allocate storage and copy the contents of the file to a memory buffer
     // allocate storage and copy the contents of the file to a memory buffer
     // (terminate it with zero)
     // (terminate it with zero)
     std::vector<char> mBuffer2;
     std::vector<char> mBuffer2;
@@ -469,7 +467,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
                         for (unsigned int a = 0; a < numIdx;++a)
                         for (unsigned int a = 0; a < numIdx;++a)
                         {
                         {
                             SkipSpaces(sz,&sz);
                             SkipSpaces(sz,&sz);
-                            m = ::strtoul10(sz,&sz);
+                            unsigned int m = ::strtoul10(sz,&sz);
                             if (m >= (unsigned int)tempPositions.size())
                             if (m >= (unsigned int)tempPositions.size())
                             {
                             {
                                 DefaultLogger::get()->error("NFF2: Vertex index overflow");
                                 DefaultLogger::get()->error("NFF2: Vertex index overflow");
@@ -635,7 +633,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
                         for (std::vector<unsigned int>::const_iterator it = tempIdx.begin(), end = tempIdx.end();
                         for (std::vector<unsigned int>::const_iterator it = tempIdx.begin(), end = tempIdx.end();
                             it != end;++it)
                             it != end;++it)
                         {
                         {
-                            m = *it;
+                            unsigned int m = *it;
 
 
                             // copy colors -vertex color specifications override polygon color specifications
                             // copy colors -vertex color specifications override polygon color specifications
                             if (hasColor)
                             if (hasColor)
@@ -735,7 +733,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
                     sz = &line[1];out = currentMesh;
                     sz = &line[1];out = currentMesh;
                 }
                 }
                 SkipSpaces(sz,&sz);
                 SkipSpaces(sz,&sz);
-                m = strtoul10(sz);
+                unsigned int m = strtoul10(sz);
 
 
                 // ---- flip the face order
                 // ---- flip the face order
                 out->vertices.resize(out->vertices.size()+m);
                 out->vertices.resize(out->vertices.size()+m);
@@ -1128,7 +1126,8 @@ void NFFImporter::InternReadFile( const std::string& pFile,
     if (!pScene->mNumMeshes)throw DeadlyImportError("NFF: No meshes loaded");
     if (!pScene->mNumMeshes)throw DeadlyImportError("NFF: No meshes loaded");
     pScene->mMeshes = new aiMesh*[pScene->mNumMeshes];
     pScene->mMeshes = new aiMesh*[pScene->mNumMeshes];
     pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials = pScene->mNumMeshes];
     pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials = pScene->mNumMeshes];
-    for (it = meshes.begin(), m = 0; it != end;++it)
+    unsigned int m = 0;
+    for (it = meshes.begin(); it != end;++it)
     {
     {
         if ((*it).faces.empty())continue;
         if ((*it).faces.empty())continue;