From: Eric Biggers Date: Wed, 19 Dec 2012 06:07:08 +0000 (-0600) Subject: Fix extract progress messages (again) X-Git-Tag: v1.2.1~10 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=52ce07dbc99a36a3050209b66a0aee257beda937 Fix extract progress messages (again) --- diff --git a/programs/imagex.c b/programs/imagex.c index 7cfc91c0..93c4d297 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -361,7 +361,7 @@ static int imagex_progress_func(enum wimlib_progress_msg msg, info->write_streams.completed_bytes >> 20, info->write_streams.total_bytes >> 20, percent_done); - if (info->write_streams.completed_bytes == info->write_streams.total_bytes) + if (info->write_streams.completed_bytes >= info->write_streams.total_bytes) putchar('\n'); break; case WIMLIB_PROGRESS_MSG_SCAN_BEGIN: @@ -426,7 +426,7 @@ static int imagex_progress_func(enum wimlib_progress_msg msg, info->extract.completed_bytes >> 20, info->extract.total_bytes >> 20, percent_done); - if (info->extract.completed_bytes == info->extract.total_bytes) + if (info->extract.completed_bytes >= info->extract.total_bytes) putchar('\n'); break; case WIMLIB_PROGRESS_MSG_EXTRACT_DENTRY: diff --git a/src/extract_image.c b/src/extract_image.c index ba9b8c67..56c72f87 100644 --- a/src/extract_image.c +++ b/src/extract_image.c @@ -546,12 +546,20 @@ static int apply_stream_list(struct list_head *stream_list, if (ret != 0) goto out; if (progress_func && - args->progress.extract.completed_bytes >= next_progress && - args->progress.extract.total_bytes != 0) + args->progress.extract.completed_bytes >= next_progress) { progress_func(WIMLIB_PROGRESS_MSG_EXTRACT_STREAMS, &args->progress); - next_progress += bytes_per_progress; + if (args->progress.extract.completed_bytes >= + args->progress.extract.total_bytes) + { + next_progress = ~0ULL; + } else { + next_progress = + min (args->progress.extract.completed_bytes + + bytes_per_progress, + args->progress.extract.total_bytes); + } } } }