Skip to content

Commit

Permalink
Silence warning on narrowing conversion
Browse files Browse the repository at this point in the history
GCC warns that int to size_t is a narrowing conversion. Fix that with
an explicit cast.
  • Loading branch information
laudrup committed Feb 26, 2024
1 parent dd51ec8 commit e5debef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/handshake_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ std::string wchar_to_string(const wchar_t* input) {
wintls::detail::throw_last_error("WideCharToMultiByte");
}

std::string output(size_needed, '\0');
std::string output(static_cast<std::size_t>(size_needed), '\0');
const auto size_written = WideCharToMultiByte(CP_UTF8, 0, input, length, &output[0], size_needed, nullptr, nullptr);
if (size_written == 0) {
wintls::detail::throw_last_error("WideCharToMultiByte");
Expand Down

0 comments on commit e5debef

Please sign in to comment.