// ip/impl/address_v4.ipp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/asio/detail/config.hpp>
#include <climits>
#include <stdexcept>
-#include <boost/throw_exception.hpp>
#include <boost/asio/error.hpp>
#include <boost/asio/detail/socket_ops.hpp>
#include <boost/asio/detail/throw_error.hpp>
+#include <boost/asio/detail/throw_exception.hpp>
#include <boost/asio/ip/address_v4.hpp>
#include <boost/asio/detail/push_options.hpp>
|| bytes[2] > 0xFF || bytes[3] > 0xFF)
{
std::out_of_range ex("address_v4 from bytes_type");
- boost::throw_exception(ex);
+ boost::asio::detail::throw_exception(ex);
}
#endif // UCHAR_MAX > 0xFF
if (addr > 0xFFFFFFFF)
{
std::out_of_range ex("address_v4 from unsigned long");
- boost::throw_exception(ex);
+ boost::asio::detail::throw_exception(ex);
}
#endif // ULONG_MAX > 0xFFFFFFFF
- addr_.s_addr = boost::asio::detail::socket_ops::host_to_network_long(addr);
+ addr_.s_addr = boost::asio::detail::socket_ops::host_to_network_long(
+ static_cast<boost::asio::detail::u_long_type>(addr));
}
address_v4::bytes_type address_v4::to_bytes() const
{
char addr_str[boost::asio::detail::max_addr_v4_str_len];
const char* addr =
- boost::asio::detail::socket_ops::inet_ntop(AF_INET, &addr_, addr_str,
+ boost::asio::detail::socket_ops::inet_ntop(
+ BOOST_ASIO_OS_DEF(AF_INET), &addr_, addr_str,
boost::asio::detail::max_addr_v4_str_len, 0, ec);
if (addr == 0)
return std::string();
{
address_v4 tmp;
if (boost::asio::detail::socket_ops::inet_pton(
- AF_INET, str, &tmp.addr_, 0, ec) <= 0)
+ BOOST_ASIO_OS_DEF(AF_INET), str, &tmp.addr_, 0, ec) <= 0)
return address_v4();
return tmp;
}