diff --git a/number_theory/test_tools.hpp b/number_theory/test_tools.hpp index b3bf74b..b3f49ac 100644 --- a/number_theory/test_tools.hpp +++ b/number_theory/test_tools.hpp @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -20,13 +21,13 @@ namespace test_tools_detail { template [[noreturn]] ATTRIBUTE_COLD inline void throw_impl(const char* message_format, T arg, - const char* file_name, uint32_t line, + const char* file_name, std::uint32_t line, const char* function_name) { std::array buffer{}; - int bytes_written = std::snprintf(buffer.data(), buffer.size(), - "Check failed at %s:%u %s\nError messssage: ", file_name, - line, function_name); - size_t err_msg_offset = uint32_t(bytes_written); + int bytes_written = std::snprintf(buffer.data(), buffer.size(), + "Check failed at %s:%u %s\nError messssage: ", file_name, + line, function_name); + auto err_msg_offset = static_cast(static_cast(bytes_written)); if (err_msg_offset > buffer.size()) { perror("std::snprintf"); err_msg_offset = 0; @@ -105,10 +106,10 @@ struct Wrapper final { private: [[noreturn]] ATTRIBUTE_COLD static void ThrowOnFOpenFail(const char* fname, const char* mode) { std::array buffer{}; - int bytes_written = std::snprintf( - buffer.data(), buffer.size(), - "Wrapper::Wrapper(const char* fname, const char* mode): std::fopen(\"%s\", \"%s\") failed: %s", - fname, mode, strerror(errno)); + int bytes_written = std::snprintf(buffer.data(), buffer.size(), + "Wrapper::Wrapper(const char* fname, const char* mode): " + "std::fopen(\"%s\", \"%s\") failed: %s", + fname, mode, std::strerror(errno)); if (bytes_written < 0) [[unlikely]] { constexpr std::string_view msg = "Wrapper::Wrapper(const char* fname,const char* mode): "