From 48b53471e89938fde4588bea068578ab2ae7864f Mon Sep 17 00:00:00 2001 From: Micah Cowan Date: Fri, 30 May 2008 22:42:36 -0700 Subject: [PATCH] Henri's -Wall patch. --- src/cookies.c | 2 +- src/ftp-basic.c | 4 ++-- src/hash.c | 2 +- src/html-url.c | 4 ++-- src/http-ntlm.c | 2 +- src/http.c | 11 ++++++----- src/init.c | 2 +- src/log.c | 2 +- src/main.c | 4 ++-- src/progress.c | 8 ++++---- src/ptimer.c | 2 +- src/spider.c | 2 +- src/url.c | 2 +- src/utils.c | 4 ++-- 14 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/cookies.c b/src/cookies.c index 147695c2..85413904 100644 --- a/src/cookies.c +++ b/src/cookies.c @@ -587,7 +587,7 @@ check_domain_match (const char *cookie_domain, const char *host) if (dccount == 2) { - int i; + size_t i; int known_toplevel = false; static const char *known_toplevel_domains[] = { ".com", ".edu", ".net", ".org", ".gov", ".mil", ".int" diff --git a/src/ftp-basic.c b/src/ftp-basic.c index 36b11bca..265a1e25 100644 --- a/src/ftp-basic.c +++ b/src/ftp-basic.c @@ -189,7 +189,7 @@ ftp_login (int csock, const char *acc, const char *pass) "331 s/key ", "331 opiekey " }; - int i; + size_t i; const char *seed = NULL; for (i = 0; i < countof (skey_head); i++) @@ -964,7 +964,7 @@ ftp_list (int csock, const char *file) int nwritten; uerr_t err; bool ok = false; - int i = 0; + size_t i = 0; /* Try `LIST -a' first and revert to `LIST' in case of failure. */ const char *list_commands[] = { "LIST -a", "LIST" }; diff --git a/src/hash.c b/src/hash.c index 4697b779..1e19fd63 100644 --- a/src/hash.c +++ b/src/hash.c @@ -226,7 +226,7 @@ prime_size (int size, int *prime_offset) 243370577, 316381771, 411296309, 534685237, 695090819, 903618083, 1174703521, 1527114613, 1837299131, 2147483647 }; - int i; + size_t i; for (i = *prime_offset; i < countof (primes); i++) if (primes[i] >= size) diff --git a/src/html-url.c b/src/html-url.c index e9f2773a..b5d3ecf0 100644 --- a/src/html-url.c +++ b/src/html-url.c @@ -185,7 +185,7 @@ init_interesting (void) matches the user's preferences as specified through --ignore-tags and --follow-tags. */ - int i; + size_t i; interesting_tags = make_nocase_string_hash_table (countof (known_tags)); /* First, add all the tags we know hot to handle, mapped to their @@ -358,7 +358,7 @@ tag_find_urls (int tagid, struct taginfo *tag, struct map_context *ctx) int i, attrind; int first = -1; - for (i = 0; i < countof (tag_url_attributes); i++) + for (i = 0; i < (int) countof (tag_url_attributes); i++) if (tag_url_attributes[i].tagid == tagid) { /* We've found the index of tag_url_attributes where the diff --git a/src/http-ntlm.c b/src/http-ntlm.c index def832be..fbba2c61 100644 --- a/src/http-ntlm.c +++ b/src/http-ntlm.c @@ -526,7 +526,7 @@ ntlm_output (struct ntlmdata *ntlm, const char *user, const char *passwd, /* Make sure that the user and domain strings fit in the target buffer before we copy them there. */ - if(size + userlen + domlen >= sizeof(ntlmbuf)) + if(((size_t) size + userlen + domlen) >= sizeof(ntlmbuf)) return NULL; memcpy(&ntlmbuf[size], domain, domlen); diff --git a/src/http.c b/src/http.c index 11dc9cc8..58e9b14a 100644 --- a/src/http.c +++ b/src/http.c @@ -2908,7 +2908,7 @@ http_atotm (const char *time_string) Netscape cookie specification.) */ }; const char *oldlocale; - int i; + size_t i; time_t ret = (time_t) -1; /* Solaris strptime fails to recognize English month names in @@ -3019,10 +3019,11 @@ digest_authentication_encode (const char *au, const char *user, au += 6; /* skip over `Digest' */ while (extract_param (&au, &name, &value, ',')) { - int i; + size_t i; for (i = 0; i < countof (options); i++) - if (name.e - name.b == strlen (options[i].name) - && 0 == strncmp (name.b, options[i].name, name.e - name.b)) + if ((size_t) (name.e - name.b) == strlen (options[i].name) + && 0 == strncmp (name.b, options[i].name, + (size_t) (name.e - name.b))) { *options[i].variable = strdupdelim (value.b, value.e); break; @@ -3102,7 +3103,7 @@ username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", response=\"%s\"", first argument and are followed by whitespace or terminating \0. The comparison is case-insensitive. */ #define STARTS(literal, b, e) \ - ((e) - (b) >= STRSIZE (literal) \ + (((size_t) ((e) - (b))) >= STRSIZE (literal) \ && 0 == strncasecmp (b, literal, STRSIZE (literal)) \ && ((e) - (b) == STRSIZE (literal) \ || c_isspace (b[STRSIZE (literal)]))) diff --git a/src/init.c b/src/init.c index 97976553..5b0206e4 100644 --- a/src/init.c +++ b/src/init.c @@ -631,7 +631,7 @@ parse_line (const char *line, char **com, char **val, int *comind) static bool setval_internal (int comind, const char *com, const char *val) { - assert (0 <= comind && comind < countof (commands)); + assert (0 <= comind && ((size_t) comind) < countof (commands)); DEBUGP (("Setting %s (%s) to %s\n", com, commands[comind].name, val)); return commands[comind].action (com, val, commands[comind].place); } diff --git a/src/log.c b/src/log.c index f7b3dca8..e84e5c61 100644 --- a/src/log.c +++ b/src/log.c @@ -762,7 +762,7 @@ escnonprint_uri (const char *str) void log_cleanup (void) { - int i; + size_t i; for (i = 0; i < countof (ring); i++) xfree_null (ring[i].buffer); } diff --git a/src/main.c b/src/main.c index d68cdbd6..009aa5e6 100644 --- a/src/main.c +++ b/src/main.c @@ -294,7 +294,7 @@ static void init_switches (void) { char *p = short_options; - int i, o = 0; + size_t i, o = 0; for (i = 0; i < countof (option_data); i++) { struct cmdline_option *opt = &option_data[i]; @@ -640,7 +640,7 @@ Recursive accept/reject:\n"), N_("Mail bug reports and suggestions to .\n") }; - int i; + size_t i; printf (_("GNU Wget %s, a non-interactive network retriever.\n"), version_string); diff --git a/src/progress.c b/src/progress.c index de108e76..2f1c2225 100644 --- a/src/progress.c +++ b/src/progress.c @@ -93,10 +93,10 @@ static int current_impl_locked; bool valid_progress_implementation_p (const char *name) { - int i; + size_t i; struct progress_implementation *pi = implementations; char *colon = strchr (name, ':'); - int namelen = colon ? colon - name : strlen (name); + size_t namelen = colon ? (size_t) (colon - name) : strlen (name); for (i = 0; i < countof (implementations); i++, pi++) if (!strncmp (pi->name, name, namelen)) @@ -109,7 +109,7 @@ valid_progress_implementation_p (const char *name) void set_progress_implementation (const char *name) { - int i, namelen; + size_t i, namelen; struct progress_implementation *pi = implementations; const char *colon; @@ -117,7 +117,7 @@ set_progress_implementation (const char *name) name = DEFAULT_PROGRESS_IMPLEMENTATION; colon = strchr (name, ':'); - namelen = colon ? colon - name : strlen (name); + namelen = colon ? (size_t) (colon - name) : strlen (name); for (i = 0; i < countof (implementations); i++, pi++) if (!strncmp (pi->name, name, namelen)) diff --git a/src/ptimer.c b/src/ptimer.c index 1e8c43c0..88ad049d 100644 --- a/src/ptimer.c +++ b/src/ptimer.c @@ -133,7 +133,7 @@ posix_init (void) #endif { CLOCK_REALTIME, NO_SYSCONF_CHECK }, }; - int i; + size_t i; /* Determine the clock we can use. For a clock to be usable, it must be confirmed with sysconf (where applicable) and with diff --git a/src/spider.c b/src/spider.c index 08fefc9f..98a296d4 100644 --- a/src/spider.c +++ b/src/spider.c @@ -85,7 +85,7 @@ print_broken_links (void) for (hash_table_iterate (nonexisting_urls_set, &iter); hash_table_iter_next (&iter); ) { - struct url_list *list; + /* Struct url_list *list; */ const char *url = (const char *) iter.key; logprintf (LOG_NOTQUIET, _("%s\n"), url); diff --git a/src/url.c b/src/url.c index 87ba3cc9..f5d621f9 100644 --- a/src/url.c +++ b/src/url.c @@ -889,7 +889,7 @@ url_parse (const char *url, int *error) const char * url_error (int error_code) { - assert (error_code >= 0 && error_code < countof (parse_errors)); + assert (error_code >= 0 && ((size_t) error_code) < countof (parse_errors)); return _(parse_errors[error_code]); } diff --git a/src/utils.c b/src/utils.c index a6c84491..15e3f89b 100644 --- a/src/utils.c +++ b/src/utils.c @@ -267,7 +267,7 @@ concat_strings (const char *str0, ...) const char *next_str; int total_length = 0; - int argcount; + size_t argcount; /* Calculate the length of and allocate the resulting string. */ @@ -1386,7 +1386,7 @@ human_readable (HR_NUMTYPE n) 'E', /* exabyte, 2^60 bytes */ }; static char buf[8]; - int i; + size_t i; /* If the quantity is smaller than 1K, just print it. */ if (n < 1024)