Boost logo

Boost-Commit :

From: technews_at_[hidden]
Date: 2007-12-26 00:45:19


Author: turkanis
Date: 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
New Revision: 42307
URL: http://svn.boost.org/trac/boost/changeset/42307

Log:
ported changes from branches/iostreams_dev revisions 42265-42306
Removed:
   trunk/libs/iostreams/test/offset_test.cpp
   trunk/libs/iostreams/test/positioning_test.cpp
Text files modified:
   trunk/boost/iostreams/code_converter.hpp | 2
   trunk/boost/iostreams/compose.hpp | 5 +
   trunk/boost/iostreams/copy.hpp | 56 +++++++++------
   trunk/boost/iostreams/detail/adapter/concept_adapter.hpp | 3
   trunk/boost/iostreams/detail/adapter/non_blocking_adapter.hpp | 1
   trunk/boost/iostreams/detail/codecvt_holder.hpp | 2
   trunk/boost/iostreams/detail/config/disable_warnings.hpp | 6 +
   trunk/boost/iostreams/detail/functional.hpp | 104 ++++++++++++++++++-----------
   trunk/boost/iostreams/device/file_descriptor.hpp | 14 +++
   trunk/boost/iostreams/device/mapped_file.hpp | 16 +++
   trunk/boost/iostreams/filter/regex.hpp | 2
   trunk/boost/iostreams/filter/stdio.hpp | 5
   trunk/boost/iostreams/filter/symmetric.hpp | 2
   trunk/boost/iostreams/filter/test.hpp | 1
   trunk/boost/iostreams/pipeline.hpp | 2
   trunk/boost/iostreams/read.hpp | 2
   trunk/boost/iostreams/restrict.hpp | 39 +++++++++--
   trunk/boost/iostreams/skip.hpp | 49 ++++++++++---
   trunk/libs/iostreams/doc/tutorial/container_device.html | 4
   trunk/libs/iostreams/example/container_device.hpp | 6 +
   trunk/libs/iostreams/src/bzip2.cpp | 4
   trunk/libs/iostreams/src/file_descriptor.cpp | 9 ++
   trunk/libs/iostreams/src/zlib.cpp | 2
   trunk/libs/iostreams/test/Jamfile.v2 | 4
   trunk/libs/iostreams/test/close_test.cpp | 61 -----------------
   trunk/libs/iostreams/test/copy_test.cpp | 137 +++++++++++++++++++++++++++++++--------
   trunk/libs/iostreams/test/detail/closable.hpp | 8 +-
   trunk/libs/iostreams/test/detail/filters.hpp | 2
   trunk/libs/iostreams/test/detail/null_padded_codecvt.hpp | 10 ++
   trunk/libs/iostreams/test/detail/operation_sequence.hpp | 1
   trunk/libs/iostreams/test/detail/utf8_codecvt_facet.hpp | 2
   trunk/libs/iostreams/test/detail/verification.hpp | 91 +++++++++++++++++++++++++-
   trunk/libs/iostreams/test/execute_test.cpp | 50 +++++++++-----
   trunk/libs/iostreams/test/file_descriptor_test.cpp | 24 +++++++
   trunk/libs/iostreams/test/operation_sequence_test.cpp | 2
   trunk/libs/iostreams/test/stream_state_test.cpp | 6
   trunk/libs/iostreams/test/symmetric_filter_test.cpp | 2
   37 files changed, 508 insertions(+), 228 deletions(-)

Modified: trunk/boost/iostreams/code_converter.hpp
==============================================================================
--- trunk/boost/iostreams/code_converter.hpp (original)
+++ trunk/boost/iostreams/code_converter.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -37,10 +37,10 @@
 #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>

Modified: trunk/boost/iostreams/compose.hpp
==============================================================================
--- trunk/boost/iostreams/compose.hpp (original)
+++ trunk/boost/iostreams/compose.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -29,6 +29,9 @@
 #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 {
@@ -421,4 +424,6 @@
 
 } } // End namespaces iostreams, boost.
 
+#include <boost/iostreams/detail/config/enable_warnings.hpp>
+
 #endif // #ifndef BOOST_IOSTREAMS_COMPOSE_HPP_INCLUDED

