瀏覽代碼

# pk3: fix CanRead()
# fix small typo in Importer.cpp

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@962 67173fc5-114c-0410-ac8e-9d2fd5bffc1f

aramis_acg 14 年之前
父節點
當前提交
ea3372f232
共有 2 個文件被更改,包括 6 次插入11 次删除
  1. 1 1
      code/Importer.cpp
  2. 5 10
      code/Q3BSPFileImporter.cpp

+ 1 - 1
code/Importer.cpp

@@ -991,7 +991,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
 			// not so bad yet ... try format auto detection.
 			const std::string::size_type s = pFile.find_last_of('.');
 			if (s != std::string::npos) {
-				DefaultLogger::get()->info("File extension now known, trying signature-based detection");
+				DefaultLogger::get()->info("File extension not known, trying signature-based detection");
 				for( unsigned int a = 0; a < pimpl->mImporter.size(); a++)	{
 
 					if( pimpl->mImporter[a]->CanRead( pFile, pimpl->mIOHandler, true)) {

+ 5 - 10
code/Q3BSPFileImporter.cpp

@@ -151,10 +151,7 @@ Q3BSPFileImporter::~Q3BSPFileImporter()
 		}
 
 		std::vector<Q3BSP::sQ3BSPFace*> *pCurFaceArray = (*it).second;
-		if ( NULL != pCurFaceArray )
-		{
-			delete pCurFaceArray;
-		}
+		delete pCurFaceArray;
 	}
 	m_MaterialLookupMap.clear();
 }
@@ -163,13 +160,11 @@ Q3BSPFileImporter::~Q3BSPFileImporter()
 //	Returns true, if the loader can read this.
 bool Q3BSPFileImporter::CanRead( const std::string& rFile, IOSystem* pIOHandler, bool checkSig ) const
 {
-	bool isBSPData = false;
-	if ( checkSig )
-	{
-		isBSPData = SimpleExtensionCheck( rFile, Q3BSPExtension .c_str() );
+	if(!checkSig) {
+		return SimpleExtensionCheck( rFile, Q3BSPExtension .c_str() );
 	}
-
-	return isBSPData;
+	// TODO perhaps add keyword based detection
+	return false;
 }
 
 // ------------------------------------------------------------------------------------------------