mirror of
https://github.com/kgabis/parson.git
synced 2025-02-05 17:05:29 +00:00
Not parsing strings in json_value_init_string and *{set,dotset,replace,append}_string functions.
This commit is contained in:
parent
0d5ac45286
commit
4a4cf7d795
8
parson.c
8
parson.c
@ -972,13 +972,13 @@ JSON_Value * json_value_init_array(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JSON_Value * json_value_init_string(const char *string) {
|
JSON_Value * json_value_init_string(const char *string) {
|
||||||
char *processed_copy = NULL;
|
char *copy = NULL;
|
||||||
if (string == NULL)
|
if (string == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
processed_copy = process_string(string, strlen(string));
|
copy = parson_strdup(string);
|
||||||
if (processed_copy == NULL)
|
if (copy == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
return json_value_init_string_no_copy(processed_copy);
|
return json_value_init_string_no_copy(copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSON_Value * json_value_init_number(double number) {
|
JSON_Value * json_value_init_number(double number) {
|
||||||
|
5
tests.c
5
tests.c
@ -264,9 +264,10 @@ void test_suite_5(void) {
|
|||||||
TEST(json_object_dotset_string(obj, "favorites.sport", "running") == JSONSuccess);
|
TEST(json_object_dotset_string(obj, "favorites.sport", "running") == JSONSuccess);
|
||||||
TEST(json_object_dotset_string(obj, "favorites.fruit", "apple") == JSONSuccess);
|
TEST(json_object_dotset_string(obj, "favorites.fruit", "apple") == JSONSuccess);
|
||||||
TEST(json_object_dotremove(obj, "favorites.fruit") == JSONSuccess);
|
TEST(json_object_dotremove(obj, "favorites.fruit") == JSONSuccess);
|
||||||
TEST(json_object_set_string(obj, "utf string", "\\u006corem\\u0020ipsum") == JSONSuccess);
|
TEST(json_object_set_string(obj, "utf string", "lorem ipsum") == JSONSuccess);
|
||||||
TEST(json_object_set_string(obj, "utf-8 string", "あいうえお") == JSONSuccess);
|
TEST(json_object_set_string(obj, "utf-8 string", "あいうえお") == JSONSuccess);
|
||||||
TEST(json_object_set_string(obj, "surrogate string", "lorem\\uD834\\uDD1Eipsum\\uD834\\uDF67lorem") == JSONSuccess);
|
TEST(json_object_set_string(obj, "surrogate string", "lorem𝄞ipsum𝍧lorem") == JSONSuccess);
|
||||||
|
TEST(json_object_set_string(obj, "windows path", "C:\\Windows\\Path") == JSONSuccess);
|
||||||
TEST(json_value_equals(val_from_file, val));
|
TEST(json_value_equals(val_from_file, val));
|
||||||
|
|
||||||
TEST(json_object_set_string(obj, NULL, "") == JSONFailure);
|
TEST(json_object_set_string(obj, NULL, "") == JSONFailure);
|
||||||
|
@ -10,5 +10,6 @@
|
|||||||
},
|
},
|
||||||
"utf string" : "\u006corem\u0020ipsum",
|
"utf string" : "\u006corem\u0020ipsum",
|
||||||
"utf-8 string": "あいうえお",
|
"utf-8 string": "あいうえお",
|
||||||
"surrogate string": "lorem\uD834\uDD1Eipsum\uD834\uDF67lorem"
|
"surrogate string": "lorem\uD834\uDD1Eipsum\uD834\uDF67lorem",
|
||||||
|
"windows path": "C:\\Windows\\Path"
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user