optimize lseek(0,SEEK_END) in ZIPs
This commit is contained in:
@@ -624,18 +624,23 @@ void RageFileObjZipDeflated::Rewind()
|
|||||||
|
|
||||||
int RageFileObjZipDeflated::Seek( int offset )
|
int RageFileObjZipDeflated::Seek( int offset )
|
||||||
{
|
{
|
||||||
return RageFileObj::Seek( offset ); /* XXX */
|
/* Optimization: if offset is the end of the file, it's a lseek(0,SEEK_END). Don't
|
||||||
/* if( offset < this->UFilePos )
|
* decode anything. */
|
||||||
|
if( offset == (int) info.uncompr_size )
|
||||||
{
|
{
|
||||||
offset += UFilePos;
|
UFilePos = info.uncompr_size;
|
||||||
Rewind();
|
CFilePos = info.compr_size;
|
||||||
|
zip.Seek( info.data_offset + info.compr_size );
|
||||||
|
decomp_buf_ptr = decomp_buf;
|
||||||
|
decomp_buf_avail = 0;
|
||||||
|
inflateReset( &dstrm );
|
||||||
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
/* Can this be optimized? */
|
||||||
|
return RageFileObj::Seek( offset );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
|
||||||
|
|
||||||
RageFileObjZipStored::RageFileObjZipStored( const RageFile &f, const FileInfo &info_, RageFile &p ):
|
RageFileObjZipStored::RageFileObjZipStored( const RageFile &f, const FileInfo &info_, RageFile &p ):
|
||||||
RageFileObj( p ),
|
RageFileObj( p ),
|
||||||
info(info_),
|
info(info_),
|
||||||
|
|||||||
Reference in New Issue
Block a user