mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Apply lint-expired fixes from <sxsn1du7ufa.fsf@florida.arsdigita.de>.
This commit is contained in:
parent
f6a41b5669
commit
5099ec0306
@ -1,3 +1,26 @@
|
||||
2000-12-17 Hrvoje Niksic <hniksic@arsdigita.com>
|
||||
|
||||
* url.c (parseurl): Rename inner loop var from i to ind to avoid
|
||||
clash with the function top-level-declared variable i.
|
||||
(str_url): Likewise, rename inner-loop i to j.
|
||||
|
||||
* recur.c (parse_robots): Don't declare LEN at top of function.
|
||||
(robots_match): Renamed parameter FORBIDDEN to avoid hiding of
|
||||
global variable.
|
||||
|
||||
* main.c (main): Change erroneous use of bitwise and to logical.
|
||||
|
||||
* init.c (cmd_address): Don't heap-allocate `sin'; it can be on
|
||||
the stack because it will be copied to closure.
|
||||
|
||||
Thanks to Csaba Raduly's run of PC-LINT over the sources.
|
||||
|
||||
2000-12-17 Hrvoje Niksic <hniksic@arsdigita.com>
|
||||
|
||||
* http.c (basic_authentication_encode): Use xmalloc(), not
|
||||
malloc(). Thanks to Csaba Raduly's run of PC-LINT over the
|
||||
sources.
|
||||
|
||||
2000-12-17 Csaba Raduly <csaba.raduly@sophos.com>
|
||||
|
||||
* sysdep.h: Test for __EMX__ rather than for EMXOS2 for OS/2
|
||||
|
@ -1851,7 +1851,7 @@ basic_authentication_encode (const char *user, const char *passwd,
|
||||
sprintf (t1, "%s:%s", user, passwd);
|
||||
t2 = (char *)alloca (1 + len2);
|
||||
base64_encode (t1, t2, len1);
|
||||
res = (char *)malloc (len2 + 11 + strlen (header));
|
||||
res = (char *)xmalloc (len2 + 11 + strlen (header));
|
||||
sprintf (res, "%s: Basic %s\r\n", header, t2);
|
||||
|
||||
return res;
|
||||
|
17
src/init.c
17
src/init.c
@ -493,26 +493,19 @@ static int myatoi PARAMS ((const char *s));
|
||||
static int
|
||||
cmd_address (const char *com, const char *val, void *closure)
|
||||
{
|
||||
struct sockaddr_in *sin;
|
||||
struct sockaddr_in sin;
|
||||
|
||||
sin = (struct sockaddr_in *) malloc(sizeof *sin);
|
||||
if (sin == NULL)
|
||||
{
|
||||
fprintf (stderr, _("%s: Out of memory.\n"), exec_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!store_hostaddress ((unsigned char *)&sin->sin_addr, val))
|
||||
if (!store_hostaddress ((unsigned char *)&sin.sin_addr, val))
|
||||
{
|
||||
fprintf (stderr, _("%s: %s: Cannot convert `%s' to an IP address.\n"),
|
||||
exec_name, com, val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sin->sin_family = AF_INET;
|
||||
sin->sin_port = 0;
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_port = 0;
|
||||
|
||||
* (struct sockaddr_in **) closure = sin;
|
||||
memcpy (closure, &sin, sizeof (sin));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -807,7 +807,7 @@ Can't timestamp and not clobber old files at the same time.\n"));
|
||||
_("Download quota (%s bytes) EXCEEDED!\n"),
|
||||
legible (opt.quota));
|
||||
}
|
||||
if (opt.convert_links & !opt.delete_after)
|
||||
if (opt.convert_links && !opt.delete_after)
|
||||
{
|
||||
convert_all_links ();
|
||||
}
|
||||
|
18
src/recur.c
18
src/recur.c
@ -703,7 +703,7 @@ parse_robots (const char *robots_filename)
|
||||
char **entries;
|
||||
char *line, *cmd, *str, *p;
|
||||
char *base_version, *version;
|
||||
int len, num, i;
|
||||
int num, i;
|
||||
int wget_matched; /* is the part meant for Wget? */
|
||||
|
||||
entries = NULL;
|
||||
@ -755,7 +755,7 @@ parse_robots (const char *robots_filename)
|
||||
wget_matched = 1;
|
||||
while ((line = read_whole_line (fp)))
|
||||
{
|
||||
len = strlen (line);
|
||||
int len = strlen (line);
|
||||
/* Destroy <CR><LF> if present. */
|
||||
if (len && line[len - 1] == '\n')
|
||||
line[--len] = '\0';
|
||||
@ -874,19 +874,19 @@ parse_robots (const char *robots_filename)
|
||||
/* May the URL url be loaded according to disallowing rules stored in
|
||||
forbidden? */
|
||||
static int
|
||||
robots_match (struct urlinfo *u, char **forbidden)
|
||||
robots_match (struct urlinfo *u, char **fb)
|
||||
{
|
||||
int l;
|
||||
|
||||
if (!forbidden)
|
||||
if (!fb)
|
||||
return 1;
|
||||
DEBUGP (("Matching %s against: ", u->path));
|
||||
for (; *forbidden; forbidden++)
|
||||
for (; *fb; fb++)
|
||||
{
|
||||
DEBUGP (("%s ", *forbidden));
|
||||
l = strlen (*forbidden);
|
||||
/* If dir is forbidden, we may not load the file. */
|
||||
if (strncmp (u->path, *forbidden, l) == 0)
|
||||
DEBUGP (("%s ", *fb));
|
||||
l = strlen (*fb);
|
||||
/* If dir is fb, we may not load the file. */
|
||||
if (strncmp (u->path, *fb, l) == 0)
|
||||
{
|
||||
DEBUGP (("matched.\n"));
|
||||
return 0; /* Matches, i.e. does not load... */
|
||||
|
16
src/url.c
16
src/url.c
@ -475,13 +475,13 @@ parseurl (const char *url, struct urlinfo *u, int strict)
|
||||
u->proto = type = URLHTTP;
|
||||
if (!u->port)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < ARRAY_SIZE (sup_protos); i++)
|
||||
if (sup_protos[i].ind == type)
|
||||
int ind;
|
||||
for (ind = 0; ind < ARRAY_SIZE (sup_protos); ind++)
|
||||
if (sup_protos[ind].ind == type)
|
||||
break;
|
||||
if (i == ARRAY_SIZE (sup_protos))
|
||||
if (ind == ARRAY_SIZE (sup_protos))
|
||||
return URLUNKNOWN;
|
||||
u->port = sup_protos[i].port;
|
||||
u->port = sup_protos[ind].port;
|
||||
}
|
||||
/* Some delimiter troubles... */
|
||||
if (url[i] == '/' && url[i - 1] != ':')
|
||||
@ -688,11 +688,11 @@ str_url (const struct urlinfo *u, int hide)
|
||||
user = CLEANDUP (u->user);
|
||||
if (u->passwd)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
passwd = CLEANDUP (u->passwd);
|
||||
if (hide)
|
||||
for (i = 0; passwd[i]; i++)
|
||||
passwd[i] = 'x';
|
||||
for (j = 0; passwd[j]; j++)
|
||||
passwd[j] = 'x';
|
||||
}
|
||||
if (u->proto == URLFTP && *dir == '/')
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user