more fixes for coverity-findings.

pull/2287/head
Kim Kulling 2018-12-28 01:44:56 +01:00
parent 4c6db68d34
commit 859153e3e6
3 changed files with 24 additions and 17 deletions

View File

@ -85,24 +85,27 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
ColladaLoader::ColladaLoader() ColladaLoader::ColladaLoader()
: mFileName() : mFileName()
, mMeshIndexByID() , mMeshIndexByID()
, mMaterialIndexByName() , mMaterialIndexByName()
, mMeshes() , mMeshes()
, newMats() , newMats()
, mCameras() , mCameras()
, mLights() , mLights()
, mTextures() , mTextures()
, mAnims() , mAnims()
, noSkeletonMesh( false ) , noSkeletonMesh( false )
, ignoreUpDirection(false) , ignoreUpDirection(false)
, mNodeNameCounter( 0 ) , useColladaName( false )
{} , mNodeNameCounter( 0 ) {
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Destructor, private as well // Destructor, private as well
ColladaLoader::~ColladaLoader() ColladaLoader::~ColladaLoader() {
{} // empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.

View File

@ -56,6 +56,9 @@ public:
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/PLY/cube.ply", aiProcess_ValidateDataStructure); const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/PLY/cube.ply", aiProcess_ValidateDataStructure);
EXPECT_EQ( 1u, scene->mNumMeshes ); EXPECT_EQ( 1u, scene->mNumMeshes );
EXPECT_NE( nullptr, scene->mMeshes[0] ); EXPECT_NE( nullptr, scene->mMeshes[0] );
if (nullptr == scene->mMeshes[0]) {
return false;
}
EXPECT_EQ( 8u, scene->mMeshes[0]->mNumVertices ); EXPECT_EQ( 8u, scene->mMeshes[0]->mNumVertices );
EXPECT_EQ( 6u, scene->mMeshes[0]->mNumFaces ); EXPECT_EQ( 6u, scene->mMeshes[0]->mNumFaces );

View File

@ -356,11 +356,12 @@ std::vector<char> ReadFile(const char* name) {
} }
::fseek(p, 0, SEEK_END); ::fseek(p, 0, SEEK_END);
const auto size = ::ftell(p); const size_t size = ::ftell(p);
::fseek(p, 0, SEEK_SET); ::fseek(p, 0, SEEK_SET);
ret.resize(size); ret.resize(size);
::fread(&ret[0], 1, size, p); const size_t readSize = ::fread(&ret[0], 1, size, p);
EXPECT_EQ(readSize, size);
::fclose(p); ::fclose(p);
return ret; return ret;