From 5f7a03932b40c23512c3da90a9d8f020a50b1b81 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 14 Mar 2011 13:32:36 +1100 Subject: [PATCH] Calculate the total expected size progressively and show it when it's not known. --- lrzip.c | 4 +++- stream.c | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lrzip.c b/lrzip.c index 6dda1cb..68b57d5 100644 --- a/lrzip.c +++ b/lrzip.c @@ -520,7 +520,9 @@ void decompress_file(rzip_control *control) print_progress("\r"); if (!(STDOUT | TEST_ONLY)) print_output("Output filename is: %s: ", control->outfile); - print_progress("[OK] - %lld bytes \n", expected_size); + if (!expected_size) + expected_size = control->st_size; + print_progress("[OK] - %lld bytes \n", expected_size); if (unlikely(close(fd_hist) || close(fd_out))) fatal("Failed to close files\n"); diff --git a/stream.c b/stream.c index 723f947..1eda96a 100644 --- a/stream.c +++ b/stream.c @@ -988,6 +988,7 @@ void *open_stream_in(rzip_control *control, int f, int n) goto failed; } print_maxverbose("Chunk size: %lld\n", sinfo->size); + control->st_size += sinfo->size; } sinfo->initial_pos = lseek(f, 0, SEEK_CUR);