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

[svn] Declare the pointers to literal strings as `const'.

This commit is contained in:
hniksic 2003-12-14 05:35:27 -08:00
parent 261183c609
commit 489452a23a
9 changed files with 35 additions and 13 deletions

View File

@ -1,3 +1,24 @@
2003-12-14 Hrvoje Niksic <hniksic@xemacs.org>
* url.c (url_file_name): Ditto.
(parse_errors): Ditto.
* retr.c (retr_rate): Ditto.
* progress.c (create_image): Ditto.
* netrc.c (parse_netrc): Ditto.
* main.c (struct cmdline_option): Ditto.
(redirect_output_signal): Ditto.
* init.c (commands): Ditto.
* ftp-ls.c (ftp_index): Ditto.
* cookies.c (check_domain_match): Declare the pointer to a literal
string as `const'.
2003-12-12 Hrvoje Niksic <hniksic@xemacs.org> 2003-12-12 Hrvoje Niksic <hniksic@xemacs.org>
* retr.c (fd_read_body): Pass total size to progress_create, not * retr.c (fd_read_body): Pass total size to progress_create, not

View File

@ -783,7 +783,7 @@ check_domain_match (const char *cookie_domain, const char *host)
{ {
int i; int i;
int known_toplevel = 0; int known_toplevel = 0;
static char *known_toplevel_domains[] = { static const char *known_toplevel_domains[] = {
".com", ".edu", ".net", ".org", ".gov", ".mil", ".int" ".com", ".edu", ".net", ".org", ".gov", ".mil", ".int"
}; };
for (i = 0; i < countof (known_toplevel_domains); i++) for (i = 0; i < countof (known_toplevel_domains); i++)

View File

@ -867,7 +867,7 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f)
{ {
/* #### Should we translate the months? Or, even better, use /* #### Should we translate the months? Or, even better, use
ISO 8601 dates? */ ISO 8601 dates? */
static char *months[] = { static const char *months[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
}; };

View File

@ -104,7 +104,7 @@ CMD_DECLARE (cmd_spec_useragent);
cleanup() function below. */ cleanup() function below. */
static struct { static struct {
char *name; const char *name;
void *closure; void *closure;
int (*action) PARAMS ((const char *, const char *, void *)); int (*action) PARAMS ((const char *, const char *, void *));
} commands[] = { } commands[] = {

View File

@ -145,7 +145,7 @@ struct cmdline_option {
OPT__NO, OPT__NO,
OPT__PARENT, OPT__PARENT,
} type; } type;
void *data; /* for standard options */ const void *data; /* for standard options */
int argtype; /* for non-standard options */ int argtype; /* for non-standard options */
}; };
@ -992,7 +992,7 @@ Can't timestamp and not clobber old files at the same time.\n"));
static RETSIGTYPE static RETSIGTYPE
redirect_output_signal (int sig) redirect_output_signal (int sig)
{ {
char *signal_name = (sig == SIGHUP ? "SIGHUP" : const char *signal_name = (sig == SIGHUP ? "SIGHUP" :
(sig == SIGUSR1 ? "SIGUSR1" : (sig == SIGUSR1 ? "SIGUSR1" :
"WTF?!")); "WTF?!"));
log_request_redirect_output (signal_name); log_request_redirect_output (signal_name);

View File

@ -258,7 +258,8 @@ static acc_t *
parse_netrc (const char *path) parse_netrc (const char *path)
{ {
FILE *fp; FILE *fp;
char *line, *p, *tok, *premature_token; char *line, *p, *tok;
const char *premature_token;
acc_t *current, *retval; acc_t *current, *retval;
int ln, quote; int ln, quote;

View File

@ -50,7 +50,7 @@ so, delete this exception statement from your version. */
#include "retr.h" #include "retr.h"
struct progress_implementation { struct progress_implementation {
char *name; const char *name;
int interactive; int interactive;
void *(*create) PARAMS ((long, long)); void *(*create) PARAMS ((long, long));
void (*update) PARAMS ((void *, long, double)); void (*update) PARAMS ((void *, long, double));
@ -834,7 +834,7 @@ create_image (struct bar_progress *bp, double dl_total_time)
/* " 1012.45K/s" */ /* " 1012.45K/s" */
if (hist->total_time && hist->total_bytes) if (hist->total_time && hist->total_bytes)
{ {
static char *short_units[] = { "B/s", "K/s", "M/s", "G/s" }; static const char *short_units[] = { "B/s", "K/s", "M/s", "G/s" };
int units = 0; int units = 0;
/* Calculate the download speed using the history ring and /* Calculate the download speed using the history ring and
recent data that hasn't made it to the ring yet. */ recent data that hasn't made it to the ring yet. */

View File

@ -485,7 +485,7 @@ char *
retr_rate (long bytes, double msecs, int pad) retr_rate (long bytes, double msecs, int pad)
{ {
static char res[20]; static char res[20];
static char *rate_names[] = {"B/s", "KB/s", "MB/s", "GB/s" }; static const char *rate_names[] = {"B/s", "KB/s", "MB/s", "GB/s" };
int units = 0; int units = 0;
double dlrate = calc_rate (bytes, msecs, &units); double dlrate = calc_rate (bytes, msecs, &units);

View File

@ -636,7 +636,7 @@ lowercase_str (char *str)
return change; return change;
} }
static char *parse_errors[] = { static const char *parse_errors[] = {
#define PE_NO_ERROR 0 #define PE_NO_ERROR 0
N_("No error"), N_("No error"),
#define PE_UNSUPPORTED_SCHEME 1 #define PE_UNSUPPORTED_SCHEME 1
@ -1563,7 +1563,7 @@ url_file_name (const struct url *u)
{ {
struct growable fnres; struct growable fnres;
char *u_file, *u_query; const char *u_file, *u_query;
char *fname, *unique; char *fname, *unique;
fnres.base = NULL; fnres.base = NULL;