qemu-devel
[Top][All Lists]
Advanced

[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: Johannes Schindelin
Subject: Re: [Qemu-devel] [6023] Use a hex value instead of possibly ambiguous 8 bit character
Date: Sun, 14 Dec 2008 11:34:43 +0100 (CET)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

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.

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).

Ciao,
Dscho





reply via email to

[Prev in Thread] Current Thread [Next in Thread]