diff --git a/code/BaseImporter.cpp b/code/BaseImporter.cpp index 9598e8e9a..09b32e3ae 100644 --- a/code/BaseImporter.cpp +++ b/code/BaseImporter.cpp @@ -358,7 +358,6 @@ void BaseImporter::ConvertToUTF8(std::vector& data) DefaultLogger::get()->debug("Found UTF-16 BOM ..."); std::vector output; - int16_t *ptr = (int16_t*) &data[ 0 ]; utf8::utf16to8(data.begin(), data.end(), back_inserter(output)); return; } diff --git a/code/BlenderDNA.h b/code/BlenderDNA.h index c09f1ca42..de0a5a62f 100644 --- a/code/BlenderDNA.h +++ b/code/BlenderDNA.h @@ -253,10 +253,7 @@ public: * a compiler complain is the result. * @param dest Destination value to be written * @param db File database, including input stream. */ - template inline void Convert (T& dest, - const FileDatabase& db) const; - - + template inline void Convert (T& dest, const FileDatabase& db) const; // -------------------------------------------------------- // generic converter diff --git a/code/FBXBinaryTokenizer.cpp b/code/FBXBinaryTokenizer.cpp index 17cb942ff..a02458fa5 100644 --- a/code/FBXBinaryTokenizer.cpp +++ b/code/FBXBinaryTokenizer.cpp @@ -161,8 +161,7 @@ uint32_t ReadWord(const char* input, const char*& cursor, const char* end) } // ------------------------------------------------------------------------------------------------ -uint64_t ReadDoubleWord(const char* input, const char*& cursor, const char* end) -{ +uint64_t ReadDoubleWord(const char* input, const char*& cursor, const char* end) { const size_t k_to_read = sizeof(uint64_t); if(Offset(cursor, end) < k_to_read) { TokenizeError("cannot ReadDoubleWord, out of bounds",input, cursor); @@ -176,7 +175,6 @@ uint64_t ReadDoubleWord(const char* input, const char*& cursor, const char* end) return dword; } - // ------------------------------------------------------------------------------------------------ uint8_t ReadByte(const char* input, const char*& cursor, const char* end) { @@ -447,8 +445,9 @@ void TokenizeBinary(TokenList& output_tokens, const char* input, unsigned int le const uint32_t flags = ReadWord(input, cursor, input + length); const uint8_t padding_0 = ReadByte(input, cursor, input + length); // unused + (void) padding_0; const uint8_t padding_1 = ReadByte(input, cursor, input + length); // unused - + (void) padding_1; while (cursor < input + length) { if(!ReadScope(output_tokens, input, cursor, input + length, flags)) { diff --git a/code/PlyLoader.cpp b/code/PlyLoader.cpp index b62b373d5..46def8c69 100644 --- a/code/PlyLoader.cpp +++ b/code/PlyLoader.cpp @@ -159,6 +159,9 @@ void PLYImporter::InternReadFile(const std::string& pFile, // Get the file-size size_t fileSize = fileStream->FileSize(); + if ( 0 == fileSize ) { + throw DeadlyImportError("File " + pFile + " is empty."); + } IOStreamBuffer streamedBuffer(1024 * 1024); streamedBuffer.open(fileStream.get()); diff --git a/code/PlyParser.cpp b/code/PlyParser.cpp index e29005068..d978b513b 100644 --- a/code/PlyParser.cpp +++ b/code/PlyParser.cpp @@ -935,30 +935,6 @@ bool PLY::PropertyInstance::ParseValue(const char* &pCur, ai_assert(NULL != out); //calc element size - unsigned int lsize = 0; - switch (eType) - { - case EDT_Char: - case EDT_UChar: - lsize = 1; - break; - - case EDT_UShort: - case EDT_Short: - lsize = 2; - break; - - case EDT_UInt: - case EDT_Int: - case EDT_Float: - lsize = 4; - break; - - case EDT_Double: - lsize = 8; - break; - } - bool ret = true; switch (eType) { @@ -990,6 +966,7 @@ bool PLY::PropertyInstance::ParseValue(const char* &pCur, out->fDouble = (double)d; break; + case EDT_INVALID: default: ret = false; break; @@ -1032,6 +1009,10 @@ bool PLY::PropertyInstance::ParseValueBinary(IOStreamBuffer &streamBuffer, case EDT_Double: lsize = 8; break; + + case EDT_INVALID: + default: + break; } //read the next file block if needed diff --git a/test/unit/utBatchLoader.cpp b/test/unit/utBatchLoader.cpp index 32ec8709e..56862f912 100644 --- a/test/unit/utBatchLoader.cpp +++ b/test/unit/utBatchLoader.cpp @@ -66,6 +66,7 @@ TEST_F( BatchLoaderTest, createTest ) { } catch ( ... ) { ok = false; } + EXPECT_TRUE( ok ); } TEST_F( BatchLoaderTest, validateAccessTest ) { diff --git a/test/unit/utglTFImportExport.cpp b/test/unit/utglTFImportExport.cpp index 3dc110435..349dddafa 100644 --- a/test/unit/utglTFImportExport.cpp +++ b/test/unit/utglTFImportExport.cpp @@ -50,10 +50,8 @@ class utglTFImportExport : public AbstractImportExportBase { public: virtual bool importerTest() { Assimp::Importer importer; - const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glFT/TwoBoxes/TwoBoxes.gltf", 0 ); - //return nullptr != scene; - - return true; + const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF/TwoBoxes/TwoBoxes.gltf", 0 ); + return nullptr != scene; } };