Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings when compiling for Windows x86 [20519] #4451

Merged
merged 3 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/cpp/utils/threading/threading_win32.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@

namespace eprosima {

template<typename... Args>
template<typename ... Args>
static void set_name_to_current_thread_impl(
const char* fmt, Args... args)
const char* fmt,
Args... args)
{
char thread_name[16]{};
snprintf(thread_name, 16, fmt, args...);
snprintf(thread_name, 16, fmt, args ...);

std::wstringstream stream;
stream << thread_name;
Expand Down Expand Up @@ -63,7 +64,8 @@ static void configure_current_thread_priority(
{
if (0 == SetThreadPriority(GetCurrentThread(), priority))
{
EPROSIMA_LOG_ERROR(SYSTEM, "Error '" << GetLastError() << "' configuring priority for thread " << GetCurrentThread());
EPROSIMA_LOG_ERROR(SYSTEM,
"Error '" << GetLastError() << "' configuring priority for thread " << GetCurrentThread());
}
}
}
Expand All @@ -73,9 +75,10 @@ static void configure_current_thread_affinity(
{
if (affinity_mask != 0)
{
if (0 == SetThreadAffinityMask(GetCurrentThread(), affinity_mask))
if (0 == SetThreadAffinityMask(GetCurrentThread(), static_cast<DWORD_PTR>(affinity_mask)))
{
EPROSIMA_LOG_ERROR(SYSTEM, "Error '" << GetLastError() << "' configuring affinity for thread " << GetCurrentThread());
EPROSIMA_LOG_ERROR(SYSTEM,
"Error '" << GetLastError() << "' configuring affinity for thread " << GetCurrentThread());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox/api/dds-pim/PubSubReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ class PubSubReader
{
return current_unread_count_ >= n_unread;
});
return current_unread_count_;
return static_cast<size_t>(current_unread_count_);
}

void block(
Expand Down
3 changes: 2 additions & 1 deletion test/blackbox/common/BlackboxTestsNetworkConf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ TEST_P(NetworkConfig, PubSubAsymmetricInterfaceWhitelistLocalhostOnly)
{
#ifdef _WIN32
GTEST_SKIP() << "This test is skipped on Windows";
#endif // _WIN32
#else
std::vector<IPFinder::info_IP> no_interfaces;

std::vector<IPFinder::info_IP> locahost_interface_only;
Expand Down Expand Up @@ -481,6 +481,7 @@ TEST_P(NetworkConfig, PubSubAsymmetricInterfaceWhitelistLocalhostOnly)
interface_whitelist_test(no_interfaces, locahost_interface_only, true);
}
}
#endif // _WIN32
}

// Regression test for redmine issue #18854 to check in UDP that setting the interface whitelist in one
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox/common/BlackboxTestsTransportUDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ void deliver_datagram_from_file(
std::basic_ifstream<char> file(filename, std::ios::binary | std::ios::in);

file.seekg(0, file.end);
size_t file_size = file.tellg();
size_t file_size = static_cast<size_t>(file.tellg());
file.seekg(0, file.beg);

std::vector<uint8_t> buf(file_size);
Expand Down
6 changes: 1 addition & 5 deletions test/blackbox/common/DDSBlackboxTestsMonitorService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,12 +835,8 @@ struct ConnectionListSampleValidator : public SampleValidator

return expected_locators_found;
}
else
{
return false;
}

return true;
return false;
});

ASSERT_NE(it, total_msgs.end());
Expand Down
Loading