[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [6023] Use a hex value instead of possibly ambiguous 8
From: |
Blue Swirl |
Subject: |
Re: [Qemu-devel] [6023] Use a hex value instead of possibly ambiguous 8 bit character |
Date: |
Sun, 14 Dec 2008 12:41:11 +0200 |
On 12/14/08, Johannes Schindelin <address@hidden> wrote:
> Hi,
>
>
> On Sun, 14 Dec 2008, Blue Swirl wrote:
>
> > Revision: 6023
> > http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6023
> > Author: blueswir1
> > Date: 2008-12-14 09:30:41 +0000 (Sun, 14 Dec 2008)
> >
> > Log Message:
> > -----------
> > Use a hex value instead of possibly ambiguous 8 bit character
>
>
> /me is curious: how could buffer[j] = '\xb0' be ambiguous when buffer is
> of type char *? It's not as if C did UTF-8 conversion with chars.
The diff does not show it properly, there was a 8 bit character
between the apostrophes, not \xb0. One day some compiler might want to
parse the source text as UTF-8, then byte B0 and apostrophe after it
could decode to something different with mysterious side effects. 0xb0
will not ever cause these problems, '\xb0' could work too.
> Besides...
>
>
> > @@ -1249,7 +1249,7 @@
> > unsigned char* c=(unsigned char*)direntry;
> > int i;
> > for(i=1;i<11 && c[i] && c[i]!=0xff;i+=2)
> > -#define ADD_CHAR(c) {buffer[j] = (c); if (buffer[j] < ' ') buffer[j] =
> '\xB0'; j++;}
> > +#define ADD_CHAR(c) {buffer[j] = (c); if (buffer[j] < ' ') buffer[j] =
> 0xb0; j++;}
>
>
> in the meantime I think it would be more readable as
>
> #define ADD_CHAR(c) buffer[j++] = (c) < ' ' ? '\xb0' : 'c';
>
> Note that
>
> - this code is only ever reached when DEBUG is defined, and
>
> - this code still assumes that your terminal is ISO-8859-1, which is
> typically wrong these days (UTF-8 is the de-facto standard).
Patches welcome :)
- [Qemu-devel] [6023] Use a hex value instead of possibly ambiguous 8 bit character, Blue Swirl, 2008/12/14
- Re: [Qemu-devel] [6023] Use a hex value instead of possibly ambiguous 8 bit character, Johannes Schindelin, 2008/12/14
- Re: [Qemu-devel] [6023] Use a hex value instead of possibly ambiguous 8 bit character,
Blue Swirl <=
- Re: [Qemu-devel] [6023] Use a hex value instead of possibly ambiguous 8 bit character, Johannes Schindelin, 2008/12/14
- Re: [Qemu-devel] [6023] Use a hex value instead of possibly ambiguous 8 bit character, Andreas Schwab, 2008/12/14
- Re: [Qemu-devel] [6023] Use a hex value instead of possibly ambiguous 8 bit character, Johannes Schindelin, 2008/12/14
- Re: [Qemu-devel] [6023] Use a hex value instead of possibly ambiguous 8 bit character, Erik de Castro Lopo, 2008/12/14
- Re: [Qemu-devel] [6023] Use a hex value instead of possibly ambiguous 8 bit character, Johannes Schindelin, 2008/12/14
- Re: [Qemu-devel] [6023] Use a hex value instead of possibly ambiguous 8 bit character, Jamie Lokier, 2008/12/14
- Re: [Qemu-devel] [6023] Use a hex value instead of possibly ambiguous 8 bit character, M. Warner Losh, 2008/12/14
- Re: [Qemu-devel] [6023] Use a hex value instead of possibly ambiguous 8 bit character, Blue Swirl, 2008/12/14
- Re: [Qemu-devel] [6023] Use a hex value instead of possibly ambiguous 8 bit character, Blue Swirl, 2008/12/14