Skip to content

Commit

Permalink
Fix generation of fixed width format specifier
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland committed Dec 8, 2023
1 parent 786bf12 commit 9d942f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/boost/charconv/to_chars.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ to_chars_result to_chars_printf_impl(char* first, char* last, T value, chars_for
// v % + . + num_digits(INT_MAX) + specifier + null terminator
// 1 + 1 + 10 + 1 + 1
char format[14] {};
std::memcpy(&format, "%", 1); // NOLINT : No null terminator is purposeful
std::memcpy(format, "%", 1); // NOLINT : No null terminator is purposeful
std::size_t pos = 1;

// precision of -1 is unspecified
Expand Down Expand Up @@ -580,7 +580,7 @@ to_chars_result to_chars_printf_impl(char* first, char* last, T value, chars_for
else if (fmt == chars_format::fixed)
{
// Force 0 decimal places
std::memcpy(&format, ".0", 2); // NOLINT : No null terminator is purposeful
std::memcpy(format + pos, ".0", 2); // NOLINT : No null terminator is purposeful
pos += 2;
}

Expand Down

0 comments on commit 9d942f8

Please sign in to comment.