[pacman-dev] [PATCH] Fix speed output edge case

Allan McRae allan at archlinux.org
Thu Nov 3 09:42:36 EDT 2011


On 03/11/11 23:32, Allan McRae wrote:
> Occasionally when the download rate showed 100.0 the output got messed up.
> This was caused by the rounding of a number between 99.95 and 100. Adjust
> the threshold to avoid this rounding issue.
>
> Signed-off-by: Allan McRae<allan at archlinux.org>
> ---
>   src/pacman/callback.c |    7 ++-----
>   1 files changed, 2 insertions(+), 5 deletions(-)
>

Seriously stuffed up creating this patch...  Here is the actual diff 
which is on my working-maint branch:


--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -698,7 +698,7 @@ void cb_dl_progress(const char *filename, off_t 
file_xfered, off_t file_total)

  	printf(" %ls%-*s ", wcfname, padwid, "");
  	/* We will show 1.6M/s, 11.6M/s, but 116K/s and 1116K/s */
-	if(rate_human < 100.0) {
+	if(rate_human < 99.95) {
  		printf("%6.1f %3s  %4.1f%c/s ",
  				xfered_human, xfered_label, rate_human, rate_label[0]);
  	} else {







More information about the pacman-dev mailing list