Browse Source

Merge branch 'master' into floatwarnings

Kim Kulling 2 years ago
parent
commit
fec39154ed

+ 0 - 4
code/AssetLib/ASE/ASELoader.cpp

@@ -87,10 +87,6 @@ ASEImporter::ASEImporter() :
     // empty
     // empty
 }
 }
 
 
-// ------------------------------------------------------------------------------------------------
-// Destructor, private as well
-ASEImporter::~ASEImporter() = default;
-
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
 // Returns whether the class can handle the format of the given file.
 // Returns whether the class can handle the format of the given file.
 bool ASEImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
 bool ASEImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {

+ 1 - 1
code/AssetLib/ASE/ASELoader.h

@@ -62,7 +62,7 @@ namespace Assimp {
 class ASEImporter : public BaseImporter {
 class ASEImporter : public BaseImporter {
 public:
 public:
     ASEImporter();
     ASEImporter();
-    ~ASEImporter() override;
+    ~ASEImporter() override = default;
 
 
     // -------------------------------------------------------------------
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
     /** Returns whether the class can handle the format of the given file.

+ 7 - 1
code/AssetLib/ASE/ASEParser.cpp

@@ -1774,7 +1774,13 @@ void Parser::ParseLV4MeshFace(ASE::Face &out) {
         // FIX: There needn't always be a value, sad but true
         // FIX: There needn't always be a value, sad but true
         while (true) {
         while (true) {
             if (*filePtr < '9' && *filePtr >= '0') {
             if (*filePtr < '9' && *filePtr >= '0') {
-                out.iSmoothGroup |= (1 << strtoul10(filePtr, &filePtr));
+                uint32_t value = strtoul10(filePtr, &filePtr);
+                if (value < 32) {
+                    out.iSmoothGroup |= (1 << strtoul10(filePtr, &filePtr));
+                } else {
+                    const std::string message = std::string("Unable to set smooth group, value with ") + ai_to_string(value) + std::string(" out of range");
+                    LogWarning(message.c_str());
+                }
             }
             }
             SkipSpaces(&filePtr);
             SkipSpaces(&filePtr);
             if (',' != *filePtr) {
             if (',' != *filePtr) {

+ 3 - 6
code/AssetLib/ASE/ASEParser.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 
 Copyright (c) 2006-2022, assimp team
 Copyright (c) 2006-2022, assimp team
 
 
-
 All rights reserved.
 All rights reserved.
 
 
 Redistribution and use of this software in source and binary forms,
 Redistribution and use of this software in source and binary forms,
@@ -385,12 +384,10 @@ struct Dummy : public BaseNode {
 /** \brief Class to parse ASE files
 /** \brief Class to parse ASE files
  */
  */
 class Parser {
 class Parser {
-private:
-    Parser() AI_NO_EXCEPT {
-        // empty
-    }
-
 public:
 public:
+    /// @brief No default constructor.
+    Parser() = delete;
+
     // -------------------------------------------------------------------
     // -------------------------------------------------------------------
     //! Construct a parser from a given input file which is
     //! Construct a parser from a given input file which is
     //! guaranteed to be terminated with zero.
     //! guaranteed to be terminated with zero.

+ 1 - 0
code/Common/ScenePreprocessor.cpp

@@ -142,6 +142,7 @@ void ScenePreprocessor::ProcessMesh(aiMesh *mesh) {
     // If the information which primitive types are there in the
     // If the information which primitive types are there in the
     // mesh is currently not available, compute it.
     // mesh is currently not available, compute it.
     if (!mesh->mPrimitiveTypes) {
     if (!mesh->mPrimitiveTypes) {
+        ai_assert(mesh->mFaces != nullptr);
         for (unsigned int a = 0; a < mesh->mNumFaces; ++a) {
         for (unsigned int a = 0; a < mesh->mNumFaces; ++a) {
             aiFace &face = mesh->mFaces[a];
             aiFace &face = mesh->mFaces[a];
             switch (face.mNumIndices) {
             switch (face.mNumIndices) {