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

[svn] Remove warnings under Borland C.

This commit is contained in:
hniksic 2005-03-05 18:11:10 -08:00
parent c5ca8b7152
commit e2241936d0
14 changed files with 57 additions and 40 deletions

View File

@ -1,3 +1,32 @@
2005-03-06 Hrvoje Niksic <hniksic@xemacs.org>
* 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 <hniksic@xemacs.org> 2005-03-06 Hrvoje Niksic <hniksic@xemacs.org>
* utils.c (fopen_excl): Fix parse error when O_BINARY is * utils.c (fopen_excl): Fix parse error when O_BINARY is

View File

@ -792,7 +792,9 @@ strptime_internal (rp, fmt, tm, decided)
struct tm *tm; struct tm *tm;
enum locale_status *decided; enum locale_status *decided;
{ {
#ifdef _NL_CURRENT
const char *rp_backup; const char *rp_backup;
#endif
int cnt; int cnt;
size_t val; size_t val;
int have_I, is_pm; int have_I, is_pm;
@ -832,8 +834,10 @@ strptime_internal (rp, fmt, tm, decided)
start_over: start_over:
#endif #endif
#ifdef _NL_CURRENT
/* Make back up of current processing pointer. */ /* Make back up of current processing pointer. */
rp_backup = rp; rp_backup = rp;
#endif
switch (*fmt++) switch (*fmt++)
{ {

View File

@ -121,7 +121,7 @@ ftp_parse_unix_ls (const char *file, int ignore_perms)
dir = l = NULL; dir = l = NULL;
/* Line loop to end of file: */ /* Line loop to end of file: */
while ((line = read_whole_line (fp))) while ((line = read_whole_line (fp)) != NULL)
{ {
len = clean_line (line); len = clean_line (line);
/* Skip if total... */ /* 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 This tactic is quite dubious when it comes to
internationalization issues (non-English month names), but it internationalization issues (non-English month names), but it
works for now. */ works for now. */
while ((tok = strtok (NULL, " "))) while ((tok = strtok (NULL, " ")) != NULL)
{ {
--next; --next;
if (next < 0) /* a month name was not encountered */ if (next < 0) /* a month name was not encountered */
@ -449,7 +449,7 @@ ftp_parse_winnt_ls (const char *file)
dir = l = NULL; dir = l = NULL;
/* Line loop to end of file: */ /* Line loop to end of file: */
while ((line = read_whole_line (fp))) while ((line = read_whole_line (fp)) != NULL)
{ {
len = clean_line (line); len = clean_line (line);
@ -557,7 +557,7 @@ ftp_parse_winnt_ls (const char *file)
l->next = NULL; l->next = NULL;
} }
xfree(line); xfree (line);
} }
fclose(fp); fclose(fp);
@ -615,21 +615,18 @@ ftp_parse_vms_ls (const char *file)
/* Skip empty line. */ /* Skip empty line. */
line = read_whole_line (fp); line = read_whole_line (fp);
if (line) xfree_null (line);
xfree (line);
/* Skip "Directory PUB$DEVICE[PUB]" */ /* Skip "Directory PUB$DEVICE[PUB]" */
line = read_whole_line (fp); line = read_whole_line (fp);
if (line) xfree_null (line);
xfree (line);
/* Skip empty line. */ /* Skip empty line. */
line = read_whole_line (fp); line = read_whole_line (fp);
if (line) xfree_null (line);
xfree (line);
/* Line loop to end of file: */ /* Line loop to end of file: */
while ((line = read_whole_line (fp))) while ((line = read_whole_line (fp)) != NULL)
{ {
char *p; char *p;
i = clean_line (line); i = clean_line (line);
@ -729,7 +726,7 @@ ftp_parse_vms_ls (const char *file)
/* Fourth/Third column: Time hh:mm[:ss] */ /* Fourth/Third column: Time hh:mm[:ss] */
tok = strtok (NULL, " "); tok = strtok (NULL, " ");
if (tok == NULL) continue; if (tok == NULL) continue;
hour = min = sec = 0; min = sec = 0;
p = tok; p = tok;
hour = atoi (p); hour = atoi (p);
for (; *p && *p != ':'; ++p); for (; *p && *p != ':'; ++p);

View File

@ -1114,7 +1114,7 @@ Error in server response, closing control connection.\n"));
char *line; char *line;
/* The lines are being read with read_whole_line because of /* The lines are being read with read_whole_line because of
no-buffering on opt.lfile. */ 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)); logprintf (LOG_ALWAYS, "%s\n", escnonprint (line));
xfree (line); xfree (line);
@ -1793,7 +1793,6 @@ ftp_retrieve_glob (struct url *u, ccon *con, int action)
return RETRBADPATTERN; return RETRBADPATTERN;
} }
} }
res = RETROK;
if (start) if (start)
{ {
/* Just get everything. */ /* Just get everything. */
@ -1843,7 +1842,6 @@ ftp_loop (struct url *u, int *dt, struct url *proxy)
con.rs = ST_UNIX; con.rs = ST_UNIX;
con.id = NULL; con.id = NULL;
con.proxy = proxy; con.proxy = proxy;
res = RETROK; /* in case it's not used */
/* If the file name is empty, the user probably wants a directory /* If the file name is empty, the user probably wants a directory
index. We'll provide one, properly HTML-ized. Unless index. We'll provide one, properly HTML-ized. Unless

View File

@ -76,11 +76,7 @@ extern int optopt;
struct option struct option
{ {
#if __STDC__
const char *name; const char *name;
#else
char *name;
#endif
/* has_arg can't be an enum because some compilers complain about /* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */ type mismatches in all the code that assumes it is an int. */
int has_arg; int has_arg;

View File

@ -21,8 +21,6 @@
#ifndef _MD5_H #ifndef _MD5_H
#define _MD5_H 1 #define _MD5_H 1
#include <stdio.h>
#if defined HAVE_LIMITS_H || _LIBC #if defined HAVE_LIMITS_H || _LIBC
# include <limits.h> # include <limits.h>
#endif #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)); 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 /* Compute MD5 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 16 bytes resulting message digest number will be written into the 16 bytes
beginning at RESBLOCK. */ beginning at RESBLOCK. */
extern int md5_stream PARAMS ((FILE *stream, void *resblock)); extern int md5_stream PARAMS ((FILE *stream, void *resblock));
#endif
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise result is always in little endian byte order, so that a byte-wise

View File

@ -47,6 +47,7 @@ so, delete this exception statement from your version. */
# include <limits.h> # include <limits.h>
#endif #endif
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>

View File

@ -519,7 +519,7 @@ response_new (const char *head)
while (*hdr == ' ' || *hdr == '\t'); while (*hdr == ' ' || *hdr == '\t');
} }
DO_REALLOC (resp->headers, size, count + 1, const char *); DO_REALLOC (resp->headers, size, count + 1, const char *);
resp->headers[count++] = NULL; resp->headers[count] = NULL;
return resp; return resp;
} }
@ -1043,7 +1043,7 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
int flags; int flags;
/* Whether authorization has been already tried. */ /* 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. */ /* Whether our connection to the remote host is through SSL. */
int using_ssl = 0; int using_ssl = 0;
@ -1427,8 +1427,6 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
proxy ? "Proxy" : "HTTP"); proxy ? "Proxy" : "HTTP");
contlen = -1; contlen = -1;
contrange = 0; contrange = 0;
type = NULL;
statcode = -1;
*dt &= ~RETROKF; *dt &= ~RETROKF;
head = fd_read_http_head (sock); head = fd_read_http_head (sock);
@ -2585,9 +2583,8 @@ basic_authentication_encode (const char *user, const char *passwd)
static int static int
extract_header_attr (const char *au, const char *attr_name, char **ret) extract_header_attr (const char *au, const char *attr_name, char **ret)
{ {
const char *cp, *ep; const char *ep;
const char *cp = au;
ep = cp = au;
if (strncmp (cp, attr_name, strlen (attr_name)) == 0) if (strncmp (cp, attr_name, strlen (attr_name)) == 0)
{ {

View File

@ -399,7 +399,7 @@ run_wgetrc (const char *file)
} }
enable_tilde_expansion = 1; enable_tilde_expansion = 1;
ln = 1; ln = 1;
while ((line = read_whole_line (fp))) while ((line = read_whole_line (fp)) != NULL)
{ {
char *com, *val; char *com, *val;
int comind, status; int comind, status;

View File

@ -315,7 +315,7 @@ logputs (enum log_options o, const char *s)
FILE *fp; FILE *fp;
check_redirect_output (); check_redirect_output ();
if (!(fp = get_log_fp ())) if ((fp = get_log_fp ()) == NULL)
return; return;
CHECK_VERBOSE (o); CHECK_VERBOSE (o);

View File

@ -660,7 +660,7 @@ main (int argc, char *const *argv)
#ifdef WINDOWS #ifdef WINDOWS
/* Drop extension (typically .EXE) from executable filename. */ /* 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 #endif
/* Set option defaults; read the system wgetrc and ~/.wgetrc. */ /* Set option defaults; read the system wgetrc and ~/.wgetrc. */
@ -712,7 +712,7 @@ main (int argc, char *const *argv)
break; break;
case OPT_FUNCALL: case OPT_FUNCALL:
{ {
void (*func) PARAMS ((void)) = opt->data; void (*func) PARAMS ((void)) = (void (*) PARAMS ((void))) opt->data;
func (); func ();
} }
break; break;

View File

@ -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 file, but you are not obligated to do so. If you do not wish to do
so, delete this exception statement from your version. */ so, delete this exception statement from your version. */
/* Needed for FDP. */
#include <stdio.h>
struct options struct options
{ {
int verbose; /* Are we verbose? */ int verbose; /* Are we verbose? */

View File

@ -536,9 +536,7 @@ fopen_excl (const char *fname, int binary)
int int
make_directory (const char *directory) make_directory (const char *directory)
{ {
int quit = 0; int i, ret, quit = 0;
int i;
int ret = 0;
char *dir; char *dir;
/* Make a copy of dir, to be able to write to it. Otherwise, the /* 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; int fd;
struct file_memory *fm; struct file_memory *fm;
wgint size; long size;
int inhibit_close = 0; int inhibit_close = 0;
/* Some magic in the finest tradition of Perl and its kin: if FILE /* Some magic in the finest tradition of Perl and its kin: if FILE

View File

@ -45,7 +45,7 @@ struct hash_table;
struct file_memory { struct file_memory {
char *content; char *content;
wgint length; long length;
int mmap_p; int mmap_p;
}; };