]> sjero.net Git - wget/blobdiff - src/retr.c
warc: fix format string for off_t in CDX function.
[wget] / src / retr.c
index 8bc544257044d5892138a8fac836b5d35a56f1d7..32dc41e27c695561566106c28d6edf8dd47065bf 100644 (file)
@@ -141,8 +141,8 @@ limit_bandwidth (wgint bytes, struct ptimer *timer)
    amount of data and decrease SKIP.  Increment *TOTAL by the amount
    of data written.  If OUT2 is not NULL, also write BUF to OUT2.
    In case of error writing to OUT, -1 is returned.  In case of error
-   writing to OUT2, -2 is returned.  In case of any other error,
-   1 is returned.  */
+   writing to OUT2, -2 is returned.  Return 1 if the whole BUF was
+   skipped.  */
 
 static int
 write_data (FILE *out, FILE *out2, const char *buf, int bufsize,
@@ -376,7 +376,7 @@ fd_read_body (int fd, FILE *out, wgint toread, wgint startpos,
         {
           sum_read += ret;
           int write_res = write_data (out, out2, dlbuf, ret, &skip, &sum_written);
-          if (write_res != 0)
+          if (write_res < 0)
             {
               ret = (write_res == -3) ? -3 : -2;
               goto out;
@@ -628,7 +628,7 @@ retr_rate (wgint bytes, double secs)
      e.g. "1022", "247", "12.5", "2.38".  */
   sprintf (res, "%.*f %s",
            dlrate >= 99.95 ? 0 : dlrate >= 9.995 ? 1 : 2,
-           dlrate, !opt.bits_fmt? rate_names[units]: rate_names_bits[units]);
+           dlrate, !opt.report_bps ? rate_names[units]: rate_names_bits[units]);
 
   return res;
 }
@@ -647,7 +647,7 @@ calc_rate (wgint bytes, double secs, int *units)
   double dlrate;
   double bibyte = 1000.0;
  
-  if (!opt.bits_fmt)
+  if (!opt.report_bps)
     bibyte = 1024.0;