]> sjero.net Git - wget/commitdiff
[svn] Remove warnings under Borland C.
authorhniksic <devnull@localhost>
Sun, 6 Mar 2005 02:11:10 +0000 (18:11 -0800)
committerhniksic <devnull@localhost>
Sun, 6 Mar 2005 02:11:10 +0000 (18:11 -0800)
14 files changed:
src/ChangeLog
src/cmpt.c
src/ftp-ls.c
src/ftp.c
src/getopt.h
src/gnu-md5.h
src/hash.c
src/http.c
src/init.c
src/log.c
src/main.c
src/options.h
src/utils.c
src/utils.h

index 28eb25d27c29fdff9513a01ccf8bff2577e29dc7..ad58ea50735f55bf1def7f64101c80b121920cfa 100644 (file)
@@ -1,3 +1,32 @@
+2005-03-06  Hrvoje Niksic  <hniksic@xemacs.org>
+
+       * utils.c (read_file): Don't use wgint for file size; LFS won't
+       work since the file is mmap'ed as a whole.
+
+       * options.h: Don't include stdio.h.
+
+       * log.c: Ditto.
+
+       * init.c: Disambiguate assignment from non-zero test to avoid
+       Borland C warning.
+
+       * http.c (response_new): Don't needlessly post-increment count.
+
+       * hash.c: Include stdio.h.
+
+       * gnu-md5.h: Don't include stdio.h.
+
+       * getopt.h (struct option): Always use const.
+
+       * ftp.c (getftp): Avoid unnecessary assignment to RES to avoid
+       Borland C warning.
+
+       * ftp-ls.c: Disambiguate assignment from non-zero test to avoid
+       Borland C warning.
+
+       * cmpt.c (strptime_internal): Don't initialize rp_backup when
+       !_NL_CURRENT to avoid Borland C warning.
+
 2005-03-06  Hrvoje Niksic  <hniksic@xemacs.org>
 
        * utils.c (fopen_excl): Fix parse error when O_BINARY is
