Re: mutt Bug #2802 - stupid usage of strcat (fwd)
On Monday, 12 March 2007 at 18:49, Thomas Roessler wrote:
> On 2007-03-12 10:05:40 -0700, Brendan Cully wrote:
>
> > These patches look sane to me. I've applied them.
>
> Mostly... Some comments below.
>
>
> > > + if (!ascii_strcasecmp (name, "utf-8")) {
> > > + strfcpy (dest, name, dlen);
> > > + goto found_utf8;
> > > + }
> > > +
> > > /* catch some common iso-8859-something misspellings */
> > > if (!ascii_strncasecmp (name, "8859", 4) && name[4] != '-')
> > > snprintf (scratch, sizeof (scratch), "iso-8859-%s", name +4);
> > > @@ -267,6 +272,7 @@ void mutt_canonical_charset (char *dest,
> > >
> > > strfcpy (dest, scratch, dlen);
> > >
> > > +found_utf8:
> > > /* for cosmetics' sake, transform to lowercase. */
> > > for (p = dest; *p; p++)
> > > *p = ascii_tolower (*p);
>
> The "goto found_utf8" strikes me as, well, nasty. Why not just
> strfcpy "utf-8" (in the right case), and return?
>
> The rest makes sense.
Thanks for cleaning that up.