From: "Blue Swirl" <blauwirbel@gmail.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: qemu-devel@nongnu.org
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 [thread overview]
Message-ID: <f43fc5580812140241u14b1438fjef02000effbbc9fc@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.1.00.0812141118020.2014@eeepc-johanness>
On 12/14/08, Johannes Schindelin <Johannes.Schindelin@gmx.de> 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 :)
next prev parent reply other threads:[~2008-12-14 10:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-14 9:30 [Qemu-devel] [6023] Use a hex value instead of possibly ambiguous 8 bit character Blue Swirl
2008-12-14 10:34 ` Johannes Schindelin
2008-12-14 10:41 ` Blue Swirl [this message]
2008-12-14 10:54 ` Johannes Schindelin
2008-12-14 11:11 ` Andreas Schwab
2008-12-14 11:23 ` Johannes Schindelin
2008-12-14 11:45 ` Erik de Castro Lopo
2008-12-14 12:00 ` Johannes Schindelin
2008-12-14 17:16 ` Jamie Lokier
2008-12-14 16:10 ` M. Warner Losh
2008-12-14 12:15 ` Blue Swirl
2008-12-14 12:09 ` Blue Swirl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f43fc5580812140241u14b1438fjef02000effbbc9fc@mail.gmail.com \
--to=blauwirbel@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).