From ef54a00fc47e9f0e5c9471e0aea984d1bdfd87b2 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 22 Sep 2019 09:12:37 +0200 Subject: [PATCH 1/3] Use correct escape sequence for unsigned. --- code/PostProcessing/ValidateDataStructure.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/PostProcessing/ValidateDataStructure.cpp b/code/PostProcessing/ValidateDataStructure.cpp index 712fd6943..501f7a9b2 100644 --- a/code/PostProcessing/ValidateDataStructure.cpp +++ b/code/PostProcessing/ValidateDataStructure.cpp @@ -958,7 +958,7 @@ void ValidateDSProcess::Validate( const aiString* pString) { if (pString->length > MAXLEN) { - ReportError("aiString::length is too large (%lu, maximum is %lu)", + ReportError("aiString::length is too large (%u, maximum is %lu)", pString->length,MAXLEN); } const char* sz = pString->data; From 94c488d7ea48511a8f65b3ef4f27b476a064b285 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 22 Sep 2019 10:15:44 +0200 Subject: [PATCH 2/3] fix compiler warnings. --- code/MD2/MD2Loader.cpp | 2 +- code/MD5/MD5Parser.cpp | 2 +- include/assimp/types.h | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code/MD2/MD2Loader.cpp b/code/MD2/MD2Loader.cpp index a26f70533..7023c0fa3 100644 --- a/code/MD2/MD2Loader.cpp +++ b/code/MD2/MD2Loader.cpp @@ -344,7 +344,7 @@ void MD2Importer::InternReadFile( const std::string& pFile, if (pcSkins->name[0]) { aiString szString; - const size_t iLen = ::strlen(pcSkins->name); + const ai_uint32 iLen = (ai_uint32) ::strlen(pcSkins->name); ::memcpy(szString.data,pcSkins->name,iLen); szString.data[iLen] = '\0'; szString.length = iLen; diff --git a/code/MD5/MD5Parser.cpp b/code/MD5/MD5Parser.cpp index b955e9cbc..37490212f 100644 --- a/code/MD5/MD5Parser.cpp +++ b/code/MD5/MD5Parser.cpp @@ -235,7 +235,7 @@ bool MD5Parser::ParseSection(Section& out) const char* szStart = ++sz; \ while('\"'!=*sz)++sz; \ const char* szEnd = (sz++); \ - out.length = (size_t)(szEnd - szStart); \ + out.length = (ai_uint32) (szEnd - szStart); \ ::memcpy(out.data,szStart,out.length); \ out.data[out.length] = '\0'; // ------------------------------------------------------------------------------------------------ diff --git a/include/assimp/types.h b/include/assimp/types.h index e0a004c92..f0805940f 100644 --- a/include/assimp/types.h +++ b/include/assimp/types.h @@ -274,8 +274,8 @@ struct aiString } /** Copy constructor */ - aiString(const aiString& rOther) : - length(rOther.length) + aiString(const aiString& rOther) + : length(rOther.length) { // Crop the string to the maximum length length = length>=MAXLEN?MAXLEN-1:length; @@ -285,7 +285,7 @@ struct aiString /** Constructor from std::string */ explicit aiString(const std::string& pString) : - length(pString.length()) + length( (ai_uint32) pString.length()) { length = length>=MAXLEN?MAXLEN-1:length; memcpy( data, pString.c_str(), length); @@ -297,14 +297,14 @@ struct aiString if( pString.length() > MAXLEN - 1) { return; } - length = pString.length(); + length = (ai_uint32)pString.length(); memcpy( data, pString.c_str(), length); data[length] = 0; } /** Copy a const char* to the aiString */ void Set( const char* sz) { - const size_t len = ::strlen(sz); + const ai_int32 len = (ai_uint32) ::strlen(sz); if( len > MAXLEN - 1) { return; } @@ -351,7 +351,7 @@ struct aiString /** Append a string to the string */ void Append (const char* app) { - const size_t len = ::strlen(app); + const ai_uint32 len = (ai_uint32) ::strlen(app); if (!len) { return; } From ab3c17419e920127f82b287ba8d13ee459fecf7b Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 22 Sep 2019 12:27:44 +0200 Subject: [PATCH 3/3] fix warning --- include/assimp/types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/assimp/types.h b/include/assimp/types.h index f0805940f..8ad5680f3 100644 --- a/include/assimp/types.h +++ b/include/assimp/types.h @@ -305,7 +305,7 @@ struct aiString /** Copy a const char* to the aiString */ void Set( const char* sz) { const ai_int32 len = (ai_uint32) ::strlen(sz); - if( len > MAXLEN - 1) { + if( len > (ai_int32)MAXLEN - 1) { return; } length = len;