From: Micah Cowan Date: Sat, 31 May 2008 07:24:53 +0000 (-0700) Subject: Minor tweaks to Henri's patch. X-Git-Tag: v1.13~421^2~12^2~8^2~1 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=dac53e8bdf8b81b9f59a47823fff191e0a629cf5 Minor tweaks to Henri's patch. --- diff --git a/src/html-url.c b/src/html-url.c index b5d3ecf0..0eb66506 100644 --- a/src/html-url.c +++ b/src/html-url.c @@ -355,10 +355,11 @@ append_url (const char *link_uri, static void tag_find_urls (int tagid, struct taginfo *tag, struct map_context *ctx) { - int i, attrind; + size_t i; + int attrind; int first = -1; - for (i = 0; i < (int) countof (tag_url_attributes); i++) + for (i = 0; i < countof (tag_url_attributes); i++) if (tag_url_attributes[i].tagid == tagid) { /* We've found the index of tag_url_attributes where the @@ -382,7 +383,7 @@ tag_find_urls (int tagid, struct taginfo *tag, struct map_context *ctx) /* Find whether TAG/ATTRIND is a combination that contains a URL. */ char *link = tag->attrs[attrind].value; - const int size = countof (tag_url_attributes); + const size_t size = countof (tag_url_attributes); /* If you're cringing at the inefficiency of the nested loops, remember that they both iterate over a very small number of diff --git a/src/http.c b/src/http.c index 58e9b14a..919d7593 100644 --- a/src/http.c +++ b/src/http.c @@ -3020,10 +3020,11 @@ digest_authentication_encode (const char *au, const char *user, while (extract_param (&au, &name, &value, ',')) { size_t i; + size_t namelen = name.e - name.b; for (i = 0; i < countof (options); i++) - if ((size_t) (name.e - name.b) == strlen (options[i].name) + if (namelen == strlen (options[i].name) && 0 == strncmp (name.b, options[i].name, - (size_t) (name.e - name.b))) + namelen)) { *options[i].variable = strdupdelim (value.b, value.e); break; @@ -3103,9 +3104,10 @@ 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) \ - (((size_t) ((e) - (b))) >= STRSIZE (literal) \ + ((e > b) \ + && ((size_t) ((e) - (b))) >= STRSIZE (literal) \ && 0 == strncasecmp (b, literal, STRSIZE (literal)) \ - && ((e) - (b) == STRSIZE (literal) \ + && ((size_t) ((e) - (b)) == STRSIZE (literal) \ || c_isspace (b[STRSIZE (literal)]))) static bool