🚨 fixed some warnings

parent d39842e6
......@@ -136,6 +136,7 @@ pedantic_clang:
-Wno-float-equal \
-Wno-switch-enum -Wno-covered-switch-default \
-Wno-c++2a-compat \
-Wno-c++17-extensions \
-Wno-padded"
# calling GCC with most warnings
......
......@@ -620,7 +620,7 @@ class serializer
if (is_negative)
{
*buffer_ptr = '-';
abs_value = static_cast<number_unsigned_t>(-1 - x) + 1;
abs_value = static_cast<number_unsigned_t>(std::abs(static_cast<std::intmax_t>(x)));
// account one more byte for the minus sign
n_chars = 1 + count_digits(abs_value);
......
......@@ -11533,7 +11533,7 @@ class serializer
if (is_negative)
{
*buffer_ptr = '-';
abs_value = static_cast<number_unsigned_t>(-1 - x) + 1;
abs_value = static_cast<number_unsigned_t>(std::abs(static_cast<std::intmax_t>(x)));
// account one more byte for the minus sign
n_chars = 1 + count_digits(abs_value);
......
......@@ -1762,7 +1762,7 @@ TEST_CASE("regression tests")
-54, -28, -26
};
std::string s;
for (int i = 0; i < sizeof(data) / sizeof(int); i++)
for (unsigned i = 0; i < sizeof(data) / sizeof(int); i++)
{
s += static_cast<char>(data[i]);
}
......
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