У меня проблема с сравнением const int ниже.
AK_FORCE_INLINE static int intArrayToCharArray(const int *const source, const int sourceSize,
char *dest, const int destSize) {
// We want to always terminate with a 0 char, so stop one short of the length to make
// sure there is room.
const int destLimit = destSize - 1;
int si = 0;
int di = 0;
while (si < sourceSize && di < destLimit && 0 != source[si]) {
const int codePoint = source[si++];
if (codePoint < 0x7F) { // One byte
dest[di++] = codePoint;
} else if (codePoint < 0x7FF) { // Two bytes
if (di + 1 >= destLimit) break;
dest[di++] = 0xC0 + (codePoint >> 6);
dest[di++] = 0x80 + (codePoint & 0x3F);
} else if (codePoint < 0xFFFF) { // Three bytes
if (di + 2 >= destLimit) break;
dest[di++] = 0xE0 + (codePoint >> 12);
dest[di++] = 0x80 + ((codePoint >> 6) & 0x3F);
dest[di++] = 0x80 + (codePoint & 0x3F);
} else if (codePoint <= 0x1FFFFF) { // Four bytes
if (di + 3 >= destLimit) break;
dest[di++] = 0xF0 + (codePoint >> 18);
dest[di++] = 0x80 + ((codePoint >> 12) & 0x3F);
dest[di++] = 0x80 + ((codePoint >> 6) & 0x3F);
dest[di++] = 0x80 + (codePoint & 0x3F);
} else if (codePoint <= 0x3FFFFFF) { // Five bytes
if (di + 4 >= destLimit) break;
dest[di++] = 0xF8 + (codePoint >> 24);
dest[di++] = 0x80 + ((codePoint >> 18) & 0x3F);
dest[di++] = 0x80 + ((codePoint >> 12) & 0x3F);
dest[di++] = 0x80 + ((codePoint >> 6) & 0x3F);
dest[di++] = codePoint & 0x3F;
} else if (codePoint <= 0x7FFFFFFF) { // Six bytes
if (di + 5 >= destLimit) break;
dest[di++] = 0xFC + (codePoint >> 30);
dest[di++] = 0x80 + ((codePoint >> 24) & 0x3F);
dest[di++] = 0x80 + ((codePoint >> 18) & 0x3F);
dest[di++] = 0x80 + ((codePoint >> 12) & 0x3F);
dest[di++] = 0x80 + ((codePoint >> 6) & 0x3F);
dest[di++] = codePoint & 0x3F;
} else {
// Not a code point... skip.
}
}
dest[di] = 0;
return di;
}
Это не проблема с ndk 16 и ниже.Но когда я поднимаюсь до ndk 17. Это делает ошибку ниже.Показ отладчика Android в строке
else if (codePoint <= 0x7FFFFFFF)
И это ошибка:
Error:(88, 30) error: comparison 'const int' <= 2147483647 is always true [-Werror,-Wtautological-constant-compare]
Спасибо за ваше участие.