From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MIQ0g-0004MK-9Q for qemu-devel@nongnu.org; Sun, 21 Jun 2009 12:35:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MIQ0a-0004Lo-QS for qemu-devel@nongnu.org; Sun, 21 Jun 2009 12:35:12 -0400 Received: from [199.232.76.173] (port=43098 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MIQ0a-0004Ll-Lr for qemu-devel@nongnu.org; Sun, 21 Jun 2009 12:35:08 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:58578) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MIQ0a-0005Qr-0H for qemu-devel@nongnu.org; Sun, 21 Jun 2009 12:35:08 -0400 From: Stefan Weil Date: Sun, 21 Jun 2009 18:35:03 +0200 Message-Id: <1245602103-6983-1-git-send-email-weil@mail.berlios.de> Subject: [Qemu-devel] [PATCH] Fix dump output in qemu-io. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 --- 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