From: TAKAHASHI Tamotsu Date: Thu, 1 Jun 2017 20:33:21 +0000 (-0700) Subject: Fix "format string is not a string literal" warnings. (closes #3949) X-Git-Tag: mutt-1-9-rel~64 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cd3b603d9ebf5c305802b33d789ca610141e869b;p=mutt Fix "format string is not a string literal" warnings. (closes #3949) Mutt calls msgfmt with '-c' to verify that translation format strings match, but it is still safer to indirect strings with no formatting through %s. --- diff --git a/crypt-gpgme.c b/crypt-gpgme.c index 0c71c2f6..885509c8 100644 --- a/crypt-gpgme.c +++ b/crypt-gpgme.c @@ -3447,7 +3447,7 @@ static void print_key_info (gpgme_key_t key, FILE *fp) fprintf (fp, _("Key Type ..: %s, %lu bit %s\n"), s2, aval, s); /* L10N: DOTFILL */ - fprintf (fp, _("Key Usage .: ")); + fprintf (fp, "%s", _("Key Usage .: ")); delim = ""; if (key_check_cap (key, KEY_CAP_CAN_ENCRYPT)) @@ -3513,7 +3513,7 @@ static void print_key_info (gpgme_key_t key, FILE *fp) if (s) { /* L10N: DOTFILL */ - fprintf (fp, _("Issued By .: ")); + fprintf (fp, "%s", _("Issued By .: ")); parse_and_print_user_id (fp, s); putc ('\n', fp); } @@ -3598,7 +3598,7 @@ static void print_key_info (gpgme_key_t key, FILE *fp) fprintf (fp, _("Key Type ..: %s, %lu bit %s\n"), "PGP", aval, s); /* L10N: DOTFILL */ - fprintf (fp, _("Key Usage .: ")); + fprintf (fp, "%s", _("Key Usage .: ")); delim = ""; if (subkey->can_encrypt) diff --git a/hook.c b/hook.c index 0cb40344..540d7867 100644 --- a/hook.c +++ b/hook.c @@ -275,7 +275,7 @@ int mutt_parse_unhook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) { if (current_hook_type) { - snprintf (err->data, err->dsize, + snprintf (err->data, err->dsize, "%s", _("unhook: Can't do unhook * from within a hook.")); return -1; } diff --git a/init.c b/init.c index aef6483e..f15a3719 100644 --- a/init.c +++ b/init.c @@ -56,7 +56,7 @@ if ((CurrentMenu == MENU_PAGER) && (idx >= 0) && \ (MuttVars[idx].flags & R_RESORT)) \ { \ - snprintf (err->data, err->dsize, \ + snprintf (err->data, err->dsize, "%s", \ _("Not available in this menu.")); \ return (-1); \ } @@ -524,7 +524,7 @@ static int add_to_replace_list (REPLACE_LIST **list, const char *pat, const char if (t->nmatch > t->rx->rx->re_nsub) { - snprintf (err->data, err->dsize, _("Not enough subexpressions for " + snprintf (err->data, err->dsize, "%s", _("Not enough subexpressions for " "template")); remove_from_replace_list(list, pat); return -1; @@ -2097,13 +2097,13 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) { if (query || unset || inv) { - snprintf (err->data, err->dsize, _("prefix is illegal with reset")); + snprintf (err->data, err->dsize, "%s", _("prefix is illegal with reset")); return (-1); } if (s && *s->dptr == '=') { - snprintf (err->data, err->dsize, _("value is illegal with reset")); + snprintf (err->data, err->dsize, "%s", _("value is illegal with reset")); return (-1); } @@ -2111,7 +2111,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) { if (CurrentMenu == MENU_PAGER) { - snprintf (err->data, err->dsize, _("Not available in this menu.")); + snprintf (err->data, err->dsize, "%s", _("Not available in this menu.")); return (-1); } for (idx = 0; MuttVars[idx].option; idx++) @@ -2138,7 +2138,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) { if (unset || inv || query) { - snprintf (err->data, err->dsize, _("Usage: set variable=yes|no")); + snprintf (err->data, err->dsize, "%s", _("Usage: set variable=yes|no")); return (-1); } @@ -2150,7 +2150,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) unset = 1; else { - snprintf (err->data, err->dsize, _("Usage: set variable=yes|no")); + snprintf (err->data, err->dsize, "%s", _("Usage: set variable=yes|no")); return (-1); } } diff --git a/main.c b/main.c index 0244b2d0..0d3ea522 100644 --- a/main.c +++ b/main.c @@ -699,7 +699,7 @@ int main (int argc, char **argv, char **environ) } printf (_("Debugging at level %d.\n"), debuglevel); #else - printf _("DEBUG was not defined during compilation. Ignored.\n"); + printf ("%s", _("DEBUG was not defined during compilation. Ignored.\n")); #endif break; diff --git a/mutt_ssl.c b/mutt_ssl.c index 2208f685..eacd1556 100644 --- a/mutt_ssl.c +++ b/mutt_ssl.c @@ -727,7 +727,7 @@ static void x509_fingerprint (char *s, int l, X509 * cert, const EVP_MD *(*hashf if (!X509_digest (cert, hashfunc(), md, &n)) { - snprintf (s, l, _("[unable to calculate]")); + snprintf (s, l, "%s", _("[unable to calculate]")); } else { @@ -1194,7 +1194,7 @@ static int interactive_check_cert (X509 *cert, int idx, int len, SSL *ssl, int a x509_get_part (x509_issuer, part[u])); row++; - snprintf (menu->dialog[row++], SHORT_STRING, _("This certificate is valid")); + snprintf (menu->dialog[row++], SHORT_STRING, "%s", _("This certificate is valid")); snprintf (menu->dialog[row++], SHORT_STRING, _(" from %s"), asn1time_to_string (X509_get_notBefore (cert))); snprintf (menu->dialog[row++], SHORT_STRING, _(" to %s"), diff --git a/pattern.c b/pattern.c index 8462e4d1..1729fe3d 100644 --- a/pattern.c +++ b/pattern.c @@ -268,7 +268,7 @@ static int eat_regexp (pattern_t *pat, BUFFER *s, BUFFER *err) } if (!*buf.data) { - snprintf (err->data, err->dsize, _("Empty expression")); + snprintf (err->data, err->dsize, "%s", _("Empty expression")); return (-1); } @@ -588,7 +588,7 @@ static int eat_date (pattern_t *pat, BUFFER *s, BUFFER *err) } if (!*buffer.data) { - snprintf (err->data, err->dsize, _("Empty expression")); + snprintf (err->data, err->dsize, "%s", _("Empty expression")); return (-1); } @@ -931,7 +931,7 @@ pattern_t *mutt_pattern_comp (/* const */ char *s, int flags, BUFFER *err) { if (!*ps.dptr) { - snprintf (err->data, err->dsize, _("missing parameter")); + snprintf (err->data, err->dsize, "%s", _("missing parameter")); mutt_pattern_free (&curlist); return NULL; } diff --git a/pop.c b/pop.c index 8e5d8fea..ecfd8d7c 100644 --- a/pop.c +++ b/pop.c @@ -98,7 +98,7 @@ static int pop_read_header (POP_DATA *pop_data, HEADER *h) pop_data->cmd_top = 0; dprint (1, (debugfile, "pop_read_header: unset TOP capability\n")); - snprintf (pop_data->err_msg, sizeof (pop_data->err_msg), + snprintf (pop_data->err_msg, sizeof (pop_data->err_msg), "%s", _("Command TOP is not supported by server.")); } } @@ -272,7 +272,7 @@ static int pop_fetch_headers (CONTEXT *ctx) pop_data->cmd_uidl = 0; dprint (1, (debugfile, "pop_fetch_headers: unset UIDL capability\n")); - snprintf (pop_data->err_msg, sizeof (pop_data->err_msg), + snprintf (pop_data->err_msg, sizeof (pop_data->err_msg), "%s", _("Command UIDL is not supported by server.")); } } diff --git a/pop_auth.c b/pop_auth.c index f0794104..e3fb51dd 100644 --- a/pop_auth.c +++ b/pop_auth.c @@ -274,7 +274,7 @@ static pop_auth_res_t pop_auth_user (POP_DATA *pop_data, const char *method) pop_data->cmd_user = 0; dprint (1, (debugfile, "pop_auth_user: unset USER capability\n")); - snprintf (pop_data->err_msg, sizeof (pop_data->err_msg), + snprintf (pop_data->err_msg, sizeof (pop_data->err_msg), "%s", _("Command USER is not supported by server.")); } }