]> sjero.net Git - wget/blobdiff - src/retr.c
[svn] Remove VERY_LONG_TYPE; use LARGE_INT instead. Remove special code
[wget] / src / retr.c
index c0b439e8f79255ae92d22d17cc02aaf9b11fc3b3..35286111e2020cd2bb7d5ff330425c5dadf2a150 100644 (file)
@@ -66,6 +66,9 @@ extern int errno;
 /* See the comment in gethttp() why this is needed. */
 int global_download_count;
 
+/* Total size of downloaded files.  Used to enforce quota.  */
+LARGE_INT total_downloaded_bytes;
+
 \f
 static struct {
   long chunk_bytes;
@@ -576,7 +579,7 @@ retrieve_from_file (const char *file, int html, int *count)
       if (cur_url->ignore_when_downloading)
        continue;
 
-      if (downloaded_exceeds_quota ())
+      if (opt.quota && total_downloaded_bytes > opt.quota)
        {
          status = QUOTEXC;
          break;
@@ -614,40 +617,6 @@ printwhat (int n1, int n2)
   logputs (LOG_VERBOSE, (n1 == n2) ? _("Giving up.\n\n") : _("Retrying.\n\n"));
 }
 
-/* Increment opt.downloaded by BY_HOW_MUCH.  If an overflow occurs,
-   set opt.downloaded_overflow to 1. */
-void
-downloaded_increase (unsigned long by_how_much)
-{
-  VERY_LONG_TYPE old;
-  if (opt.downloaded_overflow)
-    return;
-  old = opt.downloaded;
-  opt.downloaded += by_how_much;
-  if (opt.downloaded < old)    /* carry flag, where are you when I
-                                   need you? */
-    {
-      /* Overflow. */
-      opt.downloaded_overflow = 1;
-      opt.downloaded = ~((VERY_LONG_TYPE)0);
-    }
-}
-
-/* Return non-zero if the downloaded amount of bytes exceeds the
-   desired quota.  If quota is not set or if the amount overflowed, 0
-   is returned. */
-int
-downloaded_exceeds_quota (void)
-{
-  if (!opt.quota)
-    return 0;
-  if (opt.downloaded_overflow)
-    /* We don't really know.  (Wildly) assume not. */
-    return 0;
-
-  return opt.downloaded > opt.quota;
-}
-
 /* If opt.wait or opt.waitretry are specified, and if certain
    conditions are met, sleep the appropriate number of seconds.  See
    the documentation of --wait and --waitretry for more information.