1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Henri's -Wall patch.

This commit is contained in:
Micah Cowan 2008-05-30 22:42:36 -07:00
parent 695e40eb87
commit 48b53471e8
14 changed files with 26 additions and 25 deletions

View File

@ -587,7 +587,7 @@ check_domain_match (const char *cookie_domain, const char *host)
if (dccount == 2) if (dccount == 2)
{ {
int i; size_t i;
int known_toplevel = false; int known_toplevel = false;
static const char *known_toplevel_domains[] = { static const char *known_toplevel_domains[] = {
".com", ".edu", ".net", ".org", ".gov", ".mil", ".int" ".com", ".edu", ".net", ".org", ".gov", ".mil", ".int"

View File

@ -189,7 +189,7 @@ ftp_login (int csock, const char *acc, const char *pass)
"331 s/key ", "331 s/key ",
"331 opiekey " "331 opiekey "
}; };
int i; size_t i;
const char *seed = NULL; const char *seed = NULL;
for (i = 0; i < countof (skey_head); i++) for (i = 0; i < countof (skey_head); i++)
@ -964,7 +964,7 @@ ftp_list (int csock, const char *file)
int nwritten; int nwritten;
uerr_t err; uerr_t err;
bool ok = false; bool ok = false;
int i = 0; size_t i = 0;
/* Try `LIST -a' first and revert to `LIST' in case of failure. */ /* Try `LIST -a' first and revert to `LIST' in case of failure. */
const char *list_commands[] = { "LIST -a", const char *list_commands[] = { "LIST -a",
"LIST" }; "LIST" };

View File

@ -226,7 +226,7 @@ prime_size (int size, int *prime_offset)
243370577, 316381771, 411296309, 534685237, 695090819, 903618083, 243370577, 316381771, 411296309, 534685237, 695090819, 903618083,
1174703521, 1527114613, 1837299131, 2147483647 1174703521, 1527114613, 1837299131, 2147483647
}; };
int i; size_t i;
for (i = *prime_offset; i < countof (primes); i++) for (i = *prime_offset; i < countof (primes); i++)
if (primes[i] >= size) if (primes[i] >= size)

View File

@ -185,7 +185,7 @@ init_interesting (void)
matches the user's preferences as specified through --ignore-tags matches the user's preferences as specified through --ignore-tags
and --follow-tags. */ and --follow-tags. */
int i; size_t i;
interesting_tags = make_nocase_string_hash_table (countof (known_tags)); interesting_tags = make_nocase_string_hash_table (countof (known_tags));
/* First, add all the tags we know hot to handle, mapped to their /* 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 i, attrind;
int first = -1; 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) if (tag_url_attributes[i].tagid == tagid)
{ {
/* We've found the index of tag_url_attributes where the /* We've found the index of tag_url_attributes where the

View File

@ -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 /* Make sure that the user and domain strings fit in the target buffer
before we copy them there. */ before we copy them there. */
if(size + userlen + domlen >= sizeof(ntlmbuf)) if(((size_t) size + userlen + domlen) >= sizeof(ntlmbuf))
return NULL; return NULL;
memcpy(&ntlmbuf[size], domain, domlen); memcpy(&ntlmbuf[size], domain, domlen);

View File

@ -2908,7 +2908,7 @@ http_atotm (const char *time_string)
Netscape cookie specification.) */ Netscape cookie specification.) */
}; };
const char *oldlocale; const char *oldlocale;
int i; size_t i;
time_t ret = (time_t) -1; time_t ret = (time_t) -1;
/* Solaris strptime fails to recognize English month names in /* 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' */ au += 6; /* skip over `Digest' */
while (extract_param (&au, &name, &value, ',')) while (extract_param (&au, &name, &value, ','))
{ {
int i; size_t i;
for (i = 0; i < countof (options); i++) for (i = 0; i < countof (options); i++)
if (name.e - name.b == strlen (options[i].name) if ((size_t) (name.e - name.b) == strlen (options[i].name)
&& 0 == strncmp (name.b, options[i].name, name.e - name.b)) && 0 == strncmp (name.b, options[i].name,
(size_t) (name.e - name.b)))
{ {
*options[i].variable = strdupdelim (value.b, value.e); *options[i].variable = strdupdelim (value.b, value.e);
break; 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. first argument and are followed by whitespace or terminating \0.
The comparison is case-insensitive. */ The comparison is case-insensitive. */
#define STARTS(literal, b, e) \ #define STARTS(literal, b, e) \
((e) - (b) >= STRSIZE (literal) \ (((size_t) ((e) - (b))) >= STRSIZE (literal) \
&& 0 == strncasecmp (b, literal, STRSIZE (literal)) \ && 0 == strncasecmp (b, literal, STRSIZE (literal)) \
&& ((e) - (b) == STRSIZE (literal) \ && ((e) - (b) == STRSIZE (literal) \
|| c_isspace (b[STRSIZE (literal)]))) || c_isspace (b[STRSIZE (literal)])))

View File

@ -631,7 +631,7 @@ parse_line (const char *line, char **com, char **val, int *comind)
static bool static bool
setval_internal (int comind, const char *com, const char *val) 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)); DEBUGP (("Setting %s (%s) to %s\n", com, commands[comind].name, val));
return commands[comind].action (com, val, commands[comind].place); return commands[comind].action (com, val, commands[comind].place);
} }

