|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54400 - in trunk/boost/asio: . detail impl ip/detail
From: chris_at_[hidden]
Date: 2009-06-27 03:52:12
Author: chris_kohlhoff
Date: 2009-06-27 03:52:11 EDT (Sat, 27 Jun 2009)
New Revision: 54400
URL: http://svn.boost.org/trac/boost/changeset/54400
Log:
Use boost::throw_exception() rather than throw keyword to allow asio to be
used when exception support is disabled. Note that the SSL wrappers still
require exception support. Refs #2754.
Text files modified:
trunk/boost/asio/basic_streambuf.hpp | 4 +++-
trunk/boost/asio/detail/socket_option.hpp | 16 +++++++++++++---
trunk/boost/asio/impl/serial_port_base.ipp | 24 ++++++++++++++++++++----
trunk/boost/asio/ip/detail/socket_option.hpp | 34 +++++++++++++++++++++++++---------
4 files changed, 61 insertions(+), 17 deletions(-)
Modified: trunk/boost/asio/basic_streambuf.hpp
==============================================================================
--- trunk/boost/asio/basic_streambuf.hpp (original)
+++ trunk/boost/asio/basic_streambuf.hpp 2009-06-27 03:52:11 EDT (Sat, 27 Jun 2009)
@@ -25,6 +25,7 @@
#include <stdexcept>
#include <streambuf>
#include <vector>
+#include <boost/throw_exception.hpp>
#include <boost/asio/detail/pop_options.hpp>
#include <boost/asio/buffer.hpp>
@@ -318,7 +319,8 @@
}
else
{
- throw std::length_error("boost::asio::streambuf too long");
+ std::length_error ex("boost::asio::streambuf too long");
+ boost::throw_exception(ex);
}
}
Modified: trunk/boost/asio/detail/socket_option.hpp
==============================================================================
--- trunk/boost/asio/detail/socket_option.hpp (original)
+++ trunk/boost/asio/detail/socket_option.hpp 2009-06-27 03:52:11 EDT (Sat, 27 Jun 2009)
@@ -21,6 +21,7 @@
#include <cstddef>
#include <stdexcept>
#include <boost/config.hpp>
+#include <boost/throw_exception.hpp>
#include <boost/asio/detail/pop_options.hpp>
#include <boost/asio/detail/socket_types.hpp>
@@ -122,7 +123,10 @@
case sizeof(value_):
break;
default:
- throw std::length_error("boolean socket option resize");
+ {
+ std::length_error ex("boolean socket option resize");
+ boost::throw_exception(ex);
+ }
}
}
@@ -200,7 +204,10 @@
void resize(const Protocol&, std::size_t s)
{
if (s != sizeof(value_))
- throw std::length_error("integer socket option resize");
+ {
+ std::length_error ex("integer socket option resize");
+ boost::throw_exception(ex);
+ }
}
private:
@@ -294,7 +301,10 @@
void resize(const Protocol&, std::size_t s)
{
if (s != sizeof(value_))
- throw std::length_error("linger socket option resize");
+ {
+ std::length_error ex("linger socket option resize");
+ boost::throw_exception(ex);
+ }
}
private:
Modified: trunk/boost/asio/impl/serial_port_base.ipp
==============================================================================
--- trunk/boost/asio/impl/serial_port_base.ipp (original)
+++ trunk/boost/asio/impl/serial_port_base.ipp 2009-06-27 03:52:11 EDT (Sat, 27 Jun 2009)
@@ -18,6 +18,10 @@
#include <boost/asio/detail/push_options.hpp>
+#include <boost/asio/detail/push_options.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/asio/detail/pop_options.hpp>
+
namespace boost {
namespace asio {
@@ -206,7 +210,10 @@
: value_(t)
{
if (t != none && t != software && t != hardware)
- throw std::out_of_range("invalid flow_control value");
+ {
+ std::out_of_range ex("invalid flow_control value");
+ boost::throw_exception(ex);
+ }
}
inline serial_port_base::flow_control::type
@@ -314,7 +321,10 @@
: value_(t)
{
if (t != none && t != odd && t != even)
- throw std::out_of_range("invalid parity value");
+ {
+ std::out_of_range ex("invalid parity value");
+ boost::throw_exception(ex);
+ }
}
inline serial_port_base::parity::type serial_port_base::parity::value() const
@@ -411,7 +421,10 @@
: value_(t)
{
if (t != one && t != onepointfive && t != two)
- throw std::out_of_range("invalid stop_bits value");
+ {
+ std::out_of_range ex("invalid stop_bits value");
+ boost::throw_exception(ex);
+ }
}
inline serial_port_base::stop_bits::type
@@ -487,7 +500,10 @@
: value_(t)
{
if (t < 5 || t > 8)
- throw std::out_of_range("invalid character_size value");
+ {
+ std::out_of_range ex("invalid character_size value");
+ boost::throw_exception(ex);
+ }
}
inline unsigned int serial_port_base::character_size::value() const
Modified: trunk/boost/asio/ip/detail/socket_option.hpp
==============================================================================
--- trunk/boost/asio/ip/detail/socket_option.hpp (original)
+++ trunk/boost/asio/ip/detail/socket_option.hpp 2009-06-27 03:52:11 EDT (Sat, 27 Jun 2009)
@@ -21,6 +21,7 @@
#include <cstddef>
#include <cstring>
#include <boost/config.hpp>
+#include <boost/throw_exception.hpp>
#include <boost/asio/detail/pop_options.hpp>
#include <boost/asio/ip/address.hpp>
@@ -142,8 +143,8 @@
{
if (s != sizeof(ipv6_value_))
{
- throw std::length_error(
- "multicast_enable_loopback socket option resize");
+ std::length_error ex("multicast_enable_loopback socket option resize");
+ boost::throw_exception(ex);
}
ipv4_value_ = ipv6_value_ ? 1 : 0;
}
@@ -151,8 +152,8 @@
{
if (s != sizeof(ipv4_value_))
{
- throw std::length_error(
- "multicast_enable_loopback socket option resize");
+ std::length_error ex("multicast_enable_loopback socket option resize");
+ boost::throw_exception(ex);
}
ipv6_value_ = ipv4_value_ ? 1 : 0;
}
@@ -237,7 +238,10 @@
void resize(const Protocol&, std::size_t s)
{
if (s != sizeof(value_))
- throw std::length_error("unicast hops socket option resize");
+ {
+ std::length_error ex("unicast hops socket option resize");
+ boost::throw_exception(ex);
+ }
#if defined(__hpux)
if (value_ < 0)
value_ = value_ & 0xFF;
@@ -271,7 +275,10 @@
explicit multicast_hops(int v)
{
if (v < 0 || v > 255)
- throw std::out_of_range("multicast hops value out of range");
+ {
+ std::out_of_range ex("multicast hops value out of range");
+ boost::throw_exception(ex);
+ }
ipv4_value_ = (ipv4_value_type)v;
ipv6_value_ = v;
}
@@ -280,7 +287,10 @@
multicast_hops& operator=(int v)
{
if (v < 0 || v > 255)
- throw std::out_of_range("multicast hops value out of range");
+ {
+ std::out_of_range ex("multicast hops value out of range");
+ boost::throw_exception(ex);
+ }
ipv4_value_ = (ipv4_value_type)v;
ipv6_value_ = v;
return *this;
@@ -344,7 +354,10 @@
if (protocol.family() == PF_INET6)
{
if (s != sizeof(ipv6_value_))
- throw std::length_error("multicast hops socket option resize");
+ {
+ std::length_error ex("multicast hops socket option resize");
+ boost::throw_exception(ex);
+ }
if (ipv6_value_ < 0)
ipv4_value_ = 0;
else if (ipv6_value_ > 255)
@@ -355,7 +368,10 @@
else
{
if (s != sizeof(ipv4_value_))
- throw std::length_error("multicast hops socket option resize");
+ {
+ std::length_error ex("multicast hops socket option resize");
+ boost::throw_exception(ex);
+ }
ipv6_value_ = ipv4_value_;
}
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk