diff --git a/src/ChangeLog b/src/ChangeLog index 28eb25d2..ad58ea50 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,32 @@ +2005-03-06 Hrvoje Niksic + + * 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 * utils.c (fopen_excl): Fix parse error when O_BINARY is diff --git a/src/cmpt.c b/src/cmpt.c index 9e78b21a..99cbbb8a 100644 --- a/src/cmpt.c +++ b/src/cmpt.c @@ -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++) { diff --git a/src/ftp-ls.c b/src/ftp-ls.c index 148c79bf..d2dde2ec 100644 --- a/src/ftp-ls.c +++ b/src/ftp-ls.c @@ -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); diff --git a/src/ftp.c b/src/ftp.c index 47face71..a95e8389 100644 --- 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 diff --git a/src/getopt.h b/src/getopt.h index 45541f5a..c8e96c7f 100644 --- a/src/getopt.h +++ b/src/getopt.h @@ -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; diff --git a/src/gnu-md5.h b/src/gnu-md5.h index f3375501..c520e2d5 100644 --- a/src/gnu-md5.h +++ b/src/gnu-md5.h @@ -21,8 +21,6 @@ #ifndef _MD5_H #define _MD5_H 1 -#include - #if defined HAVE_LIMITS_H || _LIBC # include #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 diff --git a/src/hash.c b/src/hash.c index f3ebb0f3..195e23ea 100644 --- a/src/hash.c +++ b/src/hash.c @@ -47,6 +47,7 @@ so, delete this exception statement from your version. */ # include #endif +#include #include #include diff --git a/src/http.c b/src/http.c index 1afe586b..0239afec 100644 --- a/src/http.c +++ b/src/http.c @@ -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) { diff --git a/src/init.c b/src/init.c index 31059183..9cb2e9c7 100644 --- a/src/init.c +++ b/src/init.c @@ -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; diff --git a/src/log.c b/src/log.c index 5477093f..814d2d45 100644 --- 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); diff --git a/src/main.c b/src/main.c index 43772abe..32a79f1b 100644 --- a/src/main.c +++ b/src/main.c @@ -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; diff --git a/src/options.h b/src/options.h index 34a85e71..79c73958 100644 --- a/src/options.h +++ b/src/options.h @@ -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 - struct options { int verbose; /* Are we verbose? */ diff --git a/src/utils.c b/src/utils.c index 81c0d36b..1c6f0b06 100644 --- a/src/utils.c +++ b/src/utils.c @@ -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 diff --git a/src/utils.h b/src/utils.h index d22463ed..be2b0d9c 100644 --- a/src/utils.h +++ b/src/utils.h @@ -45,7 +45,7 @@ struct hash_table; struct file_memory { char *content; - wgint length; + long length; int mmap_p; };