utf8_functions.h: Fix PVS 359

Fix integer constant SIZE_MAX is converted to pointer.

Change-Id: Ifdff4e08a9b2c31e466580ba9a71f6ea7c0191d4
Reviewed-on: https://review.haiku-os.org/c/865
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Murai Takashi
2019-01-09 17:44:19 +00:00
committed by waddlesplash
parent 5bfdd10fb6
commit 647b5a29e9
+11 -9
View File
@@ -141,15 +141,17 @@ UTF8CountChars(const char *bytes, int32 numBytes)
return 0; return 0;
uint32 length = 0; uint32 length = 0;
const char *last; if (numBytes < 0) {
if (numBytes < 0) while (bytes[0]) {
last = (const char *)SIZE_MAX; if ((bytes++[0] & 0xc0) != 0x80)
else length++;
last = bytes + numBytes - 1; }
} else {
while (bytes[0] && bytes <= last) { const char *last = bytes + numBytes - 1;
if ((bytes++[0] & 0xc0) != 0x80) while (bytes[0] && bytes <= last) {
length++; if ((bytes++[0] & 0xc0) != 0x80)
length++;
}
} }
return length; return length;