fix compiler warnings.

pull/2670/head
Kim Kulling 2019-09-22 10:15:44 +02:00
parent ef54a00fc4
commit 94c488d7ea
3 changed files with 8 additions and 8 deletions

View File

@ -344,7 +344,7 @@ void MD2Importer::InternReadFile( const std::string& pFile,
if (pcSkins->name[0]) if (pcSkins->name[0])
{ {
aiString szString; aiString szString;
const size_t iLen = ::strlen(pcSkins->name); const ai_uint32 iLen = (ai_uint32) ::strlen(pcSkins->name);
::memcpy(szString.data,pcSkins->name,iLen); ::memcpy(szString.data,pcSkins->name,iLen);
szString.data[iLen] = '\0'; szString.data[iLen] = '\0';
szString.length = iLen; szString.length = iLen;

View File

@ -235,7 +235,7 @@ bool MD5Parser::ParseSection(Section& out)
const char* szStart = ++sz; \ const char* szStart = ++sz; \
while('\"'!=*sz)++sz; \ while('\"'!=*sz)++sz; \
const char* szEnd = (sz++); \ const char* szEnd = (sz++); \
out.length = (size_t)(szEnd - szStart); \ out.length = (ai_uint32) (szEnd - szStart); \
::memcpy(out.data,szStart,out.length); \ ::memcpy(out.data,szStart,out.length); \
out.data[out.length] = '\0'; out.data[out.length] = '\0';
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -274,8 +274,8 @@ struct aiString
} }
/** Copy constructor */ /** Copy constructor */
aiString(const aiString& rOther) : aiString(const aiString& rOther)
length(rOther.length) : length(rOther.length)
{ {
// Crop the string to the maximum length // Crop the string to the maximum length
length = length>=MAXLEN?MAXLEN-1:length; length = length>=MAXLEN?MAXLEN-1:length;
@ -285,7 +285,7 @@ struct aiString
/** Constructor from std::string */ /** Constructor from std::string */
explicit aiString(const std::string& pString) : explicit aiString(const std::string& pString) :
length(pString.length()) length( (ai_uint32) pString.length())
{ {
length = length>=MAXLEN?MAXLEN-1:length; length = length>=MAXLEN?MAXLEN-1:length;
memcpy( data, pString.c_str(), length); memcpy( data, pString.c_str(), length);
@ -297,14 +297,14 @@ struct aiString
if( pString.length() > MAXLEN - 1) { if( pString.length() > MAXLEN - 1) {
return; return;
} }
length = pString.length(); length = (ai_uint32)pString.length();
memcpy( data, pString.c_str(), length); memcpy( data, pString.c_str(), length);
data[length] = 0; data[length] = 0;
} }
/** Copy a const char* to the aiString */ /** Copy a const char* to the aiString */
void Set( const char* sz) { void Set( const char* sz) {
const size_t len = ::strlen(sz); const ai_int32 len = (ai_uint32) ::strlen(sz);
if( len > MAXLEN - 1) { if( len > MAXLEN - 1) {
return; return;
} }
@ -351,7 +351,7 @@ struct aiString
/** Append a string to the string */ /** Append a string to the string */
void Append (const char* app) { void Append (const char* app) {
const size_t len = ::strlen(app); const ai_uint32 len = (ai_uint32) ::strlen(app);
if (!len) { if (!len) {
return; return;
} }