diff --git a/batch.c b/batch.c index accc4c6e6..878b6dd1d 100644 --- a/batch.c +++ b/batch.c @@ -75,7 +75,7 @@ static int *flag_ptr[] = { NULL }; -static char *flag_name[] = { +static const char *const flag_name[] = { "--recurse (-r)", "--owner (-o)", "--group (-g)", diff --git a/daemon-parm.awk b/daemon-parm.awk index ad52e9d96..f803e43c8 100755 --- a/daemon-parm.awk +++ b/daemon-parm.awk @@ -6,7 +6,7 @@ BEGIN { heading = "/* DO NOT EDIT THIS FILE! It is auto-generated from a list of values in " ARGV[1] "! */\n\n" sect = psect = defines = accessors = prior_ptype = "" - parms = "\nstatic struct parm_struct parm_table[] = {" + parms = "\nstatic const struct parm_struct parm_table[] = {" comment_fmt = "\n/********** %s **********/\n" tdstruct = "typedef struct {" } diff --git a/flist.c b/flist.c index 17832533e..7bf3030e5 100644 --- a/flist.c +++ b/flist.c @@ -3167,8 +3167,8 @@ static void output_flist(struct file_list *flist) } else *uidbuf = '\0'; if (gid_ndx) { - static char parens[] = "(\0)\0\0\0"; - char *pp = parens + (file->flags & FLAG_SKIP_GROUP ? 0 : 3); + static const char parens[] = "(\0)\0\0\0"; + const char *pp = parens + (file->flags & FLAG_SKIP_GROUP ? 0 : 3); snprintf(gidbuf, sizeof gidbuf, " gid=%s%u%s", pp, F_GROUP(file), pp + 2); } else diff --git a/io.c b/io.c index bb60eecab..436bed45e 100644 --- a/io.c +++ b/io.c @@ -117,7 +117,7 @@ static int active_filecnt = 0; static OFF_T active_bytecnt = 0; static int first_message = 1; -static char int_byte_extra[64] = { +static const char int_byte_extra[64] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* (00 - 3F)/4 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* (40 - 7F)/4 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* (80 - BF)/4 */ @@ -1158,7 +1158,7 @@ void set_io_timeout(int secs) static void check_for_d_option_error(const char *msg) { - static char rsync263_opts[] = "BCDHIKLPRSTWabceghlnopqrtuvxz"; + static const char rsync263_opts[] = "BCDHIKLPRSTWabceghlnopqrtuvxz"; char *colon; int saw_d = 0; diff --git a/lib/md5.c b/lib/md5.c index f36c5ba7e..1506d0742 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -197,7 +197,7 @@ void md5_update(md_context *ctx, const uchar *input, uint32 length) memcpy(ctx->buffer + left, input, length); } -static uchar md5_padding[CSUM_CHUNK] = { 0x80 }; +static const uchar md5_padding[CSUM_CHUNK] = { 0x80 }; void md5_result(md_context *ctx, uchar digest[MD5_DIGEST_LEN]) { diff --git a/loadparm.c b/loadparm.c index 3906bc0f4..f557484c4 100644 --- a/loadparm.c +++ b/loadparm.c @@ -65,7 +65,7 @@ typedef enum { struct enum_list { int value; - char *name; + const char *name; }; struct parm_struct { @@ -73,7 +73,7 @@ struct parm_struct { parm_type type; parm_class class; void *ptr; - struct enum_list *enum_list; + const struct enum_list *enum_list; unsigned flags; }; @@ -95,7 +95,7 @@ static item_list section_list = EMPTY_ITEM_LIST; static int iSectionIndex = -1; static BOOL bInGlobalSection = True; -static struct enum_list enum_syslog_facility[] = { +static const struct enum_list enum_syslog_facility[] = { #ifdef LOG_AUTH { LOG_AUTH, "auth" }, #endif diff --git a/main.c b/main.c index 4f070accc..9d764e16b 100644 --- a/main.c +++ b/main.c @@ -386,7 +386,7 @@ static void handle_stats(int f) static void output_itemized_counts(const char *prefix, int *counts) { - static char *labels[] = { "reg", "dir", "link", "dev", "special" }; + static char *const labels[] = { "reg", "dir", "link", "dev", "special" }; char buf[1024], *pre = " ("; int j, len = 0; int total = counts[0]; diff --git a/options.c b/options.c index 578507c6e..54c411500 100644 --- a/options.c +++ b/options.c @@ -225,7 +225,7 @@ char *iconv_opt = struct chmod_mode_struct *chmod_modes = NULL; -static const char *debug_verbosity[] = { +static const char *const debug_verbosity[] = { /*0*/ NULL, /*1*/ NULL, /*2*/ "BIND,CMD,CONNECT,DEL,DELTASUM,DUP,FILTER,FLIST,ICONV", @@ -236,7 +236,7 @@ static const char *debug_verbosity[] = { #define MAX_VERBOSITY ((int)(sizeof debug_verbosity / sizeof debug_verbosity[0]) - 1) -static const char *info_verbosity[1+MAX_VERBOSITY] = { +static const char *const info_verbosity[1+MAX_VERBOSITY] = { /*0*/ "NONREG", /*1*/ "COPY,DEL,FLIST,MISC,NAME,STATS,SYMSAFE", /*2*/ "BACKUP,MISC2,MOUNT,NAME2,REMOVE,SKIP", @@ -474,7 +474,7 @@ static void parse_output_words(struct output_struct *words, short *levels, const static void output_item_help(struct output_struct *words) { short *levels = words == info_words ? info_levels : debug_levels; - const char **verbosity = words == info_words ? info_verbosity : debug_verbosity; + const char *const*verbosity = words == info_words ? info_verbosity : debug_verbosity; char buf[128], *opt, *fmt = "%-10s %s\n"; int j; @@ -844,7 +844,7 @@ static struct poptOption long_options[] = { {0,0,0,0, 0, 0, 0} }; -static struct poptOption long_daemon_options[] = { +static const struct poptOption long_daemon_options[] = { /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */ {"address", 0, POPT_ARG_STRING, &bind_address, 0, 0, 0 }, {"bwlimit", 0, POPT_ARG_INT, &daemon_bwlimit, 0, 0, 0 }, diff --git a/tls.c b/tls.c index 858f8f10c..e311240af 100644 --- a/tls.c +++ b/tls.c @@ -230,7 +230,7 @@ static void list_file(const char *fname) mtimebuf, atimebuf, crtimebuf, fname, linkbuf); } -static struct poptOption long_options[] = { +static const struct poptOption long_options[] = { /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */ {"atimes", 'U', POPT_ARG_NONE, &display_atimes, 0, 0, 0}, #ifdef SUPPORT_CRTIMES diff --git a/wildtest.c b/wildtest.c index bea4cebbe..3b3f46e40 100644 --- a/wildtest.c +++ b/wildtest.c @@ -40,7 +40,7 @@ int empties_mod = 0; int empty_at_start = 0; int empty_at_end = 0; -static struct poptOption long_options[] = { +static const struct poptOption long_options[] = { /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */ {"iterations", 'i', POPT_ARG_NONE, &output_iterations, 0, 0, 0}, {"empties", 'e', POPT_ARG_STRING, 0, 'e', 0, 0},