diff --git a/code/AssetLib/AMF/AMFImporter_Postprocess.cpp b/code/AssetLib/AMF/AMFImporter_Postprocess.cpp index 6d0ec2380..304361b86 100644 --- a/code/AssetLib/AMF/AMFImporter_Postprocess.cpp +++ b/code/AssetLib/AMF/AMFImporter_Postprocess.cpp @@ -48,12 +48,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "AMFImporter.hpp" -// Header files, Assimp. #include #include #include -// Header files, stdlib. #include namespace Assimp { @@ -379,7 +377,9 @@ void AMFImporter::Postprocess_BuildMeshSet(const AMFMesh &pNodeElement, const st // check if volume use material if (!ne_volume->MaterialID.empty()) { - if (!Find_ConvertedMaterial(ne_volume->MaterialID, &cur_mat)) Throw_ID_NotFound(ne_volume->MaterialID); + if (!Find_ConvertedMaterial(ne_volume->MaterialID, &cur_mat)) { + Throw_ID_NotFound(ne_volume->MaterialID); + } } // inside "volume" collect all data and place to arrays or create new objects diff --git a/include/assimp/XmlParser.h b/include/assimp/XmlParser.h index 0f73d1285..f3786479d 100644 --- a/include/assimp/XmlParser.h +++ b/include/assimp/XmlParser.h @@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef INCLUDED_AI_IRRXML_WRAPPER #define INCLUDED_AI_IRRXML_WRAPPER -// some long includes .... +#include #include "BaseImporter.h" #include "IOStream.hpp" #include @@ -117,6 +117,7 @@ public: bool parse(IOStream *stream) { if (nullptr == stream) { + ASSIMP_LOG_DEBUG("Stream is nullptr."); return false; } @@ -126,6 +127,7 @@ public: mDoc = new pugi::xml_document(); pugi::xml_parse_result parse_result = mDoc->load_string(&mData[0], pugi::parse_full); if (parse_result.status == pugi::status_ok) { + ASSIMP_LOG_DEBUG("Error while parse xml."); result = true; } diff --git a/test/unit/Common/uiScene.cpp b/test/unit/Common/uiScene.cpp index d5b123b48..7fdf5f05c 100644 --- a/test/unit/Common/uiScene.cpp +++ b/test/unit/Common/uiScene.cpp @@ -43,7 +43,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include - using namespace Assimp; class utScene : public ::testing::Test { diff --git a/test/unit/Common/utXmlParser.cpp b/test/unit/Common/utXmlParser.cpp index f2892208e..2956ce5b7 100644 --- a/test/unit/Common/utXmlParser.cpp +++ b/test/unit/Common/utXmlParser.cpp @@ -58,25 +58,20 @@ protected: TEST_F(utXmlParser, parse_xml_test) { XmlParser parser; std::string filename = ASSIMP_TEST_MODELS_DIR "/x3d/ComputerKeyboard.x3d"; - IOStream *stream = mIoSystem.Open(filename.c_str(), "rb"); - bool result = parser.parse(stream); + std::unique_ptr stream(mIoSystem.Open(filename.c_str(), "rb")); + EXPECT_NE(stream.get(), nullptr); + bool result = parser.parse(stream.get()); EXPECT_TRUE(result); - mIoSystem.Close(stream); } TEST_F(utXmlParser, parse_xml_and_traverse_test) { XmlParser parser; std::string filename = ASSIMP_TEST_MODELS_DIR "/x3d/ComputerKeyboard.x3d"; - - IOStream *stream = mIoSystem.Open(filename.c_str(), "rb"); - bool result = parser.parse(stream); + std::unique_ptr stream(mIoSystem.Open(filename.c_str(), "rb")); + EXPECT_NE(stream.get(), nullptr); + bool result = parser.parse(stream.get()); EXPECT_TRUE(result); XmlNode root = parser.getRootNode(); - std::string name = root.name(); - std::string name1 = root.name(); - EXPECT_NE(nullptr, root); - mIoSystem.Close(stream); - std::string name2 = root.name(); XmlNodeIterator nodeIt(root); EXPECT_TRUE(nodeIt.isEmpty());