From 5aa5261dda74baa2c866b698ba47005f521bbe0c Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Tue, 3 Sep 2024 09:26:38 +0200 Subject: [PATCH] debug_dump: improved printout - use 'h' suffix when len printed in hexa - for missing bytes at the end (not aligned to 16 B) print 2 spaces instead of 1, because it stands for 2 nibbles. Otherwise the ASCII representation would be moved left (the muber of chars didn't match). --- src/debug.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index 04bb81a02..dc0836fa5 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -183,7 +183,7 @@ void debug_dump(const void *lp, int len) char Buff[81]; char tmpBuf[10]; - _dprintf("Dump of %d=%x bytes\n", len, len); + _dprintf("Dump of %d=%xh bytes\n", len, len); start = 0L; while (start < len) { /* start line with pointer position key */ @@ -196,7 +196,7 @@ void debug_dump(const void *lp, int len) snprintf(tmpBuf, sizeof tmpBuf, "%02X", ((int)(*p) & 0xFF)); strcat(Buff, tmpBuf); } else - strcat(Buff, " "); + strcat(Buff, " "); if (j % 2 == 1) /* space between groups of 2 */ strcat(Buff, " "); if (j == 7) /* space between groups of 8 */