From c4e91eb33f811a50c38e89dff79f393a38164aea Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 30 Sep 2017 10:47:23 +0200 Subject: [PATCH] add some asserts. --- code/AssbinLoader.h | 1 - code/FBXConverter.cpp | 2 +- code/FBXProperties.h | 20 +++++++------------- code/SMDLoader.cpp | 6 ++++-- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/code/AssbinLoader.h b/code/AssbinLoader.h index fc28d16..2eb7a64 100644 --- a/code/AssbinLoader.h +++ b/code/AssbinLoader.h @@ -71,7 +71,6 @@ class AssbinImporter : public BaseImporter private: bool shortened; bool compressed; -protected: public: virtual bool CanRead( diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index 850028a..1a80fa4 100644 --- a/code/FBXConverter.cpp +++ b/code/FBXConverter.cpp @@ -1096,7 +1096,7 @@ void Converter::SetupNodeMetadata( const Model& model, aiNode& nd ) DirectPropertyMap unparsedProperties = props.GetUnparsedProperties(); // create metadata on node - std::size_t numStaticMetaData = 2; + const std::size_t numStaticMetaData = 2; aiMetadata* data = aiMetadata::Alloc( static_cast(unparsedProperties.size() + numStaticMetaData) ); nd.mMetaData = data; int index = 0; diff --git a/code/FBXProperties.h b/code/FBXProperties.h index 91b7c81..09b8aa9 100644 --- a/code/FBXProperties.h +++ b/code/FBXProperties.h @@ -62,8 +62,7 @@ class Element; P: "ShininessExponent", "double", "Number", "",0.5 @endvebatim */ -class Property -{ +class Property { protected: Property(); @@ -78,15 +77,13 @@ public: }; template -class TypedProperty : public Property -{ +class TypedProperty : public Property { public: explicit TypedProperty(const T& value) - : value(value) - { + : value(value) { + // empty } -public: const T& Value() const { return value; } @@ -97,21 +94,19 @@ private: typedef std::fbx_unordered_map > DirectPropertyMap; -typedef std::fbx_unordered_map PropertyMap; -typedef std::fbx_unordered_map LazyPropertyMap; +typedef std::fbx_unordered_map PropertyMap; +typedef std::fbx_unordered_map LazyPropertyMap; /** * Represents a property table as can be found in the newer FBX files (Properties60, Properties70) */ -class PropertyTable -{ +class PropertyTable { public: // in-memory property table with no source element PropertyTable(); PropertyTable(const Element& element, std::shared_ptr templateProps); ~PropertyTable(); -public: const Property* Get(const std::string& name) const; // PropertyTable's need not be coupled with FBX elements so this can be NULL @@ -132,7 +127,6 @@ private: const Element* const element; }; - // ------------------------------------------------------------------------------------------------ template inline diff --git a/code/SMDLoader.cpp b/code/SMDLoader.cpp index 4502e8d..60e3f63 100644 --- a/code/SMDLoader.cpp +++ b/code/SMDLoader.cpp @@ -650,12 +650,14 @@ void SMDImporter::ComputeAbsoluteBoneTransformations() // create output materials void SMDImporter::CreateOutputMaterials() { + ai_assert( nullptr != pScene ); + pScene->mNumMaterials = (unsigned int)aszTextures.size(); pScene->mMaterials = new aiMaterial*[std::max(1u, pScene->mNumMaterials)]; - for (unsigned int iMat = 0; iMat < pScene->mNumMaterials;++iMat) - { + for (unsigned int iMat = 0; iMat < pScene->mNumMaterials; ++iMat) { aiMaterial* pcMat = new aiMaterial(); + ai_assert( nullptr != pcMat ); pScene->mMaterials[iMat] = pcMat; aiString szName; -- 2.7.4