index 9e78b21aadbbed7b7f73adadf166cfcd5b8f4c48..99cbbb8ab82e112c023fd94e6587350413eeb2b0 100644 (file)
@@ -792,7 +792,9 @@ strptime_internal (rp, fmt, tm, decided)
      struct tm *tm;
      enum locale_status *decided;
 {
+#ifdef _NL_CURRENT
   const char *rp_backup;
+#endif
   int cnt;
   size_t val;
   int have_I, is_pm;
@@ -832,8 +834,10 @@ strptime_internal (rp, fmt, tm, decided)
     start_over:
 #endif
 
+#ifdef _NL_CURRENT
       /* Make back up of current processing pointer.  */
       rp_backup = rp;
+#endif
 
       switch (*fmt++)
        {
index 148c79bfd0fd4e3f070d3d0e71cca8ed462559cf..d2dde2ec5f5858e19a869617ca5e264010f8ba43 100644 (file)
@@ -121,7 +121,7 @@ ftp_parse_unix_ls (const char *file, int ignore_perms)
   dir = l = NULL;
 
   /* Line loop to end of file: */
-  while ((line = read_whole_line (fp)))
+  while ((line = read_whole_line (fp)) != NULL)
     {
       len = clean_line (line);
       /* Skip if total...  */
@@ -200,7 +200,7 @@ ftp_parse_unix_ls (const char *file, int ignore_perms)
         This tactic is quite dubious when it comes to
         internationalization issues (non-English month names), but it
         works for now.  */
-      while ((tok = strtok (NULL, " ")))
+      while ((tok = strtok (NULL, " ")) != NULL)
        {
          --next;
          if (next < 0)         /* a month name was not encountered */
@@ -449,7 +449,7 @@ ftp_parse_winnt_ls (const char *file)
   dir = l = NULL;
 
   /* Line loop to end of file: */
-  while ((line = read_whole_line (fp)))
+  while ((line = read_whole_line (fp)) != NULL)
     {
       len = clean_line (line);
 
@@ -557,7 +557,7 @@ ftp_parse_winnt_ls (const char *file)
          l->next = NULL;
        }
 
-      xfree(line);
+      xfree (line);
     }
 
   fclose(fp);
@@ -615,21 +615,18 @@ ftp_parse_vms_ls (const char *file)
 
   /* Skip empty line. */
   line = read_whole_line (fp);
-  if (line)
-    xfree (line);
+  xfree_null (line);
 
   /* Skip "Directory PUB$DEVICE[PUB]" */
   line = read_whole_line (fp);
-  if (line)
-    xfree (line);
+  xfree_null (line);
 
   /* Skip empty line. */
   line = read_whole_line (fp);
-  if (line)
-    xfree (line);
+  xfree_null (line);
 
   /* Line loop to end of file: */
-  while ((line = read_whole_line (fp)))
+  while ((line = read_whole_line (fp)) != NULL)
     {
       char *p;
       i = clean_line (line);
@@ -729,7 +726,7 @@ ftp_parse_vms_ls (const char *file)
       /* Fourth/Third column: Time hh:mm[:ss] */
       tok = strtok (NULL, " ");
       if (tok == NULL) continue;
-      hour = min = sec = 0;
+      min = sec = 0;
       p = tok;
       hour = atoi (p);
       for (; *p && *p != ':'; ++p);
index 47face7192b9a6aa11b63ee68a8d3670b2b745b5..a95e83897f628870d381037fe047f476ac6a2135 100644 (file)
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -1114,7 +1114,7 @@ Error in server response, closing control connection.\n"));
          char *line;
          /* The lines are being read with read_whole_line because of
             no-buffering on opt.lfile.  */
-         while ((line = read_whole_line (fp)))
+         while ((line = read_whole_line (fp)) != NULL)
            {
              logprintf (LOG_ALWAYS, "%s\n", escnonprint (line));
              xfree (line);
@@ -1793,7 +1793,6 @@ ftp_retrieve_glob (struct url *u, ccon *con, int action)
          return RETRBADPATTERN;
        }
     }
-  res = RETROK;
   if (start)
     {
       /* Just get everything.  */
@@ -1843,7 +1842,6 @@ ftp_loop (struct url *u, int *dt, struct url *proxy)
   con.rs = ST_UNIX;
   con.id = NULL;
   con.proxy = proxy;
-  res = RETROK;                        /* in case it's not used */
 
   /* If the file name is empty, the user probably wants a directory
      index.  We'll provide one, properly HTML-ized.  Unless
index 45541f5ac0f96d1125f63208961f52ecde06051e..c8e96c7ff1efc7bff495164f627ac26c10310650 100644 (file)
@@ -76,11 +76,7 @@ extern int optopt;
 
 struct option
 {
-#if    __STDC__
   const char *name;
-#else
-  char *name;
-#endif
   /* has_arg can't be an enum because some compilers complain about
      type mismatches in all the code that assumes it is an int.  */
   int has_arg;
index f33755011b573d520572e20174e7f6f5bfa7dacd..c520e2d5340535bd9a464f74e17bf5165411206a 100644 (file)
@@ -21,8 +21,6 @@
 #ifndef _MD5_H
 #define _MD5_H 1
 
-#include <stdio.h>
-
 #if defined HAVE_LIMITS_H || _LIBC
 # include <limits.h>
 #endif
@@ -125,10 +123,12 @@ extern void *md5_finish_ctx PARAMS ((struct md5_ctx *ctx, void *resbuf));
 extern void *md5_read_ctx PARAMS ((const struct md5_ctx *ctx, void *resbuf));
 
 
+#if 0 /* Unused in Wget */
 /* Compute MD5 message digest for bytes read from STREAM.  The
    resulting message digest number will be written into the 16 bytes
    beginning at RESBLOCK.  */
 extern int md5_stream PARAMS ((FILE *stream, void *resblock));
+#endif
 
 /* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The
    result is always in little endian byte order, so that a byte-wise
index f3ebb0f37f709e358075bacf8435d920e6feab22..195e23eaeb4e36b22a362882d4cb09e688f2956e 100644 (file)
@@ -47,6 +47,7 @@ so, delete this exception statement from your version.  */
 # include <limits.h>
 #endif
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <assert.h>
 
index 1afe586b3565fd4d73c581e586991d1aadbd1509..0239afec6b94f1c363899741c61eb0effb00e392 100644 (file)
@@ -519,7 +519,7 @@ response_new (const char *head)
       while (*hdr == ' ' || *hdr == '\t');
     }
   DO_REALLOC (resp->headers, size, count + 1, const char *);
-  resp->headers[count++] = NULL;
+  resp->headers[count] = NULL;
 
   return resp;
 }
@@ -1043,7 +1043,7 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
   int flags;
 
   /* Whether authorization has been already tried. */
-  int auth_tried_already = 0;
+  int auth_tried_already;
 
   /* Whether our connection to the remote host is through SSL.  */
   int using_ssl = 0;
@@ -1427,8 +1427,6 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
             proxy ? "Proxy" : "HTTP");
   contlen = -1;
   contrange = 0;
-  type = NULL;
-  statcode = -1;
   *dt &= ~RETROKF;
 
   head = fd_read_http_head (sock);
@@ -2585,9 +2583,8 @@ basic_authentication_encode (const char *user, const char *passwd)
 static int
 extract_header_attr (const char *au, const char *attr_name, char **ret)
 {
-  const char *cp, *ep;
-
-  ep = cp = au;
+  const char *ep;
+  const char *cp = au;
 
   if (strncmp (cp, attr_name, strlen (attr_name)) == 0)
     {
index 31059183596768e80c6bd5e11e0e9186c7eb9c55..9cb2e9c7cca79925be1488e9ec3728b73508efab 100644 (file)
@@ -399,7 +399,7 @@ run_wgetrc (const char *file)
     }
   enable_tilde_expansion = 1;
   ln = 1;
-  while ((line = read_whole_line (fp)))
+  while ((line = read_whole_line (fp)) != NULL)
     {
       char *com, *val;
       int comind, status;
index 5477093fecbd67f318aef89273d3f9aa3801b2b7..814d2d456179b048a17725d7cf0b6c09cc995900 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -315,7 +315,7 @@ logputs (enum log_options o, const char *s)
   FILE *fp;
 
   check_redirect_output ();
-  if (!(fp = get_log_fp ()))
+  if ((fp = get_log_fp ()) == NULL)
     return;
   CHECK_VERBOSE (o);
 
index 43772abefa31248312617d241f05b7b192c1845e..32a79f1b0595e3306276b24d43351ad7cf4e0d66 100644 (file)
@@ -660,7 +660,7 @@ main (int argc, char *const *argv)
 
 #ifdef WINDOWS
   /* Drop extension (typically .EXE) from executable filename. */
-  windows_main_junk (&argc, (char **) argv, (char **) &exec_name);
+  windows_main (&argc, (char **) argv, (char **) &exec_name);
 #endif
 
   /* Set option defaults; read the system wgetrc and ~/.wgetrc.  */
@@ -712,7 +712,7 @@ main (int argc, char *const *argv)
          break;
        case OPT_FUNCALL:
          {
-           void (*func) PARAMS ((void)) = opt->data;
+           void (*func) PARAMS ((void)) = (void (*) PARAMS ((void))) opt->data;
            func ();
          }
          break;
index 34a85e718fdde70dacb1998ef17ecb6d0e113b66..79c73958da8adf579f78702c777bc4a3cf490233 100644 (file)
@@ -27,9 +27,6 @@ modify this file, you may extend this exception to your version of the
 file, but you are not obligated to do so.  If you do not wish to do
 so, delete this exception statement from your version.  */
 
-/* Needed for FDP.  */
-#include <stdio.h>
-
 struct options
 {
   int verbose;                 /* Are we verbose? */
index 81c0d36b08dfbbed186168bfbd1f1600e2eee137..1c6f0b060569b5efb56daa217dd1c949e4259087 100644 (file)
@@ -536,9 +536,7 @@ fopen_excl (const char *fname, int binary)
 int
 make_directory (const char *directory)
 {
-  int quit = 0;
-  int i;
-  int ret = 0;
+  int i, ret, quit = 0;
   char *dir;
 
   /* Make a copy of dir, to be able to write to it.  Otherwise, the
@@ -876,7 +874,7 @@ read_file (const char *file)
 {
   int fd;
   struct file_memory *fm;
-  wgint size;
+  long size;
   int inhibit_close = 0;
 
   /* Some magic in the finest tradition of Perl and its kin: if FILE
index d22463edec3eb7f13d1aedf50dde8cf0001868d1..be2b0d9cee9629db503ad24cf717f1a5f2ca2d22 100644 (file)
@@ -45,7 +45,7 @@ struct hash_table;
 
 struct file_memory {
   char *content;
-  wgint length;
+  long length;
   int mmap_p;
 };