浏览代码

Check validity of archive without parsing

- closes https://github.com/assimp/assimp/issues/5392
Kim Kulling 1 年之前
父节点
当前提交
274f64cbf1
共有 1 个文件被更改,包括 8 次插入3 次删除
  1. 8 3
      code/AssetLib/3MF/D3MFImporter.cpp

+ 8 - 3
code/AssetLib/3MF/D3MFImporter.cpp

@@ -81,12 +81,17 @@ static constexpr aiImporterDesc desc = {
     "3mf"
     "3mf"
 };
 };
 
 
-bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool /*checkSig*/) const {
+bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool ) const {
     if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) {
     if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) {
         return false;
         return false;
     }
     }
-    D3MF::D3MFOpcPackage opcPackage(pIOHandler, filename);
-    return opcPackage.validate();
+    
+    ZipArchiveIOSystem archive(pIOHandler, rFile);
+    if (!mZipArchive->archive()) {
+        return false;
+    }
+
+    return true;
 }
 }
 
 
 void D3MFImporter::SetupProperties(const Importer*) {
 void D3MFImporter::SetupProperties(const Importer*) {