Page 1 of 1
ZLib question

Posted:
Oct 9, 2001 @ 7:27pm
by PDAFantast
Zlib fantasts...<br><br>Is there a way to get the size of the uncompressed file inside a zip ?<br><br>gzseek(...,SEEK_END);<br>gztell();<br><br>approach doesn't work, since gzseek doesn't support SEEK_END.<br><br>Any other way to do this ?<br><br>PDAFantast.
Re: ZLib question

Posted:
Oct 9, 2001 @ 7:46pm
by Dan East
When you seek in zlib, you decompress. So reading and seeking are the same performance-wise. Also, if you seek backwards, zlib resets to the beginning of the file, and decompresses all the way up to the new desired file pointer. That is why Pocket Quake loads gzipped data files so slow. So you might as well just read the whole file and count the bytes as you go to get the file size. If performance is an issue then you really should store the original file size, either in a custom header in the gzip, or in a seperate info file, etc.<br><br>Dan East
Re: ZLib question

Posted:
Oct 11, 2001 @ 9:02pm
by PDAFantast
Thanks Dan.<br><br>The problem is that I need to know the size of the uncompressed file before I even do anything with the file. Sure I can read it twice.. but ehm.. that's not a good idea.. I'm planning on allowing the roms to be zipped. Unfortunately, there is no size description inside the ROMS themselves whatsoever, so... eh well.<br>