@@ -58,7 +58,8 @@ namespace soralog {
58
58
V put_style (char *&ptr, T style) {
59
59
auto size = std::end (style) - std::begin (style);
60
60
std::memcpy (ptr, std::begin (style), size);
61
- ptr += size; // NOLINT
61
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
62
+ ptr += size;
62
63
return {};
63
64
}
64
65
@@ -77,7 +78,8 @@ namespace soralog {
77
78
const auto &style = reset_color;
78
79
auto size = std::end (style) - std::begin (style);
79
80
std::memcpy (ptr, std::begin (style), size);
80
- ptr = ptr + size; // NOLINT
81
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
82
+ ptr = ptr + size;
81
83
}
82
84
83
85
/* *
@@ -87,7 +89,8 @@ namespace soralog {
87
89
*/
88
90
void put_level_style (char *&ptr, Level level) {
89
91
assert (level <= Level::TRACE);
90
- auto color = level_to_color_map[static_cast <size_t >(level)]; // NOLINT
92
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-constant-array-index)
93
+ auto color = level_to_color_map[static_cast <size_t >(level)];
91
94
put_style (ptr,
92
95
fmt::detail::make_foreground_color<char >(color),
93
96
fmt::detail::make_emphasis<char >(fmt::emphasis::bold ));
@@ -122,7 +125,8 @@ namespace soralog {
122
125
*/
123
126
void put_separator (char *&ptr) {
124
127
for (auto c : separator) {
125
- *ptr++ = c; // NOLINT
128
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
129
+ *ptr++ = c;
126
130
}
127
131
}
128
132
@@ -132,12 +136,16 @@ namespace soralog {
132
136
* Ensures that the level is padded to a fixed width of 8 characters.
133
137
*/
134
138
void put_level (char *&ptr, Level level) {
135
- const char *const end = ptr + 8 ; // NOLINT
139
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
140
+ const char *const end = ptr + 8 ;
136
141
const char *str = levelToStr (level);
137
- while (auto c = *str++) { // NOLINT
138
- *ptr++ = c; // Copy characters one by one.
142
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
143
+ while (auto c = *str++) {
144
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
145
+ *ptr++ = c; // Copy characters one by one.
139
146
}
140
147
while (ptr < end) {
148
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
141
149
*ptr++ = ' ' ; // Pad with spaces to maintain alignment.
142
150
}
143
151
}
@@ -146,7 +154,8 @@ namespace soralog {
146
154
* @brief Writes a single-character representation of a log level.
147
155
*/
148
156
void put_level_short (char *&ptr, Level level) {
149
- *ptr++ = levelToChar (level); // NOLINT
157
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
158
+ *ptr++ = levelToChar (level);
150
159
}
151
160
152
161
/* *
@@ -155,7 +164,8 @@ namespace soralog {
155
164
template <typename T>
156
165
void put_string (char *&ptr, const T &name) {
157
166
for (auto c : name) {
158
- *ptr++ = c; // NOLINT
167
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
168
+ *ptr++ = c;
159
169
}
160
170
}
161
171
@@ -173,7 +183,8 @@ namespace soralog {
173
183
if (c == ' \0 ' or width == 0 ) {
174
184
break ;
175
185
}
176
- *ptr++ = c; // NOLINT
186
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
187
+ *ptr++ = c;
177
188
--width;
178
189
}
179
190
while (width--) {
@@ -246,7 +257,8 @@ namespace soralog {
246
257
}
247
258
248
259
auto *const begin = buff_.data ();
249
- auto *const end = buff_.data () + buff_.size (); // NOLINT
260
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
261
+ auto *const end = buff_.data () + buff_.size ();
250
262
auto *ptr = begin;
251
263
252
264
decltype (1s / 1s) psec = 0 ; // Stores previous second timestamp.
@@ -281,15 +293,17 @@ namespace soralog {
281
293
282
294
// Append timestamp to buffer.
283
295
std::memcpy (ptr, datetime.data (), datetime.size ());
284
- ptr = ptr + datetime.size (); // NOLINT
296
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
297
+ ptr = ptr + datetime.size ();
285
298
286
299
// Apply color if enabled.
287
300
if (with_color_) {
288
301
const auto &style =
289
302
fmt::detail::make_foreground_color<char >(fmt::color::gray);
290
303
auto size = std::end (style) - std::begin (style);
291
304
std::memcpy (ptr, std::begin (style), size);
292
- ptr = ptr + size; // NOLINT
305
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
306
+ ptr = ptr + size;
293
307
}
294
308
295
309
// Append microseconds.
0 commit comments