From e741e7aec6fe479d6eb638c08564bcee707e3633 Mon Sep 17 00:00:00 2001 From: Giuseppe Barbieri Date: Sat, 2 Dec 2017 23:16:10 +0100 Subject: [PATCH 01/10] Update MD5Loader.h --- code/MD5Loader.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/MD5Loader.h b/code/MD5Loader.h index 9dfc08226..a68655f55 100644 --- a/code/MD5Loader.h +++ b/code/MD5Loader.h @@ -144,7 +144,7 @@ protected: // ------------------------------------------------------------------- /** Load the contents of a specific file into memory and - * alocates a buffer to keep it. + * allocates a buffer to keep it. * * mBuffer is modified to point to this buffer. * @param pFile File stream to be read From 3e0b072263fd27b4fb709aea77ef2bf5182c0b67 Mon Sep 17 00:00:00 2001 From: Giuseppe Barbieri Date: Sat, 9 Dec 2017 23:42:23 +0100 Subject: [PATCH 02/10] Update FBXBinaryTokenizer.cpp --- code/FBXBinaryTokenizer.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/code/FBXBinaryTokenizer.cpp b/code/FBXBinaryTokenizer.cpp index 550859345..be73eaa95 100644 --- a/code/FBXBinaryTokenizer.cpp +++ b/code/FBXBinaryTokenizer.cpp @@ -435,11 +435,6 @@ void TokenizeBinary(TokenList& output_tokens, const char* input, unsigned int le TokenizeError("file is too short",0); } - if (strncmp(input,"Kaydara FBX Binary",18)) { - TokenizeError("magic bytes not found",0); - } - - //uint32_t offset = 0x15; const char* cursor = input + 0x15; From f9b599355c3b537bcb48f734d0a98ed1c22566d2 Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Tue, 12 Dec 2017 02:28:03 -0800 Subject: [PATCH 03/10] unzip: fix build with older zlib Fixes "unzip.c:150:11: error: unknown type name 'z_crc_t'" --- contrib/unzip/unzip.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/unzip/unzip.c b/contrib/unzip/unzip.c index e8b62e763..fea6e8913 100644 --- a/contrib/unzip/unzip.c +++ b/contrib/unzip/unzip.c @@ -41,6 +41,10 @@ woven in by Terry Thorsen 1/2003. #include "zlib.h" #include "unzip.h" +#if ZLIB_VERNUM < 0x1270 +typedef unsigned long z_crc_t; +#endif + #ifdef STDC # include # include From 379562055b8061480e44a56354bb778c8e5449a7 Mon Sep 17 00:00:00 2001 From: Tommy Date: Fri, 15 Dec 2017 23:18:45 +0100 Subject: [PATCH 04/10] Fix incorrect NO_GLTF_IMPORTER define name in glTFExporter.h --- code/glTFExporter.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/glTFExporter.h b/code/glTFExporter.h index c813fff44..752072604 100644 --- a/code/glTFExporter.h +++ b/code/glTFExporter.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_GLTFEXPORTER_H_INC #define AI_GLTFEXPORTER_H_INC -#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER +#ifndef ASSIMP_BUILD_NO_GLTF_EXPORTER #include #include @@ -113,6 +113,6 @@ namespace Assimp } -#endif // ASSIMP_BUILD_NO_GLTF_IMPORTER +#endif // ASSIMP_BUILD_NO_GLTF_EXPORTER #endif // AI_GLTFEXPORTER_H_INC From 068d4aa4cbcd88f6f4313374a0e562424e534467 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Wed, 13 Dec 2017 10:55:32 +0200 Subject: [PATCH 05/10] Disable clang static analysis for now Travis updated to clang 5.0 and there are new issues. --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9265dfb38..0b8d2f328 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,9 +33,10 @@ env: matrix: include: - - os: linux - compiler: clang - env: ANALYZE=ON + # disabled until clang 5.0 analyzer issues are fixed + # - os: linux + # compiler: clang + # env: ANALYZE=ON - os: linux compiler: clang env: ASAN=ON From 276fc5f46609b9a81b0a4ad0a3a6020f1708b746 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Wed, 13 Dec 2017 11:27:05 +0200 Subject: [PATCH 06/10] Remove packed attribute from aiUVTransform It would cause a warning when removing packed from aiVector2 --- include/assimp/material.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/assimp/material.h b/include/assimp/material.h index a12e7d076..502b89746 100644 --- a/include/assimp/material.h +++ b/include/assimp/material.h @@ -491,7 +491,7 @@ struct aiUVTransform } #endif -} PACK_STRUCT; +}; #include "./Compiler/poppack1.h" From 45ad63f37353fc2e84bccfb9daf32fff6fb3cbf8 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Wed, 13 Dec 2017 11:27:44 +0200 Subject: [PATCH 07/10] Remove packed attribute from aiVector2 Returning a reference to a member of packed member is UB --- include/assimp/vector2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/assimp/vector2.h b/include/assimp/vector2.h index 564d1f8b5..3b85fc22b 100644 --- a/include/assimp/vector2.h +++ b/include/assimp/vector2.h @@ -99,7 +99,7 @@ public: operator aiVector2t () const; TReal x, y; -} PACK_STRUCT; +}; typedef aiVector2t aiVector2D; From 87462165b5243a96ddf4e4d1725e16e4aac3af5c Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Wed, 13 Dec 2017 11:28:22 +0200 Subject: [PATCH 08/10] Fix bad pointer arithmetic in aiVector2 Trying to reference 'y' via pointer arithmetic on 'x' is UB --- include/assimp/vector2.inl | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/include/assimp/vector2.inl b/include/assimp/vector2.inl index 5ce13eece..fe3059ad5 100644 --- a/include/assimp/vector2.inl +++ b/include/assimp/vector2.inl @@ -114,13 +114,29 @@ const aiVector2t& aiVector2t::operator /= (TReal f) { // ------------------------------------------------------------------------------------------------ template TReal aiVector2t::operator[](unsigned int i) const { - return *(&x + i); + switch (i) { + case 0: + return x; + case 1: + return y; + default: + break; + } + return x; } // ------------------------------------------------------------------------------------------------ template TReal& aiVector2t::operator[](unsigned int i) { - return *(&x + i); + switch (i) { + case 0: + return x; + case 1: + return y; + default: + break; + } + return x; } // ------------------------------------------------------------------------------------------------ From 2f082340fc668cd8fef56232d64fa824ce2b325d Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Sat, 16 Dec 2017 14:57:59 +0200 Subject: [PATCH 09/10] MDLLoader: Add workaround for clang 5.0 build issue --- code/MDLLoader.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/MDLLoader.cpp b/code/MDLLoader.cpp index 2025d79b3..dc7b379ce 100644 --- a/code/MDLLoader.cpp +++ b/code/MDLLoader.cpp @@ -415,8 +415,14 @@ void MDLImporter::InternReadFile_Quake1( ) else { // get the first frame in the group +#if 1 + // FIXME: the cast is wrong and causea a warning on clang 5.0 + // disable thi code for now, fix it later + ai_assert(false && "Bad pointer cast"); +#else BE_NCONST MDL::GroupFrame* pcFrames2 = (BE_NCONST MDL::GroupFrame*)pcFrames; pcFirstFrame = (BE_NCONST MDL::SimpleFrame*)(&pcFrames2->time + pcFrames->type); +#endif } BE_NCONST MDL::Vertex* pcVertices = (BE_NCONST MDL::Vertex*) ((pcFirstFrame->name) + sizeof(pcFirstFrame->name)); VALIDATE_FILE_SIZE((const unsigned char*)(pcVertices + pcHeader->num_verts)); From 463dec5c7ed89088614c9f84acc61a9d5f987368 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Sat, 16 Dec 2017 15:19:53 +0200 Subject: [PATCH 10/10] Change StreamReader::IncPtr argument to signed Negative values are passed to it so it needs to be signed --- code/StreamReader.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/StreamReader.h b/code/StreamReader.h index 6220de9a8..b70ee7eca 100644 --- a/code/StreamReader.h +++ b/code/StreamReader.h @@ -192,7 +192,7 @@ public: // --------------------------------------------------------------------- /** Increase the file pointer (relative seeking) */ - void IncPtr(size_t plus) { + void IncPtr(intptr_t plus) { current += plus; if (current > limit) { throw DeadlyImportError("End of file or read limit was reached");