fix for very small ZIPs

This commit is contained in:
Glenn Maynard
2004-02-11 20:58:02 +00:00
parent 82cb271f72
commit a7b2a73889
+3 -2
View File
@@ -249,10 +249,11 @@ void RageFileDriverZip::ParseZipfile()
char tmp[INBUFSIZE]; char tmp[INBUFSIZE];
int tmp_used = 0; int tmp_used = 0;
while( real_ecrec_offset == -1 && realpos >= Size-searchlen ) while( real_ecrec_offset == -1 && realpos > 0 && realpos >= Size-searchlen )
{ {
realpos -= INBUFSIZE; realpos -= INBUFSIZE;
zip.Seek( max( 0, realpos ) ); realpos = max( 0, realpos );
zip.Seek( realpos );
int got = zip.Read( tmp+tmp_used, sizeof(tmp)-tmp_used ); int got = zip.Read( tmp+tmp_used, sizeof(tmp)-tmp_used );
if( got == -1 ) if( got == -1 )
RageException::Throw( "Couldn't open %s: %s", zip.GetPath().c_str(), zip.GetError().c_str() ); RageException::Throw( "Couldn't open %s: %s", zip.GetPath().c_str(), zip.GetError().c_str() );