Subject: [Boost-bugs] [Boost C++ Libraries] #10539: Type error in detail::socket_ops::host_to_network_short
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-09-25 13:43:21
#10539: Type error in detail::socket_ops::host_to_network_short
-------------------------------------------------+-------------------------
Reporter: Louis-Michel Veilleux | Owner:
<louismichel.veilleux@â¦> | chris_kohlhoff
Type: Bugs | Status: new
Milestone: To Be Determined | Component: asio
Version: Boost Release Branch | Severity:
Keywords: | Optimization
-------------------------------------------------+-------------------------
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)
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10539> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC