浏览代码

Fixed build warnings on MSVC14 x64 in the Quake 3 format sources.

Jared Mulconry 8 年之前
父节点
当前提交
655a470fc9
共有 2 个文件被更改,包括 11 次插入11 次删除
  1. 8 8
      code/Q3BSPFileImporter.cpp
  2. 3 3
      code/Q3BSPZipArchive.cpp

+ 8 - 8
code/Q3BSPFileImporter.cpp

@@ -330,14 +330,14 @@ void Q3BSPFileImporter::CreateNodes( const Q3BSP::Q3BSPModel *pModel, aiScene* p
         }
         }
     }
     }
 
 
-    pParent->mNumChildren = MeshArray.size();
+    pParent->mNumChildren = static_cast<unsigned int>(MeshArray.size());
     pParent->mChildren = new aiNode*[ pScene->mRootNode->mNumChildren ];
     pParent->mChildren = new aiNode*[ pScene->mRootNode->mNumChildren ];
     for ( size_t i=0; i<NodeArray.size(); i++ )
     for ( size_t i=0; i<NodeArray.size(); i++ )
     {
     {
         aiNode *pNode = NodeArray[ i ];
         aiNode *pNode = NodeArray[ i ];
         pNode->mParent = pParent;
         pNode->mParent = pParent;
         pParent->mChildren[ i ] = pNode;
         pParent->mChildren[ i ] = pNode;
-        pParent->mChildren[ i ]->mMeshes[ 0 ] = i;
+        pParent->mChildren[ i ]->mMeshes[ 0 ] = static_cast<unsigned int>(i);
     }
     }
 }
 }
 
 
@@ -364,9 +364,9 @@ aiNode *Q3BSPFileImporter::CreateTopology( const Q3BSP::Q3BSPModel *pModel,
     pMesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE;
     pMesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE;
 
 
     pMesh->mFaces = new aiFace[ numTriangles ];
     pMesh->mFaces = new aiFace[ numTriangles ];
-    pMesh->mNumFaces = numTriangles;
+    pMesh->mNumFaces = static_cast<unsigned int>(numTriangles);
 
 
-    pMesh->mNumVertices = numVerts;
+    pMesh->mNumVertices = static_cast<unsigned int>(numVerts);
     pMesh->mVertices = new aiVector3D[ numVerts ];
     pMesh->mVertices = new aiVector3D[ numVerts ];
     pMesh->mNormals =  new aiVector3D[ numVerts ];
     pMesh->mNormals =  new aiVector3D[ numVerts ];
     pMesh->mTextureCoords[ 0 ] = new aiVector3D[ numVerts ];
     pMesh->mTextureCoords[ 0 ] = new aiVector3D[ numVerts ];
@@ -515,7 +515,7 @@ void Q3BSPFileImporter::createMaterials( const Q3BSP::Q3BSPModel *pModel, aiScen
         pScene->mMaterials[ pScene->mNumMaterials ] = pMatHelper;
         pScene->mMaterials[ pScene->mNumMaterials ] = pMatHelper;
         pScene->mNumMaterials++;
         pScene->mNumMaterials++;
     }
     }
-    pScene->mNumTextures = mTextures.size();
+    pScene->mNumTextures = static_cast<unsigned int>(mTextures.size());
     pScene->mTextures = new aiTexture*[ pScene->mNumTextures ];
     pScene->mTextures = new aiTexture*[ pScene->mNumTextures ];
     std::copy( mTextures.begin(), mTextures.end(), pScene->mTextures );
     std::copy( mTextures.begin(), mTextures.end(), pScene->mTextures );
 }
 }
