aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlns <matzeton@googlemail.com>2019-12-26 02:54:52 +0100
committerlns <matzeton@googlemail.com>2019-12-26 02:54:52 +0100
commitab65f33409751baaa7b495924ecb296148619c9d (patch)
tree0c8a2ae6d7033f9ab2c448d1cd298747f6afa170
parentb0befded7fb3e65e328eaaafc9345ade9eae6abf (diff)
fixed suerfluous length check, fixed incorrect progressbar calculation
-rw-r--r--progressbar.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/progressbar.c b/progressbar.c
index 359dd79..ad3b794 100644
--- a/progressbar.c
+++ b/progressbar.c
@@ -475,11 +475,8 @@ static void show_progressbar(struct terminal const * const term,
add_printable_buf(term, finfo, "[%.2f%%]", progress * 100.0f);
remaining_len = remaining_printable_chars(term, finfo);
- if (remaining_len < 3 || remaining_len >= sizeof buf) {
- return;
- }
- float printable_progress = progress * remaining_len;
+ float printable_progress = progress * (remaining_len - 2);
memset(buf, '-', remaining_len - 2);
memset(buf, '#', (size_t)printable_progress);
buf[remaining_len - 2] = '\0';