From 19b0636459559d124ed28e2307e2d9908c7d3e53 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sun, 11 Mar 2012 21:12:44 +1100 Subject: [PATCH] Move the update counter to earlier in the hash_search so it still updates even when there are not matches. --- rzip.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/rzip.c b/rzip.c index f6508bc..9699b96 100644 --- a/rzip.c +++ b/rzip.c @@ -635,6 +635,25 @@ static bool hash_search(rzip_control *control, struct rzip_state *st, double pct sb->offset_search = p; if (unlikely(sb->offset_search > sb->offset_low + sb->size_low)) remap_low_sb(control, &control->sb); + + if (unlikely(p % 128 == 0)) { + int pct, chunk_pct; + + pct = pct_base + (pct_multiple * (100.0 * p) / + (st->chunk_size ? : 1)); + chunk_pct = p / ((end / 100) ? : 1); + if (pct != lastpct || chunk_pct != last_chunkpct) { + if (!STDIN || st->stdin_eof) + print_progress("Total: %2d%% ", pct); + print_progress("Chunk: %2d%%\r", chunk_pct); + if (control->info_cb) + control->info_cb(control->info_data, + (!STDIN || st->stdin_eof) ? pct : -1, chunk_pct); + lastpct = pct; + last_chunkpct = chunk_pct; + } + } + next_tag(control, st, p, &t); /* Don't look for a match if there are no tags with @@ -674,24 +693,6 @@ static bool hash_search(rzip_control *control, struct rzip_state *st, double pct return false; } - if (unlikely(p % 128 == 0)) { - int pct, chunk_pct; - - pct = pct_base + (pct_multiple * (100.0 * p) / - (st->chunk_size ? : 1)); - chunk_pct = p / ((end / 100) ? : 1); - if (pct != lastpct || chunk_pct != last_chunkpct) { - if (!STDIN || st->stdin_eof) - print_progress("Total: %2d%% ", pct); - print_progress("Chunk: %2d%%\r", chunk_pct); - if (control->info_cb) - control->info_cb(control->info_data, - (!STDIN || st->stdin_eof) ? pct : -1, chunk_pct); - lastpct = pct; - last_chunkpct = chunk_pct; - } - } - if (p > cksum_limit) { /* We lock the mutex here and unlock it in the * cksumthread. This lock protects all the data in