Skip to content

Commit 7974657

Browse files
committed
Fix code and update tests
1 parent dbefb48 commit 7974657

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

json_tokener.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ enum json_tokener_error json_tokener_get_error(struct json_tokener *tok)
145145
}
146146

147147
/* Stuff for decoding unicode sequences */
148-
#define IS_HIGH_SURROGATE(uc) (((uc)&0xFC00) == 0xD800)
149-
#define IS_LOW_SURROGATE(uc) (((uc)&0xFC00) == 0xDC00)
148+
#define IS_HIGH_SURROGATE(uc) (((uc)&0xFFFFFC00) == 0xD800)
149+
#define IS_LOW_SURROGATE(uc) (((uc)&0xFFFFFC00) == 0xDC00)
150150
#define DECODE_SURROGATE_PAIR(hi, lo) ((((hi)&0x3FF) << 10) + ((lo)&0x3FF) + 0x10000)
151151
static unsigned char utf8_replacement_char[3] = {0xEF, 0xBF, 0xBD};
152152

tests/test_parse.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ new_obj.to_string("\ud840")="�"
1414
new_obj.to_string("\udd27")="�"
1515
new_obj.to_string([9,'\uDAD)=null
1616
new_obj.to_string("[9,'\uDAD")=null
17-
new_obj.to_string("\uD836\uDE87")=""
17+
new_obj.to_string("\uD836\uDE87")="𝪇"
1818
new_obj.to_string(null)=null
1919
new_obj.to_string(NaN)=NaN
2020
new_obj.to_string(-NaN)=null
@@ -142,7 +142,7 @@ json_tokener_parse_ex(tok, { "foo , 6) ... OK: got correct error: continu
142142
json_tokener_parse_ex(tok, : "bar"} , 8) ... OK: got correct error: unexpected character
143143
json_tokener_parse_ex(tok, "\uD836 , 7) ... OK: got correct error: continue
144144
json_tokener_parse_ex(tok, \uDE87 , 6) ... OK: got correct error: continue
145-
json_tokener_parse_ex(tok, " , 1) ... OK: got object of type [string]: ""
145+
json_tokener_parse_ex(tok, " , 1) ... OK: got object of type [string]: "𝪇"
146146
json_tokener_parse_ex(tok, { "foo , 6) ... OK: got correct error: continue
147147
json_tokener_parse_ex(tok, ": {"bar , 8) ... OK: got correct error: continue
148148
json_tokener_parse_ex(tok, ":13}}XXXX , 10) ... OK: got object of type [object]: { "foo": { "bar": 13 } }

0 commit comments

Comments
 (0)