* UTF8CountChars() was not 64-bit safe (and that in a hard to detect way).

* Automatic white space cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36968 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-05-28 18:37:36 +00:00
parent a648cf19fd
commit 598a6d8517

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2004-2008, Haiku, Inc. * Copyright 2004-2010, Haiku, Inc.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _UTF8_FUNCTIONS_H #ifndef _UTF8_FUNCTIONS_H
@ -24,7 +24,7 @@ UTF8NextCharLenUnsafe(const char *text)
do { do {
ptr++; ptr++;
} while (IsInsideGlyph(*ptr)); } while (IsInsideGlyph(*ptr));
return ptr - text; return ptr - text;
} }
@ -43,7 +43,7 @@ static inline uint32
UTF8PreviousCharLen(const char *text, const char *limit) UTF8PreviousCharLen(const char *text, const char *limit)
{ {
const char *ptr = text; const char *ptr = text;
if (ptr == NULL || limit == NULL) if (ptr == NULL || limit == NULL)
return 0; return 0;
@ -52,7 +52,7 @@ UTF8PreviousCharLen(const char *text, const char *limit)
break; break;
ptr--; ptr--;
} while (IsInsideGlyph(*ptr)); } while (IsInsideGlyph(*ptr));
return text - ptr; return text - ptr;
} }
@ -96,7 +96,7 @@ UTF8CountChars(const char *bytes, int32 numBytes)
uint32 length = 0; uint32 length = 0;
const char *last; const char *last;
if (numBytes < 0) if (numBytes < 0)
last = (const char *)UINT_MAX; last = (const char *)SIZE_MAX;
else else
last = bytes + numBytes - 1; last = bytes + numBytes - 1;