Browse Source

Merge branch 'master' into master

Kim Kulling 7 years ago
parent
commit
05f8af950a
6 changed files with 31 additions and 8 deletions
  1. 4 3
      .travis.yml
  2. 6 0
      code/MDLLoader.cpp
  3. 1 1
      code/StreamReader.h
  4. 1 1
      include/assimp/material.h
  5. 1 1
      include/assimp/vector2.h
  6. 18 2
      include/assimp/vector2.inl

+ 4 - 3
.travis.yml

@@ -33,9 +33,10 @@ env:
 
 
 matrix:
 matrix:
   include:
   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
     - os: linux
       compiler: clang
       compiler: clang
       env: ASAN=ON
       env: ASAN=ON

+ 6 - 0
code/MDLLoader.cpp

@@ -415,8 +415,14 @@ void MDLImporter::InternReadFile_Quake1( )
     else
     else
     {
     {
         // get the first frame in the group
         // 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;
         BE_NCONST MDL::GroupFrame* pcFrames2 = (BE_NCONST MDL::GroupFrame*)pcFrames;
         pcFirstFrame = (BE_NCONST MDL::SimpleFrame*)(&pcFrames2->time + pcFrames->type);
         pcFirstFrame = (BE_NCONST MDL::SimpleFrame*)(&pcFrames2->time + pcFrames->type);
+#endif
     }
     }
     BE_NCONST MDL::Vertex* pcVertices = (BE_NCONST MDL::Vertex*) ((pcFirstFrame->name) + sizeof(pcFirstFrame->name));
     BE_NCONST MDL::Vertex* pcVertices = (BE_NCONST MDL::Vertex*) ((pcFirstFrame->name) + sizeof(pcFirstFrame->name));
     VALIDATE_FILE_SIZE((const unsigned char*)(pcVertices + pcHeader->num_verts));
     VALIDATE_FILE_SIZE((const unsigned char*)(pcVertices + pcHeader->num_verts));

+ 1 - 1
code/StreamReader.h

@@ -192,7 +192,7 @@ public:
 
 
     // ---------------------------------------------------------------------
     // ---------------------------------------------------------------------
     /** Increase the file pointer (relative seeking)  */
     /** Increase the file pointer (relative seeking)  */
-    void IncPtr(size_t plus)    {
+    void IncPtr(intptr_t plus)    {
         current += plus;
         current += plus;
         if (current > limit) {
         if (current > limit) {
             throw DeadlyImportError("End of file or read limit was reached");
             throw DeadlyImportError("End of file or read limit was reached");

+ 1 - 1
include/assimp/material.h

@@ -491,7 +491,7 @@ struct aiUVTransform
     }
     }
 #endif
 #endif
 
 
-} PACK_STRUCT;
+};
 
 
 #include "./Compiler/poppack1.h"
 #include "./Compiler/poppack1.h"
 
 

+ 1 - 1
include/assimp/vector2.h

@@ -99,7 +99,7 @@ public:
     operator aiVector2t<TOther> () const;
     operator aiVector2t<TOther> () const;
 
 
     TReal x, y;
     TReal x, y;
-} PACK_STRUCT;
+};
 
 
 typedef aiVector2t<ai_real> aiVector2D;
 typedef aiVector2t<ai_real> aiVector2D;
 
 

+ 18 - 2
include/assimp/vector2.inl

@@ -114,13 +114,29 @@ const aiVector2t<TReal>& aiVector2t<TReal>::operator /= (TReal f) {
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
 template <typename TReal>
 template <typename TReal>
 TReal aiVector2t<TReal>::operator[](unsigned int i) const {
 TReal aiVector2t<TReal>::operator[](unsigned int i) const {
-    return *(&x + i);
+    switch (i) {
+        case 0:
+            return x;
+        case 1:
+            return y;
+        default:
+            break;
+    }
+    return x;
 }
 }
 
 
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
 template <typename TReal>
 template <typename TReal>
 TReal& aiVector2t<TReal>::operator[](unsigned int i) {
 TReal& aiVector2t<TReal>::operator[](unsigned int i) {
-    return *(&x + i);
+    switch (i) {
+        case 0:
+            return x;
+        case 1:
+            return y;
+        default:
+            break;
+    }
+    return x;
 }
 }
 
 
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------