Changeset 58633


Ignore:
Timestamp:
Jan 2, 2010, 11:51:39 AM (8 years ago)
Author:
Daniel James
Message:

Merge iostream fixes, mostly by Richard Smith.

Fixes #3612, #3311, #2094, #3010, #2894, #3011, #3352, #3505.

Location:
branches/release
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • branches/release/boost/iostreams

  • branches/release/boost/iostreams/chain.hpp

    r56830 r58633  
    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>
     
    150151    // chain. Does not affect the size of the buffer for devices already
    151152    // added.
    152     void set_device_buffer_size(int n) { pimpl_->device_buffer_size_ = n; }
     153    void set_device_buffer_size(std::streamsize n)
     154        { pimpl_->device_buffer_size_ = n; }
    153155
    154156    // Sets the size of the buffer created for the filters to be added
    155157    // to this chain. Does not affect the size of the buffer for filters already
    156158    // added.
    157     void set_filter_buffer_size(int n) { pimpl_->filter_buffer_size_ = n; }
     159    void set_filter_buffer_size(std::streamsize n)
     160        { pimpl_->filter_buffer_size_ = n; }
    158161
    159162    // Sets the size of the putback buffer for filters and devices to be added
    160163    // to this chain. Does not affect the size of the buffer for filters or
    161164    // devices already added.
    162     void set_pback_size(int n) { pimpl_->pback_size_ = n; }
     165    void set_pback_size(std::streamsize n)
     166        { pimpl_->pback_size_ = n; }
    163167
    164168    //----------Device interface----------------------------------------------//
     
    173177    {
    174178        if (static_cast<size_type>(n) >= size())
    175             throw std::out_of_range("bad chain offset");
     179            boost::throw_exception(std::out_of_range("bad chain offset"));
    176180        return (*boost::next(list().begin(), n))->component_type();
    177181    }
     
    197201    {
    198202        if (static_cast<size_type>(n) >= size())
    199             throw std::out_of_range("bad chain offset");
     203            boost::throw_exception(std::out_of_range("bad chain offset"));
    200204        streambuf_type* link = *boost::next(list().begin(), n);
    201205        if (BOOST_IOSTREAMS_COMPARE_TYPE_ID(link->component_type(), typeid(T)))
     
    227231private:
    228232    template<typename T>
    229     void push_impl(const T& t, int buffer_size = -1, int pback_size = -1)
     233    void push_impl(const T& t, std::streamsize buffer_size = -1,
     234                   std::streamsize pback_size = -1)
    230235    {
    231236        typedef typename iostreams::category_of<T>::type  category;
     
    239244        BOOST_STATIC_ASSERT((is_convertible<category, Mode>::value));
    240245        if (is_complete())
    241             throw std::logic_error("chain complete");
     246            boost::throw_exception(std::logic_error("chain complete"));
    242247        streambuf_type* prev = !empty() ? list().back() : 0;
    243248        buffer_size =
     
    362367                flags_ &= ~f_open;
    363368            }
    364         list_type     links_;
    365         client_type*  client_;
    366         int           device_buffer_size_,
    367                       filter_buffer_size_,
    368                       pback_size_;
    369         int           flags_;
     369        list_type        links_;
     370        client_type*     client_;
     371        std::streamsize  device_buffer_size_,
     372                         filter_buffer_size_,
     373                         pback_size_;
     374        int              flags_;
    370375    };
    371376    friend struct chain_impl;
  • branches/release/boost/iostreams/checked_operations.hpp

    r43798 r58633  
    2121#include <boost/iostreams/traits.hpp>
    2222#include <boost/iostreams/write.hpp>
     23#include <boost/throw_exception.hpp>
    2324
    2425// Must come last.
     
    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
     
    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>
     
    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
  • branches/release/boost/iostreams/code_converter.hpp

    r56830 r58633  
    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>
     
    153154    }
    154155
    155     void open(const Device& dev, int buffer_size)
     156    template <class T>
     157    void open(const T& dev, int buffer_size)
    156158    {
    157159        if (flags_ & f_open)
    158             throw BOOST_IOSTREAMS_FAILURE("already open");
     160            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("already open"));
    159161        if (buffer_size == -1)
    160162            buffer_size = default_filter_buffer_size;
     
    355357        default:
    356358            buf.state() = state_type();
    357             throw code_conversion_error();
     359            boost::throw_exception(code_conversion_error());
    358360        }
    359361
     
    408410        default:
    409411            buf.state() = state_type();
    410             throw code_conversion_error();
     412            boost::throw_exception(code_conversion_error());
    411413        }
    412414    }
  • branches/release/boost/iostreams/detail/adapter/concept_adapter.hpp

    r43798 r58633  
    2323#include <boost/mpl/if.hpp>
    2424#include <boost/static_assert.hpp>
     25#include <boost/throw_exception.hpp>
    2526
    2627// Must come last.
     
    138139          BOOST_IOS::openmode, any_tag )
    139140    {
    140         throw cant_seek();
     141        boost::throw_exception(cant_seek());
    141142    }
    142143
     
    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
     
    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>
     
    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>
     
    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
     
    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>
  • branches/release/boost/iostreams/detail/adapter/direct_adapter.hpp

    r43798 r58633  
    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
     
    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;
     
    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) {
     
    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) {
     
    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);
  • branches/release/boost/iostreams/detail/adapter/range_adapter.hpp

    r43798 r58633  
    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>
     
    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    }
     
    145146        cur += count;
    146147        if (count < n)
    147             throw write_area_exhausted();
     148            boost::throw_exception(write_area_exhausted());
    148149        return n;
    149150    }
     
    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;
     
    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;
  • branches/release/boost/iostreams/detail/broken_overload_resolution/stream_buffer.hpp

    r56830 r58633  
    1010
    1111#include <boost/iostreams/detail/broken_overload_resolution/forward.hpp>
     12#include <boost/throw_exception.hpp>
    1213
    1314namespace boost { namespace iostreams {
     
    180181    {
    181182        if (this->is_open())
    182             throw BOOST_IOSTREAMS_FAILURE("already open");
     183            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("already open"));
    183184    }
    184185};
  • branches/release/boost/iostreams/detail/push_params.hpp

    r43798 r58633  
    1414
    1515#define BOOST_IOSTREAMS_PUSH_PARAMS() \
    16     , int buffer_size = -1 , int pback_size = -1 \
     16    , std::streamsize buffer_size = -1 , std::streamsize pback_size = -1 \
    1717    /**/
    1818
  • branches/release/boost/iostreams/detail/restrict_impl.hpp

    r56830 r58633  
    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
     
    160161        if (!open_)
    161162            open(snk, BOOST_IOS::out);
    162         if (end_ != -1 && pos_ + n >= end_)
    163             bad_write();
     163        if (end_ != -1 && pos_ + n >= end_) {
     164            if(pos_ < end_)
     165                pos_ += iostreams::write(this->component(),
     166                    snk, s, end_ - pos_);
     167            boost::throw_exception(bad_write());
     168        }
    164169        std::streamsize result =
    165170            iostreams::write(this->component(), snk, s, n);
     
    182187            pos_ = this->component().seek(dev, off, BOOST_IOS::end);
    183188            if (pos_ < beg_)
    184                 bad_seek();
     189                boost::throw_exception(bad_seek());
    185190            return offset_to_position(pos_ - beg_);
    186191        }
    187192        if (next < beg_ || (end_ != -1 && next >= end_))
    188             bad_seek();
     193            boost::throw_exception(bad_seek());
    189194        pos_ = this->component().seek(dev, next, BOOST_IOS::cur);
    190195        return offset_to_position(pos_ - beg_);
     
    249254{
    250255    if (len < -1 || off < 0)
    251         throw BOOST_IOSTREAMS_FAILURE("bad offset");
     256        boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad offset"));
    252257    iostreams::skip(this->component(), off);
    253258}
     
    272277    (const char_type* s, std::streamsize n)
    273278{
    274     if (end_ != -1 && pos_ + n >= end_)
    275         bad_write();
     279    if (end_ != -1 && pos_ + n >= end_) {
     280        if(pos_ < end_)
     281            pos_ += iostreams::write(this->component(), s, end_ - pos_);
     282        boost::throw_exception(bad_write());
     283    }
    276284    std::streamsize result = iostreams::write(this->component(), s, n);
    277285    pos_ += result;
     
    294302        pos_ = iostreams::seek(this->component(), off, BOOST_IOS::end);
    295303        if (pos_ < beg_)
    296             bad_seek();
     304            boost::throw_exception(bad_seek());
    297305        return offset_to_position(pos_ - beg_);
    298306    }
    299     if (next < beg_ || (end_ != -1 && next >= end_))
    300         bad_seek();
     307    if (next < beg_ || (end_ != -1 && next > end_))
     308        boost::throw_exception(bad_seek());
    301309    pos_ = iostreams::seek(this->component(), next - pos_, BOOST_IOS::cur);
    302310    return offset_to_position(pos_ - beg_);
     
    315323         (len != -1 && off + len > seq.second - seq.first) )
    316324    {
    317         throw BOOST_IOSTREAMS_FAILURE("bad offset");
     325        boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad offset"));
    318326    }
    319327    beg_ = seq.first + off;
     
    358366{
    359367    if (len < -1 || off < 0)
    360         throw BOOST_IOSTREAMS_FAILURE("bad offset");
     368        boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad offset"));
    361369}
    362370
  • branches/release/boost/iostreams/detail/streambuf/direct_streambuf.hpp

    r56830 r58633  
    3030#include <boost/iostreams/positioning.hpp>
    3131#include <boost/iostreams/traits.hpp>
     32#include <boost/throw_exception.hpp>
    3233
    3334// Must come last.
     
    5657            )                                             streambuf_type;
    5758public: // stream needs access.
    58     void open(const T& t, int buffer_size, int pback_size);
     59    void open(const T& t, std::streamsize buffer_size,
     60              std::streamsize pback_size);
    5961    bool is_open() const;
    6062    void close();
     
    112114
    113115template<typename T, typename Tr>
    114 void direct_streambuf<T, Tr>::open(const T& t, int, int)
     116void direct_streambuf<T, Tr>::open
     117    (const T& t, std::streamsize, std::streamsize)
    115118{
    116119    storage_.reset(t);
     
    139142{
    140143    if (!ibeg_)
    141         throw cant_read();
     144        boost::throw_exception(cant_read());
    142145    if (!gptr())
    143146        init_get_area();
     
    153156    using namespace std;
    154157    if (!ibeg_)
    155         throw cant_read();
     158        boost::throw_exception(cant_read());
    156159    if (gptr() != 0 && gptr() != ibeg_) {
    157160        gbump(-1);
     
    160163        return traits_type::not_eof(c);
    161164    }
    162     throw bad_putback();
     165    boost::throw_exception(bad_putback());
    163166}
    164167
     
    168171{
    169172    using namespace std;
    170     if (!obeg_) throw BOOST_IOSTREAMS_FAILURE("no write access");
     173    if (!obeg_)
     174        boost::throw_exception(BOOST_IOSTREAMS_FAILURE("no write access"));
    171175    if (!pptr()) init_put_area();
    172176    if (!traits_type::eq_int_type(c, traits_type::eof())) {
    173177        if (pptr() == oend_)
    174             throw BOOST_IOSTREAMS_FAILURE("write area exhausted");
     178            boost::throw_exception(
     179                BOOST_IOSTREAMS_FAILURE("write area exhausted")
     180            );
    175181        *pptr() = traits_type::to_char_type(c);
    176182        pbump(1);
     
    216222    BOOST_IOS::openmode both = BOOST_IOS::in | BOOST_IOS::out;
    217223    if (two_head() && (which & both) == both)
    218         throw bad_seek();
     224        boost::throw_exception(bad_seek());
    219225    stream_offset result = -1;
    220226    bool one = one_head();
     
    231237        }
    232238        if (next < 0 || next > (iend_ - ibeg_))
    233             throw bad_seek();
     239            boost::throw_exception(bad_seek());
    234240        setg(ibeg_, ibeg_ + next, iend_);
    235241        result = next;
     
    245251        }
    246252        if (next < 0 || next > (oend_ - obeg_))
    247             throw bad_seek();
     253            boost::throw_exception(bad_seek());
    248254        pbump(static_cast<int>(next - (pptr() - obeg_)));
    249255        result = next;
  • branches/release/boost/iostreams/detail/streambuf/indirect_streambuf.hpp

    r58575 r58633  
    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
     
    152153template<typename T, typename Tr, typename Alloc, typename Mode>
    153154void indirect_streambuf<T, Tr, Alloc, Mode>::open
    154     (const T& t, int buffer_size, int pback_size)
     155    (const T& t, std::streamsize buffer_size, std::streamsize pback_size)
    155156{
    156157    using namespace std;
     
    275276        return traits_type::not_eof(c);
    276277    } else {
    277         throw bad_putback();
     278        boost::throw_exception(bad_putback());
    278279    }
    279280}
  • branches/release/boost/iostreams/detail/system_failure.hpp

    r43798 r58633  
    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.
     
    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.
  • branches/release/boost/iostreams/device/mapped_file.hpp

    r56830 r58633  
    44// Distributed under the Boost Software License, Version 1.0. (See accompanying
    55// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
     6
     7#ifndef BOOST_IOSTREAMS_MAPPED_FILE_HPP_INCLUDED
     8#define BOOST_IOSTREAMS_MAPPED_FILE_HPP_INCLUDED
    69
    710#if defined(_MSC_VER) && (_MSC_VER >= 1020)
     
    2629#include <boost/shared_ptr.hpp>
    2730#include <boost/static_assert.hpp>
     31#include <boost/throw_exception.hpp>
    2832#include <boost/type_traits/is_same.hpp>
    2933
     
    394398    if (params.flags) {
    395399        if (params.flags != mapped_file::readonly)
    396             throw new BOOST_IOSTREAMS_FAILURE("invalid flags");
     400            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid flags"));
    397401    } else {
    398402        if (params.mode & BOOST_IOS::out)
    399             throw new BOOST_IOSTREAMS_FAILURE("invalid mode");
     403            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid mode"));
    400404        params.mode |= BOOST_IOS::in;
    401405    }
     
    480484    if (params.flags) {
    481485        if (params.flags & mapped_file::readonly)
    482             throw new BOOST_IOSTREAMS_FAILURE("invalid flags");
     486            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid flags"));
    483487    } else {
    484488        if (params.mode & BOOST_IOS::in)
    485             throw new BOOST_IOSTREAMS_FAILURE("invalid mode");
     489            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid mode"));
    486490        params.mode |= BOOST_IOS::out;
    487491    }
     
    592596
    593597#include <boost/config/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
     598
     599#endif // #ifndef BOOST_IOSTREAMS_MAPPED_FILE_HPP_INCLUDED
  • branches/release/boost/iostreams/filter/gzip.hpp

    r56830 r58633  
    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.
     
    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;
     
    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;
     
    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)) {
     
    483484            header_.reset();
    484485            footer_.reset();
    485             throw gzip_error(e);
     486            boost::throw_exception(gzip_error(e));
    486487        }
    487488        state_ = s_start;
  • branches/release/boost/iostreams/filter/newline.hpp

    r56830 r58633  
    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
     
    125126             target != newline::mac )
    126127        {
    127             throw std::logic_error("bad flags");
     128            boost::throw_exception(std::logic_error("bad flags"));
    128129        }
    129130    }
     
    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_; }
  • branches/release/boost/iostreams/filter/zlib.hpp

    r56830 r58633  
    2121#include <new>         
    2222#include <boost/config.hpp>  // MSVC, STATIC_CONSTANT, DEDUCED_TYPENAME, DINKUM.
     23#include <boost/cstdint.hpp> // uint*_t
    2324#include <boost/detail/workaround.hpp>
    2425#include <boost/iostreams/constants.hpp>   // buffer size.
     
    4445                    // Typedefs
    4546
    46 typedef unsigned int uint;
    47 typedef unsigned char byte;
    48 typedef unsigned long ulong;
     47typedef uint32_t uint;
     48typedef uint8_t byte;
     49typedef uint32_t ulong;
    4950
    5051// Prefix 'x' prevents symbols from being redefined when Z_PREFIX is defined
  • branches/release/boost/iostreams/skip.hpp

    r56830 r58633  
    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
     
    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;
     
    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;
  • branches/release/boost/iostreams/stream_buffer.hpp

    r56830 r58633  
    2323#include <boost/iostreams/traits.hpp>
    2424#include <boost/static_assert.hpp>
     25#include <boost/throw_exception.hpp>
    2526#include <boost/type_traits/is_convertible.hpp>
    2627
     
    100101        {   // Used for forwarding.
    101102            if (this->is_open())
    102                 BOOST_IOSTREAMS_FAILURE("already open");
     103                boost::throw_exception(
     104                    BOOST_IOSTREAMS_FAILURE("already open")
     105                );
    103106            base_type::open(t BOOST_IOSTREAMS_PUSH_ARGS());
    104107        }
  • branches/release/libs/iostreams

  • branches/release/libs/iostreams/build/Jamfile.v2

    r56830 r58633  
    151151}
    152152
    153 lib boost_iostreams : $(sources) : <link>shared:<define>BOOST_IOSTREAMS_DYN_LINK=1 ;
     153lib boost_iostreams
     154    : $(sources)
     155    : <link>shared:<define>BOOST_IOSTREAMS_DYN_LINK=1
     156    :
     157    : <link>shared:<define>BOOST_IOSTREAMS_DYN_LINK=1
     158    ;
    154159
    155160boost-install boost_iostreams ;
  • branches/release/libs/iostreams/doc/classes/null.html

    r43798 r58633  
    22<HTML>
    33<HEAD>
    4     <TITLE>Array Devices</TITLE>
     4    <TITLE>Null Devices</TITLE>
    55    <LINK REL="stylesheet" HREF="../../../../boost.css">
    66    <LINK REL="stylesheet" HREF="../theme/iostreams.css">
  • branches/release/libs/iostreams/doc/functions/filter_test.html

    r43798 r58633  
    22<HTML>
    33<HEAD>
    4     <TITLE>Array Devices</TITLE>
     4    <TITLE>Filter Testing Functions</TITLE>
    55    <LINK REL="stylesheet" HREF="../../../../boost.css">
    66    <LINK REL="stylesheet" HREF="../theme/iostreams.css">
  • branches/release/libs/iostreams/src/bzip2.cpp

    r43798 r58633  
    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>
     
    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}
  • branches/release/libs/iostreams/src/file_descriptor.cpp

    r56830 r58633  
    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.
     
    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 =
     
    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;
     
    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
     
    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;
     
    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(
     
    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 =
     
    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
     
    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}
     
    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}
  • branches/release/libs/iostreams/src/file_times.cpp

    r56830 r58633  
    1 /*
    2  * Distributed under the Boost Software License, Version 1.0.(See accompanying
    3  * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
    4  *
    5  * See http://www.boost.org/libs/iostreams for documentation.
    6  *
    7  * File:        libs/iostreams/src/file_times.cpp
    8  * Date:        Sun Jun 22 14:23:12 MDT 2008
    9  * Copyright:   Jorge Lodos and 2008 CodeRage, LLC
    10  * Author:      Jorge Lodos and Jonathan Turkanis
    11  * Contact:     turkanis at coderage dot com
    12  *
    13  * Implements the functions declared in the header
    14  * <boost/iostreams/detail/file_times.hpp>.
    15  */
    16 
    17 // Define BOOST_IOSTREAMS_SOURCE so that <boost/iostreams/detail/config.hpp>
    18 // knows that we are building the library (possibly exporting code), rather
    19 // than using it (possibly importing code).
    20 #define BOOST_IOSTREAMS_SOURCE
    21 
    22 #include <ctime>
    23 #include <boost/iostreams/detail/config/windows_posix.hpp>
    24 #include <boost/iostreams/detail/file_times.hpp>
    25 #include <boost/iostreams/detail/system_failure.hpp>
    26 
    27 #ifdef BOOST_IOSTREAMS_WINDOWS
    28 # define WIN32_LEAN_AND_MEAN  // Exclude rarely-used stuff from Windows headers
    29 # include <windows.h>
    30 #else
    31 # include <fcntl.h>
    32 # include <sys/stat.h>
    33 # include <sys/time.h>      // futimes
    34 # include <sys/types.h>     // struct stat.
    35 #endif
    36 
    37 // Must come last
    38 #include <boost/iostreams/detail/config/disable_warnings.hpp>
    39 
    40 namespace boost { namespace iostreams { namespace detail {
    41 
    42 std::time_t last_read_time(file_handle h)
    43 {
    44 #ifdef BOOST_IOSTREAMS_WINDOWS
    45     FILETIME ft_access;
    46     if (!::GetFileTime(h, NULL, &ft_access, NULL))
    47         throw_system_failure("failed querying last access time");
    48     SYSTEMTIME st_access;
    49     if (!FileTimeToSystemTime(&ft_access, &st_access))
    50         throw_system_failure("failed querying last access time");
    51     std::tm tm;
    52     tm.tm_sec = st_access.wSecond;
    53     tm.tm_min = st_access.wMinute;
    54     tm.tm_hour = st_access.wHour;
    55     tm.tm_mday = st_access.wDay;
    56     tm.tm_mon = st_access.wMonth - 1;
    57     tm.tm_year = st_access.wYear - 1900;
    58     return std::mktime(&tm);
    59 #else   
    60     struct stat info;
    61     if (::fstat(h, &info) == -1)
    62         throw_system_failure("failed querying last access time");
    63     return info.st_atime;
    64 #endif
    65 }
    66 
    67 void set_last_read_time(file_handle h, time_t tm)
    68 {
    69 #ifdef BOOST_IOSTREAMS_WINDOWS
    70     struct std::tm* t = std::gmtime(&tm);
    71     if (t == NULL)
    72         throw_system_failure("failed settting last access time");
    73     SYSTEMTIME st_access;
    74     st_access.wSecond = t->tm_sec;
    75     st_access.wMinute = t->tm_min;
    76     st_access.wHour = t->tm_hour;
    77     st_access.wDay = t->tm_mday;
    78     st_access.wMonth = t->tm_mon + 1;
    79     st_access.wYear = t->tm_year + 1900;
    80     FILETIME ft_access;
    81     if (!SystemTimeToFileTime(&st_access, &ft_access))
    82         throw_system_failure("failed settting last access time");
    83     if (!::SetFileTime(h, NULL, &ft_access, NULL))
    84         throw_system_failure("failed settting last access time");
    85 #else
    86     struct stat info;
    87     if (::fstat(h, &info) == -1)
    88         throw_system_failure("failed settting last access time");
    89     struct timeval tv[2];
    90     tv[0].tv_sec = tm;
    91     tv[0].tv_usec = 0;
    92     tv[1].tv_sec = info.st_mtime;
    93     tv[1].tv_usec = 0;
    94     if (futimes(h, tv) != 0)
    95         throw_system_failure("failed settting last access time");
    96 #endif
    97 }
    98 
    99 std::time_t last_write_time(file_handle h)
    100 {
    101 #ifdef BOOST_IOSTREAMS_WINDOWS
    102     FILETIME ft_modification;
    103     if (!::GetFileTime(h, NULL, NULL, &ft_modification))
    104         throw_system_failure("failed querying last modification time");
    105     SYSTEMTIME st_modification;
    106     if (!FileTimeToSystemTime(&ft_modification, &st_modification))
    107         throw_system_failure("failed querying last modification time");
    108     std::tm tm;
    109     tm.tm_sec = st_modification.wSecond;
    110     tm.tm_min = st_modification.wMinute;
    111     tm.tm_hour = st_modification.wHour;
    112     tm.tm_mday = st_modification.wDay;
    113     tm.tm_mon = st_modification.wMonth - 1;
    114     tm.tm_year = st_modification.wYear - 1900;
    115     return std::mktime(&tm);
    116 #else
    117     struct stat info;
    118     if (::fstat(h, &info) == -1)
    119         throw_system_failure("failed querying last modification time");
    120     return info.st_mtime;
    121 #endif
    122 }
    123 
    124 void set_last_write_time(file_handle h, time_t tm)
    125 {
    126 #ifdef BOOST_IOSTREAMS_WINDOWS
    127     struct std::tm* t = std::gmtime(&tm);
    128     if (t == NULL)
    129         throw_system_failure("failed settting last modification time");
    130     SYSTEMTIME st_modification;
    131     st_modification.wSecond = t->tm_sec;
    132     st_modification.wMinute = t->tm_min;
    133     st_modification.wHour = t->tm_hour;
    134     st_modification.wDay = t->tm_mday;
    135     st_modification.wMonth = t->tm_mon + 1;
    136     st_modification.wYear = t->tm_year + 1900;
    137     FILETIME ft_modification;
    138     if (!SystemTimeToFileTime(&st_modification, &ft_modification))
    139         throw_system_failure("failed settting last modification time");
    140     if(!::SetFileTime(h, NULL, &ft_modification, NULL))
    141         throw_system_failure("failed settting last modification time");
    142 #else
    143     struct stat info;
    144     if (::fstat(h, &info) == -1)
    145         throw_system_failure("failed settting last modification time");
    146     struct timeval tv[2];
    147     tv[0].tv_sec = info.st_atime;
    148     tv[0].tv_usec = 0;
    149     tv[1].tv_sec = tm;
    150     tv[1].tv_usec = 0;
    151     if (futimes(h, tv) != 0)
    152         throw_system_failure("failed settting last modification time");
    153 #endif
    154 }
    155 
    156 } } } // End namespaces detail, iostreams, boost.
    157 
    158 #include <boost/iostreams/detail/config/enable_warnings.hpp>
     1#error "This file needs to be removed from subversion."
  • branches/release/libs/iostreams/src/gzip.cpp

    r56830 r58633  
    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 {
     
    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;
  • branches/release/libs/iostreams/src/mapped_file.cpp

    r56830 r58633  
    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
     
    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);
     
    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");
     
    336343            try_map_file(p);
    337344        } else {
    338             throw e;
     345            boost::throw_exception(e);
    339346        }
    340347    }
     
    374381#ifdef BOOST_IOSTREAMS_WINDOWS
    375382    DWORD error = GetLastError();
    376     if (mapped_handle_ != INVALID_HANDLE_VALUE)
     383    if (mapped_handle_ != NULL)
    377384        ::CloseHandle(mapped_handle_);
    378     if (handle_ != NULL)
     385    if (handle_ != INVALID_HANDLE_VALUE)
    379386        ::CloseHandle(handle_);
    380387    SetLastError(error);
     
    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) {
     
    404411            break;
    405412        default:
    406             throw BOOST_IOSTREAMS_FAILURE("invalid flags");
     413            boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid flags"));
    407414        }
    408415    } else {
     
    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
  • branches/release/libs/iostreams/src/zlib.cpp

    r56830 r58633  
    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>
     
    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    }
  • branches/release/libs/iostreams/test/restrict_test.cpp

    r43798 r58633  
    1010// would interfere with the oepration of the header
    1111// <boost/iostreams/restrict.hpp>
    12 #ifndef BOOST_RESTRICT
    13 # define BOOST_RESTRICT restrict
    14 # define BOOST_RESTRICT_HEADER <boost/iostreams/restrict.hpp>
     12#include <iostream>
     13
     14#if defined(BOOST_RESTRICT_USE_SLICE)
     15#  include <boost/iostreams/slice.hpp>
     16#  define BOOST_RESTRICT slice
     17#else
     18#  include <boost/iostreams/restrict.hpp>
     19#  define BOOST_RESTRICT restrict
    1520#endif
    16 #include BOOST_RESTRICT_HEADER
    1721
    1822#include <algorithm>         // equal.
  • branches/release/libs/iostreams/test/slice_test.cpp

    r43404 r58633  
    1414 */
    1515
    16 #define BOOST_RESTRICT slice
    17 #define BOOST_RESTRICT_HEADER <boost/iostreams/slice.hpp>
     16#define BOOST_RESTRICT_USE_SLICE
    1817#include "restrict_test.cpp"
Note: See TracChangeset for help on using the changeset viewer.