From: Blue Swirl <blauwirbel@gmail.com>
To: qemu-devel <qemu-devel@nongnu.org>
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 [thread overview]
Message-ID: <AANLkTikM0BDo_JeSL3SrJdl3jJ11SBLmpOXZn_OR_AoG@mail.gmail.com> (raw)
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
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 other threads:[~2010-05-15 20:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTikM0BDo_JeSL3SrJdl3jJ11SBLmpOXZn_OR_AoG@mail.gmail.com \
--to=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).