Re: [PATCH] Use FIX_UTF8_MAC to enable conversion from UTF8-MAC to UTF8
- From
Nicolas Pitre <nico@cam.org>
- Date
- Jan 22, 2008, 14:21 UTC
- Message-ID
- <alpine.LFD.1.00.0801220917310.20753@xanadu.home>
- In-Reply-To
- <alpine.LFD.1.00.0801212025050.2957@woody.linux-foundation.org>
On Mon, 21 Jan 2008, Linus Torvalds wrote:
Show 17 quoted lines
> First off, the common case is that the filename likely has everything in
> plain 7-bit ascii. So rather than re-encoding by default, the first thing
> to do is to just see if it even needs re-encoding. Even if it's as simple
> as saying "does it have any high bits at all", that's going to be a *huge*
> performance win.
>
> So start off with something like
>
> int is_usascii(const char *p)
> {
> char c;
>
> do {
> c = *p++;
> } while (c > 0);
> return !c;
> }You need to use "signed char" here. On ARM a char is unsigned by default. That's the case on some other systems too.
Nicolas