tests: Avoid qobject_from_jsonf("%"PRId64)
authorEric Blake <eblake@redhat.com>
Wed, 23 Nov 2016 17:36:56 +0000 (11:36 -0600)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 5 Dec 2016 16:09:34 +0000 (17:09 +0100)
commit29a6731afb20707ab0c1f9be997bef74cef34665
tree2d928d983c8fab335a43a39a530de991f261633d
parent1792d7d0a2dc18496e8fc52906163f9f73f3d931
tests: Avoid qobject_from_jsonf("%"PRId64)

The qobject_from_jsonf() function implements a pseudo-printf
language for creating a QObject; however, it is hard-coded to
only parse a subset of formats understood by -Wformat, and is
not a straight synonym to bare printf().  In particular, any
use of an int64_t integer works only if the system's
definition of PRId64 matches what the parser expects; which
works on glibc (%lld or %ld depending on 32- vs. 64-bit) and
mingw (%I64d), but not on Mac OS (%qd).  Rather than enhance
the parser, it is just as easy to force the use of int (where
the value is small enough) or long long instead of int64_t,
which we know always works.

This should cover all remaining testsuite uses of
qobject_from_json[fv]() that were trying to rely on PRId64,
although my proof for that was done by adding in asserts and
checking that 'make check' still passed, where such asserts
are inappropriate during hard freeze.  A later series in 2.9
may remove all dynamic JSON parsing, but that's a bigger task.

Reported by: G 3 <programmingkidx@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1479922617-4400-4-git-send-email-eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Rename value64 to value_ll]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
tests/check-qjson.c
tests/test-qobject-input-visitor.c