From ad18a6950675d5791b900364e591471e13db7923 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 29 Jan 2024 21:39:31 +0100 Subject: [PATCH] Md5Parser fixes --- code/AssetLib/MD5/MD5Loader.h | 2 +- code/AssetLib/MD5/MD5Parser.cpp | 27 +++++++++++------------ code/AssetLib/MD5/MD5Parser.h | 2 +- code/AssetLib/STEPParser/STEPFileReader.h | 3 +-- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/code/AssetLib/MD5/MD5Loader.h b/code/AssetLib/MD5/MD5Loader.h index 65165d853..d64d6f5b8 100644 --- a/code/AssetLib/MD5/MD5Loader.h +++ b/code/AssetLib/MD5/MD5Loader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2022, assimp team +Copyright (c) 2006-2024, assimp team All rights reserved. diff --git a/code/AssetLib/MD5/MD5Parser.cpp b/code/AssetLib/MD5/MD5Parser.cpp index c4972c6e5..cdd7f9178 100644 --- a/code/AssetLib/MD5/MD5Parser.cpp +++ b/code/AssetLib/MD5/MD5Parser.cpp @@ -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) { diff --git a/code/AssetLib/MD5/MD5Parser.h b/code/AssetLib/MD5/MD5Parser.h index a1fad1b00..75e3c22f2 100644 --- a/code/AssetLib/MD5/MD5Parser.h +++ b/code/AssetLib/MD5/MD5Parser.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2023, assimp team +Copyright (c) 2006-2024, assimp team All rights reserved. diff --git a/code/AssetLib/STEPParser/STEPFileReader.h b/code/AssetLib/STEPParser/STEPFileReader.h index 8a57937c0..5a8eb7a6e 100644 --- a/code/AssetLib/STEPParser/STEPFileReader.h +++ b/code/AssetLib/STEPParser/STEPFileReader.h @@ -60,8 +60,7 @@ void ReadFile(DB& db,const EXPRESS::ConversionSchema& scheme, const char* const* /// @brief Helper to read a file. template -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); }