Ignore the eof flag if the file size is known.

This commit is contained in:
Con Kolivas 2011-03-13 21:31:03 +11:00
parent b17540d32e
commit f2ddd9022c
3 changed files with 3 additions and 5 deletions

View file

@ -265,11 +265,11 @@ i64 runzip_fd(rzip_control *control, int fd_in, int fd_out, int fd_hist, i64 exp
md5_init_ctx (&control->ctx); md5_init_ctx (&control->ctx);
gettimeofday(&start,NULL); gettimeofday(&start,NULL);
while (total < expected_size || !total || !control->eof) { do {
total += runzip_chunk(control, fd_in, fd_out, fd_hist, expected_size, total); total += runzip_chunk(control, fd_in, fd_out, fd_hist, expected_size, total);
if (STDOUT) if (STDOUT)
dump_tmpoutfile(control, fd_out); dump_tmpoutfile(control, fd_out);
} } while (total < expected_size || (!expected_size && !control->eof));
gettimeofday(&end,NULL); gettimeofday(&end,NULL);
print_progress("\nAverage DeCompression Speed: %6.3fMB/s\n", print_progress("\nAverage DeCompression Speed: %6.3fMB/s\n",

2
rzip.c
View file

@ -964,8 +964,6 @@ retry:
/* st->chunk_size may be shrunk in rzip_chunk */ /* st->chunk_size may be shrunk in rzip_chunk */
last_chunk = st->chunk_size; last_chunk = st->chunk_size;
len -= st->chunk_size; len -= st->chunk_size;
if (!len)
control->eof = 1;
} }
close_streamout_threads(control); close_streamout_threads(control);

View file

@ -962,7 +962,7 @@ void *open_stream_in(rzip_control *control, int f, int n)
if (control->major_version == 0 && control->minor_version > 5) { if (control->major_version == 0 && control->minor_version > 5) {
/* Read in flag that tells us if there are more chunks after /* Read in flag that tells us if there are more chunks after
* this */ * this. Ignored if we know the final file size */
if (unlikely(read_u8(f, &control->eof))) { if (unlikely(read_u8(f, &control->eof))) {
print_err("Failed to read eof flag in open_stream_in\n"); print_err("Failed to read eof flag in open_stream_in\n");
goto failed; goto failed;