Boost logo

Boost-Commit :

From: technews_at_[hidden]
Date: 2008-01-06 02:37:06


Author: turkanis
Date: 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
New Revision: 42515
URL: http://svn.boost.org/trac/boost/changeset/42515

Log:
full merge from trunk at 42510 of boost/iostreams and libs/iostreams
Added:
   branches/release/boost/iostreams/detail/adapter/device_adapter.hpp
      - copied unchanged from r42513, /trunk/boost/iostreams/detail/adapter/device_adapter.hpp
   branches/release/boost/iostreams/detail/adapter/filter_adapter.hpp
      - copied unchanged from r42513, /trunk/boost/iostreams/detail/adapter/filter_adapter.hpp
   branches/release/boost/iostreams/detail/config/rtl.hpp
      - copied unchanged from r42513, /trunk/boost/iostreams/detail/config/rtl.hpp
   branches/release/boost/iostreams/detail/execute.hpp
      - copied unchanged from r42513, /trunk/boost/iostreams/detail/execute.hpp
   branches/release/boost/iostreams/detail/functional.hpp
      - copied unchanged from r42513, /trunk/boost/iostreams/detail/functional.hpp
   branches/release/libs/iostreams/test/close_test.cpp
      - copied unchanged from r42514, /trunk/libs/iostreams/test/close_test.cpp
   branches/release/libs/iostreams/test/detail/closable.hpp
      - copied unchanged from r42514, /trunk/libs/iostreams/test/detail/closable.hpp
   branches/release/libs/iostreams/test/detail/operation_sequence.hpp
      - copied unchanged from r42514, /trunk/libs/iostreams/test/detail/operation_sequence.hpp
   branches/release/libs/iostreams/test/execute_test.cpp
      - copied unchanged from r42514, /trunk/libs/iostreams/test/execute_test.cpp
   branches/release/libs/iostreams/test/large_file_test.cpp
      - copied unchanged from r42514, /trunk/libs/iostreams/test/large_file_test.cpp
   branches/release/libs/iostreams/test/operation_sequence_test.cpp
      - copied unchanged from r42514, /trunk/libs/iostreams/test/operation_sequence_test.cpp
   branches/release/libs/iostreams/test/sequence_test.cpp
      - copied unchanged from r42514, /trunk/libs/iostreams/test/sequence_test.cpp
   branches/release/libs/iostreams/test/stream_offset_32bit_test.cpp
      - copied unchanged from r42514, /trunk/libs/iostreams/test/stream_offset_32bit_test.cpp
   branches/release/libs/iostreams/test/stream_offset_64bit_test.cpp
      - copied unchanged from r42514, /trunk/libs/iostreams/test/stream_offset_64bit_test.cpp
   branches/release/libs/iostreams/test/stream_state_test.cpp
      - copied unchanged from r42514, /trunk/libs/iostreams/test/stream_state_test.cpp
Removed:
   branches/release/boost/iostreams/detail/adapter/basic_adapter.hpp
   branches/release/boost/iostreams/detail/closer.hpp
   branches/release/libs/iostreams/build/bzip2.jam
   branches/release/libs/iostreams/build/zlib.jam
   branches/release/libs/iostreams/test/offset_test.cpp
   branches/release/libs/iostreams/test/positioning_test.cpp
Text files modified:
   branches/release/boost/iostreams/chain.hpp | 51 +++-
   branches/release/boost/iostreams/close.hpp | 84 ++++++++
   branches/release/boost/iostreams/code_converter.hpp | 82 ++++----
   branches/release/boost/iostreams/combine.hpp | 16
   branches/release/boost/iostreams/compose.hpp | 119 +++++++++---
   branches/release/boost/iostreams/copy.hpp | 120 +++++++++---
   branches/release/boost/iostreams/detail/adapter/concept_adapter.hpp | 3
   branches/release/boost/iostreams/detail/adapter/direct_adapter.hpp | 25 +-
   branches/release/boost/iostreams/detail/adapter/mode_adapter.hpp | 9
   branches/release/boost/iostreams/detail/adapter/non_blocking_adapter.hpp | 1
   branches/release/boost/iostreams/detail/adapter/range_adapter.hpp | 6
   branches/release/boost/iostreams/detail/broken_overload_resolution/stream_buffer.hpp | 2
   branches/release/boost/iostreams/detail/buffer.hpp | 10
   branches/release/boost/iostreams/detail/codecvt_holder.hpp | 2
   branches/release/boost/iostreams/detail/config/codecvt.hpp | 4
   branches/release/boost/iostreams/detail/config/disable_warnings.hpp | 6
   branches/release/boost/iostreams/detail/config/limits.hpp | 4
   branches/release/boost/iostreams/detail/enable_if_stream.hpp | 5
   branches/release/boost/iostreams/detail/is_iterator_range.hpp | 15 +
   branches/release/boost/iostreams/detail/resolve.hpp | 14
   branches/release/boost/iostreams/detail/streambuf/direct_streambuf.hpp | 25 +-
   branches/release/boost/iostreams/detail/streambuf/indirect_streambuf.hpp | 63 +++---
   branches/release/boost/iostreams/detail/streambuf/linked_streambuf.hpp | 50 ++++
   branches/release/boost/iostreams/detail/vc6/close.hpp | 11
   branches/release/boost/iostreams/device/file_descriptor.hpp | 14 +
   branches/release/boost/iostreams/device/mapped_file.hpp | 17 +
   branches/release/boost/iostreams/device/null.hpp | 3
   branches/release/boost/iostreams/filter/aggregate.hpp | 43 ++--
   branches/release/boost/iostreams/filter/bzip2.hpp | 11 +
   branches/release/boost/iostreams/filter/gzip.hpp | 59 +++--
   branches/release/boost/iostreams/filter/line.hpp | 31 +-
   branches/release/boost/iostreams/filter/newline.hpp | 136 ++++++++------
   branches/release/boost/iostreams/filter/regex.hpp | 2
   branches/release/boost/iostreams/filter/stdio.hpp | 5
   branches/release/boost/iostreams/filter/symmetric.hpp | 54 +++--
   branches/release/boost/iostreams/filter/test.hpp | 2
   branches/release/boost/iostreams/invert.hpp | 19 +
   branches/release/boost/iostreams/pipeline.hpp | 2
   branches/release/boost/iostreams/positioning.hpp | 10
   branches/release/boost/iostreams/read.hpp | 2
   branches/release/boost/iostreams/restrict.hpp | 67 +++++--
   branches/release/boost/iostreams/skip.hpp | 49 +++-
   branches/release/boost/iostreams/stream.hpp | 1
   branches/release/boost/iostreams/stream_buffer.hpp | 2
   branches/release/boost/iostreams/tee.hpp | 26 +-
   branches/release/boost/iostreams/traits.hpp | 12
   branches/release/libs/iostreams/doc/acknowledgments.html | 2
   branches/release/libs/iostreams/doc/classes/symmetric_filter.html | 2
   branches/release/libs/iostreams/doc/guide/concepts.html | 10
   branches/release/libs/iostreams/doc/guide/modes.html | 4
   branches/release/libs/iostreams/doc/tutorial/container_device.html | 8
   branches/release/libs/iostreams/doc/tutorial/container_sink.html | 4
   branches/release/libs/iostreams/doc/tutorial/container_source.html | 4
   branches/release/libs/iostreams/doc/tutorial/dictionary_filters.html | 1
   branches/release/libs/iostreams/doc/tutorial/multichar_filters.html | 2
   branches/release/libs/iostreams/doc/tutorial/shell_comments_filters.html | 2
   branches/release/libs/iostreams/example/container_device.hpp | 24 +
   branches/release/libs/iostreams/example/container_device_example.cpp | 6
   branches/release/libs/iostreams/example/container_sink_example.cpp | 6
   branches/release/libs/iostreams/example/container_source_example.cpp | 8
   branches/release/libs/iostreams/example/dictionary_filter.hpp | 8
   branches/release/libs/iostreams/example/finite_state_filter.hpp | 9
   branches/release/libs/iostreams/src/bzip2.cpp | 4
   branches/release/libs/iostreams/src/file_descriptor.cpp | 95 +++++-----
   branches/release/libs/iostreams/src/mapped_file.cpp | 14 +
   branches/release/libs/iostreams/src/zlib.cpp | 2
   branches/release/libs/iostreams/test/Jamfile.v2 | 57 ++++--
   branches/release/libs/iostreams/test/code_converter_test.cpp | 363 ++++++++++++++++++++++-----------------
   branches/release/libs/iostreams/test/compose_test.cpp | 4
   branches/release/libs/iostreams/test/copy_test.cpp | 137 +++++++++++---
   branches/release/libs/iostreams/test/detail/filters.hpp | 2
   branches/release/libs/iostreams/test/detail/null_padded_codecvt.hpp | 10
   branches/release/libs/iostreams/test/detail/utf8_codecvt_facet.hpp | 3
   branches/release/libs/iostreams/test/detail/verification.hpp | 93 +++++++++
   branches/release/libs/iostreams/test/example_test.cpp | 12
   branches/release/libs/iostreams/test/file_descriptor_test.cpp | 24 ++
   branches/release/libs/iostreams/test/filtering_stream_test.cpp | 10
   branches/release/libs/iostreams/test/seek_test.hpp | 16 +
   branches/release/libs/iostreams/test/seekable_filter_test.cpp | 18 +
   branches/release/libs/iostreams/test/symmetric_filter_test.cpp | 2
   branches/release/libs/iostreams/test/wide_stream_test.cpp | 18 +
   81 files changed, 1486 insertions(+), 792 deletions(-)

Modified: branches/release/boost/iostreams/chain.hpp
==============================================================================
--- branches/release/boost/iostreams/chain.hpp (original)
+++ branches/release/boost/iostreams/chain.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -11,7 +11,6 @@
 # pragma once
 #endif
 
-#include <algorithm> // for_each.
 #include <cassert>
 #include <exception>
 #include <functional> // unary_function.
@@ -38,7 +37,8 @@
 #include <boost/static_assert.hpp>
 #include <boost/type_traits/is_convertible.hpp>
 #include <boost/type.hpp>
-#if BOOST_WORKAROUND(BOOST_MSVC, < 1310)
+#include <boost/iostreams/detail/execute.hpp> // VC6.5 requires this
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1310) // #include order
 # include <boost/mpl/int.hpp>
 #endif
 
@@ -229,7 +229,8 @@
                     policy_type,
                     BOOST_IOSTREAMS_CHAR_TRAITS(char_type),
                     Alloc, Mode
- > facade_type;
+ > streambuf_t;
+ typedef typename list_type::iterator iterator;
         BOOST_STATIC_ASSERT((is_convertible<category, Mode>::value));
         if (is_complete())
             throw std::logic_error("chain complete");
@@ -242,12 +243,20 @@
             pback_size != -1 ?
                 pback_size :
                 pimpl_->pback_size_;
- std::auto_ptr<facade_type>
- buf(new facade_type(t, buffer_size, pback_size));
+ std::auto_ptr<streambuf_t>
+ buf(new streambuf_t(t, buffer_size, pback_size));
         list().push_back(buf.get());
         buf.release();
- if (is_device<policy_type>::value)
+ if (is_device<policy_type>::value) {
             pimpl_->flags_ |= f_complete | f_open;
+ for ( iterator first = list().begin(),
+ last = list().end();
+ first != last;
+ ++first )
+ {
+ (*first)->set_needs_close();
+ }
+ }
         if (prev) prev->set_next(list().back());
         notify();
     }
@@ -261,7 +270,7 @@
 
     static void close(streambuf_type* b, BOOST_IOS::openmode m)
     {
- if (m & BOOST_IOS::out)
+ if (m == BOOST_IOS::out && is_convertible<Mode, output>::value)
             b->BOOST_IOSTREAMS_PUBSYNC();
         b->close(m);
     }
@@ -295,23 +304,35 @@
               pback_size_(default_pback_buffer_size),
               flags_(f_auto_close)
             { }
- ~chain_impl() { try { close(); reset(); } catch (std::exception&) { } }
+ ~chain_impl() { try { close(); reset(); } catch (...) { } }
         void close()
             {
                 if ((flags_ & f_open) != 0) {
+ flags_ &= ~f_open;
                     stream_buffer< basic_null_device<Ch, Mode> > null;
                     if ((flags_ & f_complete) == 0) {
                         null.open(basic_null_device<Ch, Mode>());
                         set_next(links_.back(), &null);
                     }
                     links_.front()->BOOST_IOSTREAMS_PUBSYNC();
- if (is_convertible<Mode, input>::value)
- std::for_each( links_.rbegin(), links_.rend(),
- closer(BOOST_IOS::in) );
- if (is_convertible<Mode, output>::value)
- std::for_each( links_.begin(), links_.end(),
- closer(BOOST_IOS::out) );
- flags_ &= ~f_open;
+ try {
+ boost::iostreams::detail::execute_foreach(
+ links_.rbegin(), links_.rend(),
+ closer(BOOST_IOS::in)
+ );
+ } catch (...) {
+ try {
+ boost::iostreams::detail::execute_foreach(
+ links_.begin(), links_.end(),
+ closer(BOOST_IOS::out)
+ );
+ } catch (...) { }
+ throw;
+ }
+ boost::iostreams::detail::execute_foreach(
+ links_.begin(), links_.end(),
+ closer(BOOST_IOS::out)
+ );
                 }
             }
         void reset()

Modified: branches/release/boost/iostreams/close.hpp
==============================================================================
--- branches/release/boost/iostreams/close.hpp (original)
+++ branches/release/boost/iostreams/close.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -16,16 +16,65 @@
 #include <boost/iostreams/categories.hpp>
 #include <boost/iostreams/flush.hpp>
 #include <boost/iostreams/detail/adapter/non_blocking_adapter.hpp>
+#include <boost/iostreams/detail/ios.hpp> // BOOST_IOS
 #include <boost/iostreams/detail/wrap_unwrap.hpp>
 #include <boost/iostreams/operations_fwd.hpp>
 #include <boost/iostreams/traits.hpp>
 #include <boost/mpl/identity.hpp>
 #include <boost/mpl/if.hpp>
 #include <boost/type_traits/is_convertible.hpp>
+#include <boost/type_traits/is_integral.hpp>
+#include <boost/type_traits/remove_cv.hpp>
+#include <boost/type_traits/remove_reference.hpp>
 
 // Must come last.
 #include <boost/iostreams/detail/config/disable_warnings.hpp>
 
+namespace boost { namespace iostreams {
+
+template<typename T>
+void close(T& t);
+
+template<typename T>
+void close(T& t, BOOST_IOS::openmode which);
+
+template<typename T, typename Sink>
+void close(T& t, Sink& snk, BOOST_IOS::openmode which);
+
+namespace detail {
+
+template<typename T>
+void close_all(T& t)
+{
+ try {
+ boost::iostreams::close(t, BOOST_IOS::in);
+ } catch (...) {
+ try {
+ boost::iostreams::close(t, BOOST_IOS::out);
+ } catch (...) { }
+ throw;
+ }
+ boost::iostreams::close(t, BOOST_IOS::out);
+}
+
+template<typename T, typename Sink>
+void close_all(T& t, Sink& snk)
+{
+ try {
+ boost::iostreams::close(t, snk, BOOST_IOS::in);
+ } catch (...) {
+ try {
+ boost::iostreams::close(t, snk, BOOST_IOS::out);
+ } catch (...) { }
+ throw;
+ }
+ boost::iostreams::close(t, snk, BOOST_IOS::out);
+}
+
+} // End namespaces detail.
+
+} } // End namespaces iostreams, boost.
+
 #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) //-----------------------------------//
 # include <boost/iostreams/detail/vc6/close.hpp>
 #else // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) //--------------------------//
@@ -40,12 +89,35 @@
 } // End namespace detail.
 
 template<typename T>
+void close(T& t) { detail::close_all(t); }
+
+template<typename T>
 void close(T& t, BOOST_IOS::openmode which)
-{ detail::close_impl<T>::close(detail::unwrap(t), which); }
+{
+#ifdef BOOST_IOSTREAMS_STRICT
+ assert(which == BOOST_IOS::in || which == BOOST_IOS::out);
+#else
+ if (which == (BOOST_IOS::in | BOOST_IOS::out)) {
+ detail::close_all(t);
+ return;
+ }
+#endif
+ detail::close_impl<T>::close(detail::unwrap(t), which);
+}
 
 template<typename T, typename Sink>
 void close(T& t, Sink& snk, BOOST_IOS::openmode which)
-{ detail::close_impl<T>::close(detail::unwrap(t), snk, which); }
+{
+#ifdef BOOST_IOSTREAMS_STRICT
+ assert(which == BOOST_IOS::in || which == BOOST_IOS::out);
+#else
+ if (which == (BOOST_IOS::in | BOOST_IOS::out)) {
+ detail::close_all(t, snk);
+ return;
+ }
+#endif
+ detail::close_impl<T>::close(detail::unwrap(t), snk, which);
+}
 
 namespace detail {
 
@@ -83,14 +155,14 @@
     template<typename T>
     static void close(T& t, BOOST_IOS::openmode which)
     {
- if ((which & BOOST_IOS::out) != 0)
+ if (which == BOOST_IOS::out)
             iostreams::flush(t);
     }
 
     template<typename T, typename Sink>
     static void close(T& t, Sink& snk, BOOST_IOS::openmode which)
     {
- if ((which & BOOST_IOS::out) != 0) {
+ if (which == BOOST_IOS::out) {
             non_blocking_adapter<Sink> nb(snk);
             iostreams::flush(t, nb);
         }
@@ -106,7 +178,7 @@
         typedef typename category_of<T>::type category;
         const bool in = is_convertible<category, input>::value &&
                         !is_convertible<category, output>::value;
- if (in == ((which & BOOST_IOS::in) != 0))
+ if (in == (which == BOOST_IOS::in))
             t.close();
     }
     template<typename T, typename Sink>
@@ -115,7 +187,7 @@
         typedef typename category_of<T>::type category;
         const bool in = is_convertible<category, input>::value &&
                         !is_convertible<category, output>::value;
- if (in == ((which & BOOST_IOS::in) != 0)) {
+ if (in == (which == BOOST_IOS::in)) {
             non_blocking_adapter<Sink> nb(snk);
             t.close(nb);
         }

Modified: branches/release/boost/iostreams/code_converter.hpp
==============================================================================
--- branches/release/boost/iostreams/code_converter.hpp (original)
+++ branches/release/boost/iostreams/code_converter.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -33,12 +33,14 @@
 #include <boost/iostreams/detail/codecvt_holder.hpp>
 #include <boost/iostreams/detail/codecvt_helper.hpp>
 #include <boost/iostreams/detail/double_object.hpp>
+#include <boost/iostreams/detail/execute.hpp>
 #include <boost/iostreams/detail/forward.hpp>
+#include <boost/iostreams/detail/functional.hpp>
 #include <boost/iostreams/detail/ios.hpp> // failure, openmode, int types.
+#include <boost/iostreams/detail/optional.hpp>
 #include <boost/iostreams/detail/select.hpp>
 #include <boost/iostreams/traits.hpp>
 #include <boost/iostreams/operations.hpp>
-#include <boost/optional.hpp>
 #include <boost/shared_ptr.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/type_traits/is_convertible.hpp>
@@ -146,7 +148,7 @@
     {
         try {
             if (flags_ & f_open) close();
- } catch (std::exception&) { /* */ }
+ } catch (...) { /* */ }
     }
 
     void open(const Device& dev, int buffer_size)
@@ -166,28 +168,32 @@
             buf_.second().set(0, 0);
         }
         dev_.reset(concept_adapter<policy_type>(dev));
- flags_ |= f_open;
+ flags_ = f_open;
     }
 
