Revamp exception handling. ImportErrorException renamed to DeadlyImportError to avoid silent regressions. Exceptions now thrown by value, and caught by reference. Put guards in all C++ and C API functions to avoid unwanted exception propagation across module and language boundaries.
PLEASE TEST CAREFULLY IF THIS SHOULD CAUSE REGRESSIONS. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@617 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
@@ -221,7 +221,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
|
||||
|
||||
// Check whether we can read from the file
|
||||
if( !file.get())
|
||||
throw new ImportErrorException( "Failed to open NFF file " + pFile + ".");
|
||||
throw DeadlyImportError( "Failed to open NFF file " + pFile + ".");
|
||||
|
||||
unsigned int m = (unsigned int)file->FileSize();
|
||||
|
||||
@@ -428,7 +428,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
|
||||
}
|
||||
|
||||
AI_NFF2_GET_NEXT_TOKEN();
|
||||
if (!num)throw new ImportErrorException("NFF2: There are zero vertices");
|
||||
if (!num)throw DeadlyImportError("NFF2: There are zero vertices");
|
||||
num = ::strtol10(sz,&sz);
|
||||
|
||||
std::vector<unsigned int> tempIdx;
|
||||
@@ -637,7 +637,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!num)throw new ImportErrorException("NFF2: There are zero faces");
|
||||
if (!num)throw DeadlyImportError("NFF2: There are zero faces");
|
||||
}
|
||||
}
|
||||
camLookAt = camLookAt + camPos;
|
||||
@@ -1108,7 +1108,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
|
||||
}
|
||||
}
|
||||
|
||||
if (!pScene->mNumMeshes)throw new ImportErrorException("NFF: No meshes loaded");
|
||||
if (!pScene->mNumMeshes)throw DeadlyImportError("NFF: No meshes loaded");
|
||||
pScene->mMeshes = new aiMesh*[pScene->mNumMeshes];
|
||||
pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials = pScene->mNumMeshes];
|
||||
for (it = meshes.begin(), m = 0; it != end;++it)
|
||||
|
||||
Reference in New Issue
Block a user