+2008-08-15 11:53 -0700 Brendan Cully <brendan@kublai.com> (ff3fbb6a92a8)
+
+ * mutt_sasl.c: Fix type-punning warning in sasl_getprop usage
+
+2008-08-15 11:41 -0700 Brendan Cully <brendan@kublai.com> (622ef570a7e3)
+
+ * ChangeLog, parse.c: Fix a couple of compiler warnings introduced in
+ [00ce81d778bf]. Make the style of mutt_parse_references more
+ pleasing to me.
+
2008-07-10 09:38 -0400 Aron Griffis <agriffis@n01se.net> (d3ee9644765f)
* copy.c: Fix three bugs handling flags in mutt_copy_header
iconv_close (fc->cd);
FREE (_fc); /* __FREE_CHECKED__ */
}
+
+int mutt_check_charset (const char *s, int strict)
+{
+ int i;
+ iconv_t cd;
+
+ if (mutt_is_utf8 (s))
+ return 0;
+
+ if (!strict)
+ for (i = 0; PreferredMIMENames[i].key; i++)
+ {
+ if (ascii_strcasecmp (PreferredMIMENames[i].key, s) == 0 ||
+ ascii_strcasecmp (PreferredMIMENames[i].pref, s) == 0)
+ return 0;
+ }
+
+ if ((cd = mutt_iconv_open (s, s, 0)) != (iconv_t)(-1))
+ {
+ iconv_close (cd);
+ return 0;
+ }
+
+ return -1;
+}
*p = 0;
}
+static int check_charset (struct option_t *opt, const char *val)
+{
+ char *p, *q, *s = safe_strdup (val);
+ int rc = 0, strict = strcmp (opt->option, "send_charset") == 0;
+
+ for (p = strtok_r (s, ":", &q); p; p = strtok_r (NULL, ":", &q))
+ {
+ if (!*p)
+ continue;
+ if (mutt_check_charset (p, strict) < 0)
+ {
+ rc = -1;
+ break;
+ }
+ }
+
+ FREE(&s);
+ return rc;
+}
+
static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
{
int query, unset, inv, reset, r = 0;
myvar = safe_strdup (myvar);
myvar_del (myvar);
}
- else if (DTYPE (MuttVars[idx].type) == DT_ADDR)
- rfc822_free_address ((ADDRESS **) MuttVars[idx].data);
- else
- /* MuttVars[idx].data is already 'char**' (or some 'void**') or...
- * so cast to 'void*' is okay */
- FREE ((void *) MuttVars[idx].data); /* __FREE_CHECKED__ */
mutt_extract_token (tmp, s, 0);
+
if (myvar)
{
myvar_set (myvar, tmp->data);
}
else if (DTYPE (MuttVars[idx].type) == DT_PATH)
{
+ /* MuttVars[idx].data is already 'char**' (or some 'void**') or...
+ * so cast to 'void*' is okay */
+ FREE ((void *) MuttVars[idx].data); /* __FREE_CHECKED__ */
+
strfcpy (scratch, tmp->data, sizeof (scratch));
mutt_expand_path (scratch, sizeof (scratch));
*((char **) MuttVars[idx].data) = safe_strdup (scratch);
}
else if (DTYPE (MuttVars[idx].type) == DT_STR)
{
+ if (strstr (MuttVars[idx].option, "charset") &&
+ check_charset (&MuttVars[idx], tmp->data) < 0)
+ {
+ snprintf (err->data, err->dsize, _("Invalid value for option %s: \"%s\""),
+ MuttVars[idx].option, tmp->data);
+ return (-1);
+ }
+
+ FREE ((void *) MuttVars[idx].data); /* __FREE_CHECKED__ */
*((char **) MuttVars[idx].data) = safe_strdup (tmp->data);
if (mutt_strcmp (MuttVars[idx].option, "charset") == 0)
mutt_set_charset (Charset);
}
else
{
+ rfc822_free_address ((ADDRESS **) MuttVars[idx].data);
*((ADDRESS **) MuttVars[idx].data) = rfc822_parse_adrlist (NULL, tmp->data);
}
}