Changeset 54400


Ignore:
Timestamp:
Jun 27, 2009, 7:52:11 AM (9 years ago)
Author:
chris_kohlhoff
Message:

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.

Location:
trunk/boost/asio
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/boost/asio/basic_streambuf.hpp

    r49497 r54400  
    2626#include <streambuf>
    2727#include <vector>
     28#include <boost/throw_exception.hpp>
    2829#include <boost/asio/detail/pop_options.hpp>
    2930
     
    319320      else
    320321      {
    321         throw std::length_error("boost::asio::streambuf too long");
     322        std::length_error ex("boost::asio::streambuf too long");
     323        boost::throw_exception(ex);
    322324      }
    323325    }
  • trunk/boost/asio/detail/socket_option.hpp

    r52412 r54400  
    2222#include <stdexcept>
    2323#include <boost/config.hpp>
     24#include <boost/throw_exception.hpp>
    2425#include <boost/asio/detail/pop_options.hpp>
    2526
     
    123124      break;
    124125    default:
    125       throw std::length_error("boolean socket option resize");
     126      {
     127        std::length_error ex("boolean socket option resize");
     128        boost::throw_exception(ex);
     129      }
    126130    }
    127131  }
     
    201205  {
    202206    if (s != sizeof(value_))
    203       throw std::length_error("integer socket option resize");
     207    {
     208      std::length_error ex("integer socket option resize");
     209      boost::throw_exception(ex);
     210    }
    204211  }
    205212
     
    295302  {
    296303    if (s != sizeof(value_))
    297       throw std::length_error("linger socket option resize");
     304    {
     305      std::length_error ex("linger socket option resize");
     306      boost::throw_exception(ex);
     307    }
    298308  }
    299309
  • trunk/boost/asio/impl/serial_port_base.ipp

    r46535 r54400  
    1818
    1919#include <boost/asio/detail/push_options.hpp>
     20
     21#include <boost/asio/detail/push_options.hpp>
     22#include <boost/throw_exception.hpp>
     23#include <boost/asio/detail/pop_options.hpp>
    2024
    2125namespace boost {
     
    207211{
    208212  if (t != none && t != software && t != hardware)
    209     throw std::out_of_range("invalid flow_control value");
     213  {
     214    std::out_of_range ex("invalid flow_control value");
     215    boost::throw_exception(ex);
     216  }
    210217}
    211218
     
    315322{
    316323  if (t != none && t != odd && t != even)
    317     throw std::out_of_range("invalid parity value");
     324  {
     325    std::out_of_range ex("invalid parity value");
     326    boost::throw_exception(ex);
     327  }
    318328}
    319329
     
    412422{
    413423  if (t != one && t != onepointfive && t != two)
    414     throw std::out_of_range("invalid stop_bits value");
     424  {
     425    std::out_of_range ex("invalid stop_bits value");
     426    boost::throw_exception(ex);
     427  }
    415428}
    416429
     
    488501{
    489502  if (t < 5 || t > 8)
    490     throw std::out_of_range("invalid character_size value");
     503  {
     504    std::out_of_range ex("invalid character_size value");
     505    boost::throw_exception(ex);
     506  }
    491507}
    492508
  • trunk/boost/asio/ip/detail/socket_option.hpp

    r50944 r54400  
    2222#include <cstring>
    2323#include <boost/config.hpp>
     24#include <boost/throw_exception.hpp>
    2425#include <boost/asio/detail/pop_options.hpp>
    2526
     
    143144      if (s != sizeof(ipv6_value_))
    144145      {
    145         throw std::length_error(
    146             "multicast_enable_loopback socket option resize");
     146        std::length_error ex("multicast_enable_loopback socket option resize");
     147        boost::throw_exception(ex);
    147148      }
    148149      ipv4_value_ = ipv6_value_ ? 1 : 0;
     
    152153      if (s != sizeof(ipv4_value_))
    153154      {
    154         throw std::length_error(
    155             "multicast_enable_loopback socket option resize");
     155        std::length_error ex("multicast_enable_loopback socket option resize");
     156        boost::throw_exception(ex);
    156157      }
    157158      ipv6_value_ = ipv4_value_ ? 1 : 0;
     
    238239  {
    239240    if (s != sizeof(value_))
    240       throw std::length_error("unicast hops socket option resize");
     241    {
     242      std::length_error ex("unicast hops socket option resize");
     243      boost::throw_exception(ex);
     244    }
    241245#if defined(__hpux)
    242246    if (value_ < 0)
     
    272276  {
    273277    if (v < 0 || v > 255)
    274       throw std::out_of_range("multicast hops value out of range");
     278    {
     279      std::out_of_range ex("multicast hops value out of range");
     280      boost::throw_exception(ex);
     281    }
    275282    ipv4_value_ = (ipv4_value_type)v;
    276283    ipv6_value_ = v;
     
    281288  {
    282289    if (v < 0 || v > 255)
    283       throw std::out_of_range("multicast hops value out of range");
     290    {
     291      std::out_of_range ex("multicast hops value out of range");
     292      boost::throw_exception(ex);
     293    }
    284294    ipv4_value_ = (ipv4_value_type)v;
    285295    ipv6_value_ = v;
     
    345355    {
    346356      if (s != sizeof(ipv6_value_))
    347         throw std::length_error("multicast hops socket option resize");
     357      {
     358        std::length_error ex("multicast hops socket option resize");
     359        boost::throw_exception(ex);
     360      }
    348361      if (ipv6_value_ < 0)
    349362        ipv4_value_ = 0;
     
    356369    {
    357370      if (s != sizeof(ipv4_value_))
    358         throw std::length_error("multicast hops socket option resize");
     371      {
     372        std::length_error ex("multicast hops socket option resize");
     373        boost::throw_exception(ex);
     374      }
    359375      ipv6_value_ = ipv4_value_;
    360376    }
Note: See TracChangeset for help on using the changeset viewer.