From 704d7b5eb68d8cf6aae45fe45a2666bf9954a8ca Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sun, 11 Mar 2012 12:22:35 +1100 Subject: [PATCH] There is no point using a thread on the last checksum update, nor to add the value to cksum_limit. --- rzip.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rzip.c b/rzip.c index 581624a..f6508bc 100644 --- a/rzip.c +++ b/rzip.c @@ -722,12 +722,13 @@ static bool hash_search(rzip_control *control, struct rzip_state *st, double pct if (unlikely(!control->checksum.buf)) fatal_return(("Failed to malloc ckbuf in hash_search\n"), false); control->do_mcpy(control, control->checksum.buf, cksum_limit, control->checksum.len); - control->checksum.cksum = &st->cksum; - cksum_update(control); - cksum_limit += control->checksum.len; - } - - wait_mutex(control, &control->cksumlock); + st->cksum = CrcUpdate(st->cksum, control->checksum.buf, control->checksum.len); + if (!NO_MD5) + md5_process_bytes(control->checksum.buf, control->checksum.len, &control->ctx); + free(control->checksum.buf); + unlock_mutex(control, &control->cksumlock); + } else + wait_mutex(control, &control->cksumlock); if (unlikely(!put_literal(control, st, 0, 0))) return false;