Md5Parser fixes

pull/5421/head
Kim Kulling 2024-01-29 21:39:31 +01:00
parent 6230e70d02
commit ad18a69506
4 changed files with 16 additions and 18 deletions

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2023, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -140,14 +140,14 @@ bool MD5Parser::ParseSection(Section &out) {
++buffer;
if (buffer == bufferEnd) {
return false;
}
}
}
out.mName = std::string(sz, (uintptr_t)(buffer - sz));
while (IsSpace(*buffer)) {
++buffer;
if (buffer == bufferEnd) {
return false;
}
}
}
bool running = true;
@ -157,14 +157,14 @@ bool MD5Parser::ParseSection(Section &out) {
++buffer;
if (buffer == bufferEnd) {
return false;
}
}
bool run = true;
while (run) {
while (IsSpaceOrNewLine(*buffer)) {
++buffer;
if (buffer == bufferEnd) {
return false;
}
}
}
if ('\0' == *buffer) {
return false; // seems this was the last section
@ -186,14 +186,14 @@ bool MD5Parser::ParseSection(Section &out) {
++buffer;
if (buffer == bufferEnd) {
return false;
}
}
}
if (*buffer) {
++lineNumber;
*buffer++ = '\0';
if (buffer == bufferEnd) {
return false;
}
}
}
}
break;
@ -203,27 +203,25 @@ bool MD5Parser::ParseSection(Section &out) {
while (!IsSpaceOrNewLine(*buffer++)) {
if (buffer == bufferEnd) {
return false;
}
}
}
out.mGlobalValue = std::string(sz, (uintptr_t)(buffer - sz));
continue;
}
break;
}
if (buffer == bufferEnd)
if (buffer == bufferEnd) {
return false;
}
while (IsSpaceOrNewLine(*buffer)) {
if (buffer == bufferEnd) {
break;
}
}
++buffer;
}
return '\0' != *buffer;
}
// ------------------------------------------------------------------------------------------------
// Some dirty macros just because they're so funny and easy to debug
// skip all spaces ... handle EOL correctly
inline void AI_MD5_SKIP_SPACES(const char **sz, const char *bufferEnd, int linenumber) {
if (!SkipSpaces(sz, bufferEnd)) {
@ -256,7 +254,7 @@ inline void AI_MD5_READ_TRIPLE(aiVector3D &vec, const char **sz, const char *buf
inline bool AI_MD5_PARSE_STRING(const char **sz, const char *bufferEnd, aiString &out, int linenumber) {
bool bQuota = (**sz == '\"');
const char *szStart = *sz;
while (!IsSpaceOrNewLine(*sz)) {
while (!IsSpaceOrNewLine(**sz)) {
++*sz;
if (*sz == bufferEnd) break;
}
@ -293,6 +291,7 @@ inline void AI_MD5_PARSE_STRING_IN_QUOTATION(const char **sz, const char *buffer
}
out.data[out.length] = '\0';
}
// ------------------------------------------------------------------------------------------------
// .MD5MESH parsing function
MD5MeshParser::MD5MeshParser(SectionArray &mSections) {

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2023, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -60,8 +60,7 @@ void ReadFile(DB& db,const EXPRESS::ConversionSchema& scheme, const char* const*
/// @brief Helper to read a file.
template <size_t N, size_t N2>
inline
void ReadFile(DB& db,const EXPRESS::ConversionSchema& scheme, const char* const (&arr)[N], const char* const (&arr2)[N2]) {
inline void ReadFile(DB& db,const EXPRESS::ConversionSchema& scheme, const char* const (&arr)[N], const char* const (&arr2)[N2]) {
return ReadFile(db,scheme,arr,N,arr2,N2);
}