diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2021-12-01 15:38:02 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2021-12-15 15:04:50 -0800 |
commit | cf26200380585019e927fe3cf5c0ecb7c8b3ef14 (patch) | |
tree | 0601d06babe8944698e14b7fc3889a06bdb942f9 /gzip.h | |
parent | 1440bdbd16cc40f3ef3d0d91106373e29611f528 (diff) | |
download | gzip-cf26200380585019e927fe3cf5c0ecb7c8b3ef14.tar.gz |
gzip: gzip -l now outputs accurate size
gzip -l now decompresses to see how long the uncompressed file was.
This fixes what is by far the most common bug report for gzip.
It has a significant performance cost, but it’s worth it nowadays.
* gzip.c (main): -l now sets 'test' too. All uses of
'test' changed.
(treat_stdin, treat_file): Call do_list after decompressing,
so that the length is known.
(do_list): Omit arg IFD, since it is no longer needed.
All callers changed. Get the CRC and uncompressed size
from input_crc and bytes_out instead of using lseek.
* tests/list-big: New test.
* unzip.c (unzip): Set unzip_crc before returning.
* util.c (write_buf): If 'test', output nothing.
Update bytes_out with output byte count, regardless of 'test'.
All callers changed.
Diffstat (limited to 'gzip.h')
-rw-r--r-- | gzip.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -262,6 +262,7 @@ extern int zip (int in, int out); extern int file_read (char *buf, unsigned size); /* in unzip.c */ +extern ulg unzip_crc; extern int unzip (int in, int out); extern int check_zipfile (int in); |