]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
Adjust the "-Infinity" fix on the json-c-0.12 branch to match the master branch.
authorEric Haszlakiewicz <erh+git@nimenees.com>
Mon, 27 Nov 2017 04:31:00 +0000 (23:31 -0500)
committerEric Haszlakiewicz <erh+git@nimenees.com>
Mon, 27 Nov 2017 04:31:00 +0000 (23:31 -0500)
json_tokener.c
tests/test_parse.c
tests/test_parse.expected

index 0d38fc1d29e0cba27e2354fa015e33cdfabb446d..b57c303b24bec4366e787a1d988faefbc939b221 100644 (file)
@@ -337,7 +337,6 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
        state = json_tokener_state_number;
        printbuf_reset(tok->pb);
        tok->is_double = 0;
-        tok->st_pos = 0;
        goto redo_char;
       default:
        tok->err = json_tokener_error_parse_unexpected;
@@ -686,6 +685,7 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
            (c == 'i' || c == 'I'))
        {
                state = json_tokener_state_inf;
+               tok->st_pos = 0;
                goto redo_char;
        }
       }
index f6b5c03e87c199e67d58992c5c8401b4f336596b..5cfa6bbce5c153c80b8c1736153e2950d8982697 100644 (file)
@@ -79,6 +79,10 @@ static void test_basic_parse()
        printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
        json_object_put(new_obj);
 
+       new_obj = json_tokener_parse("{ \"min\": Infinity, \"max\": -Infinity}");
+       printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
+       json_object_put(new_obj);
+
        new_obj = json_tokener_parse("True");
        printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
        json_object_put(new_obj);
index b8badda5da5ce8095b057f7b9cd5f6255f9dc7e8..e8a87d72f822ca4ab6e921e5f43b8ac693e81392 100644 (file)
@@ -11,6 +11,7 @@ new_obj.to_string()=Infinity
 new_obj.to_string()=Infinity
 new_obj.to_string()=-Infinity
 new_obj.to_string()=-Infinity
+new_obj.to_string()={ "min": Infinity, "max": -Infinity }
 new_obj.to_string()=true
 new_obj.to_string()=12
 new_obj.to_string()=12.3