summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2024-10-07 21:27:29 -0400
committerHiroshi SHIBATA <[email protected]>2024-10-08 14:10:05 +0900
commitea9d34082f8a5011377c61e8eb5c21c51fbfd4a8 (patch)
tree43b12069caf91d02b34bd60791bea1945b28e7f2
parent934d67b4159f9a5febcccec782714cc12e0983f3 (diff)
[ruby/json] Fix compilation warning
``` generator.c:69:27: warning: comparison of integers of different signs: 'short' and 'unsigned long' [-Wsign-compare] for (i = 1; i < ch_len; i++) { ``` https://github.com/ruby/json/commit/ff8edcd47c
-rw-r--r--ext/json/generator/generator.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/json/generator/generator.c b/ext/json/generator/generator.c
index 48badb3126..fdada2df9d 100644
--- a/ext/json/generator/generator.c
+++ b/ext/json/generator/generator.c
@@ -55,7 +55,7 @@ static void convert_UTF8_to_JSON(FBuffer *out_buffer, VALUE in_string, bool out_
ch = in_utf8_str[pos];
ch_len = 1;
} else {
- short i;
+ unsigned long i;
if ((in_utf8_str[pos] & 0x80) == 0x00) { ch_len = 1; ch = in_utf8_str[pos]; } /* leading 1 bit is 0b0 */
else if ((in_utf8_str[pos] & 0xE0) == 0xC0) { ch_len = 2; ch = in_utf8_str[pos] & 0x1F; } /* leading 3 bits are 0b110 */
else if ((in_utf8_str[pos] & 0xF0) == 0xE0) { ch_len = 3; ch = in_utf8_str[pos] & 0x0F; } /* leading 4 bits are 0b1110 */