Modified: trunk/boost/iostreams/copy.hpp
==============================================================================
--- trunk/boost/iostreams/copy.hpp (original)
+++ trunk/boost/iostreams/copy.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -18,7 +18,9 @@
 # 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>
@@ -57,12 +59,12 @@
     typedef 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");
- }
+ streamsize total =
+ static_cast<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
@@ -83,7 +85,7 @@
             iostreams::write(snk, p.first + total, size - total);
         total += amt;
     }
- return size;
+ return total;
 }
 
 // Copy from an indirect source to a direct sink
@@ -98,23 +100,28 @@
     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;
+ ptrdiff_t capacity = p.second - p.first;
+ while (true) {
+ 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 a direct sink
+// 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_ )
-{ // 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);
@@ -138,19 +145,22 @@
 // Function object that delegates to one of the above four
 // overloads of compl_impl()
 template<typename Source, typename Sink>
-struct copy_operation {
+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)
+ : src_(src), snk_(snk), buffer_size_(buffer_size)
         { }
     std::streamsize operator()()
     {
- return copy_impl( src, snk, buffer_size,
+ return copy_impl( src_, snk_, buffer_size_,
                           is_direct<Source>(), is_direct<Sink>() );
     }
- Source& src;
- Sink& snk;
- std::streamsize buffer_size;
+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
@@ -218,7 +228,7 @@
 {
     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

Modified: trunk/boost/iostreams/detail/adapter/concept_adapter.hpp
==============================================================================
--- trunk/boost/iostreams/detail/adapter/concept_adapter.hpp (original)
+++ trunk/boost/iostreams/detail/adapter/concept_adapter.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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: trunk/boost/iostreams/detail/adapter/non_blocking_adapter.hpp
==============================================================================
--- trunk/boost/iostreams/detail/adapter/non_blocking_adapter.hpp (original)
+++ trunk/boost/iostreams/detail/adapter/non_blocking_adapter.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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: trunk/boost/iostreams/detail/codecvt_holder.hpp
==============================================================================
--- trunk/boost/iostreams/detail/codecvt_holder.hpp (original)
+++ trunk/boost/iostreams/detail/codecvt_holder.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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: trunk/boost/iostreams/detail/config/disable_warnings.hpp
==============================================================================
--- trunk/boost/iostreams/detail/config/disable_warnings.hpp (original)
+++ trunk/boost/iostreams/detail/config/disable_warnings.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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: trunk/boost/iostreams/detail/functional.hpp
==============================================================================
--- trunk/boost/iostreams/detail/functional.hpp (original)
+++ trunk/boost/iostreams/detail/functional.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -29,26 +29,32 @@
     // boost::iostreams::close
 
 template<typename T>
-struct device_close_operation {
+class device_close_operation {
+public:
     typedef void result_type;
     device_close_operation(T& t, BOOST_IOS::openmode which)
- : t(t), which(which)
+ : t_(t), which_(which)
         { }
- void operator()() const { boost::iostreams::close(t, which); }
- T& t;
- BOOST_IOS::openmode which;
+ void operator()() const { boost::iostreams::close(t_, which_); }
+private:
+ device_close_operation& operator=(const device_close_operation&);
+ T& t_;
+ BOOST_IOS::openmode which_;
 };
 
 template<typename T, typename Sink>
-struct filter_close_operation {
+class filter_close_operation {
+public:
     typedef void result_type;
     filter_close_operation(T& t, Sink& snk, BOOST_IOS::openmode which)
- : t(t), snk(snk), which(which)
+ : t_(t), snk_(snk), which_(which)
         { }
- void operator()() const { boost::iostreams::close(t, snk, which); }
- T& t;
- Sink& snk;
- BOOST_IOS::openmode which;
+ void operator()() const { boost::iostreams::close(t_, snk_, which_); }
+private:
+ filter_close_operation& operator=(const filter_close_operation&);
+ T& t_;
+ Sink& snk_;
+ BOOST_IOS::openmode which_;
 };
 
 template<typename T>
@@ -65,20 +71,26 @@
     // boost::iostreams::detail::close_all
 
 template<typename T>
-struct device_close_all_operation {
+class device_close_all_operation {
+public:
     typedef void result_type;
- device_close_all_operation(T& t) : t(t) { }
- void operator()() const { detail::close_all(t); }
- T& t;
+ device_close_all_operation(T& t) : t_(t) { }
+ void operator()() const { detail::close_all(t_); }
+private:
+ device_close_all_operation& operator=(const device_close_all_operation&);
+ T& t_;
 };
 
 template<typename T, typename Sink>
-struct filter_close_all_operation {
+class filter_close_all_operation {
+public:
     typedef void result_type;
- filter_close_all_operation(T& t, Sink& snk) : t(t), snk(snk) { }
- void operator()() const { detail::close_all(t, snk); }
- T& t;
- Sink& snk;
+ filter_close_all_operation(T& t, Sink& snk) : t_(t), snk_(snk) { }
+ void operator()() const { detail::close_all(t_, snk_); }
+private:
+ filter_close_all_operation& operator=(const filter_close_all_operation&);
+ T& t_;
+ Sink& snk_;
 };
 
 template<typename T>
@@ -94,14 +106,17 @@
     // member function void close(std::ios_base::openmode)
 
 template<typename T>
-struct member_close_operation {
+class member_close_operation {
+public:
     typedef void result_type;
     member_close_operation(T& t, BOOST_IOS::openmode which)
- : t(t), which(which)
+ : t_(t), which_(which)
         { }
- void operator()() const { t.close(which); }
- T& t;
- BOOST_IOS::openmode which;
+ void operator()() const { t_.close(which_); }
+private:
+ member_close_operation& operator=(const member_close_operation&);
+ T& t_;
+ BOOST_IOS::openmode which_;
 };
 
 template<typename T>
@@ -112,10 +127,13 @@
     // member function void reset()
 
 template<typename T>
-struct reset_operation {
- reset_operation(T& t) : t(t) { }
- void operator()() const { t.reset(); }
- T& t;
+class reset_operation {
+public:
+ reset_operation(T& t) : t_(t) { }
+ void operator()() const { t_.reset(); }
+private:
+ reset_operation& operator=(const reset_operation&);
+ T& t_;
 };
 
 template<typename T>
@@ -124,11 +142,14 @@
     // Function object and object generator for clearing a flag
 
 template<typename T>
-struct clear_flags_operation {
+class clear_flags_operation {
+public:
     typedef void result_type;
- clear_flags_operation(T& t) : t(t) { }
- void operator()() const { t = 0; }
- T& t;
+ clear_flags_operation(T& t) : t_(t) { }
+ void operator()() const { t_ = 0; }
+private:
+ clear_flags_operation& operator=(const clear_flags_operation&);
+ T& t_;
 };
 
 template<typename T>
@@ -139,19 +160,22 @@
 
 // Function object for use with execute_all()
 template<typename Buffer, typename Device>
-struct flush_buffer_operation {
+class flush_buffer_operation {
+public:
     typedef void result_type;
     flush_buffer_operation(Buffer& buf, Device& dev, bool flush)
- : buf(buf), dev(dev), flush(flush)
+ : buf_(buf), dev_(dev), flush_(flush)
         { }
     void operator()() const
     {
- if (flush)
- buf.flush(dev);
+ if (flush_)
+ buf_.flush(dev_);
     }
- Buffer& buf;
- Device& dev;
- bool flush;
+private:
+ flush_buffer_operation& operator=(const flush_buffer_operation&);
+ Buffer& buf_;
+ Device& dev_;
+ bool flush_;
 };
 
 template<typename Buffer, typename Device>

Modified: trunk/boost/iostreams/device/file_descriptor.hpp
==============================================================================
--- trunk/boost/iostreams/device/file_descriptor.hpp (original)
+++ trunk/boost/iostreams/device/file_descriptor.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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: trunk/boost/iostreams/device/mapped_file.hpp
==============================================================================
--- trunk/boost/iostreams/device/mapped_file.hpp (original)
+++ trunk/boost/iostreams/device/mapped_file.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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;

Modified: trunk/boost/iostreams/filter/regex.hpp
==============================================================================
--- trunk/boost/iostreams/filter/regex.hpp (original)
+++ trunk/boost/iostreams/filter/regex.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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: trunk/boost/iostreams/filter/stdio.hpp
==============================================================================
--- trunk/boost/iostreams/filter/stdio.hpp (original)
+++ trunk/boost/iostreams/filter/stdio.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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: trunk/boost/iostreams/filter/symmetric.hpp
==============================================================================
--- trunk/boost/iostreams/filter/symmetric.hpp (original)
+++ trunk/boost/iostreams/filter/symmetric.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -228,7 +228,7 @@
     }
 
     template<typename Sink>
- bool flush(Sink& snk, mpl::false_) { return true;}
+ bool flush(Sink&, mpl::false_) { return true;}
 
     void close_impl();
 

Modified: trunk/boost/iostreams/filter/test.hpp
==============================================================================
--- trunk/boost/iostreams/filter/test.hpp (original)
+++ trunk/boost/iostreams/filter/test.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -133,6 +133,7 @@
         return amt;
     }
 private:
+ non_blocking_sink& operator=(const non_blocking_sink&);
     std::string& dest_;
     std::streamsize inc_;
 };

Modified: trunk/boost/iostreams/pipeline.hpp
==============================================================================
--- trunk/boost/iostreams/pipeline.hpp (original)
+++ trunk/boost/iostreams/pipeline.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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: trunk/boost/iostreams/read.hpp
==============================================================================
--- trunk/boost/iostreams/read.hpp (original)
+++ trunk/boost/iostreams/read.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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: trunk/boost/iostreams/restrict.hpp
==============================================================================
--- trunk/boost/iostreams/restrict.hpp (original)
+++ trunk/boost/iostreams/restrict.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -31,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 {
 
@@ -49,9 +49,11 @@
 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,
@@ -78,6 +80,8 @@
 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,
@@ -105,8 +109,10 @@
 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,
@@ -121,7 +127,7 @@
     {
         using namespace std;
         if (!open_)
- open(src);
+ open(src, BOOST_IOS::in);
         streamsize amt =
             end_ != -1 ?
                 (std::min) (n, static_cast<streamsize>(end_ - pos_)) :
@@ -136,7 +142,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 =
@@ -167,13 +173,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_;
 };

Modified: trunk/boost/iostreams/skip.hpp
==============================================================================
--- trunk/boost/iostreams/skip.hpp (original)
+++ trunk/boost/iostreams/skip.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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: trunk/libs/iostreams/doc/tutorial/container_device.html
==============================================================================
--- trunk/libs/iostreams/doc/tutorial/container_device.html (original)
+++ trunk/libs/iostreams/doc/tutorial/container_device.html 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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_;

Modified: trunk/libs/iostreams/example/container_device.hpp
==============================================================================
--- trunk/libs/iostreams/example/container_device.hpp (original)
+++ trunk/libs/iostreams/example/container_device.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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.
@@ -43,6 +44,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 +66,7 @@
     }
     Container& container() { return container_; }
 private:
+ container_sink operator=(const container_sink&);
     Container& container_;
 };
 
@@ -124,6 +127,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 +141,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: trunk/libs/iostreams/src/bzip2.cpp
==============================================================================
--- trunk/libs/iostreams/src/bzip2.cpp (original)
+++ trunk/libs/iostreams/src/bzip2.cpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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: trunk/libs/iostreams/src/file_descriptor.cpp
==============================================================================
--- trunk/libs/iostreams/src/file_descriptor.cpp (original)
+++ trunk/libs/iostreams/src/file_descriptor.cpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -12,6 +12,7 @@
 // than using it (possibly importing code).
 #define BOOST_IOSTREAMS_SOURCE
 
+#include <cassert>
 #include <boost/config.hpp> // BOOST_JOIN
 #include <boost/iostreams/detail/error.hpp>
 #include <boost/iostreams/detail/config/dyn_link.hpp>
@@ -67,14 +68,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) {
@@ -82,6 +85,8 @@
         dwCreationDisposition = OPEN_ALWAYS;
         if (m & BOOST_IOS::app)
             pimpl_->flags_ |= impl::append;
+ } else {
+ throw BOOST_IOSTREAMS_FAILURE("bad open mode");
     }
 
     HANDLE handle =

Modified: trunk/libs/iostreams/src/zlib.cpp
==============================================================================
--- trunk/libs/iostreams/src/zlib.cpp (original)
+++ trunk/libs/iostreams/src/zlib.cpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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: trunk/libs/iostreams/test/Jamfile.v2
==============================================================================
--- trunk/libs/iostreams/test/Jamfile.v2 (original)
+++ trunk/libs/iostreams/test/Jamfile.v2 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -22,6 +22,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
@@ -70,7 +71,6 @@
           [ 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 ]
@@ -79,6 +79,8 @@
           [ 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 ]

Modified: trunk/libs/iostreams/test/close_test.cpp
==============================================================================
--- trunk/libs/iostreams/test/close_test.cpp (original)
+++ trunk/libs/iostreams/test/close_test.cpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -24,8 +24,8 @@
 #include <boost/iostreams/tee.hpp>
 #include <boost/test/test_tools.hpp>
 #include <boost/test/unit_test.hpp>
-#include "./detail/closable.hpp"
-#include "./detail/operation_sequence.hpp"
+#include "detail/closable.hpp"
+#include "detail/operation_sequence.hpp"
 
 using namespace std;
 using namespace boost;
@@ -1062,23 +1062,6 @@
         BOOST_CHECK_OPERATION_SEQUENCE(seq);
     }
 
- // Restrict a bidirectional device
- {
- operation_sequence seq;
- chain<bidirectional> ch;
- ch.push(
- io::restrict(
- closable_device<bidirectional>(
- seq.new_operation(1),
- seq.new_operation(2)
- ),
- 0
- )
- );
- BOOST_CHECK_NO_THROW(ch.reset());
- BOOST_CHECK_OPERATION_SEQUENCE(seq);
- }
-
     // Restrict a seekable device
     {
         operation_sequence seq;
@@ -1101,23 +1084,6 @@
         BOOST_CHECK_OPERATION_SEQUENCE(seq);
     }
 
- // Restrict a direct bidirectional device
- {
- operation_sequence seq;
- chain<bidirectional> ch;
- ch.push(
- io::restrict(
- closable_device<direct_bidirectional>(
- seq.new_operation(1),
- seq.new_operation(2)
- ),
- 0
- )
- );
- BOOST_CHECK_NO_THROW(ch.reset());
- BOOST_CHECK_OPERATION_SEQUENCE(seq);
- }
-
     // Restrict a direct seekable device
     {
         operation_sequence seq;
@@ -1142,29 +1108,6 @@
         BOOST_CHECK_OPERATION_SEQUENCE(seq);
     }
 
- // Restrict a bidirectional filter
- {
- operation_sequence seq;
- chain<bidirectional> ch;
- ch.push(
- io::restrict(
- closable_filter<bidirectional>(
- seq.new_operation(2),
- seq.new_operation(3)
- ),
- 0
- )
- );
- ch.push(
- closable_device<bidirectional>(
- seq.new_operation(1),
- seq.new_operation(4)
- )
- );
- BOOST_CHECK_NO_THROW(ch.reset());
- BOOST_CHECK_OPERATION_SEQUENCE(seq);
- }
-
     // Restrict a seekable filter
     {
         operation_sequence seq;

Modified: trunk/libs/iostreams/test/copy_test.cpp
==============================================================================
--- trunk/libs/iostreams/test/copy_test.cpp (original)
+++ trunk/libs/iostreams/test/copy_test.cpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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: trunk/libs/iostreams/test/detail/closable.hpp
==============================================================================
--- trunk/libs/iostreams/test/detail/closable.hpp (original)
+++ trunk/libs/iostreams/test/detail/closable.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -45,7 +45,7 @@
 class closable_device<output> : public sink {
 public:
     closable_device(operation close) : close_(close) { }
- std::streamsize write(const char*, std::streamsize n) { return 0; }
+ std::streamsize write(const char*, std::streamsize) { return 0; }
     void close() { close_.execute(); }
 private:
     operation close_;
@@ -58,7 +58,7 @@
 class closable_device<borland_output> : public sink {
 public:
     closable_device(operation close) : close_(close) { }
- std::streamsize write(const char*, std::streamsize n) { return 0; }
+ std::streamsize write(const char*, std::streamsize) { return 0; }
     void close() { close_.execute(); }
 private:
     operation close_;
@@ -72,7 +72,7 @@
         : close_input_(close_input), close_output_(close_output)
         { }
     std::streamsize read(char*, std::streamsize) { return -1; }
- std::streamsize write(const char*, std::streamsize n) { return 0; }
+ std::streamsize write(const char*, std::streamsize) { return 0; }
     void close(BOOST_IOS::openmode which)
     {
         switch (which) {
@@ -97,7 +97,7 @@
 public:
     closable_device(operation close) : close_(close) { }
     std::streamsize read(char*, std::streamsize) { return -1; }
- std::streamsize write(const char*, std::streamsize n) { return 0; }
+ std::streamsize write(const char*, std::streamsize) { return 0; }
     stream_offset seek(stream_offset, BOOST_IOS::seekdir) { return 0; }
     void close() { close_.execute(); }
 private:

Modified: trunk/libs/iostreams/test/detail/filters.hpp
==============================================================================
--- trunk/libs/iostreams/test/detail/filters.hpp (original)
+++ trunk/libs/iostreams/test/detail/filters.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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: trunk/libs/iostreams/test/detail/null_padded_codecvt.hpp
==============================================================================
--- trunk/libs/iostreams/test/detail/null_padded_codecvt.hpp (original)
+++ trunk/libs/iostreams/test/detail/null_padded_codecvt.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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: trunk/libs/iostreams/test/detail/operation_sequence.hpp
==============================================================================
--- trunk/libs/iostreams/test/detail/operation_sequence.hpp (original)
+++ trunk/libs/iostreams/test/detail/operation_sequence.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -62,6 +62,7 @@
             : seq(seq), id(id), error_code(error_code)
             { }
         ~impl() { remove_operation(seq, id); }
+ impl& operator=(const impl&); // Supress VC warning 4512
         operation_sequence& seq;
         int id;
         int error_code;

Modified: trunk/libs/iostreams/test/detail/utf8_codecvt_facet.hpp
==============================================================================
--- trunk/libs/iostreams/test/detail/utf8_codecvt_facet.hpp (original)
+++ trunk/libs/iostreams/test/detail/utf8_codecvt_facet.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -110,7 +110,7 @@
     virtual std::codecvt_base::result do_unshift(
         std::mbstate_t&,
         char * from,
- char * to,
+ char * /* to */,
         char * & next
     ) const{
         next = from;

Modified: trunk/libs/iostreams/test/detail/verification.hpp
==============================================================================
--- trunk/libs/iostreams/test/detail/verification.hpp (original)
+++ trunk/libs/iostreams/test/detail/verification.hpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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>
@@ -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: trunk/libs/iostreams/test/execute_test.cpp
==============================================================================
--- trunk/libs/iostreams/test/execute_test.cpp (original)
+++ trunk/libs/iostreams/test/execute_test.cpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -26,25 +26,33 @@
 // Function object that sets a boolean flag and returns a value
 // specified at construction
 template<typename Result>
-struct operation {
+class operation {
+public:
     typedef Result result_type;
- operation(Result r, bool& executed) : r(r), executed(executed) { }
+ explicit operation(Result r, bool& executed)
+ : r_(r), executed_(executed)
+ { }
     Result operator()() const
     {
- executed = true;
- return r;
+ executed_ = true;
+ return r_;
     }
- Result r;
- bool& executed;
+private:
+ operation& operator=(const operation&);
+ Result r_;
+ bool& executed_;
 };
 
 // Specialization for void return
 template<>
-struct operation<void> {
+class operation<void> {
+public:
     typedef void result_type;
- operation(bool& executed) : executed(executed) { }
- void operator()() const { executed = true; }
- bool& executed;
+ explicit operation(bool& executed) : executed_(executed) { }
+ void operator()() const { executed_ = true; }
+private:
+ operation& operator=(const operation&);
+ bool& executed_;
 };
 
 // Simple exception class with error code built in to type
@@ -53,24 +61,28 @@
 
 // Function object that sets a boolean flag and throws an exception
 template<int Code>
-struct thrower {
+class thrower {
+public:
     typedef void result_type;
- thrower(bool& executed) : executed(executed) { }
+ explicit thrower(bool& executed) : executed_(executed) { }
     void operator()() const
     {
- executed = true;
+ executed_ = true;
         throw error<Code>();
     }
- bool& executed;
+private:
+ thrower& operator=(const thrower&);
+ bool& executed_;
 };
 
 // Function object for use by foreach_test
-struct foreach_func {
+class foreach_func {
+public:
     typedef void result_type;
- foreach_func(int& count) : count(count) { }
+ explicit foreach_func(int& count) : count_(count) { }
     void operator()(int x) const
     {
- ++count;
+ ++count_;
         switch (x) {
         case 0: throw error<0>();
         case 1: throw error<1>();
@@ -86,7 +98,9 @@
             break;
         }
     }
- int& count; // Number of times operator() has been called
+private:
+ foreach_func& operator=(const foreach_func&);
+ int& count_; // Number of times operator() has been called
 };
 
 void success_test()

Modified: trunk/libs/iostreams/test/file_descriptor_test.cpp
==============================================================================
--- trunk/libs/iostreams/test/file_descriptor_test.cpp (original)
+++ trunk/libs/iostreams/test/file_descriptor_test.cpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -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--------------------------------------//
 
     {

Deleted: trunk/libs/iostreams/test/offset_test.cpp
==============================================================================
--- trunk/libs/iostreams/test/offset_test.cpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
+++ (empty file)
@@ -1,333 +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/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;
-}

Modified: trunk/libs/iostreams/test/operation_sequence_test.cpp
==============================================================================
--- trunk/libs/iostreams/test/operation_sequence_test.cpp (original)
+++ trunk/libs/iostreams/test/operation_sequence_test.cpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -17,7 +17,7 @@
 #include <stdexcept>
 #include <boost/test/test_tools.hpp>
 #include <boost/test/unit_test.hpp>
-#include "./detail/operation_sequence.hpp"
+#include "detail/operation_sequence.hpp"
 
 using namespace std;
 using namespace boost;

Deleted: trunk/libs/iostreams/test/positioning_test.cpp
==============================================================================
--- trunk/libs/iostreams/test/positioning_test.cpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
+++ (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: trunk/libs/iostreams/test/stream_state_test.cpp
==============================================================================
--- trunk/libs/iostreams/test/stream_state_test.cpp (original)
+++ trunk/libs/iostreams/test/stream_state_test.cpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -38,15 +38,15 @@
     typedef char char_type;
     typedef seekable_device_tag category;
     error_device(char const*) {}
- std::streamsize read(char_type* s, std::streamsize n)
+ std::streamsize read(char_type*, std::streamsize)
     {
         throw detail::bad_read();
     }
- std::streamsize write(const char_type* s, std::streamsize n)
+ std::streamsize write(const char_type*, std::streamsize)
     {
         throw detail::bad_write();
     }
- std::streampos seek(stream_offset off, BOOST_IOS::seekdir way)
+ std::streampos seek(stream_offset, BOOST_IOS::seekdir)
     {
         throw detail::bad_seek();
     }

Modified: trunk/libs/iostreams/test/symmetric_filter_test.cpp
==============================================================================
--- trunk/libs/iostreams/test/symmetric_filter_test.cpp (original)
+++ trunk/libs/iostreams/test/symmetric_filter_test.cpp 2007-12-26 00:45:15 EST (Wed, 26 Dec 2007)
@@ -29,7 +29,7 @@
                 std::streamsize buffer_size =
                     default_filter_buffer_size
              )
- : buf_(default_filter_buffer_size)
+ : buf_(buffer_size)
     {
         buf_.set(0, 0);
     }


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