浏览代码

Merge pull request #2905 from matt77hias/master

Suppressed MSVC++ warnings C4244 and C4267
Kim Kulling 5 年之前
父节点
当前提交
3e1abd1039

+ 5 - 5
code/Assjson/cencode.c

@@ -42,7 +42,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
 			{
 			{
 				state_in->result = result;
 				state_in->result = result;
 				state_in->step = step_A;
 				state_in->step = step_A;
-				return codechar - code_out;
+				return (int)(codechar - code_out);
 			}
 			}
 			fragment = *plainchar++;
 			fragment = *plainchar++;
 			result = (fragment & 0x0fc) >> 2;
 			result = (fragment & 0x0fc) >> 2;
@@ -53,7 +53,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
 			{
 			{
 				state_in->result = result;
 				state_in->result = result;
 				state_in->step = step_B;
 				state_in->step = step_B;
-				return codechar - code_out;
+				return (int)(codechar - code_out);
 			}
 			}
 			fragment = *plainchar++;
 			fragment = *plainchar++;
 			result |= (fragment & 0x0f0) >> 4;
 			result |= (fragment & 0x0f0) >> 4;
@@ -64,7 +64,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
 			{
 			{
 				state_in->result = result;
 				state_in->result = result;
 				state_in->step = step_C;
 				state_in->step = step_C;
-				return codechar - code_out;
+				return (int)(codechar - code_out);
 			}
 			}
 			fragment = *plainchar++;
 			fragment = *plainchar++;
 			result |= (fragment & 0x0c0) >> 6;
 			result |= (fragment & 0x0c0) >> 6;
@@ -81,7 +81,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
 		}
 		}
 	}
 	}
 	/* control should not reach here */
 	/* control should not reach here */
-	return codechar - code_out;
+	return (int)(codechar - code_out);
 }
 }
 
 
 int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
 int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
@@ -104,6 +104,6 @@ int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
 	}
 	}
 	*codechar++ = '\n';
 	*codechar++ = '\n';
 	
 	
-	return codechar - code_out;
+	return (int)(codechar - code_out);
 }
 }
 
 

+ 1 - 1
code/CSM/CSMLoader.cpp

@@ -178,7 +178,7 @@ void CSMImporter::InternReadFile( const std::string& pFile,
                         *ot++ = *buffer++;
                         *ot++ = *buffer++;
 
 
                     *ot = '\0';
                     *ot = '\0';
-                    nda->mNodeName.length = (size_t)(ot-nda->mNodeName.data);
+                    nda->mNodeName.length = (ai_uint32)(ot-nda->mNodeName.data);
                 }
                 }
 
 
                 anim->mNumChannels = static_cast<unsigned int>(anims_temp.size());
                 anim->mNumChannels = static_cast<unsigned int>(anims_temp.size());

+ 1 - 1
code/MDL/MDLLoader.cpp

@@ -1575,7 +1575,7 @@ void MDLImporter::InternReadFile_3DGS_MDL7( )
 				const size_t maxSize(buffersize - (i*AI_MDL7_MAX_GROUPNAMESIZE));
 				const size_t maxSize(buffersize - (i*AI_MDL7_MAX_GROUPNAMESIZE));
 				pcNode->mName.length = ai_snprintf(szBuffer, maxSize, "Group_%u", p);
 				pcNode->mName.length = ai_snprintf(szBuffer, maxSize, "Group_%u", p);
 			} else {
 			} else {
-				pcNode->mName.length = ::strlen(szBuffer);
+				pcNode->mName.length = (ai_uint32)::strlen(szBuffer);
 			}
 			}
             ::strncpy(pcNode->mName.data,szBuffer,MAXLEN-1);
             ::strncpy(pcNode->mName.data,szBuffer,MAXLEN-1);
             ++p;
             ++p;

+ 3 - 3
code/MDL/MDLMaterialLoader.cpp

@@ -541,7 +541,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
         size_t iLen2 = iLen+1;
         size_t iLen2 = iLen+1;
         iLen2 = iLen2 > MAXLEN ? MAXLEN : iLen2;
         iLen2 = iLen2 > MAXLEN ? MAXLEN : iLen2;
         memcpy(szFile.data,(const char*)szCurrent,iLen2);
         memcpy(szFile.data,(const char*)szCurrent,iLen2);
-        szFile.length = iLen;
+        szFile.length = (ai_uint32)iLen;
 
 
         szCurrent += iLen2;
         szCurrent += iLen2;
 
 
@@ -710,7 +710,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
         aiString szFile;
         aiString szFile;
         const size_t iLen = strlen((const char*)szCurrent);
         const size_t iLen = strlen((const char*)szCurrent);
         ::memcpy(szFile.data,(const char*)szCurrent,iLen+1);
         ::memcpy(szFile.data,(const char*)szCurrent,iLen+1);
