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 <pulkomandy@gmail.com>
This commit is contained in:
parent
5bfdd10fb6
commit
647b5a29e9
@ -141,15 +141,17 @@ UTF8CountChars(const char *bytes, int32 numBytes)
|
||||
return 0;
|
||||
|
||||
uint32 length = 0;
|
||||
const char *last;
|
||||
if (numBytes < 0)
|
||||
last = (const char *)SIZE_MAX;
|
||||
else
|
||||
last = bytes + numBytes - 1;
|
||||
|
||||
while (bytes[0] && bytes <= last) {
|
||||
if ((bytes++[0] & 0xc0) != 0x80)
|
||||
length++;
|
||||
if (numBytes < 0) {
|
||||
while (bytes[0]) {
|
||||
if ((bytes++[0] & 0xc0) != 0x80)
|
||||
length++;
|
||||
}
|
||||
} else {
|
||||
const char *last = bytes + numBytes - 1;
|
||||
while (bytes[0] && bytes <= last) {
|
||||
if ((bytes++[0] & 0xc0) != 0x80)
|
||||
length++;
|
||||
}
|
||||
}
|
||||
|
||||
return length;
|
||||
|
Loading…
Reference in New Issue
Block a user