Skip to content

Commit b46b6dc

Browse files
committed
Fixed bin_to_hex tidy warnings
1 parent 08a9604 commit b46b6dc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

include/spdlog/bin_to_hex.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class dump_info {
5151
// do not use begin() and end() to avoid collision with fmt/ranges
5252
It get_begin() const { return begin_; }
5353
It get_end() const { return end_; }
54-
size_t size_per_line() const { return size_per_line_; }
54+
[[nodiscard]] size_t size_per_line() const { return size_per_line_; }
5555

5656
private:
5757
It begin_, end_;
@@ -90,7 +90,7 @@ inline details::dump_info<It> to_hex(const It range_begin, const It range_end, s
9090

9191
template <typename T>
9292
struct fmt::formatter<spdlog::details::dump_info<T>, char> {
93-
const char delimiter = ' ';
93+
char delimiter = ' ';
9494
bool put_newlines = true;
9595
bool put_delimiters = true;
9696
bool use_uppercase = false;
@@ -138,14 +138,14 @@ struct fmt::formatter<spdlog::details::dump_info<T>, char> {
138138
auto inserter = ctx.out();
139139
int size_per_line = static_cast<int>(the_range.size_per_line());
140140
auto start_of_line = the_range.get_begin();
141-
for (auto i = the_range.get_begin(); i != the_range.get_end(); i++) {
141+
for (auto i = the_range.get_begin(); i != the_range.get_end(); ++i) {
142142
auto ch = static_cast<unsigned char>(*i);
143143

144144
if (put_newlines && (i == the_range.get_begin() || i - start_of_line >= size_per_line)) {
145145
if (show_ascii && i != the_range.get_begin()) {
146146
*inserter++ = delimiter;
147147
*inserter++ = delimiter;
148-
for (auto j = start_of_line; j < i; j++) {
148+
for (auto j = start_of_line; j < i; ++j) {
149149
auto pc = static_cast<unsigned char>(*j);
150150
*inserter++ = std::isprint(pc) ? static_cast<char>(*j) : '.';
151151
}
@@ -181,7 +181,7 @@ struct fmt::formatter<spdlog::details::dump_info<T>, char> {
181181
}
182182
*inserter++ = delimiter;
183183
*inserter++ = delimiter;
184-
for (auto j = start_of_line; j != the_range.get_end(); j++) {
184+
for (auto j = start_of_line; j != the_range.get_end(); ++j) {
185185
auto pc = static_cast<unsigned char>(*j);
186186
*inserter++ = std::isprint(pc) ? static_cast<char>(*j) : '.';
187187
}

0 commit comments

Comments
 (0)