From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>,
Luiz Capitulino <lcapitulino@redhat.com>
Subject: [Qemu-devel] [PATCH] qapi/string-putput-visitor: fix bugs
Date: Wed, 18 Jun 2014 18:37:18 +0300 [thread overview]
Message-ID: <1403105835-25535-1-git-send-email-mst@redhat.com> (raw)
in human mode, we are creating the string:
16-31 (16-31)
instead of
16-17 (10-1f)
because we forgot to pass 'true' as the human parameter on one of the
two calls to format_string.
Also, this is a worsening of quality; previously we would produce
16 (0x10)
to make it obvious which number was hex.
Fix these issues.
Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
qapi/string-output-visitor.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/qapi/string-output-visitor.c b/qapi/string-output-visitor.c
index 8735b00..e9aca3b 100644
--- a/qapi/string-output-visitor.c
+++ b/qapi/string-output-visitor.c
@@ -98,7 +98,7 @@ static void format_string(StringOutputVisitor *sov, Range *r, bool next,
{
if (r->end - r->begin > 1) {
if (human) {
- g_string_append_printf(sov->string, "%" PRIx64 "-%" PRIx64,
+ g_string_append_printf(sov->string, "0x%" PRIx64 "-%" PRIx64,
r->begin, r->end - 1);
} else {
@@ -107,7 +107,7 @@ static void format_string(StringOutputVisitor *sov, Range *r, bool next,
}
} else {
if (human) {
- g_string_append_printf(sov->string, "%" PRIx64, r->begin);
+ g_string_append_printf(sov->string, "0x%" PRIx64, r->begin);
} else {
g_string_append_printf(sov->string, "%" PRId64, r->begin);
}
@@ -186,7 +186,7 @@ static void print_type_int(Visitor *v, int64_t *obj, const char *name,
g_string_append(sov->string, " (");
while (l) {
Range *r = l->data;
- format_string(sov, r, l->next != NULL, false);
+ format_string(sov, r, l->next != NULL, true);
l = l->next;
}
g_string_append(sov->string, ")");
--
MST
next reply other threads:[~2014-06-18 15:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 15:37 Michael S. Tsirkin [this message]
2014-06-18 15:46 ` [Qemu-devel] [PATCH] qapi/string-putput-visitor: fix bugs Eric Blake
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=1403105835-25535-1-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=mdroth@linux.vnet.ibm.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).