- void close(BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out)
+ void close()
     {
- if (which & BOOST_IOS::in) {
- iostreams::close(dev(), BOOST_IOS::in);
+ detail::execute_all(
+ detail::call_member_close(*this, BOOST_IOS::in),
+ detail::call_member_close(*this, BOOST_IOS::out)
+ );
+ }
+
+ void close(BOOST_IOS::openmode which)
+ {
+ if (which == BOOST_IOS::in && (flags_ & f_input_closed) == 0) {
             flags_ |= f_input_closed;
+ iostreams::close(dev(), BOOST_IOS::in);
         }
- if (which & BOOST_IOS::out) {
- buf_.second().flush(dev());
- iostreams::close(dev(), BOOST_IOS::out);
+ if (which == BOOST_IOS::out && (flags_ & f_output_closed) == 0) {
             flags_ |= f_output_closed;
- }
- if ( !is_double::value ||
- (flags_ & f_input_closed) != 0 &&
- (flags_ & f_output_closed) != 0 )
- {
- dev_.reset();
- buf_.first().reset();
- buf_.second().reset();
- flags_ = 0;
+ detail::execute_all(
+ detail::flush_buffer(buf_.second(), dev(), can_write::value),
+ detail::call_close(dev(), BOOST_IOS::out),
+ detail::call_reset(dev_),
+ detail::call_reset(buf_.first()),
+ detail::call_reset(buf_.second())
+ );
         }
     }
 
@@ -305,10 +311,9 @@
 std::streamsize code_converter<Device, Codevt, Alloc>::read
     (char_type* s, std::streamsize n)
 {
- using namespace std;
     const extern_type* next; // Next external char.
     intern_type* nint; // Next internal char.
- streamsize total = 0; // Characters read.
+ std::streamsize total = 0; // Characters read.
     int status = iostreams::char_traits<char>::good();
     bool partial = false;
     buffer_type& buf = in();
@@ -324,28 +329,28 @@
         }
 
         // Convert.
- codecvt_base::result result =
+ std::codecvt_base::result result =
             cvt().in( buf.state(),
                       buf.ptr(), buf.eptr(), next,
                       s + total, s + n, nint );
         buf.ptr() += next - buf.ptr();
- total = static_cast<streamsize>(nint - s);
+ total = static_cast<std::streamsize>(nint - s);
 
         switch (result) {
- case codecvt_base::partial:
+ case std::codecvt_base::partial:
             partial = true;
             break;
- case codecvt_base::ok:
+ case std::codecvt_base::ok:
             break;
- case codecvt_base::noconv:
+ case std::codecvt_base::noconv:
             {
- streamsize amt =
- std::min<streamsize>(next - buf.ptr(), n - total);
+ std::streamsize amt =
+ std::min<std::streamsize>(next - buf.ptr(), n - total);
                 detail::strncpy_if_same(s + total, buf.ptr(), amt);
                 total += amt;
             }
             break;
- case codecvt_base::error:
+ case std::codecvt_base::error:
         default:
             buf.state() = state_type();
             throw code_conversion_error();
@@ -360,11 +365,10 @@
 std::streamsize code_converter<Device, Codevt, Alloc>::write
     (const char_type* s, std::streamsize n)
 {
- using namespace std;
     buffer_type& buf = out();
     extern_type* next; // Next external char.
     const intern_type* nint; // Next internal char.
- streamsize total = 0; // Characters written.
+ std::streamsize total = 0; // Characters written.
     bool partial = false;
 
     while (total < n) {
@@ -377,7 +381,7 @@
         }
        
         // Convert.
- codecvt_base::result result =
+ std::codecvt_base::result result =
             cvt().out( buf.state(),
                        s + total, s + n, nint,
                        buf.eptr(), buf.end(), next );
@@ -385,21 +389,21 @@
         buf.eptr() += progress;
 
         switch (result) {
- case codecvt_base::partial:
+ case std::codecvt_base::partial:
             partial = true; // Fall through.
- case codecvt_base::ok:
- total = static_cast<streamsize>(nint - s);
+ case std::codecvt_base::ok:
+ total = static_cast<std::streamsize>(nint - s);
             break;
- case codecvt_base::noconv:
+ case std::codecvt_base::noconv:
             {
- streamsize amt =
- std::min<streamsize>( nint - total - s,
- buf.end() - buf.eptr() );
+ std::streamsize amt =
+ std::min<std::streamsize>( nint - total - s,
+ buf.end() - buf.eptr() );
                 detail::strncpy_if_same(buf.eptr(), s + total, amt);
                 total += amt;
             }
             break;
- case codecvt_base::error:
+ case std::codecvt_base::error:
         default:
             buf.state() = state_type();
             throw code_conversion_error();

Modified: branches/release/boost/iostreams/combine.hpp
==============================================================================
--- branches/release/boost/iostreams/combine.hpp (original)
+++ branches/release/boost/iostreams/combine.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -97,10 +97,10 @@
     template<typename Sink>
     void close(Sink& snk, BOOST_IOS::openmode which)
         {
- if (which & BOOST_IOS::in)
- iostreams::close(in_, snk, which);
- if (which & BOOST_IOS::out)
- iostreams::close(out_, snk, which);
+ if (which == BOOST_IOS::in)
+ detail::close_all(in_, snk);
+ if (which == BOOST_IOS::out)
+ detail::close_all(out_, snk);
         }
     #ifndef BOOST_NO_STD_LOCALE
         void imbue(const std::locale& loc);
@@ -193,10 +193,10 @@
 inline void
 combined_device<Source, Sink>::close(BOOST_IOS::openmode which)
 {
- if (which & BOOST_IOS::in)
- iostreams::close(src_, which);
- if (which & BOOST_IOS::out)
- iostreams::close(sink_, which);
+ if (which == BOOST_IOS::in)
+ detail::close_all(src_);
+ if (which == BOOST_IOS::out)
+ detail::close_all(sink_);
 }
 
 #ifndef BOOST_NO_STD_LOCALE

Modified: branches/release/boost/iostreams/compose.hpp
==============================================================================
--- branches/release/boost/iostreams/compose.hpp (original)
+++ branches/release/boost/iostreams/compose.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -19,8 +19,9 @@
 #include <boost/iostreams/categories.hpp>
 #include <boost/iostreams/detail/adapter/direct_adapter.hpp>
 #include <boost/iostreams/detail/call_traits.hpp>
-#include <boost/iostreams/detail/closer.hpp>
 #include <boost/iostreams/detail/enable_if_stream.hpp>
+#include <boost/iostreams/detail/execute.hpp>
+#include <boost/iostreams/detail/functional.hpp>
 #include <boost/iostreams/operations.hpp>
 #include <boost/iostreams/traits.hpp> // mode_of, is_direct.
 #include <boost/mpl/if.hpp>
@@ -28,22 +29,27 @@
 #include <boost/static_assert.hpp>
 #include <boost/type_traits/is_convertible.hpp>
 
+// Must come last.
+#include <boost/iostreams/detail/config/disable_warnings.hpp> // MSVC.
+
 namespace boost { namespace iostreams {
 
 namespace detail {
 
-template<typename Filter, typename Device>
-struct composite_mode {
- typedef typename mode_of<Filter>::type filter_mode;
- typedef typename mode_of<Device>::type device_mode;
- typedef is_convertible<filter_mode, dual_use> is_dual_use;
- typedef typename
- mpl::if_<
- is_convertible<device_mode, input>,
- input,
- output
- >::type type;
-};
+template< typename First,
+ typename Second,
+ typename FirstMode =
+ BOOST_DEDUCED_TYPENAME mode_of<First>::type,
+ typename SecondMode =
+ BOOST_DEDUCED_TYPENAME mode_of<Second>::type >
+struct composite_mode
+ : select<
+ is_convertible<SecondMode, FirstMode>, FirstMode,
+ is_convertible<FirstMode, SecondMode>, SecondMode,
+ is_convertible<SecondMode, input>, input,
+ else_, output
+ >
+ { };
 
 //
 // Template name: composite_device.
@@ -108,14 +114,17 @@
 // Filter - A model of Filter.
 // Device - An indirect model of Device.
 //
-template<typename Filter1, typename Filter2>
+template< typename Filter1,
+ typename Filter2,
+ typename Mode =
+ BOOST_DEDUCED_TYPENAME composite_mode<Filter1, Filter2>::type >
 class composite_filter {
 private:
      typedef reference_wrapper<Filter2> filter_ref;
 public:
     typedef typename char_type_of<Filter1>::type char_type;
     struct category
- : mode_of<Filter1>::type,
+ : Mode,
           filter_tag,
           multichar_tag,
           closable_tag,
@@ -151,12 +160,48 @@
     }
 
     template<typename Device>
- void close( Device& dev,
- BOOST_IOS::openmode which =
- BOOST_IOS::in | BOOST_IOS::out )
+ void close(Device& dev)
+ {
+ BOOST_STATIC_ASSERT((!is_convertible<category, two_sequence>::value));
+ BOOST_STATIC_ASSERT((!is_convertible<category, dual_use>::value));
+
+ // Create a new device by composing the second filter2_ with dev.
+ composite_device<filter_ref, Device> cmp(boost::ref(filter2_), dev);
+
+ // Close input sequences in reverse order and output sequences in
+ // forward order
+ detail::execute_all(
+ detail::call_close(filter2_, dev, BOOST_IOS::in),
+ detail::call_close(filter1_, cmp, BOOST_IOS::in),
+ detail::call_close(filter1_, cmp, BOOST_IOS::out),
+ detail::call_close(filter2_, dev, BOOST_IOS::out)
+ );
+ }
+
+ template<typename Device>
+ void close(Device& dev, BOOST_IOS::openmode which)
     {
+ BOOST_STATIC_ASSERT(
+ (is_convertible<category, two_sequence>::value) ||
+ (is_convertible<category, dual_use>::value)
+ );
+
+ // Create a new device by composing the second filter2_ with dev.
         composite_device<filter_ref, Device> cmp(boost::ref(filter2_), dev);
- iostreams::close(filter1_, cmp, which);
+
+ // Close input sequences in reverse order
+ if (which == BOOST_IOS::in)
+ detail::execute_all(
+ detail::call_close(filter2_, dev, BOOST_IOS::in),
+ detail::call_close(filter1_, cmp, BOOST_IOS::in)
+ );
+
+ // Close output sequences in forward order
+ if (which == BOOST_IOS::out)
+ detail::execute_all(
+ detail::call_close(filter1_, cmp, BOOST_IOS::out),
+ detail::call_close(filter2_, dev, BOOST_IOS::out)
+ );
     }
 
     template<typename Device>
@@ -332,25 +377,39 @@
 template<typename Filter, typename Device, typename Mode>
 void composite_device<Filter, Device, Mode>::close()
 {
- typedef typename mode_of<Device>::type device_mode;
- BOOST_IOS::openmode which =
- is_convertible<device_mode, input>() ?
- BOOST_IOS::in :
- BOOST_IOS::out;
- close(which);
+ BOOST_STATIC_ASSERT((!is_convertible<Mode, two_sequence>::value));
+
+ // Close input sequences in reverse order and output sequences
+ // in forward order
+ detail::execute_all( detail::call_close(device_, BOOST_IOS::in),
+ detail::call_close(filter_, device_, BOOST_IOS::in),
+ detail::call_close(filter_, device_, BOOST_IOS::out),
+ detail::call_close(device_, BOOST_IOS::out) );
 }
 
 template<typename Filter, typename Device, typename Mode>
 void composite_device<Filter, Device, Mode>::close(BOOST_IOS::openmode which)
 {
- bool nothrow = false;
- external_closer<value_type> close_device(device_, which, nothrow);
- external_closer<Filter, value_type> close_filter(filter_, device_, which, nothrow);
+ BOOST_STATIC_ASSERT((is_convertible<Mode, two_sequence>::value));
+
+ // Close input sequences in reverse order
+ if (which == BOOST_IOS::in)
+ detail::execute_all(
+ detail::call_close(device_, BOOST_IOS::in),
+ detail::call_close(filter_, device_, BOOST_IOS::in)
+ );
+
+ // Close output sequences in forward order
+ if (which == BOOST_IOS::out)
+ detail::execute_all(
+ detail::call_close(filter_, device_, BOOST_IOS::out),
+ detail::call_close(device_, BOOST_IOS::out)
+ );
 }
 
 template<typename Filter, typename Device, typename Mode>
 bool composite_device<Filter, Device, Mode>::flush()
-{ // To do: consider using RAII.
+{
     bool r1 = iostreams::flush(filter_, device_);
     bool r2 = iostreams::flush(device_);
     return r1 && r2;
@@ -365,4 +424,6 @@
 
 } } // End namespaces iostreams, boost.
 
+#include <boost/iostreams/detail/config/enable_warnings.hpp>
+
 #endif // #ifndef BOOST_IOSTREAMS_COMPOSE_HPP_INCLUDED

Modified: branches/release/boost/iostreams/copy.hpp
==============================================================================
--- branches/release/boost/iostreams/copy.hpp (original)
+++ branches/release/boost/iostreams/copy.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -18,15 +18,19 @@
 # pragma once
 #endif
 
-#include <algorithm> // copy.
+#include <boost/config.hpp> // Make sure ptrdiff_t is in std.
+#include <algorithm> // copy, min.
+#include <cstddef> // ptrdiff_t.
 #include <utility> // pair.
+#include <boost/bind.hpp>
 #include <boost/detail/workaround.hpp>
 #include <boost/iostreams/chain.hpp>
 #include <boost/iostreams/constants.hpp>
 #include <boost/iostreams/detail/adapter/non_blocking_adapter.hpp>
-#include <boost/iostreams/detail/buffer.hpp>
-#include <boost/iostreams/detail/closer.hpp>
+#include <boost/iostreams/detail/buffer.hpp>
 #include <boost/iostreams/detail/enable_if_stream.hpp>
+#include <boost/iostreams/detail/execute.hpp>
+#include <boost/iostreams/detail/functional.hpp>
 #include <boost/iostreams/detail/ios.hpp> // failure, streamsize.
 #include <boost/iostreams/detail/resolve.hpp>
 #include <boost/iostreams/detail/wrap_unwrap.hpp>
@@ -39,72 +43,85 @@
 
 namespace detail {
 
+ // The following four overloads of copy_impl() optimize
+ // copying in the case that one or both of the two devices
+ // models Direct (see
+ // http://www.boost.org/libs/iostreams/doc/index.html?path=4.1.1.4)
+
+// Copy from a direct source to a direct sink
 template<typename Source, typename Sink>
 std::streamsize copy_impl( Source& src, Sink& snk,
                            std::streamsize /* buffer_size */,
                            mpl::true_, mpl::true_ )
-{ // Copy from a direct Source to a direct Sink.
+{
     using namespace std;
     typedef typename char_type_of<Source>::type char_type;
- typedef pair<char_type*, char_type*> pair_type;
+ typedef std::pair<char_type*, char_type*> pair_type;
     pair_type p1 = iostreams::input_sequence(src);
     pair_type p2 = iostreams::output_sequence(snk);
- if (p1.second - p1.first < p2.second - p2.first) {
- std::copy(p1.first, p1.second, p2.first);
- return static_cast<streamsize>(p1.second - p1.first);
- } else {
- throw BOOST_IOSTREAMS_FAILURE("destination too small");
- }
+ std::streamsize total =
+ static_cast<std::streamsize>(
+ (std::min)(p1.second - p1.first, p2.second - p2.first)
+ );
+ std::copy(p1.first, p1.first + total, p2.first);
+ return total;
 }
 
+// Copy from a direct source to an indirect sink
 template<typename Source, typename Sink>
 std::streamsize copy_impl( Source& src, Sink& snk,
                            std::streamsize /* buffer_size */,
                            mpl::true_, mpl::false_ )
-{ // Copy from a direct Source to an indirect Sink.
+{
     using namespace std;
     typedef typename char_type_of<Source>::type char_type;
- typedef pair<char_type*, char_type*> pair_type;
+ typedef std::pair<char_type*, char_type*> pair_type;
     pair_type p = iostreams::input_sequence(src);
     std::streamsize size, total;
- for ( total = 0, size = static_cast<streamsize>(p.second - p.first);
+ for ( total = 0, size = static_cast<std::streamsize>(p.second - p.first);
           total < size; )
     {
         std::streamsize amt =
             iostreams::write(snk, p.first + total, size - total);
         total += amt;
     }
- return size;
+ return total;
 }
 
+// Copy from an indirect source to a direct sink
 template<typename Source, typename Sink>
 std::streamsize copy_impl( Source& src, Sink& snk,
                            std::streamsize buffer_size,
                            mpl::false_, mpl::true_ )
-{ // Copy from an indirect Source to a direct Sink.
+{
     using namespace std;
     typedef typename char_type_of<Source>::type char_type;
- typedef pair<char_type*, char_type*> pair_type;
+ typedef std::pair<char_type*, char_type*> pair_type;
     detail::basic_buffer<char_type> buf(buffer_size);
     pair_type p = snk.output_sequence();
- streamsize total = 0;
- bool done = false;
- while (!done) {
- streamsize amt;
- done = (amt = iostreams::read(src, buf.data(), buffer_size)) == -1;
+ std::streamsize total = 0;
+ ptrdiff_t capacity = p.second - p.first;
+ while (true) {
+ std::streamsize amt =
+ iostreams::read(
+ src,
+ buf.data(),
+ (std::min)(buffer_size, capacity - total)
+ );
+ if (amt == -1)
+ break;
         std::copy(buf.data(), buf.data() + amt, p.first + total);
- if (amt != -1)
- total += amt;
+ total += amt;
     }
     return total;
 }
 
+// Copy from an indirect source to an indirect sink
 template<typename Source, typename Sink>
 std::streamsize copy_impl( Source& src, Sink& snk,
                            std::streamsize buffer_size,
                            mpl::false_, mpl::false_ )
-{ // Copy from an indirect Source to a indirect Sink. This algorithm
- // can be improved by eliminating the non_blocking_adapter.
+{
     typedef typename char_type_of<Source>::type char_type;
     detail::basic_buffer<char_type> buf(buffer_size);
     non_blocking_adapter<Sink> nb(snk);
@@ -121,6 +138,35 @@
     return total;
 }
 
+ // The following function object is used with
+ // boost::iostreams::detail::execute() in the primary
+ // overload of copy_impl(), below
+
+// Function object that delegates to one of the above four
+// overloads of compl_impl()
+template<typename Source, typename Sink>
+class copy_operation {
+public:
+ typedef std::streamsize result_type;
+ copy_operation(Source& src, Sink& snk, std::streamsize buffer_size)
+ : src_(src), snk_(snk), buffer_size_(buffer_size)
+ { }
+ std::streamsize operator()()
+ {
+ return copy_impl( src_, snk_, buffer_size_,
+ is_direct<Source>(), is_direct<Sink>() );
+ }
+private:
+ copy_operation& operator=(const copy_operation&);
+ Source& src_;
+ Sink& snk_;
+ std::streamsize buffer_size_;
+};
+
+// Primary overload of copy_impl. Delegates to one of the above four
+// overloads of compl_impl(), depending on which of the two given
+// devices, if any, models Direct (see
+// http://www.boost.org/libs/iostreams/doc/index.html?path=4.1.1.4)
 template<typename Source, typename Sink>
 std::streamsize copy_impl(Source src, Sink snk, std::streamsize buffer_size)
 {
@@ -128,19 +174,19 @@
     typedef typename char_type_of<Source>::type src_char;
     typedef typename char_type_of<Sink>::type snk_char;
     BOOST_STATIC_ASSERT((is_same<src_char, snk_char>::value));
- bool nothrow = false;
- external_closer<Source> close_source(src, BOOST_IOS::in, nothrow);
- external_closer<Sink> close_sink(snk, BOOST_IOS::out, nothrow);
- streamsize result =
- copy_impl( src, snk, buffer_size,
- is_direct<Source>(), is_direct<Sink>() );
- return result;
+ return detail::execute_all(
+ copy_operation<Source, Sink>(src, snk, buffer_size),
+ detail::call_close_all(src),
+ detail::call_close_all(snk)
+ );
 }
 
 } // End namespace detail.
                     
 //------------------Definition of copy----------------------------------------//
 
+// Overload of copy() for the case where neither the source nor the sink is
+// a standard stream or stream buffer
 template<typename Source, typename Sink>
 std::streamsize
 copy( const Source& src, const Sink& snk,
@@ -156,6 +202,8 @@
 
 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
 
+// Overload of copy() for the case where the source, but not the sink, is
+// a standard stream or stream buffer
 template<typename Source, typename Sink>
 std::streamsize
 copy( Source& src, const Sink& snk,
@@ -169,6 +217,8 @@
                               buffer_size );
 }
 
+// Overload of copy() for the case where the sink, but not the source, is
+// a standard stream or stream buffer
 template<typename Source, typename Sink>
 std::streamsize
 copy( const Source& src, Sink& snk,
@@ -178,9 +228,11 @@
 {
     typedef typename char_type_of<Source>::type char_type;
     return detail::copy_impl( detail::resolve<input, char_type>(src),
- detail::wrap(snk), buffer_size);
+ detail::wrap(snk), buffer_size );
 }
 
+// Overload of copy() for the case where neither the source nor the sink is
+// a standard stream or stream buffer
 template<typename Source, typename Sink>
 std::streamsize
 copy( Source& src, Sink& snk,

Deleted: branches/release/boost/iostreams/detail/adapter/basic_adapter.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/adapter/basic_adapter.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
+++ (empty file)
@@ -1,69 +0,0 @@
-// (C) Copyright Jonathan Turkanis 2005.
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
-
-// See http://www.boost.org/libs/iostreams for documentation.
-
-#ifndef BOOST_IOSTREAMS_DETAIL_BASIC_ADAPTER_HPP_INCLUDED
-#define BOOST_IOSTREAMS_DETAIL_BASIC_ADAPTER_HPP_INCLUDED
-
-#include <boost/iostreams/categories.hpp>
-#include <boost/iostreams/detail/call_traits.hpp>
-#include <boost/iostreams/detail/ios.hpp>
-#include <boost/iostreams/operations.hpp>
-#include <boost/iostreams/traits.hpp>
-#include <boost/static_assert.hpp>
-
-namespace boost { namespace iostreams { namespace detail {
-
-template<typename T>
-class basic_adapter {
-private:
- typedef typename detail::value_type<T>::type value_type;
- typedef typename detail::param_type<T>::type param_type;
-public:
- explicit basic_adapter(param_type t) : t_(t) { }
- T& component() { return t_; }
-
- void close(BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out)
- {
- BOOST_STATIC_ASSERT(is_device<T>::value);
- iostreams::close(t_, which);
- }
-
- template<typename Device>
- void close( Device& dev,
- BOOST_IOS::openmode which =
- BOOST_IOS::in | BOOST_IOS::out )
- {
- BOOST_STATIC_ASSERT(is_filter<T>::value);
- iostreams::close(t_, dev, which);
- }
-
- bool flush()
- {
- BOOST_STATIC_ASSERT(is_device<T>::value);
- return iostreams::flush(t_);
- }
-
- template<typename Device>
- void flush(Device& dev)
- {
- BOOST_STATIC_ASSERT(is_filter<T>::value);
- return iostreams::flush(t_, dev);
- }
-
- template<typename Locale> // Avoid dependency on <locale>
- void imbue(const Locale& loc) { iostreams::imbue(t_, loc); }
-
- std::streamsize optimal_buffer_size() const
- { return iostreams::optimal_buffer_size(t_); }
-public:
- value_type t_;
-};
-
-//----------------------------------------------------------------------------//
-
-} } } // End namespaces detail, iostreams, boost.
-
-#endif // #ifndef BOOST_IOSTREAMS_DETAIL_BASIC_ADAPTER_HPP_INCLUDED

Modified: branches/release/boost/iostreams/detail/adapter/concept_adapter.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/adapter/concept_adapter.hpp (original)
+++ branches/release/boost/iostreams/detail/adapter/concept_adapter.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -114,6 +114,7 @@
     std::streamsize optimal_buffer_size() const
     { return iostreams::optimal_buffer_size(t_); }
 public:
+ concept_adapter& operator=(const concept_adapter&);
     value_type t_;
 };
 
@@ -218,7 +219,7 @@
     template<typename Filter, typename Device>
     static std::streampos
     seek( Filter& f, Device* dev, stream_offset off,
- BOOST_IOS::seekdir way, BOOST_IOS::openmode which,
+ BOOST_IOS::seekdir way, BOOST_IOS::openmode,
           random_access, any_tag )
     { return f.seek(*dev, off, way); }
 

Modified: branches/release/boost/iostreams/detail/adapter/direct_adapter.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/adapter/direct_adapter.hpp (original)
+++ branches/release/boost/iostreams/detail/adapter/direct_adapter.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -42,9 +42,10 @@
 template<typename Direct>
 class direct_adapter_base {
 public:
- typedef typename char_type_of<Direct>::type char_type;
+ typedef typename char_type_of<Direct>::type char_type;
+ typedef typename mode_of<Direct>::type mode_type;
     struct category
- : mode_of<Direct>::type,
+ : mode_type,
           device_tag,
           closable_tag
           #ifndef BOOST_IOSTREAMS_NO_LOCALE
@@ -192,9 +193,9 @@
 {
     using namespace std;
     pointers& get = ptrs_.first();
- streamsize avail =
- static_cast<streamsize>(get.end - get.ptr);
- streamsize result = (std::min)(n, avail);
+ std::streamsize avail =
+ static_cast<std::streamsize>(get.end - get.ptr);
+ std::streamsize result = (std::min)(n, avail);
     std::copy(get.ptr, get.ptr + result, s);
     get.ptr += result;
     return result != 0 ? result : -1;
@@ -206,7 +207,7 @@
 {
     using namespace std;
     pointers& put = ptrs_.second();
- if (n > static_cast<streamsize>(put.end - put.ptr))
+ if (n > static_cast<std::streamsize>(put.end - put.ptr))
         throw write_area_exhausted();
     std::copy(s, s + n, put.ptr);
     put.ptr += n;
@@ -222,7 +223,7 @@
     pointers& get = ptrs_.first();
     pointers& put = ptrs_.second();
     if (way == BOOST_IOS::cur && get.ptr != put.ptr)
- bad_seek();
+ throw bad_seek();
     ptrdiff_t next = 0;
     if ((which & BOOST_IOS::in) || !is_double::value) {
         if (way == BOOST_IOS::beg)
@@ -231,10 +232,10 @@
             next = get.ptr - get.beg + off;
         else
             next = get.end - get.beg + off;
- if (next >= 0 && next < get.end - get.beg)
+ if (next >= 0 && next <= get.end - get.beg)
             get.ptr = get.beg + next;
         else
- bad_seek();
+ throw bad_seek();
     }
     if ((which & BOOST_IOS::out) && is_double::value) {
         if (way == BOOST_IOS::beg)
@@ -243,10 +244,10 @@
             next = put.ptr - put.beg + off;
         else
             next = put.end - put.beg + off;
- if (next >= 0 && next < put.end - put.beg)
+ if (next >= 0 && next <= put.end - put.beg)
             put.ptr = put.beg + next;
         else
- bad_seek();
+ throw bad_seek();
     }
     return offset_to_position(next);
 }
@@ -255,7 +256,7 @@
 void direct_adapter<Direct>::close()
 {
     BOOST_STATIC_ASSERT((!is_convertible<category, two_sequence>::value));
- boost::iostreams::close(d_, BOOST_IOS::in | BOOST_IOS::out);
+ detail::close_all(d_);
 }
 
 template<typename Direct>

Modified: branches/release/boost/iostreams/detail/adapter/mode_adapter.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/adapter/mode_adapter.hpp (original)
+++ branches/release/boost/iostreams/detail/adapter/mode_adapter.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -52,7 +52,8 @@
                          BOOST_IOS::openmode which =
                              BOOST_IOS::in | BOOST_IOS::out );
 #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
- void close(BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out);
+ void close();
+ void close(BOOST_IOS::openmode which);
 #endif
 
         // Filter member functions.
@@ -76,7 +77,7 @@
 
     template<typename Device>
     void close(Device& dev)
- { iostreams::close(t_, dev); }
+ { detail::close_all(t_, dev); }
 
     template<typename Device>
     void close(Device& dev, BOOST_IOS::openmode which)
@@ -108,6 +109,10 @@
 
 #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
     template<typename Mode, typename T>
+ void mode_adapter<Mode, T>::close()
+ { detail::close_all(t_); }
+
+ template<typename Mode, typename T>
     void mode_adapter<Mode, T>::close(BOOST_IOS::openmode which)
     { iostreams::close(t_, which); }
 #endif

Modified: branches/release/boost/iostreams/detail/adapter/non_blocking_adapter.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/adapter/non_blocking_adapter.hpp (original)
+++ branches/release/boost/iostreams/detail/adapter/non_blocking_adapter.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -49,6 +49,7 @@
                              BOOST_IOS::in | BOOST_IOS::out )
     { return iostreams::seek(device_, off, way, which); }
 public:
+ non_blocking_adapter& operator=(const non_blocking_adapter&);
     Device& device_;
 };
 

Modified: branches/release/boost/iostreams/detail/adapter/range_adapter.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/adapter/range_adapter.hpp (original)
+++ branches/release/boost/iostreams/detail/adapter/range_adapter.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -155,18 +155,18 @@
         using namespace std;
         switch (way) {
         case BOOST_IOS::beg:
- if (off > last - first || off < 0) bad_seek();
+ if (off > last - first || off < 0) throw bad_seek();
             cur = first + off;
             break;
         case BOOST_IOS::cur:
             {
                 std::ptrdiff_t newoff = cur - first + off;
- if (newoff > last - first || newoff < 0) bad_seek();
+ if (newoff > last - first || newoff < 0) throw bad_seek();
                 cur += off;
                 break;
             }
         case BOOST_IOS::end:
- if (last - first + off < 0 || off > 0) bad_seek();
+ if (last - first + off < 0 || off > 0) throw bad_seek();
             cur = last + off;
             break;
         default:

Modified: branches/release/boost/iostreams/detail/broken_overload_resolution/stream_buffer.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/broken_overload_resolution/stream_buffer.hpp (original)
+++ branches/release/boost/iostreams/detail/broken_overload_resolution/stream_buffer.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -44,7 +44,7 @@
         try {
             if (this->is_open() && this->auto_close())
                 this->close();
- } catch (std::exception&) { }
+ } catch (...) { }
     }
     template<typename U0>
     stream_buffer(const U0& u0)

Modified: branches/release/boost/iostreams/detail/buffer.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/buffer.hpp (original)
+++ branches/release/boost/iostreams/detail/buffer.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -95,11 +95,11 @@
     typename int_type_of<Source>::type fill(Source& src)
     {
         using namespace std;
- streamsize keep;
- if ((keep = static_cast<streamsize>(eptr_ - ptr_)) > 0)
+ std::streamsize keep;
+ if ((keep = static_cast<std::streamsize>(eptr_ - ptr_)) > 0)
             traits_type::move(this->data(), ptr_, keep);
         set(0, keep);
- streamsize result =
+ std::streamsize result =
             iostreams::read(src, this->data() + keep, this->size() - keep);
         if (result != -1)
             this->set(0, keep + result);
@@ -121,8 +121,8 @@
     bool flush(Sink& dest)
     {
         using namespace std;
- streamsize amt = static_cast<std::streamsize>(eptr_ - ptr_);
- streamsize result = iostreams::write_if(dest, ptr_, amt);
+ std::streamsize amt = static_cast<std::streamsize>(eptr_ - ptr_);
+ std::streamsize result = iostreams::write_if(dest, ptr_, amt);
         if (result < amt) {
             traits_type::move( this->data(),
                                ptr_ + result,

Deleted: branches/release/boost/iostreams/detail/closer.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/closer.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
+++ (empty file)
@@ -1,122 +0,0 @@
-// (C) Copyright Jonathan Turkanis 2003.
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
-
-// See http://www.boost.org/libs/iostreams for documentation.
-
-#ifndef BOOST_IOSTREAMS_DETAIL_CLOSER_HPP_INCLUDED
-#define BOOST_IOSTREAMS_DETAIL_CLOSER_HPP_INCLUDED
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-#include <exception> // exception.
-#include <boost/iostreams/detail/ios.hpp> // openmode.
-#include <boost/iostreams/operations.hpp> // close
-#include <boost/iostreams/traits.hpp> // is_device.
-#include <boost/mpl/if.hpp>
-
-namespace boost { namespace iostreams { namespace detail {
-
-template<typename T>
-struct closer {
- closer(T& t) : t_(&t) { }
- ~closer() { try { t_->close(); } catch (std::exception&) { } }
- T* t_;
-};
-
-template<typename Device>
-struct external_device_closer {
- external_device_closer(Device& dev, BOOST_IOS::openmode which)
- : device_(&dev), which_(which),
- dummy_(true), nothrow_(dummy_)
- { }
- external_device_closer(Device& dev, BOOST_IOS::openmode which, bool& nothrow)
- : device_(&dev), which_(which),
- dummy_(true), nothrow_(nothrow)
- { }
- ~external_device_closer()
- {
- try {
- boost::iostreams::close(*device_, which_);
- } catch (...) {
- if (!nothrow_) {
- nothrow_ = true;
- throw;
- }
- }
- }
- Device* device_;
- BOOST_IOS::openmode which_;
- bool dummy_;
- bool& nothrow_;
-};
-
-template<typename Filter, typename Device>
-struct external_filter_closer {
- external_filter_closer(Filter& flt, Device& dev, BOOST_IOS::openmode which)
- : filter_(flt), device_(dev), which_(which),
- dummy_(true), nothrow_(dummy_)
- { }
- external_filter_closer( Filter& flt, Device& dev,
- BOOST_IOS::openmode which, bool& nothrow )
- : filter_(flt), device_(dev), which_(which),
- dummy_(true), nothrow_(nothrow)
- { }
- ~external_filter_closer()
- {
- try {
- boost::iostreams::close(filter_, device_, which_);
- } catch (...) {
- if (!nothrow_) {
- nothrow_ = true;
- throw;
- }
- }
- }
- Filter& filter_;
- Device& device_;
- BOOST_IOS::openmode which_;
- bool dummy_;
- bool& nothrow_;
-};
-
-template<typename FilterOrDevice, typename DeviceOrDummy = int>
-struct external_closer_traits {
- typedef typename
- mpl::if_<
- is_device<FilterOrDevice>,
- external_device_closer<FilterOrDevice>,
- external_filter_closer<FilterOrDevice, DeviceOrDummy>
- >::type type;
-};
-
-template<typename FilterOrDevice, typename DeviceOrDummy = int>
-struct external_closer
- : external_closer_traits<FilterOrDevice, DeviceOrDummy>::type
-{
- typedef typename
- external_closer_traits<
- FilterOrDevice, DeviceOrDummy
- >::type base_type;
- external_closer(FilterOrDevice& dev, BOOST_IOS::openmode which)
- : base_type(dev, which)
- { BOOST_STATIC_ASSERT(is_device<FilterOrDevice>::value); };
- external_closer( FilterOrDevice& dev, BOOST_IOS::openmode which,
- bool& nothrow )
- : base_type(dev, which, nothrow)
- { BOOST_STATIC_ASSERT(is_device<FilterOrDevice>::value); };
- external_closer( FilterOrDevice& flt, DeviceOrDummy& dev,
- BOOST_IOS::openmode which )
- : base_type(flt, dev, which)
- { BOOST_STATIC_ASSERT(is_filter<FilterOrDevice>::value); };
- external_closer( FilterOrDevice& flt, DeviceOrDummy& dev,
- BOOST_IOS::openmode which, bool& nothrow )
- : base_type(flt, dev, which, nothrow)
- { BOOST_STATIC_ASSERT(is_filter<FilterOrDevice>::value); };
-};
-
-} } } // End namespaces detail, iostreams, boost.
-
-#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CLOSER_HPP_INCLUDED

Modified: branches/release/boost/iostreams/detail/codecvt_holder.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/codecvt_holder.hpp (original)
+++ branches/release/boost/iostreams/detail/codecvt_holder.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -30,7 +30,7 @@
 struct codecvt_holder {
     typedef Codecvt codecvt_type;
     const codecvt_type& get() const { return codecvt_; }
- void imbue(const std::locale& loc) { }
+ void imbue(const std::locale&) { }
     Codecvt codecvt_;
 };
 

Modified: branches/release/boost/iostreams/detail/config/codecvt.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/config/codecvt.hpp (original)
+++ branches/release/boost/iostreams/detail/config/codecvt.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -40,7 +40,9 @@
 
 //------------------Normalize codecvt::length---------------------------------//
 
-#if !defined(__MSL_CPP__) && !defined(__LIBCOMO__)
+#if !defined(__MSL_CPP__) && !defined(__LIBCOMO__) && \
+ (!defined(BOOST_RWSTD_VER) || BOOST_RWSTD_VER < 0x04010300)
+ /**/
 # define BOOST_IOSTREAMS_CODECVT_CV_QUALIFIER const
 #else
 # define BOOST_IOSTREAMS_CODECVT_CV_QUALIFIER

Modified: branches/release/boost/iostreams/detail/config/disable_warnings.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/config/disable_warnings.hpp (original)
+++ branches/release/boost/iostreams/detail/config/disable_warnings.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -9,13 +9,17 @@
 
 #if defined(BOOST_MSVC)
 # pragma warning(push)
+# pragma warning(disable:4127) // Conditional expression is constant.
+# pragma warning(disable:4130) // Logical operation on address of string constant.
 # pragma warning(disable:4224) // Parameter previously defined as type.
 # pragma warning(disable:4244) // Conversion: possible loss of data.
+# pragma warning(disable:4512) // Assignment operator could not be generated.
+# pragma warning(disable:4706) // Assignment within conditional expression.
 #else
 # if BOOST_WORKAROUND(__BORLANDC__, < 0x600)
 # pragma warn -8008 // Condition always true/false.
 # pragma warn -8071 // Conversion may lose significant digits.
+# pragma warn -8072 // Suspicious pointer arithmetic.
 # pragma warn -8080 // identifier declared but never used.
 # endif
 #endif
-

Modified: branches/release/boost/iostreams/detail/config/limits.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/config/limits.hpp (original)
+++ branches/release/boost/iostreams/detail/config/limits.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -11,4 +11,8 @@
 # define BOOST_IOSTREAMS_MAX_FORWARDING_ARITY 3
 #endif
 
+#ifndef BOOST_IOSTREAMS_MAX_EXECUTE_ARITY
+# define BOOST_IOSTREAMS_MAX_EXECUTE_ARITY 5
+#endif
+
 #endif // #ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_LIMITS_HPP_INCLUDED

Modified: branches/release/boost/iostreams/detail/enable_if_stream.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/enable_if_stream.hpp (original)
+++ branches/release/boost/iostreams/detail/enable_if_stream.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -15,9 +15,10 @@
 #include <boost/utility/enable_if.hpp>
 #include <boost/iostreams/traits_fwd.hpp> // is_std_io.
 
-#if ! defined(BOOST_NO_SFINAE) && ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
+#if !defined(BOOST_NO_SFINAE) && \
+ !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
 # define BOOST_IOSTREAMS_ENABLE_IF_STREAM(T) \
- , typename boost::enable_if< boost::iostreams::is_std_io<T> >::type* = 0 \
+ , typename boost::enable_if< boost::iostreams::is_std_io<T> >::type* = 0 \
     /**/
 # define BOOST_IOSTREAMS_DISABLE_IF_STREAM(T) \
     , typename boost::disable_if< boost::iostreams::is_std_io<T> >::type* = 0 \

Modified: branches/release/boost/iostreams/detail/is_iterator_range.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/is_iterator_range.hpp (original)
+++ branches/release/boost/iostreams/detail/is_iterator_range.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -11,6 +11,8 @@
 
 namespace boost {
 
+# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
+
 // We avoid dependence on Boost.Range by using a forward declaration.
 template<typename Iterator>
 class iterator_range;
@@ -21,6 +23,19 @@
 
 } // End namespace iostreams.
 
+# else // # if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //-----------------------//
+
+namespace iostreams {
+
+ template<typename T>
+ struct is_iterator_range {
+ BOOST_STATIC_CONSTANT(bool, value = false);
+ };
+
+} // End namespace iostreams.
+
+# endif // # if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) //----------------------//
+
 } // End namespace boost.
 
 #endif // #ifndef BOOST_IOSTREAMS_DETAIL_IS_ITERATOR_RANGE_HPP_INCLUDED

Modified: branches/release/boost/iostreams/detail/resolve.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/resolve.hpp (original)
+++ branches/release/boost/iostreams/detail/resolve.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -31,7 +31,9 @@
 #include <boost/mpl/and.hpp>
 #include <boost/mpl/bool.hpp> // true_.
 #include <boost/mpl/if.hpp>
-#include <boost/range/iterator_range.hpp>
+#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+# include <boost/range/iterator_range.hpp>
+#endif // #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
 #include <boost/type_traits/is_array.hpp>
 
 // Must come last.
@@ -98,10 +100,12 @@
 array_adapter<Mode, Ch> resolve(Ch (&array)[N])
 { return array_adapter<Mode, Ch>(array); }
 
-template<typename Mode, typename Ch, typename Iter>
-range_adapter< Mode, boost::iterator_range<Iter> >
-resolve(const boost::iterator_range<Iter>& rng)
-{ return range_adapter< Mode, boost::iterator_range<Iter> >(rng); }
+# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+ template<typename Mode, typename Ch, typename Iter>
+ range_adapter< Mode, boost::iterator_range<Iter> >
+ resolve(const boost::iterator_range<Iter>& rng)
+ { return range_adapter< Mode, boost::iterator_range<Iter> >(rng); }
+# endif // #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
 
 # else // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //---------------------//
 

Modified: branches/release/boost/iostreams/detail/streambuf/direct_streambuf.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/streambuf/direct_streambuf.hpp (original)
+++ branches/release/boost/iostreams/detail/streambuf/direct_streambuf.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -14,15 +14,17 @@
 #include <cassert>
 #include <cstddef>
 #include <typeinfo>
-#include <utility> // pair.
-#include <boost/config.hpp> // BOOST_DEDUCED_TYPENAME.
-#include <boost/iostreams/detail/char_traits.hpp>
+#include <utility> // pair.
+#include <boost/config.hpp> // BOOST_DEDUCED_TYPENAME,
+#include <boost/iostreams/detail/char_traits.hpp> // member template friends.
 #include <boost/iostreams/detail/config/wide_streams.hpp>
+#include <boost/iostreams/detail/error.hpp>
+#include <boost/iostreams/detail/execute.hpp>
+#include <boost/iostreams/detail/functional.hpp>
 #include <boost/iostreams/detail/ios.hpp>
 #include <boost/iostreams/detail/optional.hpp>
 #include <boost/iostreams/detail/streambuf.hpp>
 #include <boost/iostreams/detail/streambuf/linked_streambuf.hpp>
-#include <boost/iostreams/detail/error.hpp>
 #include <boost/iostreams/operations.hpp>
 #include <boost/iostreams/positioning.hpp>
 #include <boost/iostreams/traits.hpp>
@@ -70,10 +72,9 @@
     //--------------Virtual functions-----------------------------------------//
 
     // Declared in linked_streambuf.
- void close(BOOST_IOS::openmode m);
+ void close_impl(BOOST_IOS::openmode m);
     const std::type_info& component_type() const { return typeid(T); }
     void* component_impl() { return component(); }
-
 #ifdef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES
     public:
 #endif
@@ -120,15 +121,15 @@
 
 template<typename T, typename Tr>
 bool direct_streambuf<T, Tr>::is_open() const
-{ return ibeg_ != 0 && !obeg_ != 0; }
+{ return ibeg_ != 0 || obeg_ != 0; }
 
 template<typename T, typename Tr>
 void direct_streambuf<T, Tr>::close()
 {
- using namespace std;
- try { close(BOOST_IOS::in); } catch (std::exception&) { }
- try { close(BOOST_IOS::out); } catch (std::exception&) { }
- storage_.reset();
+ base_type* self = this;
+ detail::execute_all( detail::call_member_close(*self, BOOST_IOS::in),
+ detail::call_member_close(*self, BOOST_IOS::out),
+ detail::call_reset(storage_) );
 }
 
 template<typename T, typename Tr>
@@ -193,7 +194,7 @@
 }
 
 template<typename T, typename Tr>
-void direct_streambuf<T, Tr>::close(BOOST_IOS::openmode which)
+void direct_streambuf<T, Tr>::close_impl(BOOST_IOS::openmode which)
 {
     if (which == BOOST_IOS::in && ibeg_ != 0) {
         setg(0, 0, 0);

Modified: branches/release/boost/iostreams/detail/streambuf/indirect_streambuf.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/streambuf/indirect_streambuf.hpp (original)
+++ branches/release/boost/iostreams/detail/streambuf/indirect_streambuf.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -7,6 +7,8 @@
 // A. Langer and K. Kreft, "Standard C++ IOStreams and Locales",
 // Addison-Wesley, 2000, pp. 228-43.
 
+// User "GMSB" provided an optimization for small seeks.
+
 #ifndef BOOST_IOSTREAMS_DETAIL_INDIRECT_STREAMBUF_HPP_INCLUDED
 #define BOOST_IOSTREAMS_DETAIL_INDIRECT_STREAMBUF_HPP_INCLUDED
 
@@ -21,6 +23,8 @@
 #include <boost/iostreams/detail/buffer.hpp>
 #include <boost/iostreams/detail/config/wide_streams.hpp>
 #include <boost/iostreams/detail/double_object.hpp>
+#include <boost/iostreams/detail/execute.hpp>
+#include <boost/iostreams/detail/functional.hpp>
 #include <boost/iostreams/detail/ios.hpp>
 #include <boost/iostreams/detail/optional.hpp>
 #include <boost/iostreams/detail/push.hpp>
@@ -89,7 +93,7 @@
 
     // Declared in linked_streambuf.
     void set_next(streambuf_type* next);
- void close(BOOST_IOS::openmode m);
+ void close_impl(BOOST_IOS::openmode m);
     const std::type_info& component_type() const { return typeid(T); }
     void* component_impl() { return component(); }
 private:
@@ -116,14 +120,11 @@
     pos_type seek_impl( stream_offset off, BOOST_IOS::seekdir way,
                         BOOST_IOS::openmode which );
     void sync_impl();
- void close_impl(BOOST_IOS::openmode);
 
     enum flag_type {
         f_open = 1,
- f_input_closed = f_open << 1,
- f_output_closed = f_input_closed << 1,
- f_output_buffered = f_output_closed << 1,
- f_auto_close = f_output_buffered << 1
+ f_output_buffered = f_open << 1,
+ f_auto_close = f_output_buffered << 1,
     };
 
     optional<wrapper> storage_;
@@ -166,7 +167,7 @@
     // Construct input buffer.
     if (can_read()) {
         pback_size_ = (std::max)(2, pback_size); // STLPort needs 2.
- streamsize size =
+ std::streamsize size =
             pback_size_ +
             ( buffer_size ? buffer_size: 1 );
         in().resize(size);
@@ -196,10 +197,13 @@
 void indirect_streambuf<T, Tr, Alloc, Mode>::close()
 {
     using namespace std;
- try { close(BOOST_IOS::in); } catch (std::exception&) { }
- try { close(BOOST_IOS::out); } catch (std::exception&) { }
- storage_.reset();
- flags_ = 0;
+ base_type* self = this;
+ detail::execute_all(
+ detail::call_member_close(*self, BOOST_IOS::in),
+ detail::call_member_close(*self, BOOST_IOS::out),
+ detail::call_reset(storage_),
+ detail::clear_flags(flags_)
+ );
 }
 
 template<typename T, typename Tr, typename Alloc, typename Mode>
@@ -234,8 +238,9 @@
     if (gptr() < egptr()) return traits_type::to_int_type(*gptr());
 
     // Fill putback buffer.
- streamsize keep = (std::min)( static_cast<streamsize>(gptr() - eback()),
- pback_size_ );
+ std::streamsize keep =
+ (std::min)( static_cast<std::streamsize>(gptr() - eback()),
+ pback_size_ );
     if (keep)
         traits_type::move( buf.data() + (pback_size_ - keep),
                            gptr() - keep, keep );
@@ -246,7 +251,7 @@
           buf.data() + pback_size_ );
 
     // Read from source.
- streamsize chars =
+ std::streamsize chars =
         obj().read(buf.data() + pback_size_, buf.size() - pback_size_, next_);
     if (chars == -1) {
         this->set_true_eof(true);
@@ -306,7 +311,7 @@
         sync_impl();
         obj().flush(next_);
         return 0;
- } catch (std::exception&) { return -1; }
+ } catch (...) { return -1; }
 }
 
 template<typename T, typename Tr, typename Alloc, typename Mode>
@@ -315,7 +320,7 @@
     try { // sync() is no-throw.
         sync_impl();
         return obj().flush(next_);
- } catch (std::exception&) { return false; }
+ } catch (...) { return false; }
 }
 
 template<typename T, typename Tr, typename Alloc, typename Mode>
@@ -338,6 +343,13 @@
 indirect_streambuf<T, Tr, Alloc, Mode>::seek_impl
     (stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which)
 {
+ if ( gptr() != 0 && way == BOOST_IOS::cur && which == BOOST_IOS::in &&
+ eback() - gptr() <= off && off <= egptr() - gptr() )
+ { // Small seek optimization
+ gbump(off);
+ return obj().seek(0, BOOST_IOS::cur, BOOST_IOS::in, next_) -
+ static_cast<off_type>(egptr() - gptr());
+ }
     if (pptr() != 0)
         this->BOOST_IOSTREAMS_PUBSYNC(); // sync() confuses VisualAge 6.
     if (way == BOOST_IOS::cur && gptr())
@@ -353,30 +365,21 @@
 { next_ = next; }
 
 template<typename T, typename Tr, typename Alloc, typename Mode>
-inline void indirect_streambuf<T, Tr, Alloc, Mode>::close
- (BOOST_IOS::openmode which)
-{
- close_impl(which);
- try { obj().close(which, next_); } catch (std::exception&) { }
-}
-
-//----------State changing functions------------------------------------------//
-
-template<typename T, typename Tr, typename Alloc, typename Mode>
 inline void indirect_streambuf<T, Tr, Alloc, Mode>::close_impl
     (BOOST_IOS::openmode which)
 {
- if (which == BOOST_IOS::in && (flags_ & f_input_closed) == 0) {
+ if (which == BOOST_IOS::in && is_convertible<Mode, input>::value) {
         setg(0, 0, 0);
- flags_ |= f_input_closed;
     }
- if (which == BOOST_IOS::out && (flags_ & f_output_closed) == 0) {
+ if (which == BOOST_IOS::out && is_convertible<Mode, output>::value) {
         sync();
         setp(0, 0);
- flags_ |= f_output_closed;
     }
+ obj().close(which, next_);
 }
 
+//----------State changing functions------------------------------------------//
+
 template<typename T, typename Tr, typename Alloc, typename Mode>
 void indirect_streambuf<T, Tr, Alloc, Mode>::sync_impl()
 {

Modified: branches/release/boost/iostreams/detail/streambuf/linked_streambuf.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/streambuf/linked_streambuf.hpp (original)
+++ branches/release/boost/iostreams/detail/streambuf/linked_streambuf.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -40,13 +40,16 @@
 template<typename Ch, typename Tr = BOOST_IOSTREAMS_CHAR_TRAITS(Ch) >
 class linked_streambuf : public BOOST_IOSTREAMS_BASIC_STREAMBUF(Ch, Tr) {
 protected:
- linked_streambuf() : true_eof_(false) { }
- void set_true_eof(bool eof) { true_eof_ = eof; }
+ linked_streambuf() : flags_(0) { }
+ void set_true_eof(bool eof)
+ {
+ flags_ = (flags_ & ~f_true_eof) | (eof ? f_true_eof : 0);
+ }
 public:
 
     // Should be called only after receiving an ordinary EOF indication,
     // to confirm that it represents EOF rather than WOULD_BLOCK.
- bool true_eof() const { return true_eof_; }
+ bool true_eof() const { return (flags_ & f_true_eof) != 0; }
 protected:
 
     //----------grant friendship to chain_base and chainbuf-------------------//
@@ -57,20 +60,51 @@
     friend class chain_base;
     template<typename Chain, typename Mode, typename Access>
     friend class chainbuf;
+ template<typename U>
+ friend class member_close_operation;
 #else
-public:
- typedef BOOST_IOSTREAMS_BASIC_STREAMBUF(Ch, Tr) base;
- BOOST_IOSTREAMS_USING_PROTECTED_STREAMBUF_MEMBERS(base)
+ public:
+ typedef BOOST_IOSTREAMS_BASIC_STREAMBUF(Ch, Tr) base;
+ BOOST_IOSTREAMS_USING_PROTECTED_STREAMBUF_MEMBERS(base)
 #endif
+ void close(BOOST_IOS::openmode which)
+ {
+ if ( which == BOOST_IOS::in &&
+ (flags_ & f_input_closed) == 0 )
+ {
+ flags_ |= f_input_closed;
+ close_impl(which);
+ }
+ if ( which == BOOST_IOS::out &&
+ (flags_ & f_output_closed) == 0 )
+ {
+ flags_ |= f_output_closed;
+ close_impl(which);
+ }
+ }
+ void set_needs_close()
+ {
+ flags_ &= ~(f_input_closed | f_output_closed);
+ }
     virtual void set_next(linked_streambuf<Ch, Tr>* /* next */) { }
- virtual void close(BOOST_IOS::openmode) = 0;
+ virtual void close_impl(BOOST_IOS::openmode) = 0;
     virtual bool auto_close() const = 0;
     virtual void set_auto_close(bool) = 0;
     virtual bool strict_sync() = 0;
     virtual const std::type_info& component_type() const = 0;
     virtual void* component_impl() = 0;
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+ private:
+#else
+ public:
+#endif
 private:
- bool true_eof_;
+ enum flag_type {
+ f_true_eof = 1,
+ f_input_closed = f_true_eof << 1,
+ f_output_closed = f_input_closed << 1
+ };
+ int flags_;
 };
 
 } } } // End namespaces detail, iostreams, boost.

Modified: branches/release/boost/iostreams/detail/vc6/close.hpp
==============================================================================
--- branches/release/boost/iostreams/detail/vc6/close.hpp (original)
+++ branches/release/boost/iostreams/detail/vc6/close.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -14,6 +14,9 @@
 } // End namespace detail.
 
 template<typename T>
+void close(T& t) { detail::close_all(t); }
+
+template<typename T>
 void close(T& t, BOOST_IOS::openmode which)
 {
     typedef typename detail::unwrapped_type<T>::type unwrapped;
@@ -64,14 +67,14 @@
     struct inner {
         static void close(T& t, BOOST_IOS::openmode which)
         {
- if ((which & BOOST_IOS::out) != 0)
+ if (which == BOOST_IOS::out)
                 iostreams::flush(t);
         }
 
         template<typename Sink>
         static void close(T& t, Sink& snk, BOOST_IOS::openmode which)
         {
- if ((which & BOOST_IOS::out) != 0) {
+ if (which == BOOST_IOS::out) {
                 non_blocking_adapter<Sink> nb(snk);
                 iostreams::flush(t, nb);
             }
@@ -88,7 +91,7 @@
             typedef typename category_of<T>::type category;
             const bool in = is_convertible<category, input>::value &&
                             !is_convertible<category, output>::value;
- if (in == ((which & BOOST_IOS::in) != 0))
+ if (in == (which == BOOST_IOS::in))
                 t.close();
         }
         template<typename Sink>
@@ -97,7 +100,7 @@
             typedef typename category_of<T>::type category;
             const bool in = is_convertible<category, input>::value &&
                             !is_convertible<category, output>::value;
- if (in == ((which & BOOST_IOS::in) != 0)) {
+ if (in == (which == BOOST_IOS::in)) {
                 non_blocking_adapter<Sink> nb(snk);
                 t.close(nb);
             }

Modified: branches/release/boost/iostreams/device/file_descriptor.hpp
==============================================================================
--- branches/release/boost/iostreams/device/file_descriptor.hpp (original)
+++ branches/release/boost/iostreams/device/file_descriptor.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -102,8 +102,13 @@
     typedef void* handle_type;
 #endif
     typedef char char_type;
- struct category : public source_tag, closable_tag { };
+ struct category
+ : input_seekable,
+ device_tag,
+ closable_tag
+ { };
     using file_descriptor::read;
+ using file_descriptor::seek;
     using file_descriptor::open;
     using file_descriptor::is_open;
     using file_descriptor::close;
@@ -128,8 +133,13 @@
     typedef void* handle_type;
 #endif
     typedef char char_type;
- struct category : public sink_tag, closable_tag { };
+ struct category
+ : output_seekable,
+ device_tag,
+ closable_tag
+ { };
     using file_descriptor::write;
+ using file_descriptor::seek;
     using file_descriptor::open;
     using file_descriptor::is_open;
     using file_descriptor::close;

Modified: branches/release/boost/iostreams/device/mapped_file.hpp
==============================================================================
--- branches/release/boost/iostreams/device/mapped_file.hpp (original)
+++ branches/release/boost/iostreams/device/mapped_file.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -62,12 +62,22 @@
 
 struct mapped_file_params {
     explicit mapped_file_params()
- : mode(), offset(0), length(static_cast<std::size_t>(-1)),
+ #if BOOST_WORKAROUND(BOOST_MSVC, < 1400) && defined(BOOST_RWSTD_VER)
+ : mode(std::ios_base::openmode(0)),
+ #else
+ : mode(),
+ #endif
+ offset(0), length(static_cast<std::size_t>(-1)),
           new_file_size(0), hint(0)
         { }
     explicit mapped_file_params(const std::string& path)
- : path(path), mode(), offset(0),
- length(static_cast<std::size_t>(-1)),
+ : path(path),
+ #if BOOST_WORKAROUND(BOOST_MSVC, < 1400) && defined(BOOST_RWSTD_VER)
+ mode(std::ios_base::openmode(0)),
+ #else
+ mode(),
+ #endif
+ offset(0), length(static_cast<std::size_t>(-1)),
           new_file_size(0), hint(0)
         { }
     std::string path;
@@ -211,6 +221,7 @@
           public closable_tag
         { };
     using mapped_file::close;
+ using mapped_file::size;
     explicit mapped_file_sink(mapped_file_params p);
     explicit mapped_file_sink( const std::string& path,
                                size_type length = max_length,

Modified: branches/release/boost/iostreams/device/null.hpp
==============================================================================
--- branches/release/boost/iostreams/device/null.hpp (original)
+++ branches/release/boost/iostreams/device/null.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -34,7 +34,8 @@
                          BOOST_IOS::openmode =
                              BOOST_IOS::in | BOOST_IOS::out )
     { return -1; }
- void close(BOOST_IOS::openmode = BOOST_IOS::in | BOOST_IOS::out) { }
+ void close() { }
+ void close(BOOST_IOS::openmode) { }
 };
 
 template<typename Ch>

Modified: branches/release/boost/iostreams/filter/aggregate.hpp
==============================================================================
--- branches/release/boost/iostreams/filter/aggregate.hpp (original)
+++ branches/release/boost/iostreams/filter/aggregate.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -17,7 +17,6 @@
 #include <vector>
 #include <boost/iostreams/categories.hpp>
 #include <boost/iostreams/detail/char_traits.hpp>
-#include <boost/iostreams/detail/closer.hpp>
 #include <boost/iostreams/detail/ios.hpp> // openmode, streamsize.
 #include <boost/iostreams/pipeline.hpp>
 #include <boost/mpl/bool.hpp>
@@ -59,8 +58,8 @@
         state_ |= f_read;
         if (!(state_ & f_eof))
             do_read(src);
- streamsize amt =
- (std::min)(n, static_cast<streamsize>(data_.size() - ptr_));
+ std::streamsize amt =
+ (std::min)(n, static_cast<std::streamsize>(data_.size() - ptr_));
         if (amt) {
             BOOST_IOSTREAMS_CHAR_TRAITS(char_type)::copy(s, &data_[ptr_], amt);
             ptr_ += amt;
@@ -76,25 +75,25 @@
         data_.insert(data_.end(), s, s + n);
         return n;
     }
-
- // Give detail::closer permission to call close().
- typedef aggregate_filter<Ch, Alloc> self;
- friend struct detail::closer<self>;
 
     template<typename Sink>
     void close(Sink& sink, BOOST_IOS::openmode which)
     {
- if ((state_ & f_read) && (which & BOOST_IOS::in))
- close();
-
- if ((state_ & f_write) && (which & BOOST_IOS::out)) {
- detail::closer<self> closer(*this);
- vector_type filtered;
- do_filter(data_, filtered);
- do_write(
- sink, &filtered[0],
- static_cast<std::streamsize>(filtered.size())
- );
+ if ((state_ & f_read) != 0 && which == BOOST_IOS::in)
+ close_impl();
+ if ((state_ & f_write) != 0 && which == BOOST_IOS::out) {
+ try {
+ vector_type filtered;
+ do_filter(data_, filtered);
+ do_write(
+ sink, &filtered[0],
+ static_cast<std::streamsize>(filtered.size())
+ );
+ } catch (...) {
+ close_impl();
+ throw;
+ }
+ close_impl();
         }
     }
 
@@ -111,9 +110,9 @@
         using std::streamsize;
         vector_type data;
         while (true) {
- const streamsize size = default_device_buffer_size;
- Ch buf[size];
- streamsize amt;
+ const std::streamsize size = default_device_buffer_size;
+ Ch buf[size];
+ std::streamsize amt;
             if ((amt = boost::iostreams::read(src, buf, size)) == -1)
                 break;
             data.insert(data.end(), buf, buf + amt);
@@ -137,7 +136,7 @@
     template<typename Sink>
     void do_write(Sink&, const char*, std::streamsize, mpl::false_) { }
 
- void close()
+ void close_impl()
     {
         data_.clear();
         ptr_ = 0;

Modified: branches/release/boost/iostreams/filter/bzip2.hpp
==============================================================================
--- branches/release/boost/iostreams/filter/bzip2.hpp (original)
+++ branches/release/boost/iostreams/filter/bzip2.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -352,7 +352,16 @@
 }
 
 template<typename Alloc>
-void bzip2_decompressor_impl<Alloc>::close() { end(false); eof_ = false; }
+void bzip2_decompressor_impl<Alloc>::close()
+{
+ try {
+ end(false);
+ } catch (...) {
+ eof_ = false;
+ throw;
+ }
+ eof_ = false;
+}
 
 template<typename Alloc>
 inline void bzip2_decompressor_impl<Alloc>::init()

Modified: branches/release/boost/iostreams/filter/gzip.hpp
==============================================================================
--- branches/release/boost/iostreams/filter/gzip.hpp (original)
+++ branches/release/boost/iostreams/filter/gzip.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -185,8 +185,7 @@
     template<typename Source>
     std::streamsize read(Source& src, char_type* s, std::streamsize n)
     {
- using namespace std;
- streamsize result = 0;
+ std::streamsize result = 0;
 
         // Read header.
         if (!(flags_ & f_header_done))
@@ -196,7 +195,7 @@
         if (!(flags_ & f_body_done)) {
 
             // Read from basic_zlib_filter.
- streamsize amt = base_type::read(src, s + result, n - result);
+ std::streamsize amt = base_type::read(src, s + result, n - result);
             if (amt != -1) {
                 result += amt;
                 if (amt < n - result) { // Double-check for EOF.
@@ -234,30 +233,25 @@
     template<typename Sink>
     void close(Sink& snk, BOOST_IOS::openmode m)
     {
- namespace io = boost::iostreams;
+ if (m == BOOST_IOS::out) {
+ try {
 
- if (m & BOOST_IOS::out) {
+ // Close zlib compressor.
+ base_type::close(snk, BOOST_IOS::out);
 
- // Close zlib compressor.
- base_type::close(snk, BOOST_IOS::out);
+ if (flags_ & f_header_done) {
 
- if (flags_ & f_header_done) {
+ // Write final fields of gzip file format.
+ write_long(this->crc(), snk);
+ write_long(this->total_in(), snk);
+ }
 
- // Write final fields of gzip file format.
- write_long(this->crc(), snk);
- write_long(this->total_in(), snk);
+ } catch (...) {
+ close_impl();
+ throw;
             }
-
+ close_impl();
         }
- #if BOOST_WORKAROUND(__GNUC__, == 2) && defined(__STL_CONFIG_H) || \
- BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) \
- /**/
- footer_.erase(0, std::string::npos);
- #else
- footer_.clear();
- #endif
- offset_ = 0;
- flags_ = 0;
     }
 private:
     static gzip_params normalize_params(gzip_params p);
@@ -273,6 +267,19 @@
         boost::iostreams::put(next, static_cast<char>(0xFF & (n >> 24)));
     }
 
+ void close_impl()
+ {
+ #if BOOST_WORKAROUND(__GNUC__, == 2) && defined(__STL_CONFIG_H) || \
+ BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) \
+ /**/
+ footer_.erase(0, std::string::npos);
+ #else
+ footer_.clear();
+ #endif
+ offset_ = 0;
+ flags_ = 0;
+ }
+
     enum flag_type {
         f_header_done = 1,
         f_body_done = f_header_done << 1,
@@ -342,10 +349,11 @@
     {
         try {
             base_type::close(src, BOOST_IOS::in);
- flags_ = 0;
         } catch (const zlib_error& e) {
+ flags_ = 0;
             throw gzip_error(e);
         }
+ flags_ = 0;
     }
 
     std::string file_name() const { return file_name_; }
@@ -548,10 +556,9 @@
 std::streamsize basic_gzip_compressor<Alloc>::read_string
     (char* s, std::streamsize n, std::string& str)
 {
- using namespace std;
- streamsize avail =
- static_cast<streamsize>(str.size() - offset_);
- streamsize amt = (std::min)(avail, n);
+ std::streamsize avail =
+ static_cast<std::streamsize>(str.size() - offset_);
+ std::streamsize amt = (std::min)(avail, n);
     std::copy( str.data() + offset_,
                str.data() + offset_ + amt,
                s );

Modified: branches/release/boost/iostreams/filter/line.hpp
==============================================================================
--- branches/release/boost/iostreams/filter/line.hpp (original)
+++ branches/release/boost/iostreams/filter/line.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -17,7 +17,6 @@
 #include <string>
 #include <boost/config.hpp> // BOOST_STATIC_CONSTANT.
 #include <boost/iostreams/categories.hpp>
-#include <boost/iostreams/detail/closer.hpp>
 #include <boost/iostreams/detail/ios.hpp> // openmode, streamsize.
 #include <boost/iostreams/pipeline.hpp>
 
@@ -71,7 +70,7 @@
         state_ |= f_read;
 
         // Handle unfinished business.
- streamsize result = 0;
+ std::streamsize result = 0;
         if (!cur_line_.empty() && (result = read_line(s, n)) == n)
             return n;
 
@@ -117,19 +116,23 @@
         }
     }
 
- typedef basic_line_filter<Ch, Alloc> self;
- friend struct detail::closer<self>;
-
     template<typename Sink>
     void close(Sink& snk, BOOST_IOS::openmode which)
     {
- if ((state_ & f_read) && (which & BOOST_IOS::in))
- close();
+ if ((state_ & f_read) && which == BOOST_IOS::in)
+ close_impl();
 
- if ((state_ & f_write) && (which & BOOST_IOS::out)) {
- detail::closer<self> closer(*this);
- if (!cur_line_.empty())
- write_line(snk);
+ if ((state_ & f_write) && which == BOOST_IOS::out) {
+ try {
+ if (!cur_line_.empty())
+ write_line(snk);
+ } catch (...) {
+ try {
+ close_impl();
+ } catch (...) { }
+ throw;
+ }
+ close_impl();
         }
     }
 private:
@@ -140,8 +143,8 @@
     std::streamsize read_line(char_type* s, std::streamsize n)
     {
         using namespace std;
- streamsize result =
- (std::min) (n, static_cast<streamsize>(cur_line_.size()));
+ std::streamsize result =
+ (std::min) (n, static_cast<std::streamsize>(cur_line_.size()));
         traits_type::copy(s, cur_line_.data(), result);
         cur_line_.erase(0, result);
         return result;
@@ -181,7 +184,7 @@
         return result;
     }
 
- void close()
+ void close_impl()
     {
         clear();
         state_ = 0;

Modified: branches/release/boost/iostreams/filter/newline.hpp
==============================================================================
--- branches/release/boost/iostreams/filter/newline.hpp (original)
+++ branches/release/boost/iostreams/filter/newline.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -129,15 +129,18 @@
         using iostreams::newline::CR;
         using iostreams::newline::LF;
 
- if (flags_ & (has_LF | has_EOF)) {
- if (flags_ & has_LF)
+ assert((flags_ & f_write) == 0);
+ flags_ |= f_read;
+
+ if (flags_ & (f_has_LF | f_has_EOF)) {
+ if (flags_ & f_has_LF)
                 return newline();
             else
                 return EOF;
         }
 
         int c =
- (flags_ & has_CR) == 0 ?
+ (flags_ & f_has_CR) == 0 ?
                 iostreams::get(src) :
                 CR;
 
@@ -145,24 +148,24 @@
             return WOULD_BLOCK;
 
         if (c == CR) {
- flags_ |= has_CR;
+ flags_ |= f_has_CR;
 
             int d;
             if ((d = iostreams::get(src)) == WOULD_BLOCK)
                 return WOULD_BLOCK;
 
             if (d == LF) {
- flags_ &= ~has_CR;
+ flags_ &= ~f_has_CR;
                 return newline();
             }
 
             if (d == EOF) {
- flags_ |= has_EOF;
+ flags_ |= f_has_EOF;
             } else {
                 iostreams::putback(src, d);
             }
 
- flags_ &= ~has_CR;
+ flags_ &= ~f_has_CR;
             return newline();
         }
 
@@ -178,7 +181,10 @@
         using iostreams::newline::CR;
         using iostreams::newline::LF;
 
- if ((flags_ & has_LF) != 0)
+ assert((flags_ & f_read) == 0);
+ flags_ |= f_write;
+
+ if ((flags_ & f_has_LF) != 0)
             return c == LF ?
                 newline(dest) :
                 newline(dest) && this->put(dest, c);
@@ -186,13 +192,13 @@
         if (c == LF)
            return newline(dest);
 
- if ((flags_ & has_CR) != 0)
+ if ((flags_ & f_has_CR) != 0)
             return newline(dest) ?
                 this->put(dest, c) :
                 false;
 
         if (c == CR) {
- flags_ |= has_CR;
+ flags_ |= f_has_CR;
             return true;
         }
 
@@ -203,17 +209,12 @@
     void close(Sink& dest, BOOST_IOS::openmode which)
     {
         typedef typename iostreams::category_of<Sink>::type category;
- bool unfinished = (flags_ & has_CR) != 0;
- flags_ &= newline::platform_mask;
- if (which == BOOST_IOS::out && unfinished)
- close(dest, is_convertible<category, output>());
+ if ((flags_ & f_write) != 0 && (flags_ & f_has_CR) != 0)
+ newline_if_sink(dest);
+ if (which == BOOST_IOS::out)
+ flags_ &= newline::platform_mask;
     }
 private:
- template<typename Sink>
- void close(Sink& dest, mpl::true_) { newline(dest); }
-
- template<typename Sink>
- void close(Sink&, mpl::false_) { }
 
     // Returns the appropriate element of a newline sequence.
     int newline()
@@ -227,11 +228,11 @@
         case newline::mac:
             return CR;
         case newline::dos:
- if (flags_ & has_LF) {
- flags_ &= ~has_LF;
+ if (flags_ & f_has_LF) {
+ flags_ &= ~f_has_LF;
                 return LF;
             } else {
- flags_ |= has_LF;
+ flags_ |= f_has_LF;
                 return CR;
             }
         }
@@ -254,24 +255,41 @@
             success = boost::iostreams::put(dest, CR);
             break;
         case newline::dos:
- if ((flags_ & has_LF) != 0) {
+ if ((flags_ & f_has_LF) != 0) {
                 if ((success = boost::iostreams::put(dest, LF)))
- flags_ &= ~has_LF;
+ flags_ &= ~f_has_LF;
             } else if (boost::iostreams::put(dest, CR)) {
                 if (!(success = boost::iostreams::put(dest, LF)))
- flags_ |= has_LF;
+ flags_ |= f_has_LF;
             }
             break;
         }
         if (success)
- flags_ &= ~has_CR;
+ flags_ &= ~f_has_CR;
         return success;
     }
+
+ // Writes a newline sequence if the given device is a Sink.
+ template<typename Device>
+ void newline_if_sink(Device& dest)
+ {
+ typedef typename iostreams::category_of<Device>::type category;
+ newline_if_sink(dest, is_convertible<category, output>());
+ }
+
+ template<typename Sink>
+ void newline_if_sink(Sink& dest, mpl::true_) { newline(dest); }
+
+ template<typename Source>
+ void newline_if_sink(Source&, mpl::false_) { }
+
     enum flags {
- has_LF = 32768,
- has_CR = has_LF << 1,
- has_newline = has_CR << 1,
- has_EOF = has_newline << 1
+ f_has_LF = 32768,
+ f_has_CR = f_has_LF << 1,
+ f_has_newline = f_has_CR << 1,
+ f_has_EOF = f_has_newline << 1,
+ f_read = f_has_EOF << 1,
+ f_write = f_read << 1
     };
     int flags_;
 };
@@ -304,26 +322,26 @@
 
         // Update source flags.
         if (c != EOF)
- source() &= ~line_complete;
- if ((source() & has_CR) != 0) {
+ source() &= ~f_line_complete;
+ if ((source() & f_has_CR) != 0) {
             if (c == LF) {
                 source() |= newline::dos;
- source() |= line_complete;
+ source() |= f_line_complete;
             } else {
                 source() |= newline::mac;
                 if (c == EOF)
- source() |= line_complete;
+ source() |= f_line_complete;
             }
         } else if (c == LF) {
             source() |= newline::posix;
- source() |= line_complete;
+ source() |= f_line_complete;
         }
- source() = (source() & ~has_CR) | (c == CR ? has_CR : 0);
+ source() = (source() & ~f_has_CR) | (c == CR ? f_has_CR : 0);
 
         // Check for errors.
         if ( c == EOF &&
             (target_ & newline::final_newline) != 0 &&
- (source() & line_complete) == 0 )
+ (source() & f_line_complete) == 0 )
         {
             fail();
         }
@@ -351,19 +369,19 @@
             return false;
 
          // Update source flags.
- source() &= ~line_complete;
- if ((source() & has_CR) != 0) {
+ source() &= ~f_line_complete;
+ if ((source() & f_has_CR) != 0) {
             if (c == LF) {
                 source() |= newline::dos;
- source() |= line_complete;
+ source() |= f_line_complete;
             } else {
                 source() |= newline::mac;
             }
         } else if (c == LF) {
             source() |= newline::posix;
- source() |= line_complete;
+ source() |= f_line_complete;
         }
- source() = (source() & ~has_CR) | (c == CR ? has_CR : 0);
+ source() = (source() & ~f_has_CR) | (c == CR ? f_has_CR : 0);
 
         // Check for errors.
         if ( (target_ & newline::platform_mask) != 0 &&
@@ -380,22 +398,24 @@
     {
         using iostreams::newline::final_newline;
 
- // Update final_newline flag.
- if ( (source() & has_CR) != 0 ||
- (source() & line_complete) != 0 )
- {
- source() |= final_newline;
- }
+ if (which == BOOST_IOS::out) {
+
+ // Update final_newline flag.
+ if ( (source() & f_has_CR) != 0 ||
+ (source() & f_line_complete) != 0 )
+ {
+ source() |= final_newline;
+ }
 
- // Clear non-sticky flags.
- source() &= ~(has_CR | line_complete);
+ // Clear non-sticky flags.
+ source() &= ~(f_has_CR | f_line_complete);
 
- // Check for errors.
- if ( (which & BOOST_IOS::out) &&
- (target_ & final_newline) != 0 &&
- (source() & final_newline) == 0 )
- {
- fail();
+ // Check for errors.
+ if ( (target_ & final_newline) != 0 &&
+ (source() & final_newline) == 0 )
+ {
+ fail();
+ }
         }
     }
 private:
@@ -404,8 +424,8 @@
     int source() const { return flags_; }
 
     enum flags {
- has_CR = 32768,
- line_complete = has_CR << 1
+ f_has_CR = 32768,
+ f_line_complete = f_has_CR << 1
     };
 
     int target_; // Represents expected input.

Modified: branches/release/boost/iostreams/filter/regex.hpp
==============================================================================
--- branches/release/boost/iostreams/filter/regex.hpp (original)
+++ branches/release/boost/iostreams/filter/regex.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -72,7 +72,7 @@
         }
     struct simple_formatter {
         simple_formatter(const string_type& fmt, flag_type fmt_flags)
- : fmt_(fmt), fmt_flags_(fmt_flags_) { }
+ : fmt_(fmt), fmt_flags_(fmt_flags) { }
         string_type operator() (const match_type& match) const
         { return match.format(fmt_, fmt_flags_); }
         string_type fmt_;

Modified: branches/release/boost/iostreams/filter/stdio.hpp
==============================================================================
--- branches/release/boost/iostreams/filter/stdio.hpp (original)
+++ branches/release/boost/iostreams/filter/stdio.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -56,8 +56,9 @@
             : ios_(ios), old_(ios.rdbuf(newbuf))
             { }
         ~scoped_redirector() { ios_.rdbuf(old_); }
- ios_type& ios_;
- streambuf_type* old_;
+ scoped_redirector& operator=(const scoped_redirector&);
+ ios_type& ios_;
+ streambuf_type* old_;
     };
 
     virtual void do_filter() = 0;

Modified: branches/release/boost/iostreams/filter/symmetric.hpp
==============================================================================
--- branches/release/boost/iostreams/filter/symmetric.hpp (original)
+++ branches/release/boost/iostreams/filter/symmetric.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -47,7 +47,6 @@
 #include <boost/iostreams/constants.hpp> // buffer size.
 #include <boost/iostreams/detail/buffer.hpp>
 #include <boost/iostreams/detail/char_traits.hpp>
-#include <boost/iostreams/detail/closer.hpp>
 #include <boost/iostreams/detail/config/limits.hpp>
 #include <boost/iostreams/detail/template_params.hpp>
 #include <boost/iostreams/traits.hpp>
@@ -116,7 +115,9 @@
                     !filter().filter(next, buf.eptr(), next_s, end_s, flush);
                 buf.ptr() = buf.data() + (next - buf.data());
                 if (done)
- return detail::check_eof(static_cast<streamsize>(next_s - s));
+ return detail::check_eof(
+ static_cast<std::streamsize>(next_s - s)
+ );
             }
 
             // If no more characters are available without blocking, or
@@ -124,7 +125,7 @@
             if ( status == f_would_block && buf.ptr() == buf.eptr() ||
                  next_s == end_s )
             {
- return static_cast<streamsize>(next_s - s);
+ return static_cast<std::streamsize>(next_s - s);
             }
 
             // Fill buffer.
@@ -149,29 +150,31 @@
         return static_cast<std::streamsize>(next_s - s);
     }
 
- // Give detail::closer<> permission to call close().
- typedef symmetric_filter<SymmetricFilter, Alloc> self;
- friend struct detail::closer<self>;
-
     template<typename Sink>
     void close(Sink& snk, BOOST_IOS::openmode which)
     {
         using namespace std;
- if ((state() & f_read) && (which & BOOST_IOS::in))
- close();
- if ((state() & f_write) && (which & BOOST_IOS::out)) {
+ if ((state() & f_write) == 0 && which == BOOST_IOS::in)
+ close_impl();
+ if ((state() & f_write) != 0 && which == BOOST_IOS::out) {
 
             // Repeatedly invoke filter() with no input.
- detail::closer<self> closer(*this);
- buffer_type& buf = pimpl_->buf_;
- char dummy;
- const char* end = &dummy;
- bool again = true;
- while (again) {
- if (buf.ptr() != buf.eptr())
- again = filter().filter(end, end, buf.ptr(), buf.eptr(), true);
- flush(snk);
+ try {
+ buffer_type& buf = pimpl_->buf_;
+ char dummy;
+ const char* end = &dummy;
+ bool again = true;
+ while (again) {
+ if (buf.ptr() != buf.eptr())
+ again = filter().filter( end, end, buf.ptr(),
+ buf.eptr(), true );
+ flush(snk);
+ }
+ } catch (...) {
+ try { close_impl(); } catch (...) { }
+ throw;
             }
+ close_impl();
         }
     }
     SymmetricFilter& filter() { return *pimpl_; }
@@ -214,11 +217,10 @@
     template<typename Sink>
     bool flush(Sink& snk, mpl::true_)
     {
- using std::streamsize;
         typedef char_traits<char_type> traits_type;
- streamsize amt =
- static_cast<streamsize>(buf().ptr() - buf().data());
- streamsize result =
+ std::streamsize amt =
+ static_cast<std::streamsize>(buf().ptr() - buf().data());
+ std::streamsize result =
             boost::iostreams::write(snk, buf().data(), amt);
         if (result < amt && result > 0)
             traits_type::move(buf().data(), buf().data() + result, amt - result);
@@ -227,9 +229,9 @@
     }
 
     template<typename Sink>
- bool flush(Sink& snk, mpl::false_) { return true;}
+ bool flush(Sink&, mpl::false_) { return true;}
 
- void close();
+ void close_impl();
 
     enum flag_type {
         f_read = 1,
@@ -281,7 +283,7 @@
 }
 
 template<typename SymmetricFilter, typename Alloc>
-void symmetric_filter<SymmetricFilter, Alloc>::close()
+void symmetric_filter<SymmetricFilter, Alloc>::close_impl()
 {
     state() = 0;
     buf().set(0, 0);

Modified: branches/release/boost/iostreams/filter/test.hpp
==============================================================================
--- branches/release/boost/iostreams/filter/test.hpp (original)
+++ branches/release/boost/iostreams/filter/test.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -34,7 +34,6 @@
 #include <boost/iostreams/categories.hpp>
 #include <boost/iostreams/compose.hpp>
 #include <boost/iostreams/copy.hpp>
-#include <boost/iostreams/detail/adapter/basic_adapter.hpp>
 #include <boost/iostreams/detail/bool_trait_def.hpp>
 #include <boost/iostreams/detail/ios.hpp>
 #include <boost/iostreams/device/array.hpp>
@@ -134,6 +133,7 @@
         return amt;
     }
 private:
+ non_blocking_sink& operator=(const non_blocking_sink&);
     std::string& dest_;
     std::streamsize inc_;
 };

Modified: branches/release/boost/iostreams/invert.hpp
==============================================================================
--- branches/release/boost/iostreams/invert.hpp (original)
+++ branches/release/boost/iostreams/invert.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -21,6 +21,8 @@
 #include <boost/iostreams/device/array.hpp>
 #include <boost/iostreams/detail/buffer.hpp>
 #include <boost/iostreams/detail/counted_array.hpp>
+#include <boost/iostreams/detail/execute.hpp>
+#include <boost/iostreams/detail/functional.hpp> // clear_flags, call_reset
 #include <boost/mpl/if.hpp>
 #include <boost/ref.hpp>
 #include <boost/shared_ptr.hpp>
@@ -34,8 +36,9 @@
 //
 // Template name: inverse.
 // Template paramters:
-// Filter - A filter adapter which
-// Description: Returns an instance of an appropriate specialization of inverse.
+// Filter - A model of InputFilter or OutputFilter.
+// Description: Generates an InputFilter from an OutputFilter or
+// vice versa.
 //
 template<typename Filter>
 class inverse {
@@ -116,13 +119,13 @@
     }
 
     template<typename Device>
- void close( Device& dev,
- BOOST_IOS::openmode which =
- BOOST_IOS::in | BOOST_IOS::out )
+ void close(Device& dev)
     {
- if ((which & BOOST_IOS::out) != 0 && (flags() & f_write) != 0)
- buf().flush(dev);
- flags() = 0;
+ detail::execute_all(
+ detail::flush_buffer(buf(), dev, (flags() & f_write) != 0),
+ detail::call_close_all(pimpl_->filter_, dev),
+ detail::clear_flags(flags())
+ );
     }
 private:
     filter_ref filter() { return boost::ref(pimpl_->filter_); }

Modified: branches/release/boost/iostreams/pipeline.hpp
==============================================================================
--- branches/release/boost/iostreams/pipeline.hpp (original)
+++ branches/release/boost/iostreams/pipeline.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -80,6 +80,7 @@
     template<typename Chain>
     void push(Chain& chn) const { chn.push(component_); }
 private:
+ pipeline_segment operator=(const pipeline_segment&);
     const Component& component_;
 };
 
@@ -109,6 +110,7 @@
     const Pipeline& tail() const { return *this; }
     const Component& head() const { return component_; }
 private:
+ pipeline operator=(const pipeline&);
     const Component& component_;
 };
 

Modified: branches/release/boost/iostreams/positioning.hpp
==============================================================================
--- branches/release/boost/iostreams/positioning.hpp (original)
+++ branches/release/boost/iostreams/positioning.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -68,8 +68,8 @@
 {
     // Use implementation-specific member function seekpos().
     return fpos_t_to_offset(pos.seekpos()) +
- stream_offset(std::streamoff(pos)) -
- stream_offset(std::streamoff(pos.seekpos()));
+ static_cast<stream_offset>(static_cast<std::streamoff>(pos)) -
+ static_cast<stream_offset>(_FPOSOFF(pos.seekpos()));
 }
 
 # else // # if defined(_CPPLIB_VER) //----------------------------------------//
@@ -80,8 +80,10 @@
 {
     // use implementation-specific member function get_fpos_t().
     return fpos_t_to_offset(pos.get_fpos_t()) +
- stream_offset(std::streamoff(pos)) -
- stream_offset(std::streamoff(pos.get_fpos_t()));
+ static_cast<stream_offset>(static_cast<std::streamoff>(pos)) -
+ static_cast<stream_offset>(
+ static_cast<std::streamoff>(pos.get_fpos_t())
+ );
 }
 
 # endif // # if defined(_CPPLIB_VER) //---------------------------------------//

Modified: branches/release/boost/iostreams/read.hpp
==============================================================================
--- branches/release/boost/iostreams/read.hpp (original)
+++ branches/release/boost/iostreams/read.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -79,7 +79,7 @@
 template<>
 struct true_eof_impl<false> {
     template<typename T>
- static bool true_eof(T& t) { return true; }
+ static bool true_eof(T&) { return true; }
 };
 
 template<typename T>

Modified: branches/release/boost/iostreams/restrict.hpp
==============================================================================
--- branches/release/boost/iostreams/restrict.hpp (original)
+++ branches/release/boost/iostreams/restrict.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -17,7 +17,8 @@
 #include <boost/config.hpp> // DEDUCED_TYPENAME.
 #include <boost/iostreams/categories.hpp>
 #include <boost/iostreams/char_traits.hpp>
-#include <boost/iostreams/detail/adapter/basic_adapter.hpp>
+#include <boost/iostreams/detail/adapter/device_adapter.hpp>
+#include <boost/iostreams/detail/adapter/filter_adapter.hpp>
 #include <boost/iostreams/detail/call_traits.hpp>
 #include <boost/iostreams/detail/enable_if_stream.hpp>
 #include <boost/iostreams/detail/error.hpp>
@@ -30,7 +31,7 @@
 #include <boost/static_assert.hpp>
 #include <boost/type_traits/is_convertible.hpp>
 
-#include <boost/iostreams/detail/config/disable_warnings.hpp> // VC7.1 C4244.
+#include <boost/iostreams/detail/config/disable_warnings.hpp>
 
 namespace boost { namespace iostreams {
 
@@ -44,13 +45,15 @@
 // SeekableDevice.
 //
 template<typename Device>
-class restricted_indirect_device : public basic_adapter<Device> {
+class restricted_indirect_device : public device_adapter<Device> {
 private:
     typedef typename detail::param_type<Device>::type param_type;
 public:
- typedef typename char_type_of<Device>::type char_type;
+ typedef typename char_type_of<Device>::type char_type;
+ typedef typename mode_of<Device>::type mode;
+ BOOST_STATIC_ASSERT(!(is_convertible<mode, detail::two_sequence>::value));
     struct category
- : mode_of<Device>::type,
+ : mode,
           device_tag,
           closable_tag,
           flushable_tag,
@@ -73,10 +76,12 @@
 // Device - A model of Direct and Device.
 //
 template<typename Device>
-class restricted_direct_device : public basic_adapter<Device> {
+class restricted_direct_device : public device_adapter<Device> {
 public:
     typedef typename char_type_of<Device>::type char_type;
     typedef std::pair<char_type*, char_type*> pair_type;
+ typedef typename mode_of<Device>::type mode;
+ BOOST_STATIC_ASSERT(!(is_convertible<mode, detail::two_sequence>::value));
     struct category
         : mode_of<Device>::type,
           device_tag,
@@ -101,11 +106,13 @@
 // Filter - An indirect model of Filter.
 //
 template<typename Filter>
-class restricted_filter : public basic_adapter<Filter> {
+class restricted_filter : public filter_adapter<Filter> {
 public:
     typedef typename char_type_of<Filter>::type char_type;
+ typedef typename mode_of<Filter>::type mode;
+ BOOST_STATIC_ASSERT(!(is_convertible<mode, detail::two_sequence>::value));
     struct category
- : mode_of<Filter>::type,
+ : mode,
           filter_tag,
           multichar_tag,
           closable_tag,
@@ -120,12 +127,13 @@
     {
         using namespace std;
         if (!open_)
- open(src);
- streamsize amt =
+ open(src, BOOST_IOS::in);
+ std::streamsize amt =
             end_ != -1 ?
- (std::min) (n, static_cast<streamsize>(end_ - pos_)) :
+ (std::min) (n, static_cast<std::streamsize>(end_ - pos_)) :
                 n;
- streamsize result = iostreams::read(this->component(), src, s, amt);
+ std::streamsize result =
+ iostreams::read(this->component(), src, s, amt);
         if (result != -1)
             pos_ += result;
         return result;
@@ -135,7 +143,7 @@
     std::streamsize write(Sink& snk, const char_type* s, std::streamsize n)
     {
         if (!open_)
- open(snk);
+ open(snk, BOOST_IOS::out);
         if (end_ != -1 && pos_ + n >= end_)
             bad_write();
         std::streamsize result =
@@ -166,13 +174,30 @@
         pos_ = this->component().seek(dev, next, BOOST_IOS::cur);
         return offset_to_position(pos_ - beg_);
     }
+
+ template<typename Device>
+ void close(Device& dev)
+ {
+ open_ = false;
+ detail::close_all(this->component(), dev);
+ }
+
+ template<typename Device>
+ void close(Device& dev, BOOST_IOS::openmode which)
+ {
+ open_ = false;
+ iostreams::close(this->component(), dev, which);
+ }
 private:
     template<typename Device>
- void open(Device& dev)
+ void open(Device& dev, BOOST_IOS::openmode which)
     {
+ typedef typename is_convertible<mode, dual_use>::type is_dual_use;
         open_ = true;
- iostreams::skip(this->component(), dev, beg_);
+ which = is_dual_use() ? which : (BOOST_IOS::in | BOOST_IOS::out);
+ iostreams::skip(this->component(), dev, beg_, which);
     }
+
     stream_offset beg_, pos_, end_;
     bool open_;
 };
@@ -294,7 +319,7 @@
 template<typename Device>
 restricted_indirect_device<Device>::restricted_indirect_device
     (param_type dev, stream_offset off, stream_offset len)
- : basic_adapter<Device>(dev), beg_(off), pos_(off),
+ : device_adapter<Device>(dev), beg_(off), pos_(off),
       end_(len != -1 ? off + len : -1)
 {
     if (len < -1 || off < 0)
@@ -307,11 +332,11 @@
     (char_type* s, std::streamsize n)
 {
     using namespace std;
- streamsize amt =
+ std::streamsize amt =
         end_ != -1 ?
- (std::min) (n, static_cast<streamsize>(end_ - pos_)) :
+ (std::min) (n, static_cast<std::streamsize>(end_ - pos_)) :
             n;
- streamsize result = iostreams::read(this->component(), s, amt);
+ std::streamsize result = iostreams::read(this->component(), s, amt);
     if (result != -1)
         pos_ += result;
     return result;
@@ -357,7 +382,7 @@
 template<typename Device>
 restricted_direct_device<Device>::restricted_direct_device
     (const Device& dev, stream_offset off, stream_offset len)
- : basic_adapter<Device>(dev), beg_(0), end_(0)
+ : device_adapter<Device>(dev), beg_(0), end_(0)
 {
     std::pair<char_type*, char_type*> seq =
         sequence(is_convertible<category, input>());
@@ -403,7 +428,7 @@
 template<typename Filter>
 restricted_filter<Filter>::restricted_filter
     (const Filter& flt, stream_offset off, stream_offset len)
- : basic_adapter<Filter>(flt), beg_(off),
+ : filter_adapter<Filter>(flt), beg_(off),
       pos_(off), end_(len != -1 ? off + len : -1), open_(false)
 {
     if (len < -1 || off < 0)

Modified: branches/release/boost/iostreams/skip.hpp
==============================================================================
--- branches/release/boost/iostreams/skip.hpp (original)
+++ branches/release/boost/iostreams/skip.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -16,9 +16,11 @@
 #include <boost/iostreams/char_traits.hpp>
 #include <boost/iostreams/detail/ios.hpp> // failure.
 #include <boost/iostreams/operations.hpp>
+#include <boost/iostreams/seek.hpp>
 #include <boost/iostreams/traits.hpp>
 #include <boost/mpl/and.hpp>
 #include <boost/mpl/bool.hpp>
+#include <boost/mpl/or.hpp>
 #include <boost/type_traits/is_convertible.hpp>
 
 namespace boost { namespace iostreams {
@@ -44,11 +46,13 @@
 }
 
 template<typename Filter, typename Device>
-void skip(Filter& flt, Device& dev, stream_offset off, mpl::true_)
-{ flt.seek(dev, off, BOOST_IOS::cur); }
+void skip( Filter& flt, Device& dev, stream_offset off,
+ BOOST_IOS::openmode which, mpl::true_ )
+{ boost::iostreams::seek(flt, dev, off, BOOST_IOS::cur, which); }
 
 template<typename Filter, typename Device>
-void skip(Filter& flt, Device& dev, stream_offset off, mpl::false_)
+void skip( Filter& flt, Device& dev, stream_offset off,
+ BOOST_IOS::openmode, mpl::false_ )
 {
     typedef typename char_type_of<Device>::type char_type;
     char_type c;
@@ -66,20 +70,39 @@
 template<typename Device>
 void skip(Device& dev, stream_offset off)
 {
- typedef typename mode_of<Device>::type mode;
- detail::skip(dev, off, is_convertible<mode, seekable>());
+ typedef typename mode_of<Device>::type mode;
+ typedef mpl::or_<
+ is_convertible<mode, input_seekable>,
+ is_convertible<mode, output_seekable>
+ > can_seek;
+ BOOST_STATIC_ASSERT(
+ (can_seek::value || is_convertible<mode, input>::value)
+ );
+ detail::skip(dev, off, can_seek());
 }
 
 template<typename Filter, typename Device>
-void skip(Filter& flt, Device& dev, stream_offset off)
+void skip( Filter& flt, Device& dev, stream_offset off,
+ BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out )
 {
- typedef typename mode_of<Filter>::type filter_mode;
- typedef typename mode_of<Device>::type device_mode;
- typedef mpl::and_<
- is_convertible<filter_mode, output_seekable>,
- is_convertible<device_mode, output_seekable>
- > can_seek;
- detail::skip(flt, dev, off, can_seek());
+ typedef typename mode_of<Filter>::type filter_mode;
+ typedef typename mode_of<Device>::type device_mode;
+ typedef mpl::or_<
+ mpl::and_<
+ is_convertible<filter_mode, input_seekable>,
+ is_convertible<device_mode, input_seekable>
+ >,
+ mpl::and_<
+ is_convertible<filter_mode, output_seekable>,
+ is_convertible<device_mode, output_seekable>
+ >
+ > can_seek;
+ BOOST_STATIC_ASSERT(
+ ( can_seek::value ||
+ is_convertible<filter_mode, input>::value &&
+ is_convertible<device_mode, input>::value )
+ );
+ detail::skip(flt, dev, off, which, can_seek());
 }
 
 } } // End namespaces iostreams, boost.

Modified: branches/release/boost/iostreams/stream.hpp
==============================================================================
--- branches/release/boost/iostreams/stream.hpp (original)
+++ branches/release/boost/iostreams/stream.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -20,6 +20,7 @@
 #include <boost/iostreams/stream_buffer.hpp>
 #include <boost/mpl/and.hpp>
 #include <boost/type_traits/is_convertible.hpp>
+#include <boost/utility/base_from_member.hpp>
 
 namespace boost { namespace iostreams { namespace detail {
 

Modified: branches/release/boost/iostreams/stream_buffer.hpp
==============================================================================
--- branches/release/boost/iostreams/stream_buffer.hpp (original)
+++ branches/release/boost/iostreams/stream_buffer.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -83,7 +83,7 @@
         try {
             if (this->is_open() && this->auto_close())
                 this->close();
- } catch (std::exception&) { }
+ } catch (...) { }
     }
     BOOST_IOSTREAMS_FORWARD( stream_buffer, open_impl, T,
                              BOOST_IOSTREAMS_PUSH_PARAMS,

Modified: branches/release/boost/iostreams/tee.hpp
==============================================================================
--- branches/release/boost/iostreams/tee.hpp (original)
+++ branches/release/boost/iostreams/tee.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -14,9 +14,11 @@
 #include <cassert>
 #include <boost/config.hpp> // BOOST_DEDUCE_TYPENAME.
 #include <boost/iostreams/categories.hpp>
-#include <boost/iostreams/detail/adapter/basic_adapter.hpp>
+#include <boost/iostreams/detail/adapter/device_adapter.hpp>
+#include <boost/iostreams/detail/adapter/filter_adapter.hpp>
 #include <boost/iostreams/detail/call_traits.hpp>
-#include <boost/iostreams/detail/closer.hpp>
+#include <boost/iostreams/detail/execute.hpp>
+#include <boost/iostreams/detail/functional.hpp> // call_close_all
 #include <boost/iostreams/operations.hpp>
 #include <boost/iostreams/pipeline.hpp>
 #include <boost/iostreams/traits.hpp>
@@ -32,7 +34,7 @@
 // Device - A blocking Sink.
 //
 template<typename Device>
-class tee_filter : public detail::basic_adapter<Device> {
+class tee_filter : public detail::filter_adapter<Device> {
 public:
     typedef typename detail::param_type<Device>::type param_type;
     typedef typename char_type_of<Device>::type char_type;
@@ -51,7 +53,7 @@
     ));
 
     explicit tee_filter(param_type dev)
- : detail::basic_adapter<Device>(dev)
+ : detail::filter_adapter<Device>(dev)
         { }
 
     template<typename Sink>
@@ -65,10 +67,10 @@
     }
 
     template<typename Next>
- void close( Next&,
- BOOST_IOS::openmode which =
- BOOST_IOS::in | BOOST_IOS::out )
- { iostreams::close(this->component(), which); }
+ void close(Next&)
+ {
+ detail::close_all(this->component());
+ }
 
     template<typename Sink>
     bool flush(Sink& snk)
@@ -130,10 +132,10 @@
         assert(result1 == n && result2 == n);
         return n;
     }
- void close(BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out)
- {
- detail::external_closer<Sink2> close2(sink2_, which);
- detail::external_closer<Sink1> close1(sink1_, which);
+ void close()
+ {
+ detail::execute_all( detail::call_close_all(sink1_),
+ detail::call_close_all(sink2_) );
     }
     bool flush()
     {

Modified: branches/release/boost/iostreams/traits.hpp
==============================================================================
--- branches/release/boost/iostreams/traits.hpp (original)
+++ branches/release/boost/iostreams/traits.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -32,9 +32,11 @@
 #include <boost/mpl/eval_if.hpp>
 #include <boost/mpl/identity.hpp>
 #include <boost/mpl/int.hpp>
-#include <boost/mpl/or.hpp>
-#include <boost/range/iterator_range.hpp>
-#include <boost/range/value_type.hpp>
+#include <boost/mpl/or.hpp>
+#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+# include <boost/range/iterator_range.hpp>
+# include <boost/range/value_type.hpp>
+#endif // #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
 #include <boost/type_traits/is_convertible.hpp>
 
 namespace boost { namespace iostreams {
@@ -118,7 +120,9 @@
 struct char_type_of {
     template<typename U>
     struct get_value_type {
- typedef typename range_value<U>::type type;
+ #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+ typedef typename range_value<U>::type type;
+ #endif // #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
     };
     typedef typename
             mpl::eval_if<

Deleted: branches/release/libs/iostreams/build/bzip2.jam
==============================================================================
--- branches/release/libs/iostreams/build/bzip2.jam 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
+++ (empty file)
@@ -1,101 +0,0 @@
-# Boost.Iostreams Library bzip2 Jamfile
-
-# (C) Copyright Jonathan Turkanis 2004
-# Distributed under the Boost Software License, Version 1.0. (See accompanying
-# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
-
-# See http://www.boost.org/libs/iostreams for documentation.
-
-# For use in conjunction with the bzip2 data compression library by
-# Jean-loup Gailly and Mark Adler. See http://www.bzip2.org/ to obtain bzip2
-# if it is not installed on your system, or if you wish to build it with
-# different compiler or linker options.
-
-rule bzip2_config
-{
- if $(NO_COMPRESSION)
- {
- NO_BZIP2 = 1 ;
- }
-
- if $(NT) && ! $(BZIP2_SOURCE) && ! $(BZIP2_INCLUDE)
- {
- ECHO ****************************************************** ;
- ECHO Building Boost.Iostreams with bzip2 support disabled. ;
- ECHO To enable bzip2, consult the Boost.Iostreams documentation ;
- ECHO ****************************************************** ;
- NO_BZIP2 = 1 ;
- }
-
- if ! $(NO_BZIP2)
- {
- local SOURCES = blocksort bzlib compress crctable
- decompress huffman randtable ;
- BZIP2_INCLUDE ?= $(BZIP2_SOURCE) ;
-
- # define BZIP2_BINARY
- if ! $(BZIP2_SOURCE) && ! $(BZIP2_BINARY)
- {
- if $(NT) && ! [ MATCH (.*gcc.*) : $(TOOLS) ]
- {
- WINDOWS = 1 ;
- BZIP2_BINARY = "libbz2" ;
- }
- else
- {
- BZIP2_BINARY = "bz2" ;
- }
- }
-
- # declare boost_bzip2 boost_bzip2
- if $(BZIP2_SOURCE)
- {
- template bzip2_common
- : # sources
- $(BZIP2_SOURCE)/$(SOURCES).c
- : # build requirements
- [ common-names ] # magic for install and auto-link features
- <include>$(BZIP2_INCLUDE)
- : # build variants
- debug release
- ;
-
- lib boost_bzip2
- : # sources
- <template>bzip2_common
- : # build requirements
- : # build variants
- ;
-
- dll boost_bzip2
- : # sources
- <template>bzip2_common
- : # build requirements
- <define>BZIP2_DLL=1 # tell source we're building dll's
- <runtime-link>dynamic # build only for dynamic runtimes
- : # build variants
- ;
-
- install bzip2 lib
- : <lib>boost_bzip2
- ;
- }
- }
-}
-
-bzip2_config ;
-
-template bzip2
- : # sources
- [ unless $(NO_BZIP2) : ../src/bzip2.cpp ]
- [ cond $(BZIP2_SOURCE) : <lib>boost_bzip2 : ]
- : # build requirements
- [ unless $(NO_BZIP2) : <include>$(BZIP2_INCLUDE) ]
- [ unless $(NO_BZIP2) OR $(BZIP2_SOURCE)
- : <define>BOOST_BZIP2_BINARY=$(BZIP2_BINARY) ]
- [ cond $(BZIP2_LIBPATH) : <library-path>$(BZIP2_LIBPATH) : ]
- [ unless $(BZIP2_SOURCE) : <find-library>$(BZIP2_BINARY) : ]
- : # build variants
- ;
-
-# end

Deleted: branches/release/libs/iostreams/build/zlib.jam
==============================================================================
--- branches/release/libs/iostreams/build/zlib.jam 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
+++ (empty file)
@@ -1,100 +0,0 @@
-# Boost.Iostreams Library zlib Jamfile
-
-# (C) Copyright Jonathan Turkanis 2004
-# Distributed under the Boost Software License, Version 1.0. (See accompanying
-# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
-
-# See http://www.boost.org/libs/iostreams for documentation.
-
-# For use in conjunction with the zlib data compression library by
-# Jean-loup Gailly and Mark Adler. See http://www.zlib.org/ to obtain zlib
-# if it is not installed on your system, or if you wish to build it with
-# different compiler or linker options.
-
-rule zlib_config
-{
- if $(NO_COMPRESSION)
- {
- NO_ZLIB = 1 ;
- }
-
- if $(NT) && ! $(ZLIB_SOURCE) && ! $(ZLIB_INCLUDE)
- {
- ECHO ****************************************************** ;
- ECHO Building Boost.Iostreams with zlib and gzip support disabled. ;
- ECHO To enable zlib and gzip, consult the Boost.Iostreams documentation ;
- ECHO ****************************************************** ;
- NO_ZLIB = 1 ;
- }
-
- if ! $(NO_ZLIB)
- {
- local SOURCES = adler32 compress crc32 deflate inffast
- inflate inftrees trees uncompr zutil ;
- ZLIB_INCLUDE ?= $(ZLIB_SOURCE) ;
-
- # define ZLIB_BINARY
- if ! $(ZLIB_SOURCE) && ! $(ZLIB_BINARY)
- {
- if $(NT) && ! [ MATCH (.*gcc.*) : $(TOOLS) ]
- {
- ZLIB_BINARY = "zdll" ;
- }
- else
- {
- ZLIB_BINARY = "z" ;
- }
- }
-
- # declare boost_zlib boost_zlib
- if $(ZLIB_SOURCE)
- {
- template zlib_common
- : # sources
- $(ZLIB_SOURCE)/$(SOURCES).c
- : # build requirements
- [ common-names ] # magic for install and auto-link features
- <include>$(ZLIB_INCLUDE)
- : # build variants
- debug release
- ;
-
- lib boost_zlib
- : # sources
- <template>zlib_common
- : # build requirements
- : # build variants
- ;
-
- dll boost_zlib
- : # sources
- <template>zlib_common
- : # build requirements
- <define>ZLIB_DLL=1 # tell source we're building dll's
- <runtime-link>dynamic # build only for dynamic runtimes
- : # build variants
- ;
-
- install zlib lib
- : <lib>boost_zlib
- ;
- }
- }
-}
-
-zlib_config ;
-
-template zlib
- : # sources
- [ unless $(NO_ZLIB) : ../src/zlib.cpp ]
- [ cond $(ZLIB_SOURCE) : <lib>boost_zlib : ]
- : # build requirements
- [ unless $(NO_ZLIB) : <include>$(ZLIB_INCLUDE) ]
- [ unless $(NO_ZLIB) OR $(ZLIB_SOURCE)
- : <define>BOOST_ZLIB_BINARY=$(ZLIB_BINARY) ]
- [ cond $(ZLIB_LIBPATH) : <library-path>$(ZLIB_LIBPATH) : ]
- [ unless $(ZLIB_SOURCE) : <find-library>$(ZLIB_BINARY) : ]
- : # build variants
- ;
-
-# end

Modified: branches/release/libs/iostreams/doc/acknowledgments.html
==============================================================================
--- branches/release/libs/iostreams/doc/acknowledgments.html (original)
+++ branches/release/libs/iostreams/doc/acknowledgments.html 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -68,7 +68,7 @@
         Jeff Garland served as review manager and provided helpful criticism and guidance.
     </LI>
     <LI CLASS="square">
- Those who participated in the formal review or the post-review discussions, or who submitted bug reports or patches, include (in no particular order) Adam Peterson, Joaquín M López Muñoz, Neal D. Becker, Stas Garifulin, Vladimir Prus, Rob Stewart, Robert Ramey, Michel Decima, Michiel Salters, Pedro Lamarão, Dietmar Kühl, Oleg Rekutin, Reece Dunn, Stefan Slapeta, Jeff Flinn, Jeff Garland, Eugene Lazutkin, John Torjo, Brian Braatz, Keith Burton, Keith MacDonald, Phil Richards, Arjen Wagenaar, Caleb Epstein, Dylan Trotter, Ben Hutchings, Daniel James, Daniel Schlyder, Jan Christiaan van Winkel, Jonathan Graehl, Jonathan Wakely, Rene Rivera, Tony Juricic, Bronek Kozicki, George M. Garner, Jr., Thorsten Ottosen, Bertolt Mildner, Carlo Wood, Christoper Diggins, Christoph Ludwig, Daryle Walker, Dirk Griffioen, Gareth Sylvester-Bradley, Jürgen Hunold, Larry Evans, Markus Schöpflin, Martin Ecker, Martin Wille, Russel Hind, Matthew Vogt, Matthias Troyer, Peter Dimov, Bruno Martínez Aguerre, Douglas Gregor, Pa
ul A. Bristow, David B. Held, Kevin Wheatley, Pavel Vozenilek, Emmanuel Thomé, Scott Woods, Israel Fernández Cabrera, Felix Gartsman, Pavel Chikulaev, Lisa Glendenning, Yuval Ronen and Paul Harris.
+ Those who participated in the formal review or the post-review discussions, or who submitted bug reports or patches, include (in no particular order) Adam Peterson, Joaquín M López Muñoz, Neal D. Becker, Stas Garifulin, Vladimir Prus, Rob Stewart, Robert Ramey, Michel Decima, Michiel Salters, Pedro Lamarão, Dietmar Kühl, Oleg Rekutin, Reece Dunn, Stefan Slapeta, Jeff Flinn, Jeff Garland, Eugene Lazutkin, John Torjo, Brian Braatz, Keith Burton, Keith MacDonald, Phil Richards, Arjen Wagenaar, Caleb Epstein, Dylan Trotter, Ben Hutchings, Daniel James, Daniel Schlyder, Jan Christiaan van Winkel, Jonathan Graehl, Jonathan Wakely, Rene Rivera, Tony Juricic, Bronek Kozicki, George M. Garner, Jr., Thorsten Ottosen, Bertolt Mildner, Carlo Wood, Christoper Diggins, Christoph Ludwig, Daryle Walker, Dirk Griffioen, Gareth Sylvester-Bradley, Jürgen Hunold, Larry Evans, Markus Sch&ouml;pflin, Martin Ecker, Martin Wille, Russel Hind, Matthew Vogt, Matthias Troyer, Peter Dimov, Bruno Martínez Aguerre, Douglas Grego
r, Paul A. Bristow, David B. Held, Kevin Wheatley, Pavel Vozenilek, Emmanuel Thomé, Scott Woods, Israel Fernández Cabrera, Felix Gartsman, Pavel Chikulaev, Lisa Glendenning, Yuval Ronen and Paul Harris.
     </LI>
 </UL>
 

Modified: branches/release/libs/iostreams/doc/classes/symmetric_filter.html
==============================================================================
--- branches/release/libs/iostreams/doc/classes/symmetric_filter.html (original)
+++ branches/release/libs/iostreams/doc/classes/symmetric_filter.html 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -64,7 +64,7 @@
 
     <SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> T0, ..., <SPAN CLASS="keyword">typename</SPAN> TN&gt;
     symmetric_filter( <SPAN CLASS="keyword">int</SPAN> buffer_size, const T0& t0,
- <SPAN CLASS="keyword">const</SPAN> T1& t1, ..., <SPAN CLASS="keyword">const</SPAN> TN& tN );
+ <SPAN CLASS="keyword">const</SPAN> T1& t1, ..., <SPAN CLASS="keyword">const</SPAN> TN& tN );
 
     <SPAN CLASS="omitted">...</SPAN>
 <SPAN CLASS="keyword">protected</SPAN>:

Modified: branches/release/libs/iostreams/doc/guide/concepts.html
==============================================================================
--- branches/release/libs/iostreams/doc/guide/concepts.html (original)
+++ branches/release/libs/iostreams/doc/guide/concepts.html 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -62,7 +62,7 @@
     <LI><A STYLE="font-weight:normal" HREF="../concepts/device.html">Device:</A> Base for all Device concepts, provides associated character type and category.
     <LI><A STYLE="font-weight:normal" HREF="../concepts/source.html">Source:</A> Provides read-only access to a sequence of characters.
     <LI><A STYLE="font-weight:normal" HREF="../concepts/sink.html">Sink:</A> Provides write-only access to a sequence of characters.
- <LI><A STYLE="font-weight:normal" HREF="../concepts/bidirectional_device.html">Bidirectionaldevice:</A> Provides access to two separate sequences of characters, one for reading and the other for writing.
+ <LI><A STYLE="font-weight:normal" HREF="../concepts/bidirectional_device.html">BidirectionalDevice:</A> Provides access to two separate sequences of characters, one for reading and the other for writing.
     <LI><A STYLE="font-weight:normal" HREF="../concepts/seekable_device.html">SeekableDevice:</A> Provides read-write access to a single sequence of characters, with a single repositionable read/write head.
 </UL>
 
@@ -73,10 +73,10 @@
 
 <UL>
     <LI><A STYLE="font-weight:normal" HREF="../concepts/filter.html">Filter:</A> Base for all Filter concepts, provides associated character type and category.
- <LI>InputFilter: Filters characters read from a stream buffer.
- <LI>OutputFilter: Filters characters written to a stream buffer.
- <LI>BidirectionalFilter: Filters two separate character sequences, one read from a stream buffer and the other written to a stream buffer.
- <LI>SeekableFilter: Filters a single characters sequence, controlled by a stream buffer,
+ <LI>InputFilter: Filters characters read from a Source.
+ <LI>OutputFilter: Filters characters written to a Sink
+ <LI>BidirectionalFilter: Filters two separate character sequences, one read from a Sink and the other written to a Sink.
+ <LI>SeekableFilter: Filters a single characters sequence, controlled by a SeekableDevice,
     providing filtered input, output and random access with a single repositionable read/write head
 </UL>
 

Modified: branches/release/libs/iostreams/doc/guide/modes.html
==============================================================================
--- branches/release/libs/iostreams/doc/guide/modes.html (original)
+++ branches/release/libs/iostreams/doc/guide/modes.html 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -41,11 +41,11 @@
 <H2>Overview</H2>
 
 <P>
- In order for a sequence of Filters and Devices to work together they must have certain properties in common. The most basic requirement is that they have the same character type; a collection of additional properties which Filters and Devices must share to be used for a particular purpose is called an <SPAN CLASS="term">mode</SPAN>.
+ In order for a sequence of Filters and Devices to work together they must have certain properties in common. The most basic requirement is that they have the same character type; a collection of additional properties which Filters and Devices must share to be used for a particular purpose is called a <SPAN CLASS="term">mode</SPAN>.
 </P>
 
 <P>
- The templates stream_buffer and stream are each parameterized by an mode, represented by a mode tag.
+ The templates stream_buffer and stream are each parameterized by a mode, represented by a mode tag.
 </P>
 
 <P>

Modified: branches/release/libs/iostreams/doc/tutorial/container_device.html
==============================================================================
--- branches/release/libs/iostreams/doc/tutorial/container_device.html (original)
+++ branches/release/libs/iostreams/doc/tutorial/container_device.html 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -131,7 +131,7 @@
         <SPAN CLASS="keyword">if</SPAN> (pos_ != container_.size()) {
             streamsize amt =
                 <SPAN CLASS="keyword">static_cast</SPAN>&lt;streamsize&gt;(container_.size() - pos_);
- streamsize result = (min)(n, amt);
+ result = (min)(n, amt);
             std::copy(s, s + result, container_.begin() + pos_);
             pos_ += result;
         }
@@ -153,11 +153,13 @@
             next = pos_ + off;
         } <SPAN CLASS="keyword">else</SPAN> <SPAN CLASS="keyword">if</SPAN> (way == ios_bas::end) {
             next = container_.size() + off - <SPAN CLASS='numeric_literal'>1</SPAN>;
+ } <SPAN CLASS="keyword">else</SPAN> {
+ <SPAN CLASS="keyword">throw</SPAN> ios_base::failure(<SPAN CLASS='numeric_literal'>"bad seek direction"</SPAN>);
         }
 
         <SPAN CLASS='comment'>// Check for errors</SPAN>
         <SPAN CLASS="keyword">if</SPAN> (next < <SPAN CLASS='numeric_literal'>0</SPAN> || next >= container_.size())
- <SPAN CLASS="keyword">throw</SPAN> ios_base::failure("bad seek offset");
+ <SPAN CLASS="keyword">throw</SPAN> ios_base::failure(<SPAN CLASS='numeric_literal'>"bad seek offset"</SPAN>);
 
         pos_ = next;
         <SPAN CLASS="keyword">return</SPAN> pos_;
@@ -200,7 +202,7 @@
     <SPAN CLASS="keyword">using</SPAN> <SPAN CLASS="keyword">namespace</SPAN> std;
     <SPAN CLASS="keyword">typedef</SPAN> ex::container_device&lt;string&gt; string_device;
 
- string one, two;
+ string one, two;
     io::stream&lt;string_device&gt; io(one);
     io &lt;&lt; <SPAN CLASS='literal'>"Hello World!"</SPAN>;
     io.flush();

Modified: branches/release/libs/iostreams/doc/tutorial/container_sink.html
==============================================================================
--- branches/release/libs/iostreams/doc/tutorial/container_sink.html (original)
+++ branches/release/libs/iostreams/doc/tutorial/container_sink.html 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -100,8 +100,6 @@
 <LI>The implementation of <CODE>write()</CODE> simply appends the characters in the specified buffer to the underlying container using the container's <CODE>insert</CODE> funcion,
 </UL>
 
-<P>It's tempting to make <CODE>pos_</CODE> an iterator instead of an integral value. That would be fine here, but when you turn to Devices for <I>writing</I> to containers, a stored iterator could easily be invalidated if you're not careful. Since you're only dealing with RandomAccessIterators, maintaining the current reading position as an integral value is sufficient.</P>
-
 <P>You can write to a container_sink as follows</P>
 
 <PRE CLASS="broken_ie"><SPAN CLASS='preprocessor'>#include</SPAN> <SPAN CLASS='literal'>&lt;cassert&gt;</SPAN>
@@ -117,7 +115,7 @@
     <SPAN CLASS='keyword'>using</SPAN> <SPAN CLASS='keyword'>namespace</SPAN> std;
     <SPAN CLASS='keyword'>typedef</SPAN> ex::container_sink&lt;string&gt; string_sink;
 
- string result;
+ string result;
     io::stream&lt;string_sink&gt; out(result);
     out &lt;&lt; <SPAN CLASS='literal'>"Hello World!"</SPAN>;
     out.flush();

Modified: branches/release/libs/iostreams/doc/tutorial/container_source.html
==============================================================================
--- branches/release/libs/iostreams/doc/tutorial/container_source.html (original)
+++ branches/release/libs/iostreams/doc/tutorial/container_source.html 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -132,8 +132,8 @@
     <SPAN CLASS='keyword'>using</SPAN> <SPAN CLASS='keyword'>namespace</SPAN> std;
     <SPAN CLASS='keyword'>typedef</SPAN> ex::container_source&lt;string&gt; string_source;
 
- string input = <SPAN CLASS='literal'>"Hello World!"</SPAN>;
- string output;
+ string input = <SPAN CLASS='literal'>"Hello World!"</SPAN>;
+ string output;
     io::stream&lt;string_source&gt; in(input);
     getline(in, output);
     assert(input == output);

Modified: branches/release/libs/iostreams/doc/tutorial/dictionary_filters.html
==============================================================================
--- branches/release/libs/iostreams/doc/tutorial/dictionary_filters.html (original)
+++ branches/release/libs/iostreams/doc/tutorial/dictionary_filters.html 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -222,7 +222,6 @@
     dictionary& dictionary_;
     std::string current_word_;
     std::string::size_type off_;
- <SPAN CLASS="keyword"><SPAN CLASS="keyword">bool</SPAN></SPAN> initialized_;
 };
 
 } } } <SPAN CLASS="comment">// End namespace boost::iostreams:example</SPAN></PRE>

Modified: branches/release/libs/iostreams/doc/tutorial/multichar_filters.html
==============================================================================
--- branches/release/libs/iostreams/doc/tutorial/multichar_filters.html (original)
+++ branches/release/libs/iostreams/doc/tutorial/multichar_filters.html 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -29,7 +29,7 @@
 <H2>2.2.8. Multi-Character Filters</H2>
 
 <P>
- All the Filters you've seen so far &#8212; except for those that derive from <CODE>stdio_filter</CODE> &#8212; process characters one at a time. If you instead process several characters at once, you can often reduce the number of function calls it takes to filter a character sequence, resulting in more efficient code. This is what Multi-Character Filters allow us to do.
+ All the Filters you've seen so far &#8212; except for those that derive from <CODE>stdio_filter</CODE> &#8212; process characters one at a time. If you instead process several characters at once, you can often reduce the number of function calls it takes to filter a character sequence, resulting in more efficient code. This is what Multi-Character Filters allow you to do.
 </P>
 
 <A NAME="multichar_input_filters"></A>

Modified: branches/release/libs/iostreams/doc/tutorial/shell_comments_filters.html
==============================================================================
--- branches/release/libs/iostreams/doc/tutorial/shell_comments_filters.html (original)
+++ branches/release/libs/iostreams/doc/tutorial/shell_comments_filters.html 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -165,7 +165,7 @@
     Here the member variable <CODE>skip_</CODE> plays the same role as the local variable <CODE>skip</CODE> <CODE>shell_comments_stdio_filter::do_filter</CODE>. The implementation of <CODE>get</CODE> is very similar to that of <CODE>shell_comments_stdio_filter::do_filter</CODE>: the <CODE>while</CODE> loop reads a character <CODE>c</CODE>, updates <CODE>skip_</CODE> and returns <CODE>c</CODE> unless <CODE>skip_</CODE> is <CODE>true</CODE>. The main difference is that you have to handle the special value <CODE>WOULD_BLOCK</CODE>, which indicates that no input is currently available.
 </P>
 <P>
- So you see that implementing an InputFilter from scratch is a bit more involved than deriving from stdio_filter. When writing an <CODE>InputFilter</CODE> you must be prepared to be interupted at any point in the middle of the algorithm; when this happens, you must record enough information about the current state of the algorithm to allow you to pick up later exactly where you left off. The same is true for OutputFilters. In fact, many Inputfilters and OutputFilters can be seen as finite state machines; I will formalize this idea later. <I>See</I> Finite State Filters.
+ So you see that implementing an InputFilter from scratch is a bit more involved than deriving from stdio_filter. When writing an <CODE>InputFilter</CODE> you must be prepared to be interrupted at any point in the middle of the algorithm; when this happens, you must record enough information about the current state of the algorithm to allow you to pick up later exactly where you left off. The same is true for OutputFilters. In fact, many Inputfilters and OutputFilters can be seen as finite state machines; I will formalize this idea later. <I>See</I> Finite State Filters.
 </P>
 <P>
     There's still one problem with <CODE>shell_comments_input_filter</CODE>: its instances can only be used once. That's because someone might close a stream while the <CODE>skip_</CODE> flag is set. If the stream were later reopened &#8212; with a fresh sequence of unfiltered data &#8212; the first line of text would be filtered out, regardless of whether it were commented.

Modified: branches/release/libs/iostreams/example/container_device.hpp
==============================================================================
--- branches/release/libs/iostreams/example/container_device.hpp (original)
+++ branches/release/libs/iostreams/example/container_device.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -8,6 +8,7 @@
 #define BOOST_IOSTREAMS_CONTAINTER_DEVICE_HPP_INCLUDED
 
 #include <algorithm> // copy, min.
+#include <cassert>
 #include <boost/config.hpp> // BOOST_NO_STDC_NAMESPACE.
 #include <boost/iostreams/categories.hpp>
 #include <boost/iostreams/detail/ios.hpp> // failure.
@@ -29,8 +30,9 @@
     std::streamsize read(char_type* s, std::streamsize n)
     {
         using namespace std;
- streamsize amt = static_cast<streamsize>(container_.size() - pos_);
- streamsize result = (min)(n, amt);
+ std::streamsize amt =
+ static_cast<std::streamsize>(container_.size() - pos_);
+ std::streamsize result = (min)(n, amt);
         if (result != 0) {
             std::copy( container_.begin() + pos_,
                        container_.begin() + pos_ + result,
@@ -43,6 +45,7 @@
     }
     Container& container() { return container_; }
 private:
+ container_source operator=(const container_source&);
     typedef typename Container::size_type size_type;
     Container& container_;
     size_type pos_;
@@ -64,6 +67,7 @@
     }
     Container& container() { return container_; }
 private:
+ container_sink operator=(const container_sink&);
     Container& container_;
 };
 
@@ -83,8 +87,9 @@
     std::streamsize read(char_type* s, std::streamsize n)
     {
         using namespace std;
- streamsize amt = static_cast<streamsize>(container_.size() - pos_);
- streamsize result = (min)(n, amt);
+ std::streamsize amt =
+ static_cast<std::streamsize>(container_.size() - pos_);
+ std::streamsize result = (min)(n, amt);
         if (result != 0) {
             std::copy( container_.begin() + pos_,
                        container_.begin() + pos_ + result,
@@ -98,11 +103,11 @@
     std::streamsize write(const char_type* s, std::streamsize n)
     {
         using namespace std;
- streamsize result = 0;
+ std::streamsize result = 0;
         if (pos_ != container_.size()) {
- streamsize amt =
- static_cast<streamsize>(container_.size() - pos_);
- streamsize result = (min)(n, amt);
+ std::streamsize amt =
+ static_cast<std::streamsize>(container_.size() - pos_);
+ result = (min)(n, amt);
             std::copy(s, s + result, container_.begin() + pos_);
             pos_ += result;
         }
@@ -124,6 +129,8 @@
             next = pos_ + off;
         } else if (way == BOOST_IOS::end) {
             next = container_.size() + off - 1;
+ } else {
+ throw BOOST_IOSTREAMS_FAILURE("bad seek direction");
         }
 
         // Check for errors
@@ -136,6 +143,7 @@
 
     Container& container() { return container_; }
 private:
+ container_device operator=(const container_device&);
     typedef typename Container::size_type size_type;
     Container& container_;
     size_type pos_;

Modified: branches/release/libs/iostreams/example/container_device_example.cpp
==============================================================================
--- branches/release/libs/iostreams/example/container_device_example.cpp (original)
+++ branches/release/libs/iostreams/example/container_device_example.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -6,7 +6,7 @@
 
 #include <cassert>
 #include <string>
-#include <boost/iostreams/stream_facade.hpp>
+#include <boost/iostreams/stream.hpp>
 #include <boost/iostreams/detail/ios.hpp> // ios_base::beg.
 #include <libs/iostreams/example/container_device.hpp>
 
@@ -18,8 +18,8 @@
     using namespace std;
     typedef ex::container_device<string> string_device;
 
- string one, two;
- io::stream_facade<string_device> io(one);
+ string one, two;
+ io::stream<string_device> io(one);
     io << "Hello World!";
     io.flush();
     io.seekg(0, BOOST_IOS::beg);

Modified: branches/release/libs/iostreams/example/container_sink_example.cpp
==============================================================================
--- branches/release/libs/iostreams/example/container_sink_example.cpp (original)
+++ branches/release/libs/iostreams/example/container_sink_example.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -6,7 +6,7 @@
 
 #include <cassert>
 #include <string>
-#include <boost/iostreams/stream_facade.hpp>
+#include <boost/iostreams/stream.hpp>
 #include <libs/iostreams/example/container_device.hpp>
 
 namespace io = boost::iostreams;
@@ -17,8 +17,8 @@
     using namespace std;
     typedef ex::container_sink<string> string_sink;
 
- string result;
- io::stream_facade<string_sink> out(result);
+ string result;
+ io::stream<string_sink> out(result);
     out << "Hello World!";
     out.flush();
     assert(result == "Hello World!");

Modified: branches/release/libs/iostreams/example/container_source_example.cpp
==============================================================================
--- branches/release/libs/iostreams/example/container_source_example.cpp (original)
+++ branches/release/libs/iostreams/example/container_source_example.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -6,7 +6,7 @@
 
 #include <cassert>
 #include <string>
-#include <boost/iostreams/stream_facade.hpp>
+#include <boost/iostreams/stream.hpp>
 #include <libs/iostreams/example/container_device.hpp>
 
 namespace io = boost::iostreams;
@@ -17,9 +17,9 @@
     using namespace std;
     typedef ex::container_source<string> string_source;
 
- string input = "Hello World!";
- string output;
- io::stream_facade<string_source> in(input);
+ string input = "Hello World!";
+ string output;
+ io::stream<string_source> in(input);
     getline(in, output);
     assert(input == output);
 }

Modified: branches/release/libs/iostreams/example/dictionary_filter.hpp
==============================================================================
--- branches/release/libs/iostreams/example/dictionary_filter.hpp (original)
+++ branches/release/libs/iostreams/example/dictionary_filter.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -51,7 +51,7 @@
             if (c == EOF || !std::isalpha((unsigned char) c)) {
                 dictionary_.replace(current_word_);
                 cout.write( current_word_.data(),
- static_cast<streamsize>(current_word_.size()) );
+ static_cast<std::streamsize>(current_word_.size()) );
                 current_word_.erase();
                 if (c == EOF)
                     break;
@@ -167,8 +167,9 @@
     bool write_current_word(Sink& dest)
     {
         using namespace std;
- streamsize amt = static_cast<streamsize>(current_word_.size() - off_);
- streamsize result =
+ std::streamsize amt =
+ static_cast<std::streamsize>(current_word_.size() - off_);
+ std::streamsize result =
             iostreams::write(dest, current_word_.data() + off_, amt);
         if (result == amt) {
             current_word_.erase();
@@ -183,7 +184,6 @@
     dictionary& dictionary_;
     std::string current_word_;
     std::string::size_type off_;
- bool initialized_;
 };
 
 //------------------Implementation of dictionary------------------------------//

Modified: branches/release/libs/iostreams/example/finite_state_filter.hpp
==============================================================================
--- branches/release/libs/iostreams/example/finite_state_filter.hpp (original)
+++ branches/release/libs/iostreams/example/finite_state_filter.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -342,11 +342,12 @@
     void close(Device& dev, BOOST_IOS::openmode which)
     {
         if (which == BOOST_IOS::out) {
- while (!this->empty())
- iostreams::put_if(dev, this->pop());
+ if (flags_ & f_write)
+ while (!this->empty())
+ iostreams::put_if(dev, this->pop());
+ this->reset();
+ flags_ = 0;
         }
- this->reset();
- flags_ = 0;
     }
 private:
     enum flags {

Modified: branches/release/libs/iostreams/src/bzip2.cpp
==============================================================================
--- branches/release/libs/iostreams/src/bzip2.cpp (original)
+++ branches/release/libs/iostreams/src/bzip2.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -121,8 +121,8 @@
 void bzip2_base::do_init
     ( bool compress,
       #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
- bzip2::alloc_func alloc,
- bzip2::free_func free,
+ bzip2::alloc_func /* alloc */,
+ bzip2::free_func /* free */,
       #endif
       void* derived )
 {

Modified: branches/release/libs/iostreams/src/file_descriptor.cpp
==============================================================================
--- branches/release/libs/iostreams/src/file_descriptor.cpp (original)
+++ branches/release/libs/iostreams/src/file_descriptor.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -1,4 +1,4 @@
-// (C) Copyright Jonathan Turkanis 2003.
+// (C) Copyright Jonathan Turkanis 2003-2007.
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
 
@@ -12,41 +12,34 @@
 // than using it (possibly importing code).
 #define BOOST_IOSTREAMS_SOURCE
 
-#include <boost/config.hpp> // BOOST_JOIN
+#include <cassert>
+#include <cerrno>
+#include <cstdio> // SEEK_SET, etc.
+#include <boost/config.hpp> // BOOST_JOIN
 #include <boost/iostreams/detail/error.hpp>
 #include <boost/iostreams/detail/config/dyn_link.hpp>
+#include <boost/iostreams/detail/config/rtl.hpp> // BOOST_IOSTREAMS_FD_XXX
 #include <boost/iostreams/detail/config/windows_posix.hpp>
-#include <boost/iostreams/detail/ios.hpp> // openmodes, failure.
+#include <boost/iostreams/detail/ios.hpp> // openmodes, failure.
 #include <boost/iostreams/device/file_descriptor.hpp>
 #include <boost/integer_traits.hpp>
 
     // OS-specific headers for low-level i/o.
 
-#include <cassert>
-#include <cstdio> // SEEK_SET, etc.
-#include <errno.h>
 #include <fcntl.h> // file opening flags.
 #include <sys/stat.h> // file access permissions.
 #ifdef BOOST_IOSTREAMS_WINDOWS
 # include <io.h> // low-level file i/o.
 # define WINDOWS_LEAN_AND_MEAN
 # include <windows.h>
+# ifndef INVALID_SET_FILE_POINTER
+# define INVALID_SET_FILE_POINTER ((DWORD)-1)
+# endif
 #else
 # include <sys/types.h> // mode_t.
 # include <unistd.h> // low-level file i/o.
 #endif
 
-// Names of runtime library routines vary.
-#if defined(__BORLANDC__)
-# define BOOST_RTL(x) BOOST_JOIN(_rtl_, x)
-#else
-# if defined(BOOST_IOSTREAMS_WINDOWS) && !defined(__CYGWIN__)
-# define BOOST_RTL(x) BOOST_JOIN(_, x)
-# else
-# define BOOST_RTL(x) ::x
-# endif
-#endif
-
 namespace boost { namespace iostreams {
 
 //------------------Implementation of file_descriptor-------------------------//
@@ -64,14 +57,16 @@
              ==
          (BOOST_IOS::in | BOOST_IOS::out) )
     {
- assert(!(m & BOOST_IOS::app));
+ if (m & BOOST_IOS::app)
+ throw BOOST_IOSTREAMS_FAILURE("bad open mode");
         dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
         dwCreationDisposition =
             (m & BOOST_IOS::trunc) ?
                 OPEN_ALWAYS :
                 OPEN_EXISTING;
     } else if (m & BOOST_IOS::in) {
- assert(!(m & (BOOST_IOS::app |BOOST_IOS::trunc)));
+ if (m & (BOOST_IOS::app |BOOST_IOS::trunc))
+ throw BOOST_IOSTREAMS_FAILURE("bad open mode");
         dwDesiredAccess = GENERIC_READ;
         dwCreationDisposition = OPEN_EXISTING;
     } else if (m & BOOST_IOS::out) {
@@ -79,12 +74,14 @@
         dwCreationDisposition = OPEN_ALWAYS;
         if (m & BOOST_IOS::app)
             pimpl_->flags_ |= impl::append;
+ } else {
+ throw BOOST_IOSTREAMS_FAILURE("bad open mode");
     }
 
     HANDLE handle =
         ::CreateFileA( path.c_str(),
                        dwDesiredAccess,
- 0, // dwShareMode
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
                        NULL, // lpSecurityAttributes
                        dwCreationDisposition,
                        FILE_ATTRIBUTE_NORMAL,
@@ -118,6 +115,9 @@
     }
     if (m & BOOST_IOS::trunc)
         oflag |= O_CREAT;
+ #ifdef _LARGEFILE64_SOURCE
+ oflag |= O_LARGEFILE;
+ #endif
 
         // Calculate pmode argument to open.
 
@@ -127,7 +127,7 @@
 
         // Open file.
 
- int fd = BOOST_RTL(open)(path.c_str(), oflag, pmode);
+ int fd = BOOST_IOSTREAMS_FD_OPEN(path.c_str(), oflag, pmode);
     if (fd == -1) {
         throw BOOST_IOSTREAMS_FAILURE("bad open");
     } else {
@@ -148,7 +148,7 @@
     }
 #endif
     errno = 0;
- std::streamsize result = BOOST_RTL(read)(pimpl_->fd_, s, n);
+ std::streamsize result = BOOST_IOSTREAMS_FD_READ(pimpl_->fd_, s, n);
     if (errno != 0)
         throw detail::bad_read();
     return result == 0 ? -1 : result;
@@ -159,9 +159,13 @@
 #ifdef BOOST_IOSTREAMS_WINDOWS
     if (pimpl_->flags_ & impl::has_handle) {
         if (pimpl_->flags_ & impl::append) {
- ::SetFilePointer(pimpl_->handle_, 0, NULL, FILE_END);
- if (::GetLastError() != NO_ERROR)
+ DWORD const dwResult =
+ ::SetFilePointer(pimpl_->handle_, 0, NULL, FILE_END);
+ if ( dwResult == INVALID_SET_FILE_POINTER &&
+ ::GetLastError() != NO_ERROR )
+ {
                 throw detail::bad_seek();
+ }
         }
         DWORD ignore;
         if (!::WriteFile(pimpl_->handle_, s, n, &ignore, NULL))
@@ -169,7 +173,7 @@
         return n;
     }
 #endif
- int amt = BOOST_RTL(write)(pimpl_->fd_, s, n);
+ int amt = BOOST_IOSTREAMS_FD_WRITE(pimpl_->fd_, s, n);
     if (amt < n)
         throw detail::bad_write(); // Handles blocking fd's only.
     return n;
@@ -192,39 +196,32 @@
                                   way == BOOST_IOS::cur ?
                                     FILE_CURRENT :
                                     FILE_END );
- if (::GetLastError() != NO_ERROR) {
+ if ( dwResultLow == INVALID_SET_FILE_POINTER &&
+ ::GetLastError() != NO_ERROR )
+ {
             throw detail::bad_seek();
         } else {
- return offset_to_position((lDistanceToMoveHigh << 32) + dwResultLow);
+ return offset_to_position(
+ (stream_offset(lDistanceToMoveHigh) << 32) + dwResultLow
+ );
         }
     }
 #endif // #ifdef BOOST_IOSTREAMS_WINDOWS
-
-#ifndef BOOST_IOSTREAMS_HAS_LSEEK64
- if ( off > integer_traits<long>::const_max ||
- off < integer_traits<long>::const_min )
+ if ( off > integer_traits<BOOST_IOSTREAMS_FD_OFFSET>::const_max ||
+ off < integer_traits<BOOST_IOSTREAMS_FD_OFFSET>::const_min )
     {
         throw BOOST_IOSTREAMS_FAILURE("bad offset");
     }
-#endif
-
     stream_offset result =
- #ifdef BOOST_IOSTREAMS_HAS_LSEEK64
- lseek64
- #else
- lseek
- #endif
- ( pimpl_->fd_,
- #ifdef BOOST_IOSTREAMS_HAS_LSEEK64
- off,
- #else
- static_cast<long>(off),
- #endif
- way == BOOST_IOS::beg ?
+ BOOST_IOSTREAMS_FD_SEEK(
+ pimpl_->fd_,
+ static_cast<BOOST_IOSTREAMS_FD_OFFSET>(off),
+ ( way == BOOST_IOS::beg ?
                   SEEK_SET :
- way == BOOST_IOS::cur ?
- SEEK_CUR :
- SEEK_END );
+ way == BOOST_IOS::cur ?
+ SEEK_CUR :
+ SEEK_END )
+ );
     if (result == -1)
         throw detail::bad_seek();
     return offset_to_position(result);
@@ -244,7 +241,7 @@
     }
 #endif
     if (i.fd_ != -1) {
- if (BOOST_RTL(close)(i.fd_) == -1)
+ if (BOOST_IOSTREAMS_FD_CLOSE(i.fd_) == -1)
             throw BOOST_IOSTREAMS_FAILURE("bad close");
         i.fd_ = -1;
         i.flags_ = 0;

Modified: branches/release/libs/iostreams/src/mapped_file.cpp
==============================================================================
--- branches/release/libs/iostreams/src/mapped_file.cpp (original)
+++ branches/release/libs/iostreams/src/mapped_file.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -22,6 +22,9 @@
 #ifdef BOOST_IOSTREAMS_WINDOWS
 # define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
 # include <windows.h>
+# ifndef INVALID_SET_FILE_POINTER
+# define INVALID_SET_FILE_POINTER ((DWORD)-1)
+# endif
 #else
 # include <errno.h>
 # include <fcntl.h>
@@ -39,7 +42,7 @@
 
 struct mapped_file_impl {
     mapped_file_impl() { clear(false); }
- ~mapped_file_impl() { try { close(); } catch (std::exception&) { } }
+ ~mapped_file_impl() { try { close(); } catch (...) { } }
     void clear(bool error)
     {
         data_ = 0;
@@ -194,9 +197,14 @@
     if (p.new_file_size != 0 && !readonly) {
         LONG sizehigh = (p.new_file_size >> (sizeof(LONG) * 8));
         LONG sizelow = (p.new_file_size & 0xffffffff);
- ::SetFilePointer(pimpl_->handle_, sizelow, &sizehigh, FILE_BEGIN);
- if (::GetLastError() != NO_ERROR || !::SetEndOfFile(pimpl_->handle_))
+ DWORD result =
+ ::SetFilePointer(pimpl_->handle_, sizelow, &sizehigh, FILE_BEGIN);
+ if ( result == INVALID_SET_FILE_POINTER &&
+ ::GetLastError() != NO_ERROR ||
+ !::SetEndOfFile(pimpl_->handle_) )
+ {
             detail::cleanup_and_throw(*pimpl_, "failed setting file size");
+ }
     }
 
     //--------------Create mapping--------------------------------------------//

Modified: branches/release/libs/iostreams/src/zlib.cpp
==============================================================================
--- branches/release/libs/iostreams/src/zlib.cpp (original)
+++ branches/release/libs/iostreams/src/zlib.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -153,7 +153,7 @@
 void zlib_base::do_init
     ( const zlib_params& p, bool compress,
       #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
- zlib::alloc_func alloc, zlib::free_func free,
+ zlib::alloc_func /* alloc */, zlib::free_func /* free*/,
       #endif
       void* derived )
 {

Modified: branches/release/libs/iostreams/test/Jamfile.v2
==============================================================================
--- branches/release/libs/iostreams/test/Jamfile.v2 (original)
+++ branches/release/libs/iostreams/test/Jamfile.v2 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -11,7 +11,8 @@
 
 local NO_BZIP2 = [ modules.peek : NO_BZIP2 ] ;
 local NO_ZLIB = [ modules.peek : NO_ZLIB ] ;
-
+local LARGE_FILE_TEMP = [ modules.peek : LARGE_FILE_TEMP ] ;
+local LARGE_FILE_KEEP = [ modules.peek : LARGE_FILE_KEEP ] ;
 
 rule test-iostreams ( sources * : requirements * ) {
     return [
@@ -22,6 +23,7 @@
             : # input files
             : # build requirements
                 <toolset>msvc,<stdlib>stlport:<runtime-link>static
+ <toolset>msvc:<cxxflags>"-wd4996"
                 <toolset>cw-9.3,<os>darwin:<runtime-link>static
                 <define>BOOST_IOSTREAMS_NO_LIB
                 <link>shared:<define>BOOST_IOSTREAMS_DYN_LINK=1
@@ -29,35 +31,27 @@
         ] ;
 }
 
-
     local all-tests =
           [ test-iostreams array_test.cpp ]
           [ test-iostreams auto_close_test.cpp ]
           [ test-iostreams buffer_size_test.cpp ]
+ [ test-iostreams close_test.cpp ]
           [ test-iostreams
                 code_converter_test.cpp
                 detail/utf8_codecvt_facet.cpp ]
-
- #: # build requirements
- # std::locale-support ]
           [ test-iostreams compose_test.cpp ]
           [ test-iostreams component_access_test.cpp ]
           [ test-iostreams copy_test.cpp ]
           [ test-iostreams counter_test.cpp ]
           [ test-iostreams direct_adapter_test.cpp ]
           [ test-iostreams example_test.cpp ]
+ [ test-iostreams execute_test.cpp ]
           [ test-iostreams file_test.cpp ]
           [ test-iostreams
                 file_descriptor_test.cpp
                 ../build//boost_iostreams : <link>static ]
           [ test-iostreams filtering_stream_test.cpp ]
- [ test-iostreams
- finite_state_filter_test.cpp
- : # build requirements
- # FIXME: yet to implement
- #std::locale-support
- ]
-
+ [ test-iostreams finite_state_filter_test.cpp ]
           [ test-iostreams flush_test.cpp ]
           [ test-iostreams invert_test.cpp ]
           [ test-iostreams line_filter_test.cpp ]
@@ -66,32 +60,55 @@
                 ../build//boost_iostreams : <link>static ]
           [ test-iostreams newline_test.cpp ]
           [ test-iostreams null_test.cpp ]
+ [ test-iostreams operation_sequence_test.cpp ]
           [ test-iostreams pipeline_test.cpp ]
- [ test-iostreams positioning_test.cpp ]
           [ test-iostreams
                 regex_filter_test.cpp
                 /boost/regex//boost_regex ]
           [ test-iostreams restrict_test.cpp ]
           [ test-iostreams seekable_file_test.cpp ]
           [ test-iostreams seekable_filter_test.cpp ]
+ [ test-iostreams sequence_test.cpp ]
           [ test-iostreams stdio_filter_test.cpp ]
+ [ test-iostreams stream_offset_32bit_test.cpp ]
+ [ test-iostreams stream_offset_64bit_test.cpp ]
+ #[ test-iostreams stream_state_test.cpp ]
           [ test-iostreams symmetric_filter_test.cpp ]
           [ test-iostreams tee_test.cpp ]
           [ test-iostreams wide_stream_test.cpp ]
           ;
 
+ if $(LARGE_FILE_KEEP)
+ {
+ all-tests +=
+ [ test-iostreams
+ large_file_test.cpp
+ ../build//boost_iostreams
+ : <define>LARGE_FILE_KEEP=$(LARGE_FILE_KEEP)
+ $(KEEP) ] ;
+ }
+ if $(LARGE_FILE_TEMP)
+ {
+ all-tests +=
+ [ test-iostreams
+ large_file_test.cpp
+ ../build//boost_iostreams
+ : <define>LARGE_FILE_TEMP=$(LARGE_FILE_TEMP)
+ $(KEEP) ] ;
+ }
       if ! $(NO_BZIP2)
       {
           all-tests += [ test-iostreams
- bzip2_test.cpp ../build//boost_iostreams ] ;
- }
+ bzip2_test.cpp ../build//boost_iostreams ] ;
+ }
       if ! $(NO_ZLIB)
       {
- all-tests += [ test-iostreams
- gzip_test.cpp ../build//boost_iostreams ]
- [ test-iostreams
- zlib_test.cpp ../build//boost_iostreams ] ;
- }
+ all-tests +=
+ [ test-iostreams
+ gzip_test.cpp ../build//boost_iostreams ]
+ [ test-iostreams
+ zlib_test.cpp ../build//boost_iostreams ] ;
+ }
           
     test-suite "iostreams" : $(all-tests) ;
     

Modified: branches/release/libs/iostreams/test/code_converter_test.cpp
==============================================================================
--- branches/release/libs/iostreams/test/code_converter_test.cpp (original)
+++ branches/release/libs/iostreams/test/code_converter_test.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -22,13 +22,15 @@
 #if !defined(__COMO__) || !defined(BOOST_COMO_STRICT)
 # if defined(BOOST_IOSTREAMS_NO_LIB) || defined(BOOST_ALL_NO_LIB)
 # include "../src/file_descriptor.cpp"
-# else
+# else
 # include <boost/iostreams/device/file_descriptor.hpp>
 # endif
 #endif
 #include <boost/iostreams/stream.hpp>
 #include <boost/test/test_tools.hpp>
 #include <boost/test/unit_test.hpp>
+#include "detail/closable.hpp"
+#include "detail/operation_sequence.hpp"
 #include "detail/temp_file.hpp"
 
     // Include codevct facets
@@ -36,75 +38,75 @@
 #include "detail/null_padded_codecvt.hpp"
 #include "detail/utf8_codecvt_facet.hpp"
 #ifdef BOOST_IOSTREAMS_USE_DINKUM_COREX
-# include <codecvt/8859_1>
-# include <codecvt/8859_10>
-# include <codecvt/8859_13>
-# include <codecvt/8859_14>
-# include <codecvt/8859_15>
-# include <codecvt/8859_16>
-# include <codecvt/8859_2>
-# include <codecvt/8859_3>
-# include <codecvt/8859_4>
-# include <codecvt/8859_5>
-# include <codecvt/8859_6>
-# include <codecvt/8859_7>
-# include <codecvt/8859_8>
-# include <codecvt/8859_9>
-# include <codecvt/baltic>
-# include <codecvt/big5>
-# include <codecvt/cp037>
-# include <codecvt/cp1006>
-# include <codecvt/cp1026>
-# include <codecvt/cp1250>
-# include <codecvt/cp1251>
-# include <codecvt/cp1252>
-# include <codecvt/cp1253>
-# include <codecvt/cp1254>
-# include <codecvt/cp1255>
-# include <codecvt/cp1256>
-# include <codecvt/cp1257>
-# include <codecvt/cp1258>
-# include <codecvt/cp424>
-# include <codecvt/cp437>
-# include <codecvt/cp500>
-# include <codecvt/cp737>
-# include <codecvt/cp775>
-# include <codecvt/cp850>
-# include <codecvt/cp852>
-# include <codecvt/cp855>
-# include <codecvt/cp856>
-# include <codecvt/cp857>
-# include <codecvt/cp860>
-# include <codecvt/cp861>
-# include <codecvt/cp862>
-# include <codecvt/cp863>
-# include <codecvt/cp864>
-# include <codecvt/cp865>
-# include <codecvt/cp866>
-# include <codecvt/cp869>
-# include <codecvt/cp874>
-# include <codecvt/cp875>
-# include <codecvt/cp932>
-# include <codecvt/cp936>
-# include <codecvt/cp949>
-# include <codecvt/cp950>
-# include <codecvt/cyrillic>
-# include <codecvt/ebcdic>
-# include <codecvt/euc>
-# include <codecvt/euc_0208>
-# include <codecvt/gb12345>
-# include <codecvt/gb2312>
-# include <codecvt/greek>
-# include <codecvt/iceland>
-# include <codecvt/jis>
-# include <codecvt/jis_0208>
-# include <codecvt/jis0201>
-# include <codecvt/ksc5601>
-# include <codecvt/latin2>
-# include <codecvt/one_one>
-# include <codecvt/roman>
-# include <codecvt/sjis>
-# include <codecvt/sjis_0208>
+# include <codecvt/8859_1>
+# include <codecvt/8859_10>
+# include <codecvt/8859_13>
+# include <codecvt/8859_14>
+# include <codecvt/8859_15>
+# include <codecvt/8859_16>
+# include <codecvt/8859_2>
+# include <codecvt/8859_3>
+# include <codecvt/8859_4>
+# include <codecvt/8859_5>
+# include <codecvt/8859_6>
+# include <codecvt/8859_7>
+# include <codecvt/8859_8>
+# include <codecvt/8859_9>
+# include <codecvt/baltic>
+# include <codecvt/big5>
+# include <codecvt/cp037>
+# include <codecvt/cp1006>
+# include <codecvt/cp1026>
+# include <codecvt/cp1250>
+# include <codecvt/cp1251>
+# include <codecvt/cp1252>
+# include <codecvt/cp1253>
+# include <codecvt/cp1254>
+# include <codecvt/cp1255>
+# include <codecvt/cp1256>
+# include <codecvt/cp1257>
+# include <codecvt/cp1258>
+# include <codecvt/cp424>
+# include <codecvt/cp437>
+# include <codecvt/cp500>
+# include <codecvt/cp737>
+# include <codecvt/cp775>
+# include <codecvt/cp850>
+# include <codecvt/cp852>
+# include <codecvt/cp855>
+# include <codecvt/cp856>
+# include <codecvt/cp857>
+# include <codecvt/cp860>
+# include <codecvt/cp861>
+# include <codecvt/cp862>
+# include <codecvt/cp863>
+# include <codecvt/cp864>
+# include <codecvt/cp865>
+# include <codecvt/cp866>
+# include <codecvt/cp869>
+# include <codecvt/cp874>
+# include <codecvt/cp875>
+# include <codecvt/cp932>
+# include <codecvt/cp936>
+# include <codecvt/cp949>
+# include <codecvt/cp950>
+# include <codecvt/cyrillic>
+# include <codecvt/ebcdic>
+# include <codecvt/euc>
+# include <codecvt/euc_0208>
+# include <codecvt/gb12345>
+# include <codecvt/gb2312>
+# include <codecvt/greek>
+# include <codecvt/iceland>
+# include <codecvt/jis>
+# include <codecvt/jis_0208>
+# include <codecvt/jis0201>
+# include <codecvt/ksc5601>
+# include <codecvt/latin2>
+# include <codecvt/one_one>
+# include <codecvt/roman>
+# include <codecvt/sjis>
+# include <codecvt/sjis_0208>
 # include <codecvt/turkish>
 # include <codecvt/utf16>
 # include <codecvt/utf8>
@@ -118,7 +120,7 @@
 using namespace boost::iostreams;
 using namespace boost::iostreams::detail;
 using namespace boost::iostreams::test;
-using boost::unit_test::test_suite;
+using boost::unit_test::test_suite;
 namespace io = boost::iostreams;
 
 const int max_length = 30;
@@ -144,9 +146,9 @@
 
 template<typename Codecvt>
 basic_string<
- BOOST_DEDUCED_TYPENAME
+ BOOST_DEDUCED_TYPENAME
     codecvt_intern<Codecvt>::type
->
+>
 test_string()
 {
     typedef typename codecvt_intern<Codecvt>::type intern_type;
@@ -155,7 +157,7 @@
         if (valid_char<Codecvt>(c))
             pattern += c;
     result.reserve(pattern.size() * pattern_reps);
- for (int w = 0; w < pattern_reps; ++w)
+ for (unsigned int w = 0; w < pattern_reps; ++w)
         result += pattern;
     return result;
 }
@@ -167,7 +169,7 @@
     typedef io::file_descriptor_sink classic_file_sink;
 #else
     struct classic_file_source : io::source {
- classic_file_source(const std::string& path)
+ classic_file_source(const std::string& path)
             : file_(new filebuf)
         {
             file_->pubimbue(locale::classic());
@@ -178,7 +180,7 @@
     };
 
     struct classic_file_sink : io::sink {
- classic_file_sink(const std::string& path)
+ classic_file_sink(const std::string& path)
             : file_(new filebuf)
         {
             file_->pubimbue(locale::classic());
@@ -193,21 +195,21 @@
 bool codecvt_test1()
 {
     typedef basic_string<
- BOOST_DEDUCED_TYPENAME
+ BOOST_DEDUCED_TYPENAME
                 codecvt_intern<Codecvt>::type
> string_type;
     typedef code_converter<classic_file_source, Codecvt> wide_file_source;
     typedef code_converter<classic_file_sink, Codecvt> wide_file_sink;
 
     BOOST_CHECK(Codecvt().max_length() <= max_length);
- temp_file temp;
- string_type test = test_string<Codecvt>();
+ temp_file temp;
+ string_type test = test_string<Codecvt>();
     stream<wide_file_sink> out(temp.name());
     out.write(test.data(), static_cast<streamsize>(test.size()));
     out.close();
 
     stream<wide_file_source> in(temp.name());
- string_type test2;
+ string_type test2;
     io::copy(in, io::back_inserter(test2));
 
     return test == test2;
@@ -217,7 +219,7 @@
 bool codecvt_test2()
 {
     typedef basic_string<
- BOOST_DEDUCED_TYPENAME
+ BOOST_DEDUCED_TYPENAME
                 codecvt_intern<Codecvt>::type
> string_type;
     typedef code_converter<classic_file_source> wide_file_source;
@@ -227,14 +229,14 @@
     locale loc = add_facet(locale(), new Codecvt);
     locale::global(loc);
 
- temp_file temp;
- string_type test = test_string<Codecvt>();
+ temp_file temp;
+ string_type test = test_string<Codecvt>();
     stream<wide_file_sink> out(temp.name());
     out.write(test.data(), static_cast<streamsize>(test.size()));
     out.close();
 
     stream<wide_file_source> in(temp.name());
- string_type test2;
+ string_type test2;
     io::copy(in, io::back_inserter(test2));
 
     return test == test2;
@@ -242,8 +244,8 @@
 
 template<typename Codecvt>
 bool codecvt_test()
-{
- return codecvt_test1<Codecvt>() && codecvt_test2<Codecvt>();
+{
+ return codecvt_test1<Codecvt>() && codecvt_test2<Codecvt>();
 }
 
 void code_converter_test()
@@ -253,75 +255,75 @@
     BOOST_CHECK(codecvt_test<stateless_null_padded_codecvt>());
 #ifdef BOOST_IOSTREAMS_USE_DINKUM_COREX
     using namespace Dinkum::conversions;
- BOOST_CHECK(codecvt_test< codecvt_8859_1<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_8859_10<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_8859_13<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_8859_14<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_8859_15<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_8859_16<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_8859_2<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_8859_3<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_8859_4<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_8859_5<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_8859_6<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_8859_7<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_8859_8<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_8859_9<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_baltic<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_big5<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp037<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp1006<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp1026<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp1250<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp1251<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp1252<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp1253<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp1254<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp1255<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp1256<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp1257<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp1258<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp424<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp437<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp500<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp737<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp775<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp850<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp852<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp855<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp856<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp857<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp860<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp861<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp862<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp863<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp864<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp865<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp866<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp869<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp874<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp875<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp932<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp936<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp949<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cp950<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_cyrillic<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_ebcdic<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_euc<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_euc_0208<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_gb12345<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_gb2312<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_greek<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_iceland<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_jis<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_jis_0208<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_jis0201<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_ksc5601<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_latin2<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_one_one<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_roman<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_sjis<wchar_t> >());
- BOOST_CHECK(codecvt_test< codecvt_sjis_0208<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_8859_1<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_8859_10<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_8859_13<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_8859_14<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_8859_15<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_8859_16<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_8859_2<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_8859_3<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_8859_4<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_8859_5<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_8859_6<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_8859_7<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_8859_8<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_8859_9<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_baltic<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_big5<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp037<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp1006<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp1026<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp1250<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp1251<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp1252<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp1253<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp1254<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp1255<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp1256<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp1257<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp1258<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp424<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp437<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp500<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp737<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp775<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp850<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp852<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp855<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp856<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp857<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp860<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp861<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp862<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp863<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp864<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp865<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp866<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp869<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp874<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp875<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp932<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp936<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp949<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cp950<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_cyrillic<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_ebcdic<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_euc<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_euc_0208<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_gb12345<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_gb2312<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_greek<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_iceland<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_jis<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_jis_0208<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_jis0201<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_ksc5601<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_latin2<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_one_one<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_roman<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_sjis<wchar_t> >());
+ BOOST_CHECK(codecvt_test< codecvt_sjis_0208<wchar_t> >());
     BOOST_CHECK(codecvt_test< codecvt_turkish<wchar_t> >());
     BOOST_CHECK(codecvt_test< codecvt_utf16<wchar_t> >());
     BOOST_CHECK(codecvt_test< codecvt_utf8<wchar_t> >());
@@ -329,9 +331,56 @@
 #endif
 }
 
-test_suite* init_unit_test_suite(int, char* [])
+/* Defer pending further testing
+void close_test()
+{
+ typedef utf8_codecvt_facet<wchar_t, char> codecvt_type;
+
+ // Test code converter based on a source
+ {
+ operation_sequence seq;
+ io::wchain<input> ch;
+ ch.push(
+ code_converter<closable_device<input>, codecvt_type>(
+ seq.new_operation(1)
+ )
+ );
+ BOOST_CHECK_NO_THROW(ch.reset());
+ BOOST_CHECK_OPERATION_SEQUENCE(seq);
+ }
+
+ // Test code converter based on a sink
+ {
+ operation_sequence seq;
+ io::wchain<output> ch;
+ ch.push(
+ code_converter<closable_device<output>, codecvt_type>(
+ seq.new_operation(1)
+ )
+ );
+ BOOST_CHECK_NO_THROW(ch.reset());
+ BOOST_CHECK_OPERATION_SEQUENCE(seq);
+ }
+
+ // Test code converter based on a bidirectional device
+ {
+ operation_sequence seq;
+ io::wchain<bidirectional> ch;
+ ch.push(
+ code_converter<closable_device<bidirectional>, codecvt_type>(
+ seq.new_operation(1),
+ seq.new_operation(2)
+ )
+ );
+ BOOST_CHECK_NO_THROW(ch.reset());
+ BOOST_CHECK_OPERATION_SEQUENCE(seq);
+ }
+}*/
+
+test_suite* init_unit_test_suite(int, char* [])
 {
     test_suite* test = BOOST_TEST_SUITE("code_converter test");
     test->add(BOOST_TEST_CASE(&code_converter_test));
+ //test->add(BOOST_TEST_CASE(&close_test));
     return test;
-}
\ No newline at end of file
+}

Modified: branches/release/libs/iostreams/test/compose_test.cpp
==============================================================================
--- branches/release/libs/iostreams/test/compose_test.cpp (original)
+++ branches/release/libs/iostreams/test/compose_test.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -27,6 +27,7 @@
     test_file src1, src2;
     filtering_istream first, second;
 
+ // Test composite device
     first.push(toupper_filter());
     first.push(padding_filter('a'));
     first.push(file_source(src1.name(), in_mode));
@@ -38,6 +39,7 @@
         "failed reading from a stdio_filter"
     );
 
+ // Test composite filter
     first.reset();
     second.reset();
     first.push(toupper_filter());
@@ -60,6 +62,7 @@
     temp_file dest1, dest2;
     filtering_ostream out1, out2;
 
+ // Test composite device
     out1.push(tolower_filter());
     out1.push(padding_filter('a'));
     out1.push(file_sink(dest1.name(), in_mode));
@@ -80,6 +83,7 @@
         );
     }
 
+ // Test composite filter
     out1.push(tolower_filter());
     out1.push(padding_filter('a'));
     out1.push(file_sink(dest1.name(), in_mode));

Modified: branches/release/libs/iostreams/test/copy_test.cpp
==============================================================================
--- branches/release/libs/iostreams/test/copy_test.cpp (original)
+++ branches/release/libs/iostreams/test/copy_test.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -4,68 +4,147 @@
 
 // See http://www.boost.org/libs/iostreams for documentation.
 
-#include <fstream>
+#include <algorithm> // Equal
+#include <vector>
 #include <boost/config.hpp> // MSVC.
 #include <boost/detail/workaround.hpp>
+#include <boost/iostreams/concepts.hpp> // sink
 #include <boost/iostreams/copy.hpp>
+#include <boost/iostreams/device/array.hpp>
 #include <boost/iostreams/device/file.hpp>
+#include <boost/iostreams/stream.hpp>
 #include <boost/test/test_tools.hpp>
 #include <boost/test/unit_test.hpp>
-#include "detail/temp_file.hpp"
-#include "detail/verification.hpp"
+#include "../example/container_device.hpp"
+#include "detail/sequence.hpp"
 
 using namespace std;
 using namespace boost;
 using namespace boost::iostreams;
+using namespace boost::iostreams::example;
 using namespace boost::iostreams::test;
 using boost::unit_test::test_suite;
+
+//------------------Definition of fixed_sink----------------------------------//
+
+/*class fixed_sink : public sink {
+public:
+ fixed_sink(vector<char>& storage)
+ : storage_(storage), pos_(0)
+ { }
+ std::streamsize write(const char_type* s, std::streamsize n)
+ {
+ streamsize capacity = static_cast<streamsize>(storage_.size() - pos_);
+ streamsize result = (min)(n, capacity);
+ std::copy(s, s + result, storage_.begin() + pos_);
+ pos_ += result;
+ return result;
+ }
+private:
+ fixed_sink operator=(const fixed_sink&);
+ typedef vector<char>::size_type size_type;
+ vector<char>& storage_;
+ size_type pos_;
+};*/
+
+//------------------Definition of stream types--------------------------------//
+
+typedef container_source< vector<char> > vector_source;
+typedef container_sink< vector<char> > vector_sink;
+typedef stream<vector_source> vector_istream;
+typedef stream<vector_sink> vector_ostream;
+//typedef stream<fixed_sink> fixed_ostream;
+
+//------------------Definition of copy_test-----------------------------------//
 
 void copy_test()
 {
- test_file test;
-
+ // Stream to stream
     {
- temp_file dest;
- ifstream first(test.name().c_str(), in_mode);
- ofstream second(dest.name().c_str(), out_mode);
- boost::iostreams::copy(first, second);
- first.close();
- second.close();
+ test_sequence<> src;
+ vector<char> dest;
+ vector_istream first;
+ vector_ostream second;
+ first.open(vector_source(src));
+ second.open(vector_sink(dest));
         BOOST_CHECK_MESSAGE(
- compare_files(test.name(), dest.name()),
+ boost::iostreams::copy(first, second) == src.size() && src == dest,
             "failed copying from stream to stream"
         );
     }
 
+ // Stream to indirect sink
+ {
+ test_sequence<> src;
+ vector<char> dest;
+ vector_istream in;
+ vector_sink out(dest);
+ in.open(vector_source(src));
+ BOOST_CHECK_MESSAGE(
+ boost::iostreams::copy(in, out) == src.size() && src == dest,
+ "failed copying from stream to indirect sink"
+ );
+ }
+
+ // Indirect source to stream
+ {
+ test_sequence<> src;
+ vector<char> dest;
+ vector_source in(src);
+ vector_ostream out;
+ out.open(vector_sink(dest));
+ BOOST_CHECK_MESSAGE(
+ boost::iostreams::copy(in, out) == src.size() && src == dest,
+ "failed copying from indirect source to stream"
+ );
+ }
+
+ // Indirect source to indirect sink
+ {
+ test_sequence<> src;
+ vector<char> dest;
+ vector_source in(src);
+ vector_sink out(dest);
+ BOOST_CHECK_MESSAGE(
+ boost::iostreams::copy(in, out) == src.size() && src == dest,
+ "failed copying from indirect source to indirect sink"
+ );
+ }
+
+ // Direct source to direct sink
     {
- temp_file dest;
- ifstream first(test.name().c_str(), in_mode);
- boost::iostreams::copy(first, file_sink(dest.name(), out_mode));
- first.close();
+ test_sequence<> src;
+ vector<char> dest(src.size(), '?');
+ array_source in(&src[0], &src[0] + src.size());
+ array_sink out(&dest[0], &dest[0] + dest.size());
         BOOST_CHECK_MESSAGE(
- compare_files(test.name(), dest.name()),
- "failed copying from stream to file_sink"
+ boost::iostreams::copy(in, out) == src.size() && src == dest,
+ "failed copying from direct source to direct sink"
         );
     }
 
+ // Direct source to indirect sink
     {
- temp_file dest;
- ofstream second(dest.name().c_str(), out_mode);
- boost::iostreams::copy(file_source(test.name(), in_mode), second);
- second.close();
+ test_sequence<> src;
+ vector<char> dest;
+ array_source in(&src[0], &src[0] + src.size());
+ vector_ostream out(dest);
         BOOST_CHECK_MESSAGE(
- compare_files(test.name(), dest.name()),
- "failed copying from file_source to stream"
+ boost::iostreams::copy(in, out) == src.size() && src == dest,
+ "failed copying from direct source to indirect sink"
         );
     }
 
+ // Indirect source to direct sink
     {
- temp_file dest;
- boost::iostreams::copy( file_source(test.name(), in_mode),
- file_sink(dest.name(), out_mode) );
+ test_sequence<> src;
+ vector<char> dest(src.size(), '?');
+ vector_istream in;
+ array_sink out(&dest[0], &dest[0] + dest.size());
+ in.open(vector_source(src));
         BOOST_CHECK_MESSAGE(
- compare_files(test.name(), dest.name()),
- "failed copying from file_source to file_sink"
+ boost::iostreams::copy(in, out) == src.size() && src == dest,
+ "failed copying from indirect source to direct sink"
         );
     }
 }

Modified: branches/release/libs/iostreams/test/detail/filters.hpp
==============================================================================
--- branches/release/libs/iostreams/test/detail/filters.hpp (original)
+++ branches/release/libs/iostreams/test/detail/filters.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -134,7 +134,7 @@
           flushable_tag
         { };
     template<typename Sink>
- bool put(Sink& s, char c)
+ bool put(Sink&, char c)
     {
         buf_.push_back(c);
         return true;

Modified: branches/release/libs/iostreams/test/detail/null_padded_codecvt.hpp
==============================================================================
--- branches/release/libs/iostreams/test/detail/null_padded_codecvt.hpp (original)
+++ branches/release/libs/iostreams/test/detail/null_padded_codecvt.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -132,7 +132,10 @@
     }
 
     std::codecvt_base::result
- do_unshift(state_type& state, char* first2, char* last2, char*& next2) const
+ do_unshift( state_type& state,
+ char* /* first2 */,
+ char* last2,
+ char*& next2 ) const
     {
         using namespace std;
         next2 = last2;
@@ -231,7 +234,10 @@
     }
 
     std::codecvt_base::result
- do_unshift(state_type&, char* first2, char* last2, char*& next2) const
+ do_unshift( state_type&,
+ char* /* first2 */,
+ char* /* last2 */,
+ char*& /* next2 */ ) const
     {
         return std::codecvt_base::ok;
     }

Modified: branches/release/libs/iostreams/test/detail/utf8_codecvt_facet.hpp
==============================================================================
--- branches/release/libs/iostreams/test/detail/utf8_codecvt_facet.hpp (original)
+++ branches/release/libs/iostreams/test/detail/utf8_codecvt_facet.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -52,6 +52,7 @@
 
 #include <locale>
 #include <cstddef> // size_t
+#include <wchar.h> // mbstate_t
 #include <boost/integer_traits.hpp>
 #include <boost/iostreams/detail/config/wide_streams.hpp>
 #include <boost/iostreams/detail/codecvt_helper.hpp>
@@ -110,7 +111,7 @@
     virtual std::codecvt_base::result do_unshift(
         std::mbstate_t&,
         char * from,
- char * to,
+ char * /* to */,
         char * & next
     ) const{
         next = from;

Modified: branches/release/libs/iostreams/test/detail/verification.hpp
==============================================================================
--- branches/release/libs/iostreams/test/detail/verification.hpp (original)
+++ branches/release/libs/iostreams/test/detail/verification.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -8,6 +8,7 @@
 #ifndef BOOST_IOSTREAMS_TEST_VERIFICATION_HPP_INCLUDED
 #define BOOST_IOSTREAMS_TEST_VERIFICATION_HPP_INCLUDED
 
+#include <iostream>
 #include <exception>
 #include <string>
 #include <string.h>
@@ -48,7 +49,7 @@
 BOOST_TEMPLATE_DECL
 bool compare_streams_in_chars(BOOST_ISTREAM& first, BOOST_ISTREAM& second)
 {
- for (int z = 0; z < 10; ++z)
+ for (int z = 0; z < data_reps; ++z)
         for (int w = 0; w < data_length(); ++w)
             if (first.eof() != second.eof() || first.get() != second.get())
                 return false;
@@ -137,7 +138,7 @@
     // Test seeking with ios::beg
     std::streamoff off = 0;
     io.seekp(0, BOOST_IOS::beg);
- for (i = 0; i < data_reps; ++i, off+= chunk_size) {
+ for (i = 0; i < data_reps; ++i, off += chunk_size) {
         int j;
         for (j = 0; j < chunk_size; ++j)
             io.put(narrow_data()[j]);
@@ -173,7 +174,7 @@
 {
     int i; // old 'for' scope workaround.
 
- // Test seeking with ios::cu
+ // Test seeking with ios::cur
     for (i = 0; i < data_reps; ++i) {
         io.write(narrow_data(), chunk_size);
         io.seekp(-chunk_size, BOOST_IOS::cur);
@@ -188,7 +189,7 @@
     // Test seeking with ios::beg
     std::streamoff off = 0;
     io.seekp(0, BOOST_IOS::beg);
- for (i = 0; i < data_reps; ++i) {
+ for (i = 0; i < data_reps; ++i, off += chunk_size) {
         io.write(narrow_data(), chunk_size);
         io.seekp(off, BOOST_IOS::beg);
         char buf[chunk_size];
@@ -203,7 +204,7 @@
     io.seekp(0, BOOST_IOS::end);
     off = io.tellp();
     io.seekp(-off, BOOST_IOS::end);
- for (i = 0; i < data_reps; ++i) {
+ for (i = 0; i < data_reps; ++i, off -= chunk_size) {
         io.write(narrow_data(), chunk_size);
         io.seekp(-off, BOOST_IOS::end);
         char buf[chunk_size];
@@ -216,6 +217,88 @@
     return true;
 }
 
+bool test_input_seekable(std::istream& io)
+{
+ int i; // old 'for' scope workaround.
+
+ // Test seeking with ios::cur
+ for (i = 0; i < data_reps; ++i) {
+ for (int j = 0; j < chunk_size; ++j)
+ if (io.get() != narrow_data()[j])
+ return false;
+ io.seekg(-chunk_size, BOOST_IOS::cur);
+ char buf[chunk_size];
+ io.read(buf, chunk_size);
+ if (strncmp(buf, narrow_data(), chunk_size) != 0)
+ return false;
+ }
+
+ // Test seeking with ios::beg
+ std::streamoff off = 0;
+ io.seekg(0, BOOST_IOS::beg);
+ for (i = 0; i < data_reps; ++i, off += chunk_size) {
+ for (int j = 0; j < chunk_size; ++j)
+ if (io.get() != narrow_data()[j])
+ return false;
+ io.seekg(off, BOOST_IOS::beg);
+ char buf[chunk_size];
+ io.read(buf, chunk_size);
+ if (strncmp(buf, narrow_data(), chunk_size) != 0)
+ return false;
+ }
+
+ // Test seeking with ios::end
+ io.seekg(0, BOOST_IOS::end);
+ off = io.tellg();
+ io.seekg(-off, BOOST_IOS::end);
+ for (i = 0; i < data_reps; ++i, off -= chunk_size) {
+ for (int j = 0; j < chunk_size; ++j)
+ if (io.get() != narrow_data()[j])
+ return false;
+ io.seekg(-off, BOOST_IOS::end);
+ char buf[chunk_size];
+ io.read(buf, chunk_size);
+ if (strncmp(buf, narrow_data(), chunk_size) != 0)
+ return false;
+ }
+ return true;
+}
+
+bool test_output_seekable(std::ostream& io)
+{
+ int i; // old 'for' scope workaround.
+
+ // Test seeking with ios::cur
+ for (i = 0; i < data_reps; ++i) {
+ for (int j = 0; j < chunk_size; ++j)
+ io.put(narrow_data()[j]);
+ io.seekp(-chunk_size, BOOST_IOS::cur);
+ io.write(narrow_data(), chunk_size);
+ }
+
+ // Test seeking with ios::beg
+ std::streamoff off = 0;
+ io.seekp(0, BOOST_IOS::beg);
+ for (i = 0; i < data_reps; ++i, off += chunk_size) {
+ for (int j = 0; j < chunk_size; ++j)
+ io.put(narrow_data()[j]);
+ io.seekp(off, BOOST_IOS::beg);
+ io.write(narrow_data(), chunk_size);
+ }
+
+ // Test seeking with ios::end
+ io.seekp(0, BOOST_IOS::end);
+ off = io.tellp();
+ io.seekp(-off, BOOST_IOS::end);
+ for (i = 0; i < data_reps; ++i, off -= chunk_size) {
+ for (int j = 0; j < chunk_size; ++j)
+ io.put(narrow_data()[j]);
+ io.seekp(-off, BOOST_IOS::end);
+ io.write(narrow_data(), chunk_size);
+ }
+ return true;
+}
+
 } } } // End namespaces test, iostreams, boost.
 
 #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)

Modified: branches/release/libs/iostreams/test/example_test.cpp
==============================================================================
--- branches/release/libs/iostreams/test/example_test.cpp (original)
+++ branches/release/libs/iostreams/test/example_test.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -39,23 +39,23 @@
     typedef ex::container_device<vector_type> vector_device;
 
     {
- test_sequence<> seq;
- test_file file;
+ test_sequence<> seq;
+ test_file file;
         io::stream<vector_source> first(seq);
         io::stream<io::file_source> second(file.name(), in_mode);
         BOOST_CHECK(compare_streams_in_chunks(first, second));
     }
 
     {
- std::vector<char> first;
- test_sequence<> second;
- io::stream<vector_sink> out(first);
+ std::vector<char> first;
+ test_sequence<> second;
+ io::stream<vector_sink> out(first);
         write_data_in_chunks(out);
         BOOST_CHECK(first == second);
     }
 
     {
- vector<char> v;
+ vector<char> v;
         io::stream<vector_device> io(v);
         BOOST_CHECK(test_seekable_in_chunks(io));
     }

Modified: branches/release/libs/iostreams/test/file_descriptor_test.cpp
==============================================================================
--- branches/release/libs/iostreams/test/file_descriptor_test.cpp (original)
+++ branches/release/libs/iostreams/test/file_descriptor_test.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -142,6 +142,30 @@
         BOOST_CHECK(!file.is_open());
     }
 
+ //--Test seeking with file_descriptor_source and file_descriptor_sink-----//
+
+ {
+ file_descriptor_sink sink(test1.name());
+ fdostream out(sink);
+ BOOST_CHECK(out->is_open());
+ BOOST_CHECK_MESSAGE(
+ test_output_seekable(out),
+ "failed seeking within a file_descriptor_sink"
+ );
+ out->close();
+ BOOST_CHECK(!out->is_open());
+
+ file_descriptor_source source(test1.name());
+ fdistream in(source);
+ BOOST_CHECK(in->is_open());
+ BOOST_CHECK_MESSAGE(
+ test_input_seekable(in),
+ "failed seeking within a file_descriptor_source"
+ );
+ in->close();
+ BOOST_CHECK(!in->is_open());
+ }
+
     //--------------Test file_descriptor--------------------------------------//
 
     {

Modified: branches/release/libs/iostreams/test/filtering_stream_test.cpp
==============================================================================
--- branches/release/libs/iostreams/test/filtering_stream_test.cpp (original)
+++ branches/release/libs/iostreams/test/filtering_stream_test.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -8,17 +8,13 @@
 #include "read_input_test.hpp"
 #include "read_bidir_test.hpp"
 #include "read_seekable_test.hpp"
-#include "read_input_seq_test.hpp"
 #include "read_bidir_streambuf_test.hpp"
-#include "read_seekable_seq_test.hpp"
 #include "read_input_istream_test.hpp"
 #include "write_output_test.hpp"
 #include "write_bidir_test.hpp"
 #include "write_seekable_test.hpp"
 #include "write_output_iterator_test.hpp"
-#include "write_output_seq_test.hpp"
 #include "write_bidir_streambuf_test.hpp"
-#include "write_seekable_seq_test.hpp"
 #include "write_output_ostream_test.hpp"
 #include "read_input_filter_test.hpp"
 #include "read_bidir_filter_test.hpp"
@@ -31,21 +27,17 @@
 
 test_suite* init_unit_test_suite(int, char* [])
 {
- test_suite* test = BOOST_TEST_SUITE("filtering_streambuf test");
+ test_suite* test = BOOST_TEST_SUITE("filtering_stream test");
     test->add(BOOST_TEST_CASE(&read_input_test));
     test->add(BOOST_TEST_CASE(&read_bidirectional_test));
     test->add(BOOST_TEST_CASE(&read_seekable_test));
- test->add(BOOST_TEST_CASE(&read_input_sequence_test));
     test->add(BOOST_TEST_CASE(&read_bidirectional_streambuf_test));
- test->add(BOOST_TEST_CASE(&read_seekable_sequence_test));
     test->add(BOOST_TEST_CASE(&read_input_istream_test));
     test->add(BOOST_TEST_CASE(&write_output_test));
     test->add(BOOST_TEST_CASE(&write_bidirectional_test));
     test->add(BOOST_TEST_CASE(&write_seekable_test));
     test->add(BOOST_TEST_CASE(&write_output_iterator_test));
- test->add(BOOST_TEST_CASE(&write_output_sequence_test));
     test->add(BOOST_TEST_CASE(&write_bidirectional_streambuf_test));
- test->add(BOOST_TEST_CASE(&write_seekable_sequence_test));
     test->add(BOOST_TEST_CASE(&write_output_ostream_test));
     test->add(BOOST_TEST_CASE(&read_input_filter_test));
     test->add(BOOST_TEST_CASE(&read_bidirectional_filter_test));

Deleted: branches/release/libs/iostreams/test/offset_test.cpp
==============================================================================
--- branches/release/libs/iostreams/test/offset_test.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
+++ (empty file)
@@ -1,334 +0,0 @@
-// (C) Copyright Jonathan Turkanis 2004
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
-
-// See http://www.boost.org/libs/iostreams for documentation.
-
-// Todo: add tests for direct devices.
-
-#include <algorithm> // equal.
-#include <cctype>
-#include <iterator> // back_inserter.
-#include <vector>
-#include <boost/iostreams/copy.hpp>
-#include <boost/iostreams/device/file.hpp>
-#include <boost/iostreams/device/null.hpp>
-#include <boost/iostreams/filtering_stream.hpp>
-#include <boost/iostreams/offset.hpp>
-#include <boost/range/iterator_range.hpp>
-#include <boost/test/test_tools.hpp>
-#include <boost/test/unit_test.hpp>
-#include "detail/constants.hpp"
-#include "detail/filters.hpp"
-#include "detail/sequence.hpp"
-#include "detail/temp_file.hpp"
-#include "detail/verification.hpp"
-
-using namespace std;
-using namespace boost;
-using namespace boost::iostreams;
-using namespace boost::iostreams::test;
-using boost::unit_test::test_suite;
-
-const char pad_char = '\n';
-const small_padding = 50;
-const large_padding = default_device_buffer_size + 50;
-
-void write_padding(std::ofstream& out, int len)
-{
- for (int z = 0; z < len; ++z)
- out.put(pad_char);
-}
-
-struct offset_test_file : public temp_file {
- offset_test_file(int padding)
- {
- BOOST_IOS::openmode mode =
- BOOST_IOS::out | BOOST_IOS::binary;
- ::std::ofstream f(name().c_str(), mode);
- write_padding(f, padding);
- const char* buf = narrow_data();
- for (int z = 0; z < data_reps; ++z)
- f.write(buf, data_length());
- write_padding(f, padding);
- }
-};
-
-struct offset_test_sequence : public std::vector<char> {
- offset_test_sequence(int padding)
- {
- for (int z = 0; z < padding; ++z)
- push_back(pad_char);
- const char* buf = narrow_data();
- for (int z = 0; z < data_reps; ++z)
- insert(end(), buf, buf + data_length());
- for (int z = 0; z < padding; ++z)
- push_back(pad_char);
- }
-};
-
-struct offset_uppercase_file : public temp_file {
- offset_uppercase_file(int padding)
- {
- BOOST_IOS::openmode mode =
- BOOST_IOS::out | BOOST_IOS::binary;
- ::std::ofstream f(name().c_str(), mode);
- write_padding(f, padding);
- const char* buf = narrow_data();
- for (int z = 0; z < data_reps; ++z)
- for (int w = 0; w < data_length(); ++w)
- f.put((char) std::toupper(buf[w]));
- write_padding(f, padding);
- }
-};
-
-struct offset_lowercase_file : public temp_file {
- offset_lowercase_file(int padding)
- {
- BOOST_IOS::openmode mode =
- BOOST_IOS::out | BOOST_IOS::binary;
- ::std::ofstream f(name().c_str(), mode);
- write_padding(f, padding);
- const char* buf = narrow_data();
- for (int z = 0; z < data_reps; ++z)
- for (int w = 0; w < data_length(); ++w)
- f.put((char) std::tolower(buf[w]));
- write_padding(f, padding);
- }
-};
-
-// Can't have an offset view of a non-seekble output filter.
-struct tolower_seekable_filter : public seekable_filter {
- typedef char char_type;
- struct category
- : output_seekable,
- filter_tag
- { };
- template<typename Sink>
- bool put(Sink& s, char c)
- { return boost::iostreams::put(s, (char) std::tolower(c)); }
-
- template<typename Sink>
- std::streampos seek(Sink& s, stream_offset off, BOOST_IOS::seekdir way)
- { return boost::iostreams::seek(s, off, way); }
-};
-
-void read_device()
-{
- {
- offset_test_file src1(small_padding);
- test_file src2;
- stream_offset off = small_padding,
- len = data_reps * data_length();
- filtering_istream first(offset(file_source(src1.name(), in_mode), off, len));
- ifstream second(src2.name().c_str(), in_mode);
- BOOST_CHECK_MESSAGE(
- compare_streams_in_chunks(first, second),
- "failed reading from offset_view<Device> with small padding"
- );
- }
-
- {
- offset_test_file src1(large_padding);
- test_file src2;
- stream_offset off = large_padding,
- len = data_reps * data_length();
- filtering_istream first(offset(file_source(src1.name(), in_mode), off, len));
- ifstream second(src2.name().c_str(), in_mode);
- BOOST_CHECK_MESSAGE(
- compare_streams_in_chunks(first, second),
- "failed reading from offset_view<Device> with large padding"
- );
- }
-}
-
-void read_direct_device()
-{
-
- test_sequence<char> first;
- offset_test_sequence src(small_padding);
- array_source array_src(&src[0], &src[0] + src.size());
- stream_offset off = small_padding,
- len = data_reps * data_length();
- filtering_istream second(offset(array_src, off, len));
- BOOST_CHECK_MESSAGE(
- compare_container_and_stream(first, second),
- "failed reading from offset_view<DirectDevice>"
- );
-}
-
-void read_filter()
-{
- {
- offset_test_file src1(small_padding);
- uppercase_file src2;
- stream_offset off = small_padding,
- len = data_reps * data_length();
- filtering_istream first;
- first.push(offset(toupper_filter(), off, len));
- first.push(file_source(src1.name(), in_mode));
- ifstream second(src2.name().c_str(), in_mode);
- BOOST_CHECK_MESSAGE(
- compare_streams_in_chunks(first, second),
- "failed reading from an offset_view<Filter> with small padding"
- );
- }
-
- {
- offset_test_file src1(large_padding);
- uppercase_file src2;
- stream_offset off = large_padding,
- len = data_reps * data_length();
- filtering_istream first;
- first.push(offset(toupper_filter(), off, len));
- first.push(file_source(src1.name(), in_mode));
- ifstream second(src2.name().c_str(), in_mode);
- BOOST_CHECK_MESSAGE(
- compare_streams_in_chunks(first, second),
- "failed reading from offset_view<Filter> with large padding"
- );
- }
-}
-
-void write_device()
-{
- {
- offset_uppercase_file dest1(small_padding);
- offset_test_file dest2(small_padding);
- stream_offset off = small_padding,
- len = data_reps * data_length();
- filtering_ostream out(offset(file(dest1.name(), BOOST_IOS::binary), off, len));
- write_data_in_chunks(out);
- out.reset();
- ifstream first(dest1.name().c_str(), in_mode);
- ifstream second(dest2.name().c_str(), in_mode);
- BOOST_CHECK_MESSAGE(
- compare_streams_in_chunks(first, second),
- "failed writing to an offset_view<Device> with small padding"
- );
- }
-
- {
- offset_uppercase_file dest1(large_padding);
- offset_test_file dest2(large_padding);
- stream_offset off = large_padding,
- len = data_reps * data_length();
- filtering_ostream out(offset(file(dest1.name(), BOOST_IOS::binary), off, len));
- write_data_in_chunks(out);
- out.reset();
- ifstream first(dest1.name().c_str(), in_mode);
- ifstream second(dest2.name().c_str(), in_mode);
- BOOST_CHECK_MESSAGE(
- compare_streams_in_chunks(first, second),
- "failed writing to offset_view<Device> with large padding"
- );
- }
-}
-
-void write_direct_device()
-{
- vector<char> dest1(data_reps * data_length() + 2 * small_padding, '\n');
- offset_test_sequence dest2(small_padding);
- stream_offset off = small_padding,
- len = data_reps * data_length();
- array_sink array(&dest1[0], &dest1[0] + dest1.size());
- filtering_ostream out(offset(array, off, len));
- write_data_in_chunks(out);
- out.reset();
- BOOST_CHECK_MESSAGE(
- std::equal(dest1.begin(), dest1.end(), dest2.begin()),
- "failed writing to offset_view<DirectDevice>"
- );
-}
-
-void write_filter()
-{
- {
- offset_test_file dest1(small_padding);
- offset_lowercase_file dest2(small_padding);
- stream_offset off = small_padding,
- len = data_reps * data_length();
- filtering_ostream out;
- out.push(offset(tolower_seekable_filter(), off, len));
- out.push(file(dest1.name(), BOOST_IOS::binary));
- write_data_in_chunks(out);
- out.reset();
- ifstream first(dest1.name().c_str(), in_mode);
- ifstream second(dest2.name().c_str(), in_mode);
- BOOST_CHECK_MESSAGE(
- compare_streams_in_chunks(first, second),
- "failed writing to offset_view<Filter> with small padding"
- );
- }
-
- {
- offset_test_file dest1(large_padding);
- offset_lowercase_file dest2(large_padding);
- stream_offset off = large_padding,
- len = data_reps * data_length();
- filtering_ostream out;
- out.push(offset(tolower_seekable_filter(), off, len));
- out.push(file(dest1.name(), BOOST_IOS::binary));
- write_data_in_chunks(out);
- out.reset();
- ifstream first(dest1.name().c_str(), in_mode);
- ifstream second(dest2.name().c_str(), in_mode);
- BOOST_CHECK_MESSAGE(
- compare_streams_in_chunks(first, second),
- "failed writing to offset_view<Filter> with large padding"
- );
- }
-}
-
-void seek_device()
-{
- offset_test_file src(small_padding);
- stream_offset off = large_padding,
- len = data_reps * data_length();
- filtering_stream<seekable> io(offset(file(src.name(), BOOST_IOS::binary), off, len));
- BOOST_CHECK_MESSAGE(
- test_seekable_in_chars(io),
- "failed seeking within offset_view<Device>"
- );
-}
-
-void seek_direct_device()
-{
- vector<char> src(data_reps * data_length() + 2 * small_padding, '\n');
- stream_offset off = small_padding,
- len = data_reps * data_length();
- array ar(&src[0], &src[0] + src.size());
- filtering_stream<seekable> io(offset(ar, off, len));
- BOOST_CHECK_MESSAGE(
- test_seekable_in_chars(io),
- "failed seeking within offset_view<DirectDevice> with small padding"
- );
-}
-
-void seek_filter()
-{
- offset_test_file src(small_padding);
- stream_offset off = large_padding,
- len = data_reps * data_length();
- filtering_stream<seekable> io;
- io.push(offset(identity_seekable_filter(), off, len));
- io.push(file(src.name(), BOOST_IOS::binary));
- BOOST_CHECK_MESSAGE(
- test_seekable_in_chars(io),
- "failed seeking within offset_view<Device>"
- );
-}
-
-test_suite* init_unit_test_suite(int, char* [])
-{
- test_suite* test = BOOST_TEST_SUITE("offset test");
- test->add(BOOST_TEST_CASE(&read_device));
- test->add(BOOST_TEST_CASE(&read_direct_device));
- test->add(BOOST_TEST_CASE(&read_filter));
- test->add(BOOST_TEST_CASE(&write_device));
- test->add(BOOST_TEST_CASE(&write_direct_device));
- test->add(BOOST_TEST_CASE(&write_filter));
- test->add(BOOST_TEST_CASE(&seek_device));
- test->add(BOOST_TEST_CASE(&seek_direct_device));
- return test;
-}

Deleted: branches/release/libs/iostreams/test/positioning_test.cpp
==============================================================================
--- branches/release/libs/iostreams/test/positioning_test.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
+++ (empty file)
@@ -1,68 +0,0 @@
-// (C) Copyright Jonathan Turkanis 2005
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
-
-// See http://www.boost.org/libs/iostreams for documentation.
-
-#include <boost/iostreams/detail/ios.hpp>
-#include <boost/iostreams/positioning.hpp>
-#include <boost/integer_traits.hpp>
-#include <boost/test/test_tools.hpp>
-#include <boost/test/unit_test.hpp>
-
-#include <iostream>
-
-using namespace std;
-using namespace boost;
-using namespace boost::iostreams;
-using boost::unit_test::test_suite;
-
-//void extrema_test_test()
-//{
-// stream_offset minoff = integer_traits<stream_offset>::const_min;
-// stream_offset maxoff = integer_traits<stream_offset>::const_max;
-//
-// BOOST_CHECK(minoff == position_to_offset(offset_to_position(minoff)));
-// BOOST_CHECK(0 == position_to_offset(offset_to_position(0)));
-// BOOST_CHECK(maxoff == position_to_offset(offset_to_position(maxoff)));
-//}
-
-void large_file_test()
-{
- stream_offset large_file = 100 * 1024 * 1024 * 1024; // 100GB.
- stream_offset first = -large_file - (-large_file) % 10000000;
- stream_offset last = large_file - large_file % 10000000;
-
- for (stream_offset off = first; off < last; off += 10000000)
- {
- BOOST_CHECK(off == position_to_offset(offset_to_position(off)));
- }
-}
-
-void small_file_test()
-{
- stream_offset small_file = 1000000;
- stream_offset off = -small_file;
- streampos pos = offset_to_position(off);
-
- while (off < small_file)
- {
- BOOST_CHECK(off == position_to_offset(offset_to_position(off)));
- BOOST_CHECK(pos == offset_to_position(position_to_offset(pos)));
- off += 20000;
- pos += 20000;
- BOOST_CHECK(off == position_to_offset(offset_to_position(off)));
- BOOST_CHECK(pos == offset_to_position(position_to_offset(pos)));
- off -= 10000;
- pos -= 10000;
- }
-}
-
-test_suite* init_unit_test_suite(int, char* [])
-{
- test_suite* test = BOOST_TEST_SUITE("positioning test");
- //test->add(BOOST_TEST_CASE(&extrema_test_test));
- test->add(BOOST_TEST_CASE(&large_file_test));
- test->add(BOOST_TEST_CASE(&small_file_test));
- return test;
-}

Modified: branches/release/libs/iostreams/test/seek_test.hpp
==============================================================================
--- branches/release/libs/iostreams/test/seek_test.hpp (original)
+++ branches/release/libs/iostreams/test/seek_test.hpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -7,22 +7,29 @@
 #ifndef BOOST_IOSTREAMS_TEST_SEEK_HPP_INCLUDED
 #define BOOST_IOSTREAMS_TEST_SEEK_HPP_INCLUDED
 
+
+#include <boost/config.hpp> // BOOST_MSVC, make sure size_t is in std.
+#include <cstddef> // std::size_t.
 #include <string>
+#include <boost/iostreams/device/array.hpp>
 #include <boost/iostreams/filtering_stream.hpp>
-#include <boost/range/iterator_range.hpp>
 #include <boost/test/test_tools.hpp>
-#include "detail/verification.hpp"
+#include "../example/container_device.hpp" // We use container_device instead
+#include "detail/verification.hpp" // of make_iterator_range to
+ // reduce dependence on Boost.Range
 
 void seek_test()
 {
     using namespace std;
     using namespace boost;
     using namespace boost::iostreams;
+ using namespace boost::iostreams::example;
     using namespace boost::iostreams::test;
 
     {
         string test(data_reps * data_length(), '\0');
- filtering_stream<seekable> io(make_iterator_range(test));
+ filtering_stream<seekable> io;
+ io.push(container_device<string>(test));
         BOOST_CHECK_MESSAGE(
             test_seekable_in_chars(io),
             "failed seeking within a filtering_stream<seekable>, in chars"
@@ -31,7 +38,8 @@
 
     {
         string test(data_reps * data_length(), '\0');
- filtering_stream<seekable> io(make_iterator_range(test));
+ filtering_stream<seekable> io;
+ io.push(container_device<string>(test));
         BOOST_CHECK_MESSAGE(
             test_seekable_in_chunks(io),
             "failed seeking within a filtering_stream<seekable>, in chunks"

Modified: branches/release/libs/iostreams/test/seekable_filter_test.cpp
==============================================================================
--- branches/release/libs/iostreams/test/seekable_filter_test.cpp (original)
+++ branches/release/libs/iostreams/test/seekable_filter_test.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -10,16 +10,18 @@
 #include <boost/iostreams/device/array.hpp>
 #include <boost/iostreams/device/array.hpp>
 #include <boost/iostreams/filtering_stream.hpp>
-#include <boost/range/iterator_range.hpp>
 #include <boost/test/test_tools.hpp>
 #include <boost/test/unit_test.hpp>
-#include "detail/filters.hpp"
-#include "detail/temp_file.hpp"
-#include "detail/verification.hpp"
+#include "../example/container_device.hpp" // We use container_device instead
+#include "detail/filters.hpp" // of make_iterator_range to
+#include "detail/temp_file.hpp" // reduce dependence on Boost.Range
+#include "detail/verification.hpp"
+
 
 using namespace std;
 using namespace boost;
 using namespace boost::iostreams;
+using namespace boost::iostreams::example;
 using namespace boost::iostreams::test;
 using boost::unit_test::test_suite;
 
@@ -35,7 +37,7 @@
         vector<char> test(data_reps * data_length(), '0');
         filtering_stream<seekable> io;
         io.push(identity_seekable_filter());
- io.push(make_iterator_range(test));
+ io.push(container_device< vector<char> >(test));
         io.exceptions(BOOST_IOS::failbit | BOOST_IOS::badbit);
         BOOST_CHECK_MESSAGE(
             test_seekable_in_chars(io),
@@ -47,7 +49,7 @@
         vector<char> test(data_reps * data_length(), '0');
         filtering_stream<seekable> io;
         io.push(identity_seekable_filter());
- io.push(make_iterator_range(test));
+ io.push(container_device< vector<char> >(test));
         io.exceptions(BOOST_IOS::failbit | BOOST_IOS::badbit);
         BOOST_CHECK_MESSAGE(
             test_seekable_in_chunks(io),
@@ -59,7 +61,7 @@
         vector<char> test(data_reps * data_length(), '0');
         filtering_stream<seekable> io;
         io.push(identity_seekable_multichar_filter());
- io.push(make_iterator_range(test));
+ io.push(container_device< vector<char> >(test));
         io.exceptions(BOOST_IOS::failbit | BOOST_IOS::badbit);
         BOOST_CHECK_MESSAGE(
             test_seekable_in_chars(io),
@@ -71,7 +73,7 @@
         vector<char> test(data_reps * data_length(), '0');
         filtering_stream<seekable> io;
         io.push(identity_seekable_multichar_filter());
- io.push(make_iterator_range(test));
+ io.push(container_device< vector<char> >(test));
         io.exceptions(BOOST_IOS::failbit | BOOST_IOS::badbit);
         BOOST_CHECK_MESSAGE(
             test_seekable_in_chunks(io),

Modified: branches/release/libs/iostreams/test/symmetric_filter_test.cpp
==============================================================================
--- branches/release/libs/iostreams/test/symmetric_filter_test.cpp (original)
+++ branches/release/libs/iostreams/test/symmetric_filter_test.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -29,7 +29,7 @@
                 std::streamsize buffer_size =
                     default_filter_buffer_size
              )
- : buf_(default_filter_buffer_size)
+ : buf_(buffer_size)
     {
         buf_.set(0, 0);
     }

Modified: branches/release/libs/iostreams/test/wide_stream_test.cpp
==============================================================================
--- branches/release/libs/iostreams/test/wide_stream_test.cpp (original)
+++ branches/release/libs/iostreams/test/wide_stream_test.cpp 2008-01-06 02:36:59 EST (Sun, 06 Jan 2008)
@@ -13,11 +13,11 @@
 #include <vector>
 #include <boost/iostreams/device/back_inserter.hpp>
 #include <boost/iostreams/filtering_stream.hpp>
-#include <boost/range/iterator_range.hpp>
-#include "detail/filters.hpp"
 #include <boost/test/test_tools.hpp>
 #include <boost/test/unit_test.hpp>
-#include "detail/sequence.hpp"
+#include "../example/container_device.hpp" // We use container_device instead
+#include "detail/filters.hpp" // of make_iterator_range to
+#include "detail/sequence.hpp" // reduce dependence on Boost.Range
 #include "detail/temp_file.hpp"
 #include "detail/verification.hpp"
 
@@ -28,12 +28,14 @@
     using namespace std;
     using namespace boost;
     using namespace boost::iostreams;
+ using namespace boost::iostreams::example;
     using namespace boost::iostreams::test;
 
- test_sequence<wchar_t> seq;
+ test_sequence<wchar_t> seq;
+ container_device< test_sequence<wchar_t> > source(seq);
 
     {
- filtering_wistream first(make_iterator_range(seq), 0);
+ filtering_wistream first(source, 0);
         basic_istringstream<wchar_t> second(
             basic_string<wchar_t>(seq.begin(), seq.end())
         );
@@ -44,7 +46,7 @@
     }
 
     {
- filtering_wistream first(make_iterator_range(seq), 0);
+ filtering_wistream first(source, 0);
         basic_istringstream<wchar_t> second(
             basic_string<wchar_t>(seq.begin(), seq.end())
         );
@@ -55,7 +57,7 @@
     }
 
     {
- filtering_wistream first(make_iterator_range(seq));
+ filtering_wistream first(source);
         basic_istringstream<wchar_t> second(
             basic_string<wchar_t>(seq.begin(), seq.end())
         );
@@ -66,7 +68,7 @@
     }
 
     {
- filtering_wistream first(make_iterator_range(seq));
+ filtering_wistream first(source);
         basic_istringstream<wchar_t> second(
             basic_string<wchar_t>(seq.begin(), seq.end())
         );


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