From 643426e2b2e2dbcf1faffc150893879980ef1f1c Mon Sep 17 00:00:00 2001 From: gabime Date: Sun, 15 Mar 2020 17:20:02 +0200 Subject: [PATCH] Small refactor --- include/spdlog/fmt/bin_to_hex.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/include/spdlog/fmt/bin_to_hex.h b/include/spdlog/fmt/bin_to_hex.h index d004f086..e974cf51 100644 --- a/include/spdlog/fmt/bin_to_hex.h +++ b/include/spdlog/fmt/bin_to_hex.h @@ -80,9 +80,7 @@ namespace fmt { template struct formatter> { - const std::size_t line_size = 100; const char delimiter = ' '; - bool put_newlines = true; bool put_delimiters = true; bool use_uppercase = false; @@ -148,8 +146,8 @@ struct formatter> { if (show_ascii && i != the_range.begin()) { - *inserter++ = ' '; - *inserter++ = ' '; + *inserter++ = delimiter; + *inserter++ = delimiter; for (auto j = start_of_line; j < i; j++) { auto pc = static_cast(*j); @@ -174,23 +172,23 @@ struct formatter> *inserter++ = hex_chars[(ch >> 4) & 0x0f]; *inserter++ = hex_chars[ch & 0x0f]; } - if (show_ascii) + if (show_ascii) // add ascii to last line { if (the_range.end() - the_range.begin() > size_per_line) { auto blank_num = size_per_line - (the_range.end() - start_of_line); while (blank_num-- > 0) { - *inserter++ = ' '; - *inserter++ = ' '; + *inserter++ = delimiter; + *inserter++ = delimiter; if (put_delimiters) { - *inserter++ = ' '; + *inserter++ = delimiter; } } } - *inserter++ = ' '; - *inserter++ = ' '; + *inserter++ = delimiter; + *inserter++ = delimiter; for (auto j = start_of_line; j != the_range.end(); j++) { auto pc = static_cast(*j);