]> sjero.net Git - wget/blobdiff - src/progress.c
Use Gnulib's alloc functions throughout the source.
[wget] / src / progress.c
index 80dab04a1c808102ea58fb5b9734707e7137176b..62e8d87dad544453e2d9b3b37b6c7da600ced6a1 100644 (file)
@@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
 shall include the source code for the parts of OpenSSL used as well
 as that of the covered work.  */
 
+#define USE_GNULIB_ALLOC
+
 #include "wget.h"
 
 #include <stdio.h>
@@ -453,8 +455,8 @@ dot_set_params (const char *params)
     }
   else
     fprintf (stderr,
-             _("Invalid dot style specification `%s'; leaving unchanged.\n"),
-             params);
+             _("Invalid dot style specification %s; leaving unchanged.\n"),
+             quote (params));
 }
 \f
 /* "Thermometer" (bar) progress. */
@@ -767,7 +769,7 @@ update_speed_ring (struct bar_progress *bp, wgint howmuch, double dltime)
 #endif
 }
 
-#if HAVE_MBTOWC && HAVE_WCWIDTH
+#if USE_NLS_PROGRESS_BAR
 int
 count_cols (const char *mbs)
 {
@@ -795,8 +797,6 @@ count_cols (const char *mbs)
 }
 #else
 # define count_cols(mbs) ((int)(strlen(mbs)))
-# undef  wcwidth
-# define wcwidth(wc) (1)
 #endif
 
 /* Translation note: "ETA" is English-centric, but this must
@@ -813,7 +813,7 @@ get_eta (void)
       int nbytes;
       int ncols;
 
-#if HAVE_WCWIDTH && HAVE_MBTOWC
+#if USE_NLS_PROGRESS_BAR
       eta_trans = _(eta_str);
 #else
       eta_trans = eta_str;
@@ -876,12 +876,12 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
      "[]"              - progress bar decorations - 2 chars
      " nnn,nnn,nnn"    - downloaded bytes         - 12 chars or very rarely more
      " 12.5K/s"        - download rate             - 8 chars
-     "  eta 36m 51s"   - ETA                      - 13 chars
+     "  eta 36m 51s"   - ETA                      - 14 chars
 
      "=====>..."       - progress bar             - the rest
   */
   int dlbytes_size = 1 + MAX (size_grouped_len, 11);
-  int progress_size = bp->width - (4 + 2 + dlbytes_size + 8 + 13);
+  int progress_size = bp->width - (4 + 2 + dlbytes_size + 8 + 14);
 
   if (progress_size < 5)
     progress_size = 0;
@@ -1049,8 +1049,6 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
       move_to_end (p);
     }
 
-  assert (p - bp->buffer - bytes_cols_diff - size_grouped_diff <= bp->width);
-
   while (p - bp->buffer - bytes_cols_diff - size_grouped_diff < bp->width)
     *p++ = ' ';
   *p = '\0';