replace NULL by nullptr on loadFile.
parent
abb628bc58
commit
6397bfbf90
|
@ -407,7 +407,9 @@ void AMFImporter::ParseFile(const std::string& pFile, IOSystem* pIOHandler)
|
|||
std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb"));
|
||||
|
||||
// Check whether we can read from the file
|
||||
if(file.get() == NULL) throw DeadlyImportError("Failed to open AMF file " + pFile + ".");
|
||||
if (file.get() == nullptr) {
|
||||
throw DeadlyImportError("Failed to open AMF file " + pFile + ".");
|
||||
}
|
||||
|
||||
// generate a XML reader for it
|
||||
std::unique_ptr<CIrrXML_IOStreamReader> mIOWrapper(new CIrrXML_IOStreamReader(file.get()));
|
||||
|
|
|
@ -124,12 +124,14 @@ void BVHLoader::InternReadFile( const std::string& pFile, aiScene* pScene, IOSys
|
|||
|
||||
// read file into memory
|
||||
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||
if( file.get() == NULL)
|
||||
throw DeadlyImportError( "Failed to open file " + pFile + ".");
|
||||
if (file.get() == nullptr) {
|
||||
throw DeadlyImportError("Failed to open file " + pFile + ".");
|
||||
}
|
||||
|
||||
size_t fileSize = file->FileSize();
|
||||
if( fileSize == 0)
|
||||
throw DeadlyImportError( "File is too small.");
|
||||
if (fileSize == 0) {
|
||||
throw DeadlyImportError("File is too small.");
|
||||
}
|
||||
|
||||
mBuffer.resize( fileSize);
|
||||
file->Read( &mBuffer.front(), 1, fileSize);
|
||||
|
|
|
@ -127,7 +127,7 @@ void CSMImporter::InternReadFile( const std::string& pFile,
|
|||
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
||||
|
||||
// Check whether we can read from the file
|
||||
if( file.get() == NULL) {
|
||||
if( file.get() == nullptr) {
|
||||
throw DeadlyImportError( "Failed to open CSM file " + pFile + ".");
|
||||
}
|
||||
|
||||
|
|
|
@ -122,8 +122,9 @@ void HMPImporter::InternReadFile( const std::string& pFile,
|
|||
std::unique_ptr<IOStream> file(mIOHandler->Open(pFile));
|
||||
|
||||
// Check whether we can read from the file
|
||||
if( file.get() == nullptr)
|
||||
throw DeadlyImportError( "Failed to open HMP file " + pFile + ".");
|
||||
if (file.get() == nullptr) {
|
||||
throw DeadlyImportError("Failed to open HMP file " + pFile + ".");
|
||||
}
|
||||
|
||||
// Check whether the HMP file is large enough to contain
|
||||
// at least the file header
|
||||
|
|
|
@ -139,8 +139,9 @@ void IRRMeshImporter::InternReadFile( const std::string& pFile,
|
|||
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||
|
||||
// Check whether we can read from the file
|
||||
if( file.get() == NULL)
|
||||
throw DeadlyImportError( "Failed to open IRRMESH file " + pFile + "");
|
||||
if (file.get() == nullptr) {
|
||||
throw DeadlyImportError("Failed to open IRRMESH file " + pFile + ".");
|
||||
}
|
||||
|
||||
// Construct the irrXML parser
|
||||
CIrrXML_IOStreamReader st(file.get());
|
||||
|
|
|
@ -501,7 +501,7 @@ void LWSImporter::InternReadFile(const std::string &pFile, aiScene *pScene,
|
|||
std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb"));
|
||||
|
||||
// Check whether we can read from the file
|
||||
if (file.get() == NULL) {
|
||||
if (file.get() == nullptr) {
|
||||
throw DeadlyImportError("Failed to open LWS file " + pFile + ".");
|
||||
}
|
||||
|
||||
|
|
|
@ -221,20 +221,21 @@ void MD2Importer::InternReadFile( const std::string& pFile,
|
|||
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||
|
||||
// Check whether we can read from the file
|
||||
if( file.get() == NULL)
|
||||
throw DeadlyImportError( "Failed to open MD2 file " + pFile + "");
|
||||
if (file.get() == nullptr) {
|
||||
throw DeadlyImportError("Failed to open MD2 file " + pFile + "");
|
||||
}
|
||||
|
||||
// check whether the md3 file is large enough to contain
|
||||
// at least the file header
|
||||
fileSize = (unsigned int)file->FileSize();
|
||||
if( fileSize < sizeof(MD2::Header))
|
||||
throw DeadlyImportError( "MD2 File is too small");
|
||||
if (fileSize < sizeof(MD2::Header)) {
|
||||
throw DeadlyImportError("MD2 File is too small");
|
||||
}
|
||||
|
||||
std::vector<uint8_t> mBuffer2(fileSize);
|
||||
file->Read(&mBuffer2[0], 1, fileSize);
|
||||
mBuffer = &mBuffer2[0];
|
||||
|
||||
|
||||
m_pcHeader = (BE_NCONST MD2::Header*)mBuffer;
|
||||
|
||||
#ifdef AI_BUILD_BIG_ENDIAN
|
||||
|
|
|
@ -747,8 +747,9 @@ void MD3Importer::InternReadFile( const std::string& pFile, aiScene* pScene, IOS
|
|||
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||
|
||||
// Check whether we can read from the file
|
||||
if( file.get() == NULL)
|
||||
throw DeadlyImportError( "Failed to open MD3 file " + pFile + ".");
|
||||
if (file.get() == nullptr) {
|
||||
throw DeadlyImportError("Failed to open MD3 file " + pFile + ".");
|
||||
}
|
||||
|
||||
// Check whether the md3 file is large enough to contain the header
|
||||
fileSize = (unsigned int)file->FileSize();
|
||||
|
|
|
@ -332,13 +332,12 @@ void MD5Importer::AttachChilds_Anim(int iParentID, aiNode *piParent, AnimBoneLis
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
// Load a MD5MESH file
|
||||
void MD5Importer::LoadMD5MeshFile() {
|
||||
std::string pFile = mFile + "md5mesh";
|
||||
std::unique_ptr<IOStream> file(mIOHandler->Open(pFile, "rb"));
|
||||
std::string filename = mFile + "md5mesh";
|
||||
std::unique_ptr<IOStream> file(mIOHandler->Open(filename, "rb"));
|
||||
|
||||
// Check whether we can read from the file
|
||||
if (file.get() == nullptr || !file->FileSize()) {
|
||||
ASSIMP_LOG_WARN("Failed to access MD5MESH file: " + pFile);
|
||||
return;
|
||||
throw DeadlyImportError("Failed to open MD5 file " + filename + ".");
|
||||
}
|
||||
bHadMD5Mesh = true;
|
||||
LoadFileIntoMemory(file.get());
|
||||
|
@ -552,9 +551,9 @@ void MD5Importer::LoadMD5AnimFile() {
|
|||
|
||||
// Check whether we can read from the file
|
||||
if (!file.get() || !file->FileSize()) {
|
||||
ASSIMP_LOG_WARN("Failed to read MD5ANIM file: " + pFile);
|
||||
return;
|
||||
throw DeadlyImportError("Failed to open MD3 file " + file + ".");
|
||||
}
|
||||
|
||||
LoadFileIntoMemory(file.get());
|
||||
|
||||
// parse the basic file structure
|
||||
|
|
|
@ -222,12 +222,14 @@ void HL1MDLLoader::load_file_into_buffer(const std::string &file_path, unsigned
|
|||
|
||||
std::unique_ptr<IOStream> file(io_->Open(file_path));
|
||||
|
||||
if (file.get() == NULL)
|
||||
if (file.get() == nullptr) {
|
||||
throw DeadlyImportError("Failed to open MDL file " + DefaultIOSystem::fileName(file_path) + ".");
|
||||
}
|
||||
|
||||
const size_t file_size = file->FileSize();
|
||||
if (file_size < sizeof(MDLFileHeader))
|
||||
if (file_size < sizeof(MDLFileHeader)) {
|
||||
throw DeadlyImportError("MDL file is too small.");
|
||||
}
|
||||
|
||||
buffer = new unsigned char[1 + file_size];
|
||||
file->Read((void *)buffer, 1, file_size);
|
||||
|
|
|
@ -104,7 +104,7 @@ void RAWImporter::InternReadFile( const std::string& pFile,
|
|||
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
||||
|
||||
// Check whether we can read from the file
|
||||
if( file.get() == NULL) {
|
||||
if( file.get() == nullptr) {
|
||||
throw DeadlyImportError( "Failed to open RAW file " + pFile + ".");
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ const aiImporterDesc* XFileImporter::GetInfo () const {
|
|||
void XFileImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) {
|
||||
// read file into memory
|
||||
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||
if ( file.get() == NULL ) {
|
||||
if ( file.get() == nullptr ) {
|
||||
throw DeadlyImportError( "Failed to open file " + pFile + "." );
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace Assimp {
|
|||
* @code
|
||||
* // open the file
|
||||
* std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||
* if( file.get() == NULL) {
|
||||
* if( file.get() == nullptr ) {
|
||||
* throw DeadlyImportError( "Failed to open file " + pFile + ".");
|
||||
* }
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue