From Bradley Anderegg, "Ok, I am re-submitting this with the changes we discussed. That is, there is a default implementation of osgDB::Archive::getDirectoryContents() that uses getFileNames(), and the osgDB::ArchiveExtended header was removed as it is now unnecessary.

Here is a quick list of the modified files:

Archive - getDirectoryContents() no longer pure virtual
Archive.cpp - default getDirectoryContents() implementation
unzip.cpp - modified to fix a bug where the same file will not load twice in a row
ZipArchive.h / ZipArchive.cpp - extends osgDB::Archive and provides support for random access loading within a .zip file
ReaderWriterZip.cpp - modified to use the ZipArchive class"
This commit is contained in:
Robert Osfield
2011-05-25 09:04:44 +00:00
parent 51a9e63c55
commit 76b6cd6fa3
6 changed files with 206 additions and 236 deletions

View File

@@ -4203,10 +4203,25 @@ ZRESULT TUnzip::Unzip(int index,void *dst,unsigned int len,DWORD flags)
}
bool reached_eof;
int res = unzReadCurrentFile(uf,dst,len,&reached_eof);
if (res<=0) {unzCloseCurrentFile(uf); currentfile=-1;}
if (reached_eof) return ZR_OK;
if (res>0) return ZR_MORE;
if (res==UNZ_PASSWORD) return ZR_PASSWORD;
if (res<=0)
{
unzCloseCurrentFile(uf); currentfile=-1;
}
if (reached_eof)
{
unzCloseCurrentFile(uf);
currentfile=-1;
return ZR_OK;
}
if (res>0)
{
return ZR_MORE;
}
if (res==UNZ_PASSWORD)
{
return ZR_PASSWORD;
}
return ZR_FLATE;
}
// otherwise we're writing to a handle or a file