Opened 8 years ago
#10539 new Bugs
Type error in detail::socket_ops::host_to_network_short
Reported by: | Owned by: | chris_kohlhoff | |
---|---|---|---|
Milestone: | To Be Determined | Component: | asio |
Version: | Boost Release Branch | Severity: | Optimization |
Keywords: | Cc: |
Description
Type of result local variable should be u_short_type. Causes compilation warning C4244 with MSVC ( "possible loss of data" ).
u_short_type host_to_network_short(u_short_type value) { #if defined(BOOST_ASIO_WINDOWS_RUNTIME) u_long_type result; unsigned char* result_p = reinterpret_cast<unsigned char*>(&result); result_p[0] = static_cast<unsigned char>((value >> 8) & 0xFF); result_p[1] = static_cast<unsigned char>(value & 0xFF); return result; #else // defined(BOOST_ASIO_WINDOWS_RUNTIME) return htons(value); #endif // defined(BOOST_ASIO_WINDOWS_RUNTIME) }
Note:
See TracTickets
for help on using tickets.