Skip to content

Commit

Permalink
Using static_cast to narrow its_device.size() to a socklen_t
Browse files Browse the repository at this point in the history
  • Loading branch information
kheaactua committed Apr 4, 2024
1 parent ff8ec66 commit 00398bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion implementation/endpoints/src/tcp_client_endpoint_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void tcp_client_endpoint_impl::connect() {
std::string its_device(configuration_->get_device());
if (its_device != "") {
if (setsockopt(socket_->native_handle(),
SOL_SOCKET, SO_BINDTODEVICE, its_device.c_str(), socklen_t{its_device.size()}) == -1) {
SOL_SOCKET, SO_BINDTODEVICE, its_device.c_str(), static_cast<socklen_t>(its_device.size())) == -1) {
VSOMEIP_WARNING << "TCP Client: Could not bind to device \"" << its_device << "\"";
}
}
Expand Down
2 changes: 1 addition & 1 deletion implementation/endpoints/src/udp_server_endpoint_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ udp_server_endpoint_impl::udp_server_endpoint_impl(
std::string its_device(configuration_->get_device());
if (its_device != "") {
if (setsockopt(unicast_socket_.native_handle(),
SOL_SOCKET, SO_BINDTODEVICE, its_device.c_str(), socklen_t{its_device.size()}) == -1) {
SOL_SOCKET, SO_BINDTODEVICE, its_device.c_str(), static_cast<socklen_t>(its_device.size())) == -1) {
VSOMEIP_WARNING << "UDP Server: Could not bind to device \"" << its_device << "\"";
}
}
Expand Down

0 comments on commit 00398bc

Please sign in to comment.