qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/3] mingw32: avoid using %hh format which is not kn


From: Blue Swirl
Subject: [Qemu-devel] [PATCH 2/3] mingw32: avoid using %hh format which is not known by the compiler
Date: Sat, 15 May 2010 23:49:28 +0300

Signed-off-by: Blue Swirl <address@hidden>
---
 arch_init.c |   18 ++++++++++++++++++
 sysemu.h    |    4 ++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index cfc03ea..110421b 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -441,10 +441,28 @@ int qemu_uuid_parse(const char *str, uint8_t *uuid)
         return -1;
     }

+#ifndef _WIN32
     ret = sscanf(str, UUID_FMT, &uuid[0], &uuid[1], &uuid[2], &uuid[3],
                  &uuid[4], &uuid[5], &uuid[6], &uuid[7], &uuid[8], &uuid[9],
                  &uuid[10], &uuid[11], &uuid[12], &uuid[13], &uuid[14],
                  &uuid[15]);
+#else
+    {
+        int uuid2[16];
+        unsigned int i;
+
+        ret = sscanf(str, UUID_FMT, &uuid2[0], &uuid2[1], &uuid2[2], &uuid2[3],
+                     &uuid2[4], &uuid2[5], &uuid2[6], &uuid2[7], &uuid2[8],
+                     &uuid2[9], &uuid2[10], &uuid2[11], &uuid2[12], &uuid2[13],
+                     &uuid2[14], &uuid2[15]);
+        if (ret == 16) {
+            for (i = 0; i < ret; i++) {
+                uuid[i] = uuid2[i];
+            }
+        }
+
+    }
+#endif

     if (ret != 16) {
         return -1;
diff --git a/sysemu.h b/sysemu.h
index fa921df..0228e6b 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -22,7 +22,11 @@ extern int vm_running;
 extern const char *qemu_name;
 extern uint8_t qemu_uuid[];
 int qemu_uuid_parse(const char *str, uint8_t *uuid);
+#ifndef _WIN32
 #define UUID_FMT
"%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
+#else
+#define UUID_FMT
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
+#endif

 typedef struct vm_change_state_entry VMChangeStateEntry;
 typedef void VMChangeStateHandler(void *opaque, int running, int reason);
-- 
1.6.2.4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]