@@ -649,7 +649,7 @@ bool Q3BSPFileImporter::importTextureFromArchive( const Q3BSP::Q3BSPModel *pMode
             size_t texSize = pTextureStream->FileSize();
             size_t texSize = pTextureStream->FileSize();
             aiTexture *pTexture = new aiTexture;
             aiTexture *pTexture = new aiTexture;
             pTexture->mHeight = 0;
             pTexture->mHeight = 0;
-            pTexture->mWidth = texSize;
+            pTexture->mWidth = static_cast<unsigned int>(texSize);
             unsigned char *pData = new unsigned char[ pTexture->mWidth ];
             unsigned char *pData = new unsigned char[ pTexture->mWidth ];
             size_t readSize = pTextureStream->Read( pData, sizeof( unsigned char ), pTexture->mWidth );
             size_t readSize = pTextureStream->Read( pData, sizeof( unsigned char ), pTexture->mWidth );
             (void)readSize;
             (void)readSize;
@@ -663,7 +663,7 @@ bool Q3BSPFileImporter::importTextureFromArchive( const Q3BSP::Q3BSPModel *pMode
 
 
             aiString name;
             aiString name;
             name.data[ 0 ] = '*';
             name.data[ 0 ] = '*';
-            name.length = 1 + ASSIMP_itoa10( name.data + 1, MAXLEN-1, mTextures.size() );
+            name.length = 1 + ASSIMP_itoa10( name.data + 1, static_cast<unsigned int>(MAXLEN-1), static_cast<int32_t>(mTextures.size()) );
 
 
             pArchive->Close( pTextureStream );
             pArchive->Close( pTextureStream );
 
 
@@ -721,7 +721,7 @@ bool Q3BSPFileImporter::importLightmap( const Q3BSP::Q3BSPModel *pModel, aiScene
 
 
     aiString name;
     aiString name;
     name.data[ 0 ] = '*';
     name.data[ 0 ] = '*';
-    name.length = 1 + ASSIMP_itoa10( name.data + 1, MAXLEN-1,  mTextures.size() );
+    name.length = 1 + ASSIMP_itoa10( name.data + 1, static_cast<unsigned int>(MAXLEN-1), static_cast<int32_t>(mTextures.size()) );
 
 
     pMatHelper->AddProperty( &name,AI_MATKEY_TEXTURE_LIGHTMAP( 1 ) );
     pMatHelper->AddProperty( &name,AI_MATKEY_TEXTURE_LIGHTMAP( 1 ) );
     mTextures.push_back( pTexture );
     mTextures.push_back( pTexture );

+ 3 - 3
code/Q3BSPZipArchive.cpp

@@ -73,19 +73,19 @@ voidpf IOSystem2Unzip::open(voidpf opaque, const char* filename, int mode) {
 uLong IOSystem2Unzip::read(voidpf /*opaque*/, voidpf stream, void* buf, uLong size) {
 uLong IOSystem2Unzip::read(voidpf /*opaque*/, voidpf stream, void* buf, uLong size) {
     IOStream* io_stream = (IOStream*) stream;
     IOStream* io_stream = (IOStream*) stream;
 
 
-    return io_stream->Read(buf, 1, size);
+    return static_cast<uLong>(io_stream->Read(buf, 1, size));
 }
 }
 
 
 uLong IOSystem2Unzip::write(voidpf /*opaque*/, voidpf stream, const void* buf, uLong size) {
 uLong IOSystem2Unzip::write(voidpf /*opaque*/, voidpf stream, const void* buf, uLong size) {
     IOStream* io_stream = (IOStream*) stream;
     IOStream* io_stream = (IOStream*) stream;
 
 
-    return io_stream->Write(buf, 1, size);
+    return static_cast<uLong>(io_stream->Write(buf, 1, size));
 }
 }
 
 
 long IOSystem2Unzip::tell(voidpf /*opaque*/, voidpf stream) {
 long IOSystem2Unzip::tell(voidpf /*opaque*/, voidpf stream) {
     IOStream* io_stream = (IOStream*) stream;
     IOStream* io_stream = (IOStream*) stream;
 
 
-    return io_stream->Tell();
+    return static_cast<long>(io_stream->Tell());
 }
 }
 
 
 long IOSystem2Unzip::seek(voidpf /*opaque*/, voidpf stream, uLong offset, int origin) {
 long IOSystem2Unzip::seek(voidpf /*opaque*/, voidpf stream, uLong offset, int origin) {