From ed3e218550f726b09a25beda5900379e1d7c9a6c Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 21 May 2022 19:08:43 +0200 Subject: [PATCH] Bugfix: fix not initialized member attributes --- code/AssetLib/FBX/FBXConverter.cpp | 10 +++------- code/AssetLib/FBX/FBXDocumentUtil.cpp | 9 +++------ code/Common/Version.cpp | 3 +++ 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/code/AssetLib/FBX/FBXConverter.cpp b/code/AssetLib/FBX/FBXConverter.cpp index 72d12c63b..19732a3b0 100644 --- a/code/AssetLib/FBX/FBXConverter.cpp +++ b/code/AssetLib/FBX/FBXConverter.cpp @@ -65,12 +65,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include #include #include #include -#include -#include namespace Assimp { namespace FBX { @@ -187,8 +184,7 @@ std::string FBXConverter::MakeUniqueNodeName(const Model *const model, const aiN /// This struct manages nodes which may or may not end up in the node hierarchy. /// When a node becomes a child of another node, that node becomes its owner and mOwnership should be released. -struct FBXConverter::PotentialNode -{ +struct FBXConverter::PotentialNode { PotentialNode() : mOwnership(new aiNode), mNode(mOwnership.get()) {} PotentialNode(const std::string& name) : mOwnership(new aiNode(name)), mNode(mOwnership.get()) {} aiNode* operator->() { return mNode; } @@ -452,7 +448,7 @@ void FBXConverter::GetUniqueName(const std::string &name, std::string &uniqueNam auto it_pair = mNodeNames.insert({ name, 0 }); // duplicate node name instance count unsigned int &i = it_pair.first->second; while (!it_pair.second) { - i++; + ++i; std::ostringstream ext; ext << name << std::setfill('0') << std::setw(3) << i; uniqueName = ext.str(); @@ -651,7 +647,6 @@ void FBXConverter::GetRotationMatrix(Model::RotOrder mode, const aiVector3D &rot bool FBXConverter::NeedsComplexTransformationChain(const Model &model) { const PropertyTable &props = model.Props(); - bool ok; const float zero_epsilon = ai_epsilon; const aiVector3D all_ones(1.0f, 1.0f, 1.0f); @@ -665,6 +660,7 @@ bool FBXConverter::NeedsComplexTransformationChain(const Model &model) { bool scale_compare = (comp == TransformationComp_GeometricScaling || comp == TransformationComp_Scaling); + bool ok = true; const aiVector3D &v = PropertyGet(props, NameTransformationCompProperty(comp), ok); if (ok && scale_compare) { if ((v - all_ones).SquareLength() > zero_epsilon) { diff --git a/code/AssetLib/FBX/FBXDocumentUtil.cpp b/code/AssetLib/FBX/FBXDocumentUtil.cpp index 68185e564..c41eb2747 100644 --- a/code/AssetLib/FBX/FBXDocumentUtil.cpp +++ b/code/AssetLib/FBX/FBXDocumentUtil.cpp @@ -59,14 +59,12 @@ namespace Util { // ------------------------------------------------------------------------------------------------ // signal DOM construction error, this is always unrecoverable. Throws DeadlyImportError. -void DOMError(const std::string& message, const Token& token) -{ +void DOMError(const std::string& message, const Token& token) { throw DeadlyImportError("FBX-DOM", Util::GetTokenText(&token), message); } // ------------------------------------------------------------------------------------------------ -void DOMError(const std::string& message, const Element* element /*= nullptr*/) -{ +void DOMError(const std::string& message, const Element* element /*= nullptr*/) { if(element) { DOMError(message,element->KeyToken()); } @@ -76,8 +74,7 @@ void DOMError(const std::string& message, const Element* element /*= nullptr*/) // ------------------------------------------------------------------------------------------------ // print warning, do return -void DOMWarning(const std::string& message, const Token& token) -{ +void DOMWarning(const std::string& message, const Token& token) { if(DefaultLogger::get()) { ASSIMP_LOG_WARN("FBX-DOM", Util::GetTokenText(&token), message); } diff --git a/code/Common/Version.cpp b/code/Common/Version.cpp index cfb0de4e5..808c3598d 100644 --- a/code/Common/Version.cpp +++ b/code/Common/Version.cpp @@ -135,6 +135,9 @@ ASSIMP_API aiScene::aiScene() : mNumCameras(0), mCameras(nullptr), mMetaData(nullptr), + mName(), + mNumSkeletons(0), + mSkeletons(nullptr), mPrivate(new Assimp::ScenePrivateData()) { // empty }