[fnd] Fix/Enhance fnd::SimpleTextOutput::hxdStyleDump().

This commit is contained in:
jakcron 2018-04-25 19:36:21 +08:00
parent 7e81d04fac
commit 167a343937

View file

@ -6,6 +6,7 @@ void fnd::SimpleTextOutput::hxdStyleDump(const byte_t* data, size_t len, size_t
// iterate over blocks
for (size_t i = 0; i < (len / row_len); i++)
{
printf("%08" PRIx64 " | ", i*row_len);
// for block i print each byte
for (size_t j = 0; j < row_len; j++)
{
@ -22,6 +23,32 @@ void fnd::SimpleTextOutput::hxdStyleDump(const byte_t* data, size_t len, size_t
}
printf("\n");
}
if ((len % row_len) > 0)
{
size_t i = (len / row_len);
printf("%08" PRIx64 " | ", i * row_len);
// for block i print each byte
for (size_t j = 0; j < row_len; j++)
{
if (j < (len % row_len))
printf("%02X", data[(i * row_len) + j]);
else
printf(" ");
if (((j+1) % byte_grouping_size) == 0)
{
putchar(' ');
}
}
printf(" ");
for (size_t j = 0; j < row_len; j++)
{
if (j < (len % row_len))
printf("%c", isalnum(data[(i * row_len) + j]) ? data[(i * row_len) + j] : '.');
else
printf(" ");
}
printf("\n");
}
}
void fnd::SimpleTextOutput::hxdStyleDump(const byte_t* data, size_t len)