* [Qemu-devel] [PATCH] Fix dump output in qemu-io.
@ 2009-06-21 16:35 Stefan Weil
0 siblings, 0 replies; only message in thread
From: Stefan Weil @ 2009-06-21 16:35 UTC (permalink / raw)
To: QEMU Developers
The dump output was not nicely formatted for bytes
larger than 0x7f, because signed values expanded to
sizeof(int) bytes. So for example 0xab did not print
as "ab", but as "ffffffab".
I also cleaned the function prototype, which avoids
new type casts and allows to remove an existing
type cast.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
qemu-io.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/qemu-io.c b/qemu-io.c
index f0a17b9..e2a3a1b 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -54,20 +54,20 @@ static void qemu_io_free(void *p)
}
static void
-dump_buffer(char *buffer, int64_t offset, int len)
+dump_buffer(const void *buffer, int64_t offset, int len)
{
int i, j;
- char *p;
+ const uint8_t *p;
for (i = 0, p = buffer; i < len; i += 16) {
- char *s = p;
+ const uint8_t *s = p;
printf("%08llx: ", (unsigned long long)offset + i);
for (j = 0; j < 16 && i + j < len; j++, p++)
printf("%02x ", *p);
printf(" ");
for (j = 0; j < 16 && i + j < len; j++, s++) {
- if (isalnum((int)*s))
+ if (isalnum(*s))
printf("%c", *s);
else
printf(".");
--
1.5.6.5
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-06-21 16:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-21 16:35 [Qemu-devel] [PATCH] Fix dump output in qemu-io Stefan Weil
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).