render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
9119d9
From ce9423c4be3408f3d230320ad3326f4b3c40d3c9 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <ce9423c4be3408f3d230320ad3326f4b3c40d3c9@dist-git>
9119d9
From: Pavel Hrdina <phrdina@redhat.com>
9119d9
Date: Fri, 26 Sep 2014 12:43:58 +0200
9119d9
Subject: [PATCH] Fix MinGW build
9119d9
9119d9
When building on mingw the format string for long long/unsigned long
9119d9
long have to be I64d/I64u instead of lld/llu.
9119d9
9119d9
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9119d9
(cherry picked from commit b8b3c56566712757eebd76ac199b69673766226a)
9119d9
9119d9
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1115898
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 examples/object-events/event-test.c | 13 +++++++++++--
9119d9
 1 file changed, 11 insertions(+), 2 deletions(-)
9119d9
9119d9
diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c
9119d9
index 9e09736..faf0cf2 100644
9119d9
--- a/examples/object-events/event-test.c
9119d9
+++ b/examples/object-events/event-test.c
9119d9
@@ -476,6 +476,15 @@ myDomainEventTunableCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
9119d9
     printf("%s EVENT: Domain %s(%d) tunable updated:\n",
9119d9
            __func__, virDomainGetName(dom), virDomainGetID(dom));
9119d9
 
9119d9
+#ifdef WIN32
9119d9
+/* MinGW doesn't know the lld/llu so we have to use I64f/I64u instead. */
9119d9
+# define LLD_FORMAT "%I64d"
9119d9
+# define LLU_FORMAT "%I64u"
9119d9
+#else /* WIN32 */
9119d9
+# define LLD_FORMAT "%lld"
9119d9
+# define LLU_FORMAT "%llu"
9119d9
+#endif /* WIN32 */
9119d9
+
9119d9
     for (i = 0; i < nparams; i++) {
9119d9
         switch (params[i].type) {
9119d9
         case VIR_TYPED_PARAM_INT:
9119d9
@@ -485,10 +494,10 @@ myDomainEventTunableCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
9119d9
             printf("\t%s: %u\n", params[i].field, params[i].value.ui);
9119d9
             break;
9119d9
         case VIR_TYPED_PARAM_LLONG:
9119d9
-            printf("\t%s: %lld\n", params[i].field, params[i].value.l);
9119d9
+            printf("\t%s: " LLD_FORMAT "\n", params[i].field, params[i].value.l);
9119d9
             break;
9119d9
         case VIR_TYPED_PARAM_ULLONG:
9119d9
-            printf("\t%s: %llu\n", params[i].field, params[i].value.ul);
9119d9
+            printf("\t%s: " LLU_FORMAT "\n", params[i].field, params[i].value.ul);
9119d9
             break;
9119d9
         case VIR_TYPED_PARAM_DOUBLE:
9119d9
             printf("\t%s: %g\n", params[i].field, params[i].value.d);
9119d9
-- 
9119d9
2.1.1
9119d9