Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LBoHo-0006h7-HD for qemu-devel@nongnu.org; Sun, 14 Dec 2008 05:33:20 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LBoHm-0006fI-83 for qemu-devel@nongnu.org; Sun, 14 Dec 2008 05:33:20 -0500 Received: from [199.232.76.173] (port=55574 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LBoHm-0006f2-0V for qemu-devel@nongnu.org; Sun, 14 Dec 2008 05:33:18 -0500 Received: from mail.gmx.net ([213.165.64.20]:44810) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1LBoHl-0000B1-Ei for qemu-devel@nongnu.org; Sun, 14 Dec 2008 05:33:17 -0500 Date: Sun, 14 Dec 2008 11:34:43 +0100 (CET) From: Johannes Schindelin Subject: Re: [Qemu-devel] [6023] Use a hex value instead of possibly ambiguous 8 bit character In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel@nongnu.org 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