| 71 | //----------------------------------------------------------------------------- |
| 72 | |
| 73 | bool ZipArchive::readCentralDirectory() |
| 74 | { |
| 75 | mEntries.clear(); |
| 76 | SAFE_DELETE(mRoot); |
| 77 | mRoot = new ZipEntry; |
| 78 | mRoot->mName = ""; |
| 79 | mRoot->mIsDirectory = true; |
| 80 | mRoot->mCD.setFilename(""); |
| 81 | |
| 82 | if(! mEOCD.findInStream(mStream)) |
| 83 | return false; |
| 84 | |
| 85 | if(! mEOCD.read(mStream)) |
| 86 | return false; |
| 87 | |
| 88 | if(mEOCD.mDiskNum != mEOCD.mStartCDDiskNum || |
| 89 | mEOCD.mNumEntriesInThisCD != mEOCD.mTotalEntriesInCD) |
| 90 | { |
| 91 | if(isVerbose()) |
| 92 | Con::errorf("ZipArchive::readCentralDirectory - %s: Zips that span multiple disks are not supported.", mFilename ? mFilename : "<no filename>"); |
| 93 | return false; |
| 94 | } |
| 95 | |
| 96 | if(! mStream->setPosition(mEOCD.mCDOffset)) |
| 97 | return false; |
| 98 | |
| 99 | for(S32 i = 0;i < mEOCD.mNumEntriesInThisCD;++i) |
| 100 | { |
| 101 | ZipEntry *ze = new ZipEntry; |
| 102 | if(! ze->mCD.read(mStream)) |
| 103 | { |
| 104 | delete ze; |
| 105 | |
| 106 | if(isVerbose()) |
| 107 | Con::errorf("ZipArchive::readCentralDirectory - %s: Error reading central directory.", mFilename ? mFilename : "<no filename>"); |
| 108 | return false; |
| 109 | } |
| 110 | |
| 111 | insertEntry(ze); |
| 112 | } |
| 113 | |
| 114 | return true; |
| 115 | } |
| 116 | |
| 117 | void ZipArchive::dumpCentralDirectory(ZipEntry* entry, String* indent) |
| 118 | { |
nothing calls this directly
no test coverage detected