[Spice-devel] [PATCH libcacard 2/3] tests: fix size_t printf format error
marcandre.lureau at redhat.com
marcandre.lureau at redhat.com
Wed Aug 8 11:21:36 UTC 2018
From: Marc-André Lureau <marcandre.lureau at redhat.com>
With mingw build, the compiler complains:
../tests/libcacard.c:174:17: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t {aka long long unsigned int}' [-Werror=format=]
(in theory, -D__USE_MINGW_ANSI_STDIO=1 should help to use %zu, but
that doesn't work for some reason)
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
tests/common.c | 6 +++---
tests/libcacard.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/common.c b/tests/common.c
index d222c6e..21d1f21 100644
--- a/tests/common.c
+++ b/tests/common.c
@@ -143,7 +143,7 @@ void get_properties_coid(VReader *reader, const unsigned char coid[2],
g_debug("The generated SimpleTLV can not be parsed");
g_assert_not_reached();
}
- g_debug("Tag: 0x%02x, Len: %lu", tag, vlen);
+ g_debug("Tag: 0x%02x, Len: %" G_GSIZE_FORMAT, tag, vlen);
g_assert_cmpint(vlen, <=, p_end - p);
switch (tag) {
@@ -175,7 +175,7 @@ void get_properties_coid(VReader *reader, const unsigned char coid[2],
g_assert_not_reached();
}
g_assert_cmpint(vlen2, <=, p2_end - p2);
- g_debug(" Tag: 0x%02x, Len: %lu", tag2, vlen2);
+ g_debug(" Tag: 0x%02x, Len: %" G_GSIZE_FORMAT, tag2, vlen2);
switch (tag2) {
case 0x41: /* Object ID */
@@ -388,7 +388,7 @@ void read_buffer(VReader *reader, uint8_t type, int object_type)
g_debug("The generated SimpleTLV can not be parsed");
g_assert_not_reached();
}
- g_debug("Tag: 0x%02x, Len: %lu", tag, vlen);
+ g_debug("Tag: 0x%02x, Len: %" G_GSIZE_FORMAT, tag, vlen);
switch (tag) {
case 0xF3: /* CardURL from CCC */
diff --git a/tests/libcacard.c b/tests/libcacard.c
index 5acb15c..a70f5be 100644
--- a/tests/libcacard.c
+++ b/tests/libcacard.c
@@ -171,7 +171,7 @@ static void parse_acr(uint8_t *buf, int buflen)
g_assert_not_reached();
}
g_assert_cmpint(vlen, <=, p_end - p);
- g_debug("Tag: 0x%02x, Len: %lu", tag, vlen);
+ g_debug("Tag: 0x%02x, Len: %" G_GSIZE_FORMAT, tag, vlen);
switch (tag) {
case 0x01: /* Applet Information */
g_assert_cmpint(vlen, ==, 5);
--
2.18.0.547.g1d89318c48
More information about the Spice-devel
mailing list