-        szFile.length = iLen;
+        szFile.length = (ai_uint32)iLen;
 
 
         pcMatOut->AddProperty(&szFile,AI_MATKEY_TEXTURE_DIFFUSE(0));
         pcMatOut->AddProperty(&szFile,AI_MATKEY_TEXTURE_DIFFUSE(0));
 
 
@@ -831,7 +831,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
         aiString szFile;
         aiString szFile;
         ::memcpy(szFile.data,pcSkin->texture_name,sizeof(pcSkin->texture_name));
         ::memcpy(szFile.data,pcSkin->texture_name,sizeof(pcSkin->texture_name));
         szFile.data[sizeof(pcSkin->texture_name)] = '\0';
         szFile.data[sizeof(pcSkin->texture_name)] = '\0';
-        szFile.length = ::strlen(szFile.data);
+        szFile.length = (ai_uint32)::strlen(szFile.data);
 
 
         pcMatOut->AddProperty(&szFile,AI_MATKEY_NAME);
         pcMatOut->AddProperty(&szFile,AI_MATKEY_NAME);
     }
     }

+ 1 - 1
code/Material/MaterialSystem.cpp

@@ -504,7 +504,7 @@ aiReturn aiMaterial::AddBinaryProperty (const void* pInput,
     pcNew->mData = new char[pSizeInBytes];
     pcNew->mData = new char[pSizeInBytes];
     memcpy (pcNew->mData,pInput,pSizeInBytes);
     memcpy (pcNew->mData,pInput,pSizeInBytes);
 
 
-    pcNew->mKey.length = ::strlen(pKey);
+    pcNew->mKey.length = (ai_uint32)::strlen(pKey);
     ai_assert ( MAXLEN > pcNew->mKey.length);
     ai_assert ( MAXLEN > pcNew->mKey.length);
     strcpy( pcNew->mKey.data, pKey );
     strcpy( pcNew->mKey.data, pKey );
 
 

+ 1 - 1
code/Q3BSP/Q3BSPFileImporter.cpp

@@ -616,7 +616,7 @@ bool Q3BSPFileImporter::importTextureFromArchive( const Q3BSP::Q3BSPModel *model
             // We'll leave it up to the user to figure out which extension the file has.
             // We'll leave it up to the user to figure out which extension the file has.
             aiString name;
             aiString name;
             strncpy( name.data, pTexture->strName, sizeof name.data );
             strncpy( name.data, pTexture->strName, sizeof name.data );
-            name.length = strlen( name.data );
+            name.length = (ai_uint32)strlen( name.data );
             pMatHelper->AddProperty( &name, AI_MATKEY_TEXTURE_DIFFUSE( 0 ) );
             pMatHelper->AddProperty( &name, AI_MATKEY_TEXTURE_DIFFUSE( 0 ) );
         }
         }
     }
     }

+ 1 - 1
code/SMD/SMDLoader.cpp

@@ -616,7 +616,7 @@ void SMDImporter::CreateOutputMaterials() {
         if (aszTextures[iMat].length())
         if (aszTextures[iMat].length())
         {
         {
             ::strncpy(szName.data, aszTextures[iMat].c_str(),MAXLEN-1);
             ::strncpy(szName.data, aszTextures[iMat].c_str(),MAXLEN-1);
-            szName.length = aszTextures[iMat].length();
+            szName.length = (ai_uint32)aszTextures[iMat].length();
             pcMat->AddProperty(&szName,AI_MATKEY_TEXTURE_DIFFUSE(0));
             pcMat->AddProperty(&szName,AI_MATKEY_TEXTURE_DIFFUSE(0));
         }
         }
     }
     }

+ 1 - 1
code/Unreal/UnrealLoader.cpp

@@ -403,7 +403,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
 
 
         // set color and name
         // set color and name
         mat->AddProperty(&color,1,AI_MATKEY_COLOR_DIFFUSE);
         mat->AddProperty(&color,1,AI_MATKEY_COLOR_DIFFUSE);
-        s.length = ::strlen(s.data);
+        s.length = (ai_uint32)::strlen(s.data);
         mat->AddProperty(&s,AI_MATKEY_NAME);
         mat->AddProperty(&s,AI_MATKEY_NAME);
 
 
         // set texture, if any
         // set texture, if any

+ 1 - 1
code/X/XFileImporter.cpp

@@ -211,7 +211,7 @@ aiNode* XFileImporter::CreateNodes( aiScene* pScene, aiNode* pParent, const XFil
 
 
     // create node
     // create node
     aiNode* node = new aiNode;
     aiNode* node = new aiNode;
-    node->mName.length = pNode->mName.length();
+    node->mName.length = (ai_uint32)pNode->mName.length();
     node->mParent = pParent;
     node->mParent = pParent;
     memcpy( node->mName.data, pNode->mName.c_str(), pNode->mName.length());
     memcpy( node->mName.data, pNode->mName.c_str(), pNode->mName.length());
     node->mName.data[node->mName.length] = 0;
     node->mName.data[node->mName.length] = 0;