🚨 fix a maybe-uninitialized warning

parent 14881cf9
...@@ -359,9 +359,9 @@ TEST_CASE("formatting") ...@@ -359,9 +359,9 @@ TEST_CASE("formatting")
{ {
auto check_float = [](float number, const std::string & expected) auto check_float = [](float number, const std::string & expected)
{ {
char buf[33]; std::array<char, 33> buf{};
char* end = nlohmann::detail::to_chars(buf, buf + 32, number); char* end = nlohmann::detail::to_chars(buf.data(), buf.data() + 32, number);
std::string actual(buf, end); std::string actual(buf.data(), end);
CHECK(actual == expected); CHECK(actual == expected);
}; };
...@@ -419,9 +419,9 @@ TEST_CASE("formatting") ...@@ -419,9 +419,9 @@ TEST_CASE("formatting")
{ {
auto check_double = [](double number, const std::string & expected) auto check_double = [](double number, const std::string & expected)
{ {
char buf[33]; std::array<char, 33> buf{};
char* end = nlohmann::detail::to_chars(buf, buf + 32, number); char* end = nlohmann::detail::to_chars(buf.data(), buf.data() + 32, number);
std::string actual(buf, end); std::string actual(buf.data(), end);
CHECK(actual == expected); CHECK(actual == expected);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment