Ticket #2094: boost_iostreams_no_throw.diff

File boost_iostreams_no_throw.diff, 33.8 KB (added by Richard Smith <richard@…>, 13 years ago)

Updated patch

  • boost/iostreams/device/mapped_file.hpp

    Patch from <https://svn.boost.org/trac/boost/ticket/2094>
    
    old new  
    2525#include <boost/iostreams/positioning.hpp>
    2626#include <boost/shared_ptr.hpp>
    2727#include <boost/static_assert.hpp>
     28#include <boost/throw_execption.hpp>
    2829#include <boost/type_traits/is_same.hpp>
    2930
    3031// Must come last.
     
    393394    param_type params(p);
    394395    if (params.flags) {
    395396        if (params.flags != mapped_file::readonly)
    396             throw BOOST_IOSTREAMS_FAILURE("invalid flags");
     397            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid flags"));
    397398    } else {
    398399        if (params.mode & BOOST_IOS::out)
    399             throw BOOST_IOSTREAMS_FAILURE("invalid mode");
     400            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid mode"));
    400401        params.mode |= BOOST_IOS::in;
    401402    }
    402403    open_impl(params);
     
    479480    param_type params(p);
    480481    if (params.flags) {
    481482        if (params.flags & mapped_file::readonly)
    482             throw BOOST_IOSTREAMS_FAILURE("invalid flags");
     483            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid flags"));
    483484    } else {
    484485        if (params.mode & BOOST_IOS::in)
    485             throw BOOST_IOSTREAMS_FAILURE("invalid mode");
     486            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid mode"));
    486487        params.mode |= BOOST_IOS::out;
    487488    }
    488489    mapped_file::open(params);
  • boost/iostreams/detail/adapter/direct_adapter.hpp

    old new  
    3030#include <boost/preprocessor/repetition/enum_binary_params.hpp>
    3131#include <boost/preprocessor/repetition/enum_params.hpp>
    3232#include <boost/static_assert.hpp>
     33#include <boost/throw_exception.hpp>
    3334#include <boost/type_traits/is_convertible.hpp>
    3435
    3536// Must come last.
     
    209210    using namespace std;
    210211    pointers& put = ptrs_.second();
    211212    if (n > static_cast<std::streamsize>(put.end - put.ptr))
    212         throw write_area_exhausted();
     213        boost::throw_exception(write_area_exhausted());
    213214    std::copy(s, s + n, put.ptr);
    214215    put.ptr += n;
    215216    return n;
     
    224225    pointers& get = ptrs_.first();
    225226    pointers& put = ptrs_.second();
    226227    if (way == BOOST_IOS::cur && get.ptr != put.ptr)
    227        throw bad_seek();
     228       boost::throw_exception(bad_seek());
    228229    ptrdiff_t next = 0;
    229230    if ((which & BOOST_IOS::in) || !is_double::value) {
    230231        if (way == BOOST_IOS::beg)
     
    236237        if (next >= 0 && next <= get.end - get.beg)
    237238            get.ptr = get.beg + next;
    238239        else
    239             throw bad_seek();
     240            boost::throw_exception(bad_seek());
    240241    }
    241242    if ((which & BOOST_IOS::out) && is_double::value) {
    242243        if (way == BOOST_IOS::beg)
     
    248249        if (next >= 0 && next <= put.end - put.beg)
    249250            put.ptr = put.beg + next;
    250251        else
    251             throw bad_seek();
     252            boost::throw_exception(bad_seek());
    252253    }
    253254    return offset_to_position(next);
    254255}
  • boost/iostreams/detail/adapter/concept_adapter.hpp

    old new  
    2222#include <boost/iostreams/operations.hpp>
    2323#include <boost/mpl/if.hpp>
    2424#include <boost/static_assert.hpp>
     25#include <boost/throw_exception.hpp>
    2526
    2627// Must come last.
    2728#include <boost/iostreams/detail/config/disable_warnings.hpp>  // MSVC.
     
    137138    seek( Device&, stream_offset, BOOST_IOS::seekdir,
    138139          BOOST_IOS::openmode, any_tag )
    139140    {
    140         throw cant_seek();
     141        boost::throw_exception(cant_seek());
    141142    }
    142143
    143144    template<typename Device>
     
    171172    static std::streamsize
    172173    write( Device&, Dummy*, const typename char_type_of<Device>::type*,
    173174           std::streamsize )
    174     { throw cant_write(); }
     175    { boost::throw_exception(cant_write()); }
    175176};
    176177
    177178template<>
     
    179180    template<typename Device, typename Dummy>
    180181    static std::streamsize
    181182    read(Device&, Dummy*, typename char_type_of<Device>::type*, std::streamsize)
    182     { throw cant_read(); }
     183    { boost::throw_exception(cant_read()); }
    183184
    184185    template<typename Device, typename Dummy>
    185186    static std::streamsize
     
    205206    static std::streampos
    206207    seek( Filter&, Device*, stream_offset,
    207208          BOOST_IOS::seekdir, BOOST_IOS::openmode, any_tag )
    208     { throw cant_seek(); }
     209    { boost::throw_exception(cant_seek()); }
    209210
    210211    template<typename Filter, typename Device>
    211212    static std::streampos
     
    252253    static std::streamsize
    253254    write( Filter&, Sink*, const typename char_type_of<Filter>::type*,
    254255           std::streamsize )
    255     { throw cant_write(); }
     256    { boost::throw_exception(cant_write()); }
    256257};
    257258
    258259template<>
     
    260261    template<typename Filter, typename Source>
    261262    static std::streamsize
    262263    read(Filter&, Source*, typename char_type_of<Filter>::type*,std::streamsize)
    263     { throw cant_read(); }
     264    { boost::throw_exception(cant_read()); }
    264265
    265266    template<typename Filter, typename Sink>
    266267    static std::streamsize
  • boost/iostreams/detail/adapter/range_adapter.hpp

    old new  
    2121#include <boost/iostreams/detail/error.hpp>
    2222#include <boost/iostreams/positioning.hpp>
    2323#include <boost/mpl/if.hpp>
     24#include <boost/throw_exception.hpp>
    2425#include <boost/type_traits/is_convertible.hpp>
    2526#include <boost/utility/enable_if.hpp>
    2627
     
    116117    {
    117118        while (cur != last && n-- > 0) *cur++ = *s++;
    118119        if (cur == last && n > 0)
    119             throw write_area_exhausted();
     120            boost::throw_exception(write_area_exhausted());
    120121        return n;
    121122    }
    122123};
     
    144145        std::copy(s, s + count, cur);
    145146        cur += count;
    146147        if (count < n)
    147             throw write_area_exhausted();
     148            boost::throw_exception(write_area_exhausted());
    148149        return n;
    149150    }
    150151
     
    156157        using namespace std;
    157158        switch (way) {
    158159        case BOOST_IOS::beg:
    159             if (off > last - first || off < 0) throw bad_seek();
     160            if (off > last - first || off < 0)
     161                boost::throw_exception(bad_seek());
    160162            cur = first + off;
    161163            break;
    162164        case BOOST_IOS::cur:
    163165            {
    164166                std::ptrdiff_t newoff = cur - first + off;
    165                 if (newoff > last - first || newoff < 0) throw bad_seek();
     167                if (newoff > last - first || newoff < 0)
     168                    boost::throw_exception(bad_seek());
    166169                cur += off;
    167170                break;
    168171            }
    169172        case BOOST_IOS::end:
    170             if (last - first + off < 0 || off > 0) throw bad_seek();
     173            if (last - first + off < 0 || off > 0)
     174                boost::throw_exception(bad_seek());
    171175            cur = last + off;
    172176            break;
    173177        default:
  • boost/iostreams/detail/system_failure.hpp

    old new  
    1818#include <cstring>
    1919#include <string>
    2020#include <boost/config.hpp>
     21#include <boost/throw_exception.hpp>
    2122#include <boost/iostreams/detail/config/windows_posix.hpp>
    2223#include <boost/iostreams/detail/ios.hpp>  // failure.
    2324
     
    7374{ return system_failure(msg.c_str()); }
    7475
    7576inline void throw_system_failure(const char* msg)
    76 { throw system_failure(msg); }
     77{ boost::throw_exception(system_failure(msg)); }
    7778
    7879inline void throw_system_failure(const std::string& msg)
    79 { throw system_failure(msg); }
     80{ boost::throw_exception(system_failure(msg)); }
    8081
    8182} } } // End namespaces detail, iostreams, boost.
    8283
  • boost/iostreams/detail/streambuf/indirect_streambuf.hpp

    old new  
    3535#include <boost/iostreams/traits.hpp>
    3636#include <boost/iostreams/operations.hpp>
    3737#include <boost/mpl/if.hpp>
     38#include <boost/throw_exception.hpp>
    3839#include <boost/type_traits/is_convertible.hpp>
    3940
    4041// Must come last.
     
    274275            *gptr() = traits_type::to_char_type(c);
    275276        return traits_type::not_eof(c);
    276277    } else {
    277         throw bad_putback();
     278        boost::throw_exception(bad_putback());
    278279    }
    279280}
    280281
  • boost/iostreams/detail/streambuf/direct_streambuf.hpp

    old new  
    2929#include <boost/iostreams/operations.hpp>
    3030#include <boost/iostreams/positioning.hpp>
    3131#include <boost/iostreams/traits.hpp>
     32#include <boost/throw_exception.hpp>
    3233
    3334// Must come last.
    3435#include <boost/iostreams/detail/config/disable_warnings.hpp> // MSVC.
     
    138139direct_streambuf<T, Tr>::underflow()
    139140{
    140141    if (!ibeg_)
    141         throw cant_read();
     142        boost::throw_exception(cant_read());
    142143    if (!gptr())
    143144        init_get_area();
    144145    return gptr() != iend_ ?
     
    152153{
    153154    using namespace std;
    154155    if (!ibeg_)
    155         throw cant_read();
     156        boost::throw_exception(cant_read());
    156157    if (gptr() != 0 && gptr() != ibeg_) {
    157158        gbump(-1);
    158159        if (!traits_type::eq_int_type(c, traits_type::eof()))
    159160            *gptr() = traits_type::to_char_type(c);
    160161        return traits_type::not_eof(c);
    161162    }
    162     throw bad_putback();
     163    boost::throw_exception(bad_putback());
    163164}
    164165
    165166template<typename T, typename Tr>
     
    167168direct_streambuf<T, Tr>::overflow(int_type c)
    168169{
    169170    using namespace std;
    170     if (!obeg_) throw BOOST_IOSTREAMS_FAILURE("no write access");
     171    if (!obeg_)
     172        boost::throw_exception(BOOST_IOSTREAMS_FAILURE("no write access"));
    171173    if (!pptr()) init_put_area();
    172174    if (!traits_type::eq_int_type(c, traits_type::eof())) {
    173175        if (pptr() == oend_)
    174             throw BOOST_IOSTREAMS_FAILURE("write area exhausted");
     176            boost::throw_exception(
     177                BOOST_IOSTREAMS_FAILURE("write area exhausted")
     178            );
    175179        *pptr() = traits_type::to_char_type(c);
    176180        pbump(1);
    177181        return c;
     
    215219    using namespace std;
    216220    BOOST_IOS::openmode both = BOOST_IOS::in | BOOST_IOS::out;
    217221    if (two_head() && (which & both) == both)
    218         throw bad_seek();
     222        boost::throw_exception(bad_seek());
    219223    stream_offset result = -1;
    220224    bool one = one_head();
    221225    if (one && (pptr() != 0 || gptr()== 0))
     
    230234        default: assert(0);
    231235        }
    232236        if (next < 0 || next > (iend_ - ibeg_))
    233             throw bad_seek();
     237            boost::throw_exception(bad_seek());
    234238        setg(ibeg_, ibeg_ + next, iend_);
    235239        result = next;
    236240    }
     
    244248        default: assert(0);
    245249        }
    246250        if (next < 0 || next > (oend_ - obeg_))
    247             throw bad_seek();
     251            boost::throw_exception(bad_seek());
    248252        pbump(static_cast<int>(next - (pptr() - obeg_)));
    249253        result = next;
    250254    }
  • libs/iostreams/src/zlib.cpp

    old new  
    1414// than using it (possibly importing code).
    1515#define BOOST_IOSTREAMS_SOURCE
    1616
     17#include <boost/throw_exception.hpp>
    1718#include <boost/iostreams/detail/config/dyn_link.hpp>
    1819#include <boost/iostreams/filter/zlib.hpp>
    1920#include "zlib.h"   // Jean-loup Gailly's and Mark Adler's "zlib.h" header.
     
    7879    //case Z_BUF_ERROR:
    7980        return;
    8081    case Z_MEM_ERROR:
    81         throw std::bad_alloc();
     82        boost::throw_exception(std::bad_alloc());
    8283    default:
    83         throw zlib_error(error);
     84        boost::throw_exception(zlib_error(error));
    8485        ;
    8586    }
    8687}
  • libs/iostreams/src/mapped_file.cpp

    old new  
    1414#include <boost/iostreams/detail/file_handle.hpp>
    1515#include <boost/iostreams/detail/system_failure.hpp>
    1616#include <boost/iostreams/device/mapped_file.hpp>
     17#include <boost/throw_exception.hpp>
    1718
    1819#ifdef BOOST_IOSTREAMS_WINDOWS
    1920# define WIN32_LEAN_AND_MEAN  // Exclude rarely-used stuff from Windows headers
     
    8283void mapped_file_impl::open(param_type p)
    8384{
    8485    if (is_open())
    85         throw BOOST_IOSTREAMS_FAILURE("file already open");
     86        boost::throw_exception(BOOST_IOSTREAMS_FAILURE("file already open"));
    8687    p.normalize();
    8788    open_file(p);
    8889    map_file(p);  // May modify p.hint
     
    110111void mapped_file_impl::resize(stream_offset new_size)
    111112{
    112113    if (!is_open())
    113         throw BOOST_IOSTREAMS_FAILURE("file is closed");
     114        boost::throw_exception(BOOST_IOSTREAMS_FAILURE("file is closed"));
    114115    if (flags() & mapped_file::priv)
    115         throw BOOST_IOSTREAMS_FAILURE("can't resize private mapped file");
     116        boost::throw_exception(
     117            BOOST_IOSTREAMS_FAILURE("can't resize private mapped file")
     118        );
    116119    if (!(flags() & mapped_file::readwrite))
    117         throw BOOST_IOSTREAMS_FAILURE("can't resize readonly mapped file");
     120        boost::throw_exception(
     121            BOOST_IOSTREAMS_FAILURE("can't resize readonly mapped file")
     122        );
    118123    if (params_.offset >= new_size)
    119         throw BOOST_IOSTREAMS_FAILURE("can't resize below mapped offset");
     124        boost::throw_exception(
     125            BOOST_IOSTREAMS_FAILURE("can't resize below mapped offset")
     126        );
    120127    if (!unmap_file())
    121128        cleanup_and_throw("failed unmapping file");
    122129#ifdef BOOST_IOSTREAMS_WINDOWS
     
    335342            p.hint = 0;
    336343            try_map_file(p);
    337344        } else {
    338             throw e;
     345            boost::throw_exception(e);
    339346        }
    340347    }
    341348}
     
    393400void mapped_file_params_base::normalize()
    394401{
    395402    if (mode && flags)
    396         throw BOOST_IOSTREAMS_FAILURE(
     403        boost::throw_exception(BOOST_IOSTREAMS_FAILURE(
    397404            "at most one of 'mode' and 'flags' may be specified"
    398         );
     405        ));
    399406    if (flags) {
    400407        switch (flags) {
    401408        case mapped_file::readonly:
     
    403410        case mapped_file::priv:
    404411            break;
    405412        default:
    406             throw BOOST_IOSTREAMS_FAILURE("invalid flags");
     413            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid flags"));
    407414        }
    408415    } else {
    409416        flags = (mode & BOOST_IOS::out) ?
     
    412419        mode = BOOST_IOS::openmode();
    413420    }
    414421    if (offset < 0)
    415         throw BOOST_IOSTREAMS_FAILURE("invalid offset");
     422        boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid offset"));
    416423    if (new_file_size < 0)
    417         throw BOOST_IOSTREAMS_FAILURE("invalid new file size");
     424        boost::throw_exception(
     425            BOOST_IOSTREAMS_FAILURE("invalid new file size")
     426        );
    418427}
    419428
    420429} // End namespace detail.
  • libs/iostreams/src/bzip2.cpp

    old new  
    1414// than using it (possibly importing code).
    1515#define BOOST_IOSTREAMS_SOURCE
    1616
     17#include <boost/throw_exception.hpp>
    1718#include <boost/iostreams/detail/config/dyn_link.hpp>
    1819#include <boost/iostreams/filter/bzip2.hpp>
    1920#include "bzlib.h"  // Julian Seward's "bzip.h" header.
     
    6566    case BZ_STREAM_END:
    6667        return;
    6768    case BZ_MEM_ERROR:
    68         throw std::bad_alloc();
     69        boost::throw_exception(std::bad_alloc());
    6970    default:
    70         throw bzip2_error(error);
     71        boost::throw_exception(bzip2_error(error));
    7172    }
    7273}
    7374
  • libs/iostreams/src/gzip.cpp

    old new  
    1515#define BOOST_IOSTREAMS_SOURCE
    1616
    1717#include <boost/iostreams/detail/config/dyn_link.hpp>
    18 #include <boost/iostreams/filter/gzip.hpp>
     18#include <boost/iostreams/filter/gzip.hpp>
     19#include <boost/throw_exception.hpp>
    1920
    2021namespace boost { namespace iostreams {
    2122
     
    2930    switch (state_) {
    3031    case s_id1:
    3132        if (value != gzip::magic::id1)
    32             throw gzip_error(gzip::bad_header);
     33            boost::throw_exception(gzip_error(gzip::bad_header));
    3334        state_ = s_id2;
    3435        break;
    3536    case s_id2:
    3637        if (value != gzip::magic::id2)
    37             throw gzip_error(gzip::bad_header);
     38            boost::throw_exception(gzip_error(gzip::bad_header));
    3839        state_ = s_cm;
    3940        break;
    4041    case s_cm:
    4142        if (value != gzip::method::deflate)
    42             throw gzip_error(gzip::bad_method);
     43            boost::throw_exception(gzip_error(gzip::bad_method));
    4344        state_ = s_flg;
    4445        break;
    4546    case s_flg:
  • libs/iostreams/src/file_descriptor.cpp

    old new  
    2222#include <boost/iostreams/detail/ios.hpp>         // openmodes, failure.
    2323#include <boost/iostreams/device/file_descriptor.hpp>
    2424#include <boost/integer_traits.hpp>
     25#include <boost/throw_exception.hpp>
    2526
    2627    // OS-specific headers for low-level i/o.
    2728
     
    108109         (BOOST_IOS::in | BOOST_IOS::out) )
    109110    {
    110111        if (mode & BOOST_IOS::app)
    111             throw BOOST_IOSTREAMS_FAILURE("bad open mode");
     112            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad open mode"));
    112113        dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
    113114        dwCreationDisposition =
    114115            (mode & BOOST_IOS::trunc) ?
     
    116117                OPEN_EXISTING;
    117118    } else if (mode & BOOST_IOS::in) {
    118119        if (mode & (BOOST_IOS::app |BOOST_IOS::trunc))
    119             throw BOOST_IOSTREAMS_FAILURE("bad open mode");
     120            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad open mode"));
    120121        dwDesiredAccess = GENERIC_READ;
    121122        dwCreationDisposition = OPEN_EXISTING;
    122123    } else if (mode & BOOST_IOS::out) {
     
    125126        if (mode & BOOST_IOS::app)
    126127            flags_ |= append;
    127128    } else {
    128         throw BOOST_IOSTREAMS_FAILURE("bad open mode");
     129        boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad open mode"));
    129130    }
    130131
    131132    HANDLE handle = p.is_wide() ?
     
    186187
    187188    int fd = BOOST_IOSTREAMS_FD_OPEN(p.c_str(), oflag, pmode);
    188189    if (fd == -1) {
    189         throw system_failure("failed opening file");
     190        boost::throw_exception(system_failure("failed opening file"));
    190191    } else {
    191192        handle_ = fd;
    192193        flags_ = close_on_exit;
     
    271272    if ( dwResultLow == INVALID_SET_FILE_POINTER &&
    272273         ::GetLastError() != NO_ERROR )
    273274    {
    274         throw system_failure("failed seeking");
     275        boost::throw_exception(system_failure("failed seeking"));
    275276    } else {
    276277       return offset_to_position(
    277278                  (stream_offset(lDistanceToMoveHigh) << 32) + dwResultLow
     
    281282    if ( off > integer_traits<BOOST_IOSTREAMS_FD_OFFSET>::const_max ||
    282283         off < integer_traits<BOOST_IOSTREAMS_FD_OFFSET>::const_min )
    283284    {
    284         throw BOOST_IOSTREAMS_FAILURE("bad offset");
     285        boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad offset"));
    285286    }
    286287    stream_offset result =
    287288        BOOST_IOSTREAMS_FD_SEEK(
     
    294295                      SEEK_END )
    295296        );
    296297    if (result == -1)
    297         throw system_failure("failed seeking");
     298        boost::throw_exception(system_failure("failed seeking"));
    298299    return offset_to_position(result);
    299300#endif // #ifdef BOOST_IOSTREAMS_WINDOWS
    300301}
     
    431432    const detail::path& path, BOOST_IOS::openmode mode)
    432433{
    433434    if (mode & (BOOST_IOS::out | BOOST_IOS::app | BOOST_IOS::trunc))
    434         throw BOOST_IOSTREAMS_FAILURE("invalid mode");
     435        boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid mode"));
    435436    file_descriptor::open(path, mode, BOOST_IOS::in);
    436437}
    437438                   
     
    482483    const detail::path& path, BOOST_IOS::openmode mode)
    483484{
    484485    if (mode & BOOST_IOS::in)
    485         throw BOOST_IOSTREAMS_FAILURE("invalid mode");
     486        boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid mode"));
    486487    file_descriptor::open(path, mode, BOOST_IOS::out);
    487488}
    488489
  • boost/iostreams/detail/broken_overload_resolution/stream_buffer.hpp

    old new  
    99#define BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_BUFFER_HPP_INCLUDED
    1010
    1111#include <boost/iostreams/detail/broken_overload_resolution/forward.hpp>
     12#include <boost/throw_exception.hpp>
    1213
    1314namespace boost { namespace iostreams {
    1415
     
    179180    void check_open()
    180181    {
    181182        if (this->is_open())
    182             throw BOOST_IOSTREAMS_FAILURE("already open");
     183            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("already open"));
    183184    }
    184185};
    185186
  • boost/iostreams/chain.hpp

    old new  
    3636#include <boost/next_prior.hpp>
    3737#include <boost/shared_ptr.hpp>
    3838#include <boost/static_assert.hpp>
     39#include <boost/throw_exception.hpp>
    3940#include <boost/type_traits/is_convertible.hpp>
    4041#include <boost/type.hpp>
    4142#include <boost/iostreams/detail/execute.hpp>   // VC6.5 requires this
     
    172173    const std::type_info& component_type(int n) const
    173174    {
    174175        if (static_cast<size_type>(n) >= size())
    175             throw std::out_of_range("bad chain offset");
     176            boost::throw_exception(std::out_of_range("bad chain offset"));
    176177        return (*boost::next(list().begin(), n))->component_type();
    177178    }
    178179
     
    196197    T* component(int n, boost::type<T>) const
    197198    {
    198199        if (static_cast<size_type>(n) >= size())
    199             throw std::out_of_range("bad chain offset");
     200            boost::throw_exception(std::out_of_range("bad chain offset"));
    200201        streambuf_type* link = *boost::next(list().begin(), n);
    201202        if (BOOST_IOSTREAMS_COMPARE_TYPE_ID(link->component_type(), typeid(T)))
    202203            return static_cast<T*>(link->component_impl());
     
    238239        typedef typename list_type::iterator              iterator;
    239240        BOOST_STATIC_ASSERT((is_convertible<category, Mode>::value));
    240241        if (is_complete())
    241             throw std::logic_error("chain complete");
     242            boost::throw_exception(std::logic_error("chain complete"));
    242243        streambuf_type* prev = !empty() ? list().back() : 0;
    243244        buffer_size =
    244245            buffer_size != -1 ?
  • boost/iostreams/checked_operations.hpp

    old new  
    2020#include <boost/iostreams/seek.hpp>
    2121#include <boost/iostreams/traits.hpp>
    2222#include <boost/iostreams/write.hpp>
     23#include <boost/throw_exception.hppp>
    2324
    2425// Must come last.
    2526#include <boost/iostreams/detail/config/disable_warnings.hpp>  // MSVC.
     
    9394
    9495    template<typename T>
    9596    static bool put(T&, typename char_type_of<T>::type)
    96     { throw cant_write(); }
     97    { boost::throw_exception(cant_write()); }
    9798
    9899    template<typename T>
    99100    static std::streamsize
    100101    write(T&, const typename char_type_of<T>::type*, std::streamsize)
    101     { throw cant_write(); }
     102    { boost::throw_exception(cant_write()); }
    102103};
    103104
    104105template<>
    105106struct read_write_if_impl<output> {
    106107    template<typename T>
    107108    static typename int_type_of<T>::type get(T&)
    108     { throw cant_read(); }
     109    { boost::throw_exception(cant_read()); }
    109110
    110111    template<typename T>
    111112    static std::streamsize
    112113    read(T&, typename char_type_of<T>::type*, std::streamsize)
    113     { throw cant_read(); }
     114    { boost::throw_exception(cant_read()); }
    114115
    115116    template<typename T>
    116117    static bool put(T& t, typename char_type_of<T>::type c)
     
    139140    template<typename T>
    140141    static std::streampos
    141142    seek(T&, stream_offset, BOOST_IOS::seekdir, BOOST_IOS::openmode)
    142     { throw cant_seek(); }
     143    { boost::throw_exception(cant_seek()); }
    143144};
    144145
    145146} // End namespace detail.
  • boost/iostreams/code_converter.hpp

    old new  
    4444#include <boost/iostreams/operations.hpp>
    4545#include <boost/shared_ptr.hpp>
    4646#include <boost/static_assert.hpp>
     47#include <boost/throw_exception.hpp>
    4748#include <boost/type_traits/is_convertible.hpp>
    4849#include <boost/type_traits/is_same.hpp>
    4950
     
    155156    void open(const Device& dev, int buffer_size)
    156157    {
    157158        if (flags_ & f_open)
    158             throw BOOST_IOSTREAMS_FAILURE("already open");
     159            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("already open"));
    159160        if (buffer_size == -1)
    160161            buffer_size = default_filter_buffer_size;
    161162        int max_length = cvt_.get().max_length();
     
    354355        case std::codecvt_base::error:
    355356        default:
    356357            buf.state() = state_type();
    357             throw code_conversion_error();
     358            boost::throw_exception(code_conversion_error());
    358359        }
    359360
    360361    } while (total < n && status != EOF && status != WOULD_BLOCK);
     
    407408        case std::codecvt_base::error:
    408409        default:
    409410            buf.state() = state_type();
    410             throw code_conversion_error();
     411            boost::throw_exception(code_conversion_error());
    411412        }
    412413    }
    413414    return total;
  • boost/iostreams/detail/restrict_impl.hpp

    old new  
    4444# include <boost/iostreams/traits.hpp>         // mode_of, is_direct.
    4545# include <boost/mpl/bool.hpp>
    4646# include <boost/static_assert.hpp>
     47# include <boost/throw_exception.hpp>
    4748# include <boost/type_traits/is_convertible.hpp>
    4849
    4950# include <boost/iostreams/detail/config/disable_warnings.hpp>
     
    248249      end_(len != -1 ? off + len : -1)
    249250{
    250251    if (len < -1 || off < 0)
    251         throw BOOST_IOSTREAMS_FAILURE("bad offset");
     252        boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad offset"));
    252253    iostreams::skip(this->component(), off);
    253254}
    254255
     
    314315    if ( off < 0 || len < -1 ||
    315316         (len != -1 && off + len > seq.second - seq.first) )
    316317    {
    317         throw BOOST_IOSTREAMS_FAILURE("bad offset");
     318        boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad offset"));
    318319    }
    319320    beg_ = seq.first + off;
    320321    end_ = len != -1 ?
     
    357358      pos_(off), end_(len != -1 ? off + len : -1), open_(false)
    358359{
    359360    if (len < -1 || off < 0)
    360         throw BOOST_IOSTREAMS_FAILURE("bad offset");
     361        boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad offset"));
    361362}
    362363
    363364} // End namespace detail.
  • boost/iostreams/filter/gzip.hpp

    old new  
    3636#include <boost/iostreams/device/back_inserter.hpp>
    3737#include <boost/iostreams/filter/zlib.hpp>
    3838#include <boost/iostreams/pipeline.hpp>     
    39 #include <boost/iostreams/putback.hpp>         
     39#include <boost/iostreams/putback.hpp>
     40#include <boost/throw_exception.hpp>
    4041
    4142// Must come last.
    4243#if defined(BOOST_MSVC)
     
    417418            if (state_ == s_header) {
    418419                int c = boost::iostreams::get(peek);
    419420                if (traits_type::is_eof(c)) {
    420                     throw gzip_error(gzip::bad_header);
     421                    boost::throw_exception(gzip_error(gzip::bad_header));
    421422                } else if (traits_type::would_block(c)) {
    422423                    break;
    423424                }
     
    437438                        state_ = s_footer;
    438439                    }
    439440                } catch (const zlib_error& e) {
    440                     throw gzip_error(e);
     441                    boost::throw_exception(gzip_error(e));
    441442                }
    442443            } else { // state_ == s_footer
    443444                int c = boost::iostreams::get(peek);
    444445                if (traits_type::is_eof(c)) {
    445                     throw gzip_error(gzip::bad_footer);
     446                    boost::throw_exception(gzip_error(gzip::bad_footer));
    446447                } else if (traits_type::would_block(c)) {
    447448                    break;
    448449                }
    449450                footer_.process(c);
    450451                if (footer_.done()) {
    451452                    if (footer_.crc() != this->crc())
    452                         throw gzip_error(gzip::bad_crc);
     453                        boost::throw_exception(gzip_error(gzip::bad_crc));
    453454                    int c = boost::iostreams::get(peek);
    454455                    if (traits_type::is_eof(c)) {
    455456                        state_ = s_done;
     
    482483            state_ = s_start;
    483484            header_.reset();
    484485            footer_.reset();
    485             throw gzip_error(e);
     486            boost::throw_exception(gzip_error(e));
    486487        }
    487488        state_ = s_start;
    488489    }
  • boost/iostreams/filter/newline.hpp

    old new  
    2727#include <boost/iostreams/pipeline.hpp>
    2828#include <boost/iostreams/putback.hpp>
    2929#include <boost/mpl/bool.hpp>
     30#include <boost/throw_exception.hpp>
    3031#include <boost/type_traits/is_convertible.hpp>
    3132
    3233// Must come last.
     
    124125             target != newline::dos &&
    125126             target != newline::mac )
    126127        {
    127             throw std::logic_error("bad flags");
     128            boost::throw_exception(std::logic_error("bad flags"));
    128129        }
    129130    }
    130131
     
    420421        }
    421422    }
    422423private:
    423     void fail() { throw newline_error(source()); }
     424    void fail() { boost::throw_exception(newline_error(source())); }
    424425    int& source() { return flags_; }
    425426    int source() const { return flags_; }
    426427
  • boost/iostreams/skip.hpp

    old new  
    2222#include <boost/mpl/and.hpp>
    2323#include <boost/mpl/bool.hpp>
    2424#include <boost/mpl/or.hpp>
     25#include <boost/throw_exception.hpp>
    2526#include <boost/type_traits/is_convertible.hpp>
    2627
    2728namespace boost { namespace iostreams {
     
    4041    for (stream_offset z = 0; z < off; ) {
    4142        typename traits_type::int_type c;
    4243        if (traits_type::is_eof(c = iostreams::get(dev)))
    43             throw BOOST_IOSTREAMS_FAILURE("bad skip offset");
     44            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad skip offset"));
    4445        if (!traits_type::would_block(c))
    4546            ++z;
    4647    }
     
    6061    for (stream_offset z = 0; z < off; ) {
    6162        std::streamsize amt;
    6263        if ((amt = iostreams::read(flt, dev, &c, 1)) == -1)
    63             throw BOOST_IOSTREAMS_FAILURE("bad skip offset");
     64            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad skip offset"));
    6465        if (amt == 1)
    6566            ++z;
    6667    }