COMMON: Fix Signed vs. Unsigned GCC Compiler Warnings in Punycode

This commit is contained in:
D G Turner 2023-06-25 15:45:26 +01:00
parent 2182e825bb
commit 231d7ffaee

View file

@ -228,10 +228,10 @@ U32String punycode_decode(const String &src1) {
return src1;
String src(&src1.c_str()[4]); // Skip the prefix for simplification
int srclen = src.size();
uint srclen = src.size();
// Ensure that the input contains only ASCII characters.
for (int si = 0; si < srclen; si++) {
for (uint si = 0; si < srclen; si++) {
if (src[si] & 0x80) {
return src1;
}
@ -266,7 +266,7 @@ U32String punycode_decode(const String &src1) {
bool noncode = false;
// Scan string to the end for illegal characters
for (int i = di + 1; i < srclen; i++) {
for (uint i = di + 1; i < srclen; i++) {
if (!((src[i] >= '0' && src[i] <= '9') || (src[i] >= 'a' && src[i] <= 'z'))) {
noncode = true;
break;
@ -302,7 +302,7 @@ U32String punycode_decode(const String &src1) {
size_t n = INITIAL_N;
size_t bias = INITIAL_BIAS;
for (int si = b + (b > 0 ? 1 : 0); si < srclen; di++) {
for (int si = b + (b > 0 ? 1 : 0); si < (int)srclen; di++) {
size_t org_i = i;
for (size_t w = 1, k = BASE; true; k += BASE) {