]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
Fix code and update tests 893/head
authorShane F. Carr <shane@unicode.org>
Thu, 31 Jul 2025 00:40:56 +0000 (17:40 -0700)
committerShane F. Carr <shane@unicode.org>
Thu, 31 Jul 2025 00:40:56 +0000 (17:40 -0700)
json_tokener.c
tests/test_parse.expected

index a6bcbbb403c0c774be30786e93c05bc5d765351a..8412eaeabba989a0f7e8198425800820821aae3a 100644 (file)
@@ -145,8 +145,8 @@ enum json_tokener_error json_tokener_get_error(struct json_tokener *tok)
 }
 
 /* Stuff for decoding unicode sequences */
-#define IS_HIGH_SURROGATE(uc) (((uc)&0xFC00) == 0xD800)
-#define IS_LOW_SURROGATE(uc) (((uc)&0xFC00) == 0xDC00)
+#define IS_HIGH_SURROGATE(uc) (((uc)&0xFFFFFC00) == 0xD800)
+#define IS_LOW_SURROGATE(uc) (((uc)&0xFFFFFC00) == 0xDC00)
 #define DECODE_SURROGATE_PAIR(hi, lo) ((((hi)&0x3FF) << 10) + ((lo)&0x3FF) + 0x10000)
 static unsigned char utf8_replacement_char[3] = {0xEF, 0xBF, 0xBD};
 
index 6f7b8aab6f25b60a2c9e90476711df2ae06a1532..8d3961f51d6dae24262a2d70a4f8af759dad3fa5 100644 (file)
@@ -14,7 +14,7 @@ new_obj.to_string("\ud840")="�"
 new_obj.to_string("\udd27")="�"
 new_obj.to_string([9,'\uDAD)=null
 new_obj.to_string("[9,'\uDAD")=null
-new_obj.to_string("\uD836\uDE87")=""
+new_obj.to_string("\uD836\uDE87")="𝪇"
 new_obj.to_string(null)=null
 new_obj.to_string(NaN)=NaN
 new_obj.to_string(-NaN)=null
@@ -142,7 +142,7 @@ json_tokener_parse_ex(tok, { "foo      ,   6) ... OK: got correct error: continu
 json_tokener_parse_ex(tok, : "bar"}    ,   8) ... OK: got correct error: unexpected character
 json_tokener_parse_ex(tok, "\uD836     ,   7) ... OK: got correct error: continue
 json_tokener_parse_ex(tok, \uDE87      ,   6) ... OK: got correct error: continue
-json_tokener_parse_ex(tok, "           ,   1) ... OK: got object of type [string]: ""
+json_tokener_parse_ex(tok, "           ,   1) ... OK: got object of type [string]: "𝪇"
 json_tokener_parse_ex(tok, { "foo      ,   6) ... OK: got correct error: continue
 json_tokener_parse_ex(tok, ": {"bar    ,   8) ... OK: got correct error: continue
 json_tokener_parse_ex(tok, ":13}}XXXX  ,  10) ... OK: got object of type [object]: { "foo": { "bar": 13 } }