Commit 35386dfd authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Mark Brown

spi: spidev_test: Improve decoded text part of hex dump

- Print spaces as spaces,
  - Do not print characters > 126, as they will be shown as garbage
    in the modern UTF-8 era,
  - Use a normal period instead of its hexadecimal ASCII value,
  - Delimit the text part with pipe symbols on both sides (was left side
    only), without any spaces, to make it clear where the decoded text
    starts and ends,
  - Drop a useless comment.
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 3806112c
...@@ -73,12 +73,12 @@ static void hex_dump(const void *src, size_t length, size_t line_size, ...@@ -73,12 +73,12 @@ static void hex_dump(const void *src, size_t length, size_t line_size,
while (i++ % line_size) while (i++ % line_size)
printf("__ "); printf("__ ");
} }
printf(" | "); /* right close */ printf(" |");
while (line < address) { while (line < address) {
c = *line++; c = *line++;
printf("%c", (c < 33 || c == 255) ? 0x2E : c); printf("%c", (c < 32 || c > 126) ? '.' : c);
} }
printf("\n"); printf("|\n");
if (length > 0) if (length > 0)
printf("%s | ", prefix); printf("%s | ", prefix);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment