aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Weil <weil@mail.berlios.de>2009-06-21 18:35:03 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-06-24 09:09:15 -0500
commit3abcdf4904d695a9501d7886aa0d243cf086c087 (patch)
treee28b4576833d8658b6ead691f143aa6a6835f735
parentffe6370c9f2a596814bf14e472910fe6ef7e001d (diff)
Fix dump output in qemu-io.
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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--qemu-io.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/qemu-io.c b/qemu-io.c
index f0a17b9868..e2a3a1b1fb 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(".");