Fix deleted line return

For some reason, `isprint()` claims that `0xff` is printable. But it's used by print functions as a magic value to suppress the line return.
So when viewing a dump where the last byte of a block/sector is `0xff`, it was suppressing the new line between blocks/sectors.

Signed-off-by: Jean-Michel Picod <jmichel.p@gmail.com>
This commit is contained in:
Jean-Michel Picod 2024-10-01 08:29:27 +02:00 committed by GitHub
commit eb0d92ea98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -529,7 +529,7 @@ char *sprint_hex_ascii(const uint8_t *data, const size_t len) {
while (i < max_len) { while (i < max_len) {
unsigned char c = (unsigned char)data[i]; unsigned char c = (unsigned char)data[i];
tmp[pos + i] = isprint(c) ? c : '.'; tmp[pos + i] = (isprint(c) && c != 0xff) ? c : '.';
++i; ++i;
} }
out: out:
@ -546,7 +546,7 @@ char *sprint_ascii_ex(const uint8_t *data, const size_t len, const size_t min_st
while (i < max_len) { while (i < max_len) {
unsigned char c = (unsigned char)data[i]; unsigned char c = (unsigned char)data[i];
tmp[i] = isprint(c) ? c : '.'; tmp[i] = (isprint(c) && c != 0xff) ? c : '.';
++i; ++i;
} }