]> sjero.net Git - wget/blobdiff - src/retr.c
[svn] Fix K&R incompatibilities reported by `gcc -Wtraditional'.
[wget] / src / retr.c
index a5198b7e591171792bf8b11360003d01c8dc4fed..c5c1532ba7188c7c39ef0dd6315e3fdf984a76e9 100644 (file)
@@ -56,10 +56,6 @@ so, delete this exception statement from your version.  */
 #include "convert.h"
 #include "ptimer.h"
 
-#ifdef HAVE_SSL
-# include "gen_sslfunc.h"      /* for ssl_iread */
-#endif
-
 #ifndef errno
 extern int errno;
 #endif
@@ -285,10 +281,10 @@ fd_read_body (int fd, FILE *out, wgint toread, wgint startpos,
        }
       ret = fd_read (fd, dlbuf, rdsize, tmout);
 
-      if (ret == 0 || (ret < 0 && errno != ETIMEDOUT))
-       break;                  /* read error */
-      else if (ret < 0)
-       ret = 0;                /* read timeout */
+      if (progress_interactive && ret < 0 && errno == ETIMEDOUT)
+       ret = 0;                /* interactive timeout, handled above */
+      else if (ret <= 0)
+       break;                  /* EOF or read error */
 
       if (progress || opt.limit_rate)
        {
@@ -303,7 +299,7 @@ fd_read_body (int fd, FILE *out, wgint toread, wgint startpos,
          if (!write_data (out, dlbuf, ret, &skip, &sum_written))
            {
              ret = -2;
-             goto out;
+             goto out_;
            }
        }
 
@@ -321,7 +317,7 @@ fd_read_body (int fd, FILE *out, wgint toread, wgint startpos,
   if (ret < -1)
     ret = -1;
 
- out:
+ out_:
   if (progress)
     progress_finish (progress, ptimer_read (timer));
 
@@ -392,7 +388,7 @@ fd_read_hunk (int fd, hunk_terminator_t terminator, long sizehint, long maxsize)
 
       /* First, peek at the available data. */
 
-      pklen = fd_peek (fd, hunk + tail, bufsize - 1 - tail, -1);
+      pklen = fd_peek (fd, hunk + tail, bufsize - 1 - tail, -1.0);
       if (pklen < 0)
        {
          xfree (hunk);
@@ -425,7 +421,7 @@ fd_read_hunk (int fd, hunk_terminator_t terminator, long sizehint, long maxsize)
         how much data we'll get.  (Some TCP stacks are notorious for
         read returning less data than the previous MSG_PEEK.)  */
 
-      rdlen = fd_read (fd, hunk + tail, remain, 0);
+      rdlen = fd_read (fd, hunk + tail, remain, 0.0);
       if (rdlen < 0)
        {
          xfree_null (hunk);
@@ -534,10 +530,10 @@ calc_rate (wgint bytes, double msecs, int *units)
 
   if (msecs == 0)
     /* If elapsed time is exactly zero, it means we're under the
-       granularity of the timer.  This can easily happen on systems
+       resolution of the timer.  This can easily happen on systems
        that use time() for the timer.  Since the interval lies between
-       0 and the timer's granularity, assume half the granularity.  */
-    msecs = ptimer_granularity () / 2.0;
+       0 and the timer's resolution, assume half the resolution.  */
+    msecs = ptimer_resolution () / 2.0;
 
   dlrate = 1000.0 * bytes / msecs;
   if (dlrate < 1024.0)
@@ -834,8 +830,8 @@ retrieve_from_file (const char *file, int html, int *count)
 
       if (filename && opt.delete_after && file_exists_p (filename))
        {
-         DEBUGP (("Removing file due to --delete-after in"
-                  " retrieve_from_file():\n"));
+         DEBUGP (("\
+Removing file due to --delete-after in retrieve_from_file():\n"));
          logprintf (LOG_VERBOSE, _("Removing %s.\n"), filename);
          if (unlink (filename))
            logprintf (LOG_NOTQUIET, "unlink: %s\n", strerror (errno));
@@ -883,7 +879,7 @@ sleep_between_retrievals (int count)
       /* If opt.waitretry is specified and this is a retry, wait for
         COUNT-1 number of seconds, or for opt.waitretry seconds.  */
       if (count <= opt.waitretry)
-       xsleep (count - 1);
+       xsleep (count - 1.0);
       else
        xsleep (opt.waitretry);
     }
@@ -996,7 +992,7 @@ getproxy (struct url *u)
 }
 
 /* Should a host be accessed through proxy, concerning no_proxy?  */
-int
+static int
 no_proxy_match (const char *host, const char **no_proxy)
 {
   if (!no_proxy)