[MPlayer-dev-eng] [PATCH] fix compile with clang r150242

Ivan Kalvachev ikalvachev at gmail.com
Mon Feb 27 20:58:02 CET 2012


On 2/27/12, Diego Biurrun <diego at biurrun.de> wrote:
> On Sat, Feb 25, 2012 at 11:48:45PM +0200, Ivan Kalvachev wrote:
>> On 2/25/12, Nicolas George <nicolas.george at normalesup.org> wrote:
>> > Le sextidi 6 ventôse, an CCXX, compn a écrit :
>> >> sub/sub_cc.c:68:19: error: illegal character encoding in character
>> >> literal
>> >>   chartbl[0x2a] = 'á';
>> >
>> > As a matter of curiosity: what compiler and environment?
>> >
>> >> --- sub/sub_cc.c	(revision 34760)
>> >> +++ sub/sub_cc.c	(working copy)
>> >> @@ -65,16 +65,16 @@
>> >>    for (i = 0; i < 128; i++)
>> >>      chartbl[i] = (char) i;
>> >>    /* now the special codes */
>> >> -  chartbl[0x2a] = 'á';
>> >> -  chartbl[0x5c] = 'é';
>> >> -  chartbl[0x5e] = 'í';
>> >> -  chartbl[0x5f] = 'ó';
>> >> -  chartbl[0x60] = 'ú';
>> >> -  chartbl[0x7b] = 'ç';
>> >> -  chartbl[0x7c] = '÷';
>> >> -  chartbl[0x7d] = 'Ñ';
>> >> -  chartbl[0x7e] = 'ñ';
>> >> -  chartbl[0x7f] = '¤';    /* FIXME: this should be a solid block */
>> >> +  chartbl[0x2a] = 0xe1;
>> >> +  chartbl[0x5c] = 0xe9;
>> >> +  chartbl[0x5e] = 0xed;
>> >> +  chartbl[0x5f] = 0xf3;
>> >> +  chartbl[0x60] = 0xfa;
>> >> +  chartbl[0x7b] = 0xe7;
>> >> +  chartbl[0x7c] = 0xf7;
>> >> +  chartbl[0x7d] = 0xd1;
>> >> +  chartbl[0x7e] = 0xf1;
>> >> +  chartbl[0x7f] = 0xa4;    /* FIXME: this should be a solid block */
>> >>  }
>> >
>> > Assuming the original code was right and supposed to be ISO-8859-1, the
>> > change seems fine. I would like it even better with:
>> >
>> > +  chartbl[0x2a] = 0xe1; /* á */
>> > +  chartbl[0x5c] = 0xe9; /* é */
>> > +  chartbl[0x5e] = 0xed; /* í */
>> > +  chartbl[0x5f] = 0xf3; /* ó */
>> > +  chartbl[0x60] = 0xfa; /* ú */
>> > +  chartbl[0x7b] = 0xe7; /* ç */
>> > +  chartbl[0x7c] = 0xf7; /* ÷ */
>> > +  chartbl[0x7d] = 0xd1; /* Ñ */
>> > +  chartbl[0x7e] = 0xf1; /* ñ */
>> > +  chartbl[0x7f] = 0xa4; /* ¤ FIXME: this should be a solid block */
>> >
>> > The compiler should not choke on non-ASCII in comments.
>>
>> We are better without them.
>> They could still cause issues, when viewing/editing the file on UTF-8
>> locale.
>
> Just make the characters UTF-8.

Then it would break on all single-byte codepage locales. The utf8
sequence would be interpreted as multiple characters, that is not
allowed in a literal.


More information about the MPlayer-dev-eng mailing list