1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:47:45 +00:00

Everywhere: Replace the multiple impls of print_buffer() with :hex-dump

This commit is contained in:
Ali Mohammad Pur 2021-06-17 13:12:58 +04:30 committed by Ali Mohammad Pur
parent 7eda164c25
commit 2fe9c81b30
3 changed files with 6 additions and 37 deletions

View file

@ -91,20 +91,10 @@ static int crc32_tests();
static void print_buffer(ReadonlyBytes buffer, int split)
{
for (size_t i = 0; i < buffer.size(); ++i) {
if (split > 0) {
if (i % split == 0 && i) {
out(" ");
for (size_t j = i - split; j < i; ++j) {
auto ch = buffer[j];
out("{}", ch >= 32 && ch <= 127 ? ch : '.'); // silly hack
}
outln();
}
}
out("{:02x} ", buffer[i]);
}
puts("");
if (split > 0)
out("{:>{}hex-dump}", buffer, split);
else
out("{:hex-dump}", buffer);
}
static Core::EventLoop g_loop;