From 90f7228507a2a0ece3a7b605aa57b40fbe8fd07b Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 10 Mar 2015 20:02:27 +1100 Subject: [PATCH] Fix ISO C warning in runzip.c --- runzip.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/runzip.c b/runzip.c index 69c4936..3fb7cd8 100644 --- a/runzip.c +++ b/runzip.c @@ -372,6 +372,7 @@ i64 runzip_fd(rzip_control *control, int fd_in, int fd_out, int fd_hist, i64 exp uchar md5_stored[MD5_DIGEST_SIZE]; struct timeval start,end; i64 total = 0, u; + double tdiff; if (!NO_MD5) md5_init_ctx (&control->ctx); @@ -406,9 +407,13 @@ i64 runzip_fd(rzip_control *control, int fd_in, int fd_out, int fd_hist, i64 exp } while (total < expected_size || (!expected_size && !control->eof)); gettimeofday(&end,NULL); - if (!ENCRYPT) + if (!ENCRYPT) { + tdiff = end.tv_sec - start.tv_sec; + if (!tdiff) + tdiff = 1; print_progress("\nAverage DeCompression Speed: %6.3fMB/s\n", - (total / 1024 / 1024) / (double)((end.tv_sec-start.tv_sec)? : 1)); + (total / 1024 / 1024) / tdiff); + } if (!NO_MD5) { int i,j;