QObject *obj;
QString *str;
- obj = qobject_from_json(test_cases[i].encoded);
+ obj = qobject_from_json(test_cases[i].encoded, NULL);
str = qobject_to_qstring(obj);
g_assert(str);
g_assert_cmpstr(qstring_get_str(str), ==, test_cases[i].decoded);
QObject *obj;
QString *str;
- obj = qobject_from_json(test_cases[i].encoded);
+ obj = qobject_from_json(test_cases[i].encoded, NULL);
str = qobject_to_qstring(obj);
g_assert(str);
g_assert(strcmp(qstring_get_str(str), test_cases[i].decoded) == 0);
QObject *obj;
QString *str;
- obj = qobject_from_json(test_cases[i].encoded);
+ obj = qobject_from_json(test_cases[i].encoded, NULL);
str = qobject_to_qstring(obj);
g_assert(str);
g_assert(strcmp(qstring_get_str(str), test_cases[i].decoded) == 0);
utf8_in = test_cases[i].utf8_in ?: test_cases[i].utf8_out;
json_out = test_cases[i].json_out ?: test_cases[i].json_in;
- obj = qobject_from_json(json_in);
+ obj = qobject_from_json(json_in, NULL);
if (utf8_out) {
str = qobject_to_qstring(obj);
g_assert(str);
* FIXME Enable once these bugs have been fixed.
*/
if (0 && json_out != json_in) {
- obj = qobject_from_json(json_out);
+ obj = qobject_from_json(json_out, NULL);
str = qobject_to_qstring(obj);
g_assert(str);
g_assert_cmpstr(qstring_get_str(str), ==, utf8_out);
for (i = 0; test_cases[i].encoded; i++) {
QInt *qint;
- qint = qobject_to_qint(qobject_from_json(test_cases[i].encoded));
+ qint = qobject_to_qint(qobject_from_json(test_cases[i].encoded, NULL));
g_assert(qint);
g_assert(qint_get_int(qint) == test_cases[i].decoded);
if (test_cases[i].skip == 0) {
QObject *obj;
QFloat *qfloat;
- obj = qobject_from_json(test_cases[i].encoded);
+ obj = qobject_from_json(test_cases[i].encoded, NULL);
qfloat = qobject_to_qfloat(obj);
g_assert(qfloat);
g_assert(qfloat_get_double(qfloat) == test_cases[i].decoded);
QObject *null;
QString *str;
- obj = qobject_from_json("true");
+ obj = qobject_from_json("true", NULL);
qbool = qobject_to_qbool(obj);
g_assert(qbool);
g_assert(qbool_get_bool(qbool) == true);
QDECREF(qbool);
- obj = qobject_from_json("false");
+ obj = qobject_from_json("false", NULL);
qbool = qobject_to_qbool(obj);
g_assert(qbool);
g_assert(qbool_get_bool(qbool) == false);
g_assert(qbool_get_bool(qbool) == true);
QDECREF(qbool);
- obj = qobject_from_json("null");
+ obj = qobject_from_json("null", NULL);
g_assert(obj != NULL);
g_assert(qobject_type(obj) == QTYPE_QNULL);
QObject *obj;
QString *str;
- obj = qobject_from_json(test_cases[i].encoded);
+ obj = qobject_from_json(test_cases[i].encoded, NULL);
g_assert(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1);
str = qobject_to_json(obj);
qobject_decref(obj);
- obj = qobject_from_json(qstring_get_str(str));
+ obj = qobject_from_json(qstring_get_str(str), NULL);
g_assert(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1);
qobject_decref(obj);
QDECREF(str);
QObject *obj;
gen_test_json(gstr, 10, 100);
- obj = qobject_from_json(gstr->str);
+ obj = qobject_from_json(gstr->str, NULL);
g_assert(obj != NULL);
qobject_decref(obj);
QObject *obj;
QString *str;
- obj = qobject_from_json(test_cases[i].encoded);
+ obj = qobject_from_json(test_cases[i].encoded, NULL);
g_assert(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1);
str = qobject_to_json(obj);
qobject_decref(obj);
- obj = qobject_from_json(qstring_get_str(str));
+ obj = qobject_from_json(qstring_get_str(str), NULL);
g_assert(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1);
qobject_decref(obj);
QDECREF(str);
QObject *obj;
QString *str;
- obj = qobject_from_json(test_cases[i].encoded);
+ obj = qobject_from_json(test_cases[i].encoded, NULL);
g_assert(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1);
str = qobject_to_json(obj);
qobject_decref(obj);
- obj = qobject_from_json(qstring_get_str(str));
+ obj = qobject_from_json(qstring_get_str(str), NULL);
g_assert(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1);
qobject_decref(obj);
{}})),
{}}));
- embedded_obj = qobject_from_json("[32, 42]");
+ embedded_obj = qobject_from_json("[32, 42]", NULL);
g_assert(embedded_obj != NULL);
obj = qobject_from_jsonf("[%d, 2, %p]", 1, embedded_obj);
{
const char *empty = "";
- QObject *obj = qobject_from_json(empty);
+ QObject *obj = qobject_from_json(empty, NULL);
g_assert(obj == NULL);
}
static void unterminated_string(void)
{
- QObject *obj = qobject_from_json("\"abc");
+ QObject *obj = qobject_from_json("\"abc", NULL);
g_assert(obj == NULL);
}
static void unterminated_sq_string(void)
{
- QObject *obj = qobject_from_json("'abc");
+ QObject *obj = qobject_from_json("'abc", NULL);
g_assert(obj == NULL);
}
static void unterminated_escape(void)
{
- QObject *obj = qobject_from_json("\"abc\\\"");
+ QObject *obj = qobject_from_json("\"abc\\\"", NULL);
g_assert(obj == NULL);
}
static void unterminated_array(void)
{
- QObject *obj = qobject_from_json("[32");
+ QObject *obj = qobject_from_json("[32", NULL);
g_assert(obj == NULL);
}
static void unterminated_array_comma(void)
{
- QObject *obj = qobject_from_json("[32,");
+ QObject *obj = qobject_from_json("[32,", NULL);
g_assert(obj == NULL);
}
static void invalid_array_comma(void)
{
- QObject *obj = qobject_from_json("[32,}");
+ QObject *obj = qobject_from_json("[32,}", NULL);
g_assert(obj == NULL);
}
static void unterminated_dict(void)
{
- QObject *obj = qobject_from_json("{'abc':32");
+ QObject *obj = qobject_from_json("{'abc':32", NULL);
g_assert(obj == NULL);
}
static void unterminated_dict_comma(void)
{
- QObject *obj = qobject_from_json("{'abc':32,");
+ QObject *obj = qobject_from_json("{'abc':32,", NULL);
g_assert(obj == NULL);
}
static void invalid_dict_comma(void)
{
- QObject *obj = qobject_from_json("{'abc':32,}");
+ QObject *obj = qobject_from_json("{'abc':32,}", NULL);
g_assert(obj == NULL);
}
static void unterminated_literal(void)
{
- QObject *obj = qobject_from_json("nul");
+ QObject *obj = qobject_from_json("nul", NULL);
g_assert(obj == NULL);
}
char buf[2 * (max_nesting + 1) + 1];
QObject *obj;
- obj = qobject_from_json(make_nest(buf, max_nesting));
+ obj = qobject_from_json(make_nest(buf, max_nesting), NULL);
g_assert(obj != NULL);
qobject_decref(obj);
- obj = qobject_from_json(make_nest(buf, max_nesting + 1));
+ obj = qobject_from_json(make_nest(buf, max_nesting + 1), NULL);
g_assert(obj == NULL);
}