From ea912b20ba2b3b9dfdbbae758ad56263c9aa41b3 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Sat, 28 Oct 2006 01:13:16 +0200 Subject: [PATCH] warning fixes Signed-off-by: Pierre Habouzit --- alias.c | 6 +++--- alias.h | 2 +- charset.c | 4 ++-- charset.h | 2 +- compose.c | 8 ++++---- curs_lib.c | 2 +- globals.h | 3 +-- imap/message.c | 2 +- init.c | 26 +++++++++++++------------- init.h | 9 ++++----- lib.h | 3 --- mapping.h | 2 +- mutt.h | 2 +- nntp/newsrc.c | 2 +- protos.h | 2 +- rfc822.h | 1 - 16 files changed, 35 insertions(+), 41 deletions(-) diff --git a/alias.c b/alias.c index 65fa634..667dad2 100644 --- a/alias.c +++ b/alias.c @@ -37,7 +37,7 @@ static struct mapping_t AliasHelp[] = { {N_("Undel"), OP_UNDELETE}, {N_("Select"), OP_GENERIC_SELECT_ENTRY}, {N_("Help"), OP_HELP}, - {NULL} + {NULL, OP_NULL} }; ADDRESS *mutt_lookup_alias (const char *s) @@ -174,10 +174,10 @@ static void write_safe_address (FILE * fp, char *s) } } -ADDRESS *mutt_get_address (ENVELOPE * env, char **pfxp) +ADDRESS *mutt_get_address (ENVELOPE * env, const char **pfxp) { ADDRESS *adr; - char *pfx = NULL; + const char *pfx = NULL; if (mutt_addr_is_user (env->from)) { if (env->to && !mutt_is_mail_list (env->to)) { diff --git a/alias.h b/alias.h index 6a22e61..32fa20c 100644 --- a/alias.h +++ b/alias.h @@ -23,7 +23,7 @@ typedef struct alias { void mutt_create_alias (ENVELOPE *, ADDRESS *); int mutt_check_alias_name (const char *, char *); -ADDRESS *mutt_get_address (ENVELOPE *, char **); +ADDRESS *mutt_get_address (ENVELOPE *, const char **); ADDRESS *mutt_lookup_alias (const char *s); ADDRESS *mutt_expand_aliases (ADDRESS *); void mutt_expand_aliases_env (ENVELOPE *); diff --git a/charset.c b/charset.c index 4f5700d..683afc9 100644 --- a/charset.c +++ b/charset.c @@ -44,8 +44,8 @@ */ static struct { - char *key; - char *pref; + const char *key; + const char *pref; } PreferredMIMENames[] = { { "ansi_x3.4-1968", "us-ascii"}, { diff --git a/charset.h b/charset.h index e238f48..482339b 100644 --- a/charset.h +++ b/charset.h @@ -19,7 +19,7 @@ typedef void *iconv_t; #endif #ifndef HAVE_ICONV -#define ICONV_CONST /**/ +#define ICONV_CONST const iconv_t iconv_open (const char *, const char *); size_t iconv (iconv_t, ICONV_CONST char **, size_t *, char **, size_t *); int iconv_close (iconv_t); diff --git a/compose.c b/compose.c index 9e0ebcc..e7d2886 100644 --- a/compose.c +++ b/compose.c @@ -90,7 +90,7 @@ enum { #define SW (option(OPTMBOXPANE)?SidebarWidth:0) #define W (COLS - HDR_XOFFSET - SW) -static char *Prompts[] = { +static const char *Prompts[] = { "From: ", "To: ", "Cc: ", @@ -115,7 +115,7 @@ static struct mapping_t ComposeHelp[] = { {N_("Attach file"), OP_COMPOSE_ATTACH_FILE}, {N_("Descrip"), OP_COMPOSE_EDIT_DESCRIPTION}, {N_("Help"), OP_HELP}, - {NULL} + {NULL, OP_NULL} }; #ifdef USE_NNTP @@ -127,7 +127,7 @@ static struct mapping_t ComposeNewsHelp[] = { {N_("Attach file"), OP_COMPOSE_ATTACH_FILE}, {N_("Descrip"), OP_COMPOSE_EDIT_DESCRIPTION}, {N_("Help"), OP_HELP}, - {NULL} + {NULL, OP_NULL} }; #endif @@ -207,7 +207,7 @@ static void redraw_crypt_lines (HEADER * msg) static void redraw_mix_line (LIST * chain) { int c; - char *t; + const char *t; mvaddstr (HDR_MIX, SW, " Mix: "); diff --git a/curs_lib.c b/curs_lib.c index 86c2c38..e5f9480 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -114,7 +114,7 @@ event_t mutt_getch (void) return (ch == ctrl ('G') ? err : ret); } -int _mutt_get_field ( /* const */ char *field, char *buf, size_t buflen, +int _mutt_get_field ( const char *field, char *buf, size_t buflen, int complete, int multiple, char ***files, int *numfiles) { int ret; diff --git a/globals.h b/globals.h index 3583416..9d20bb9 100644 --- a/globals.h +++ b/globals.h @@ -73,7 +73,7 @@ WHERE char *Locale; WHERE char *MailcapPath; WHERE char *Maildir; -#if USE_HCACHE +#ifdef USE_HCACHE WHERE char *HeaderCache; #if HAVE_GDBM || HAVE_DB4 WHERE char *HeaderCachePageSize; @@ -286,7 +286,6 @@ WHERE char *SmimeCryptAlg; WHERE short SmimeTimeout; WHERE char *SmimeCertificates; WHERE char *SmimeKeys; -WHERE char *SmimeCryptAlg; WHERE char *SmimeCALocation; WHERE char *SmimeVerifyCommand; WHERE char *SmimeVerifyOpaqueCommand; diff --git a/imap/message.c b/imap/message.c index 8423a5c..bc75ed5 100644 --- a/imap/message.c +++ b/imap/message.c @@ -282,7 +282,7 @@ int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend) ((msgno + 1) >= fetchlast))); if ((mfhrc < -1) || ((rc != IMAP_CMD_CONTINUE) && (rc != IMAP_CMD_OK))) { - imap_free_header_data ((void **) &h.data); + imap_free_header_data ((void *)&h.data); fclose (fp); #if USE_HCACHE mutt_hcache_close (hc); diff --git a/init.c b/init.c index 734f88e..c32e551 100644 --- a/init.c +++ b/init.c @@ -53,15 +53,6 @@ #include #include -#define CHECK_PAGER \ - if ((CurrentMenu == MENU_PAGER) && \ - (!option || (option->flags & R_RESORT))) \ - { \ - snprintf (err->data, err->dsize, \ - _("Not available in this menu.")); \ - return (-1); \ - } else - /* * prototypes */ @@ -358,7 +349,7 @@ static int user_from_string (struct option_t* dst, const char* val, static void quad_to_string (char* dst, size_t dstlen, struct option_t* option) { - char *vals[] = { "no", "yes", "ask-no", "ask-yes" }; + const char *vals[] = { "no", "yes", "ask-no", "ask-yes" }; snprintf (dst, dstlen, "%s=%s", option->option, vals[quadoption (option->data)]); } @@ -1224,7 +1215,7 @@ static int parse_unattach_list (BUFFER *buf, BUFFER *s, LIST **ldata, BUFFER *er return 0; } -static int print_attach_list (LIST *lp, char op, char *name) { +static int print_attach_list (LIST *lp, char op, const char *name) { while (lp) { printf("attachments %c%s %s/%s\n", op, name, ((ATTACH_MATCH *)lp->data)->major, @@ -1607,7 +1598,7 @@ static void mutt_set_default (const char* name, void* p, unsigned long more) { } static struct option_t* add_option (const char* name, const char* init, - short type, short dup) { + short type, short dodup) { struct option_t* option = mem_calloc (1, sizeof (struct option_t)); debug_print (1, ("adding $%s\n", name)); @@ -1615,7 +1606,7 @@ static struct option_t* add_option (const char* name, const char* init, option->option = str_dup (name); option->type = type; if (init) - option->init = dup ? str_dup (init) : (char*) init; + option->init = dodup ? str_dup (init) : (char*) init; return (option); } @@ -1819,6 +1810,15 @@ static const struct mapping_t* get_sortmap (struct option_t* option) { return (map); } +#define CHECK_PAGER \ + if ((CurrentMenu == MENU_PAGER) && \ + (!option || (option->flags & R_RESORT))) \ + { \ + snprintf (err->data, err->dsize, \ + _("Not available in this menu.")); \ + return (-1); \ + } + static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data, BUFFER * err) { diff --git a/init.h b/init.h index 1966bd0..37e3112 100644 --- a/init.h +++ b/init.h @@ -63,11 +63,11 @@ #define R_RESORT_BOTH (R_RESORT|R_RESORT_SUB) struct option_t { - char *option; + const char *option; short type; short flags; unsigned long data; - char* init; + const char *init; }; #define UL (unsigned long) @@ -122,7 +122,7 @@ struct option_t { # endif #endif -struct option_t MuttVars[] = { +struct option_t const MuttVars[] = { /*++*/ {"abort_noattach", DT_QUAD, R_NONE, OPT_ATTACH, "no" }, /* @@ -4012,10 +4012,9 @@ static int parse_alternates (BUFFER *, BUFFER *, unsigned long, BUFFER *); static int parse_unalternates (BUFFER *, BUFFER *, unsigned long, BUFFER *); struct command_t { - char *name; + const char *name; int (*func) (BUFFER *, BUFFER *, unsigned long, BUFFER *); unsigned long data; - unsigned long data1; }; struct command_t Commands[] = { diff --git a/lib.h b/lib.h index 352ee6e..01ca97b 100644 --- a/lib.h +++ b/lib.h @@ -39,9 +39,6 @@ #define FOREVER while (1) -# ifndef _EXTLIB_C -extern void (*mutt_error) (const char *, ...); -# endif void mutt_exit (int); /* Exit values used in send_msg() */ diff --git a/mapping.h b/mapping.h index 0e9b19e..3872f77 100644 --- a/mapping.h +++ b/mapping.h @@ -11,7 +11,7 @@ #define MAPPING_H struct mapping_t { - char *name; + const char *name; int value; }; diff --git a/mutt.h b/mutt.h index a385f27..e8d53e6 100644 --- a/mutt.h +++ b/mutt.h @@ -334,7 +334,7 @@ enum { OPTFORCENAME, OPTFORWDECODE, OPTFORWQUOTE, -#if USE_HCACHE +#ifdef USE_HCACHE OPTHCACHEVERIFY, #if HAVE_QDBM OPTHCACHECOMPRESS, diff --git a/nntp/newsrc.c b/nntp/newsrc.c index 93f2f30..8e57a10 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -87,7 +87,7 @@ static int nntp_parse_newsrc_line (NNTP_SERVER * news, char *line) nntp_add_to_list (news, data); } else - mem_free ((void **) &data->entries); + mem_free (&data->entries); data->rc = 1; data->entries = mem_calloc (x * 2, sizeof (NEWSRC_ENTRY)); diff --git a/protos.h b/protos.h index 24c6716..0fc9575 100644 --- a/protos.h +++ b/protos.h @@ -230,7 +230,7 @@ int mutt_resend_message (FILE *, CONTEXT *, HEADER *); int _mutt_enter_fname (const char *, char *, size_t, int *, int, int, char ***, int *); #define mutt_get_field(A,B,C,D) _mutt_get_field(A,B,C,D,0,NULL,NULL) -int _mutt_get_field (char *, char *, size_t, int, int, char ***, int *); +int _mutt_get_field (const char *, char *, size_t, int, int, char ***, int *); int mutt_get_field_unbuffered (char *, char *, size_t, int); int mutt_get_hook_type (const char *); int mutt_get_postponed (CONTEXT *, HEADER *, HEADER **, char *, size_t); diff --git a/rfc822.h b/rfc822.h index 0668be1..0c55020 100644 --- a/rfc822.h +++ b/rfc822.h @@ -35,7 +35,6 @@ ADDRESS *rfc822_cpy_adr_real (ADDRESS * addr); ADDRESS *rfc822_append (ADDRESS ** a, ADDRESS * b); void rfc822_write_address (char *, size_t, ADDRESS *, int); void rfc822_write_address_single (char *, size_t, ADDRESS *, int); -void rfc822_free_address (ADDRESS ** addr); void rfc822_cat (char *, size_t, const char *, const char *); extern int RFC822Error; -- 2.20.1