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:
@@ -100,12 +100,12 @@ void ObjFileImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
|
||||
const std::string mode = "rb";
|
||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, mode));
|
||||
if (NULL == file.get())
|
||||
throw new ImportErrorException( "Failed to open file " + pFile + ".");
|
||||
throw DeadlyImportError( "Failed to open file " + pFile + ".");
|
||||
|
||||
// Get the filesize and vaslidate it, throwing an exception when failes
|
||||
size_t fileSize = file->FileSize();
|
||||
if( fileSize < 16)
|
||||
throw new ImportErrorException( "OBJ-file is too small.");
|
||||
throw DeadlyImportError( "OBJ-file is too small.");
|
||||
|
||||
// Allocate buffer and read file into it
|
||||
TextFileToBuffer(file.get(),m_Buffer);
|
||||
|
||||
Reference in New Issue
Block a user