View File

@ -762,7 +762,7 @@ escnonprint_uri (const char *str)
void void
log_cleanup (void) log_cleanup (void)
{ {
int i; size_t i;
for (i = 0; i < countof (ring); i++) for (i = 0; i < countof (ring); i++)
xfree_null (ring[i].buffer); xfree_null (ring[i].buffer);
} }

View File

@ -294,7 +294,7 @@ static void
init_switches (void) init_switches (void)
{ {
char *p = short_options; char *p = short_options;
int i, o = 0; size_t i, o = 0;
for (i = 0; i < countof (option_data); i++) for (i = 0; i < countof (option_data); i++)
{ {
struct cmdline_option *opt = &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 <bug-wget@gnu.org>.\n") N_("Mail bug reports and suggestions to <bug-wget@gnu.org>.\n")
}; };
int i; size_t i;
printf (_("GNU Wget %s, a non-interactive network retriever.\n"), printf (_("GNU Wget %s, a non-interactive network retriever.\n"),
version_string); version_string);

View File

@ -93,10 +93,10 @@ static int current_impl_locked;
bool bool
valid_progress_implementation_p (const char *name) valid_progress_implementation_p (const char *name)
{ {
int i; size_t i;
struct progress_implementation *pi = implementations; struct progress_implementation *pi = implementations;
char *colon = strchr (name, ':'); 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++) for (i = 0; i < countof (implementations); i++, pi++)
if (!strncmp (pi->name, name, namelen)) if (!strncmp (pi->name, name, namelen))
@ -109,7 +109,7 @@ valid_progress_implementation_p (const char *name)
void void
set_progress_implementation (const char *name) set_progress_implementation (const char *name)
{ {
int i, namelen; size_t i, namelen;
struct progress_implementation *pi = implementations; struct progress_implementation *pi = implementations;
const char *colon; const char *colon;
@ -117,7 +117,7 @@ set_progress_implementation (const char *name)
name = DEFAULT_PROGRESS_IMPLEMENTATION; name = DEFAULT_PROGRESS_IMPLEMENTATION;
colon = strchr (name, ':'); 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++) for (i = 0; i < countof (implementations); i++, pi++)
if (!strncmp (pi->name, name, namelen)) if (!strncmp (pi->name, name, namelen))

View File

@ -133,7 +133,7 @@ posix_init (void)
#endif #endif
{ CLOCK_REALTIME, NO_SYSCONF_CHECK }, { CLOCK_REALTIME, NO_SYSCONF_CHECK },
}; };
int i; size_t i;
/* Determine the clock we can use. For a clock to be usable, it /* Determine the clock we can use. For a clock to be usable, it
must be confirmed with sysconf (where applicable) and with must be confirmed with sysconf (where applicable) and with

View File

@ -85,7 +85,7 @@ print_broken_links (void)
for (hash_table_iterate (nonexisting_urls_set, &iter); for (hash_table_iterate (nonexisting_urls_set, &iter);
hash_table_iter_next (&iter); ) hash_table_iter_next (&iter); )
{ {
struct url_list *list; /* Struct url_list *list; */
const char *url = (const char *) iter.key; const char *url = (const char *) iter.key;
logprintf (LOG_NOTQUIET, _("%s\n"), url); logprintf (LOG_NOTQUIET, _("%s\n"), url);

View File

@ -889,7 +889,7 @@ url_parse (const char *url, int *error)
const char * const char *
url_error (int error_code) 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]); return _(parse_errors[error_code]);
} }

View File

@ -267,7 +267,7 @@ concat_strings (const char *str0, ...)
const char *next_str; const char *next_str;
int total_length = 0; int total_length = 0;
int argcount; size_t argcount;
/* Calculate the length of and allocate the resulting string. */ /* Calculate the length of and allocate the resulting string. */
@ -1386,7 +1386,7 @@ human_readable (HR_NUMTYPE n)
'E', /* exabyte, 2^60 bytes */ 'E', /* exabyte, 2^60 bytes */
}; };
static char buf[8]; static char buf[8];
int i; size_t i;
/* If the quantity is smaller than 1K, just print it. */ /* If the quantity is smaller than 1K, just print it. */
if (n < 1024) if (n < 1024)