diff mbox

[2/3] mingw32: avoid using %hh format which is not known by the compiler

Message ID AANLkTikM0BDo_JeSL3SrJdl3jJ11SBLmpOXZn_OR_AoG@mail.gmail.com
State New
Headers show

Commit Message

Blue Swirl May 15, 2010, 8:49 p.m. UTC
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 arch_init.c |   18 ++++++++++++++++++
 sysemu.h    |    4 ++++
 2 files changed, 22 insertions(+), 0 deletions(-)

 typedef struct vm_change_state_entry VMChangeStateEntry;
 typedef void VMChangeStateHandler(void *opaque, int running, int reason);
diff mbox

Patch

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