$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: technews_at_[hidden]
Date: 2008-01-07 00:20:34
Author: turkanis
Date: 2008-01-07 00:20:32 EST (Mon, 07 Jan 2008)
New Revision: 42565
URL: http://svn.boost.org/trac/boost/changeset/42565
Log:
merged changes from branches/iostreams_dev, revisions 42544-42544
- added "slice" as an alias for "restrict", for platforms on which "restrict" is a keyword
- attempted to configure file_descriptor for __IBMCPP__
- added better error output to stream_offset_64bit_test.cpp
Added:
   trunk/boost/iostreams/detail/restrict_impl.hpp
      - copied unchanged from r42554, /branches/iostreams_dev/boost/iostreams/detail/restrict_impl.hpp
   trunk/boost/iostreams/slice.hpp
      - copied unchanged from r42554, /branches/iostreams_dev/boost/iostreams/slice.hpp
   trunk/libs/iostreams/test/slice_test.cpp
      - copied unchanged from r42554, /branches/iostreams_dev/libs/iostreams/test/slice_test.cpp
Text files modified: 
   trunk/boost/iostreams/detail/config/rtl.hpp            |     5                                         
   trunk/boost/iostreams/restrict.hpp                     |   455 +-------------------------------------- 
   trunk/libs/iostreams/test/Jamfile.v2                   |     1                                         
   trunk/libs/iostreams/test/restrict_test.cpp            |   133 +++++++----                             
   trunk/libs/iostreams/test/stream_offset_64bit_test.cpp |    16 +                                       
   5 files changed, 119 insertions(+), 491 deletions(-)
Modified: trunk/boost/iostreams/detail/config/rtl.hpp
==============================================================================
--- trunk/boost/iostreams/detail/config/rtl.hpp	(original)
+++ trunk/boost/iostreams/detail/config/rtl.hpp	2008-01-07 00:20:32 EST (Mon, 07 Jan 2008)
@@ -48,9 +48,10 @@
 #else // Non-windows
 # if defined(_LARGEFILE64_SOURCE) && \
          (!defined(_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64) || \
-     defined(BOOST_IOSTREAMS_HAS_LSEEK64) \
+     defined(__IBMCPP__) && !defined(__64BIT__) && !defined(_LARGE_FILE) || \
+     defined(BOOST_IOSTREAMS_HAS_LSEEK64)
      /**/
-#  define BOOST_IOSTREAMS_FD_SEEK      lseek64  // GCC for some 32-bit *nix
+#  define BOOST_IOSTREAMS_FD_SEEK      lseek64  // Some GCC and IBM
 #  define BOOST_IOSTREAMS_FD_TRUNCATE  ftruncate64
 #  define BOOST_IOSTREAMS_FD_STAT      stat64
 #  define BOOST_IOSTREAMS_FD_OFFSET    off64_t
Modified: trunk/boost/iostreams/restrict.hpp
==============================================================================
--- trunk/boost/iostreams/restrict.hpp	(original)
+++ trunk/boost/iostreams/restrict.hpp	2008-01-07 00:20:32 EST (Mon, 07 Jan 2008)
@@ -1,443 +1,24 @@
-// (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.
+/*
+ * 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.
+ *
+ * File:        boost/iostreams/detail/restrict.hpp
+ * Date:        Sun Jan 06 12:57:30 MST 2008
+ * Copyright:   2004-2007 Jonathan Turkanis
+ * Author:      Jonathan Turkanis
+ *
+ * Defines the class template boost::iostreams::restriction and the 
+ * overloaded function template boost::iostreams::restrict
+ */
 
 #ifndef BOOST_IOSTREAMS_RESTRICT_HPP_INCLUDED
 #define BOOST_IOSTREAMS_RESTRICT_HPP_INCLUDED
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-#include <algorithm>          // min.
-#include <utility>            // pair.
-#include <boost/cstdint.hpp>  // intmax_t.
-#include <boost/config.hpp>   // DEDUCED_TYPENAME.
-#include <boost/iostreams/categories.hpp>
-#include <boost/iostreams/char_traits.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>
-#include <boost/iostreams/detail/ios.hpp>     // failure.
-#include <boost/iostreams/detail/select.hpp>
-#include <boost/iostreams/operations.hpp>
-#include <boost/iostreams/skip.hpp>
-#include <boost/iostreams/traits.hpp>         // mode_of, is_direct.
-#include <boost/mpl/bool.hpp>
-#include <boost/static_assert.hpp>
-#include <boost/type_traits/is_convertible.hpp>
-
-#include <boost/iostreams/detail/config/disable_warnings.hpp>
-
-namespace boost { namespace iostreams {
-
-namespace detail {
-
-//
-// Template name: restricted_indirect_device.
-// Description: Provides an restricted view of an indirect Device.
-// Template paramters:
-//      Device - An indirect model of Device that models either Source or
-//          SeekableDevice.
-//
-template<typename 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 mode_of<Device>::type       mode;
-    BOOST_STATIC_ASSERT(!(is_convertible<mode, detail::two_sequence>::value));
-    struct category
-        : mode,
-          device_tag,
-          closable_tag,
-          flushable_tag,
-          localizable_tag,
-          optimally_buffered_tag
-        { };
-    restricted_indirect_device( param_type dev, stream_offset off,
-                                stream_offset len = -1 );
-    std::streamsize read(char_type* s, std::streamsize n);
-    std::streamsize write(const char_type* s, std::streamsize n);
-    std::streampos seek(stream_offset off, BOOST_IOS::seekdir way);
-private:
-    stream_offset beg_, pos_, end_;
-};
-
-//
-// Template name: restricted_direct_device.
-// Description: Provides an restricted view of a Direct Device.
-// Template paramters:
-//      Device - A model of Direct and Device.
-//
-template<typename 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,
-          direct_tag,
-          closable_tag,
-          localizable_tag
-        { };
-    restricted_direct_device( const Device& dev, stream_offset off,
-                              stream_offset len = -1 );
-    pair_type input_sequence();
-    pair_type output_sequence();
-private:
-    pair_type sequence(mpl::true_);
-    pair_type sequence(mpl::false_);
-    char_type *beg_, *end_;
-};
-
-//
-// Template name: restricted_filter.
-// Description: Provides an restricted view of a Filter.
-// Template paramters:
-//      Filter - An indirect model of Filter.
-//
-template<typename 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,
-          filter_tag,
-          multichar_tag,
-          closable_tag,
-          localizable_tag,
-          optimally_buffered_tag
-        { };
-    restricted_filter( const Filter& flt, stream_offset off, 
-                       stream_offset len = -1 );
-
-    template<typename Source>
-    std::streamsize read(Source& src, char_type* s, std::streamsize n)
-    {
-        using namespace std;
-        if (!open_)
-            open(src, BOOST_IOS::in);
-        std::streamsize amt =
-            end_ != -1 ?
-                (std::min) (n, static_cast<std::streamsize>(end_ - pos_)) :
-                n;
-        std::streamsize result = 
-            iostreams::read(this->component(), src, s, amt);
-        if (result != -1)
-            pos_ += result;
-        return result;
-    }
-
-    template<typename Sink>
-    std::streamsize write(Sink& snk, const char_type* s, std::streamsize n)
-    {
-        if (!open_)
-            open(snk, BOOST_IOS::out);
-        if (end_ != -1 && pos_ + n >= end_)
-            bad_write();
-        std::streamsize result = 
-            iostreams::write(this->component(), snk, s, n);
-        pos_ += result;
-        return result;
-    }
-
-    template<typename Device>
-    std::streampos seek(Device& dev, stream_offset off, BOOST_IOS::seekdir way)
-    {
-        stream_offset next;
-        if (way == BOOST_IOS::beg) {
-            next = beg_ + off;
-        } else if (way == BOOST_IOS::cur) {
-            next = pos_ + off;
-        } else if (end_ != -1) {
-            next = end_ + off;
-        } else {
-            // Restriction is half-open; seek relative to the actual end.
-            pos_ = this->component().seek(dev, off, BOOST_IOS::end);
-            if (pos_ < beg_)
-                bad_seek();
-            return offset_to_position(pos_ - beg_);
-        }
-        if (next < beg_ || end_ != -1 && next >= end_)
-            bad_seek();
-        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, BOOST_IOS::openmode which)
-    {
-        typedef typename is_convertible<mode, dual_use>::type is_dual_use;
-        open_ = true;
-        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_;
-};
-
-template<typename T>
-struct restriction_traits
-    : iostreams::select<  // Disambiguation for Tru64.
-          is_filter<T>,  restricted_filter<T>,
-          is_direct<T>,  restricted_direct_device<T>,
-          else_,         restricted_indirect_device<T>
-      >
-    { };
-
-} // End namespace detail.
-
-template<typename T>
-struct restriction : public detail::restriction_traits<T>::type {
-    typedef typename detail::param_type<T>::type          param_type;
-    typedef typename detail::restriction_traits<T>::type  base_type;
-    restriction(param_type t, stream_offset off, stream_offset len = -1)
-        : base_type(t, off, len)
-        { }
-};
-
-//--------------Implementation of restrict------------------------------------//
-
-// Note: The following workarounds are patterned after resolve.hpp. It has not
-// yet been confirmed that they are necessary.
-
-#ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //-------------------------//
-# ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //-------------------------------//
-
-template<typename T>
-restriction<T> restrict( const T& t, stream_offset off, stream_offset len = -1
-                         BOOST_IOSTREAMS_DISABLE_IF_STREAM(T) )
-{ return restriction<T>(t, off, len); }
-
-template<typename Ch, typename Tr>
-restriction< std::basic_streambuf<Ch, Tr> >
-restrict(std::basic_streambuf<Ch, Tr>& sb, stream_offset off, stream_offset len = -1)
-{ return restriction< std::basic_streambuf<Ch, Tr> >(sb, off, len); }
-
-template<typename Ch, typename Tr>
-restriction< std::basic_istream<Ch, Tr> >
-restrict(std::basic_istream<Ch, Tr>& is, stream_offset off, stream_offset len = -1)
-{ return restriction< std::basic_istream<Ch, Tr> >(is, off, len); }
-
-template<typename Ch, typename Tr>
-restriction< std::basic_ostream<Ch, Tr> >
-restrict(std::basic_ostream<Ch, Tr>& os, stream_offset off, stream_offset len = -1)
-{ return restriction< std::basic_ostream<Ch, Tr> >(os, off, len); }
-
-template<typename Ch, typename Tr>
-restriction< std::basic_iostream<Ch, Tr> >
-restrict(std::basic_iostream<Ch, Tr>& io, stream_offset off, stream_offset len = -1)
-{ return restriction< std::basic_iostream<Ch, Tr> >(io, off, len); }
-
-# else // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //---------------------//
-
-template<typename T>
-restriction<T> restrict( const T& t, stream_offset off, stream_offset len = -1
-                         BOOST_IOSTREAMS_DISABLE_IF_STREAM(T) )
-{ return restriction<T>(t, off, len); }
-
-restriction<std::streambuf> 
-restrict(std::streambuf& sb, stream_offset off, stream_offset len = -1)
-{ return restriction<std::streambuf>(sb, off, len); }
-
-restriction<std::istream> 
-restrict(std::istream<Ch, Tr>& is, stream_offset off, stream_offset len = -1)
-{ return restriction<std::istream>(is, off, len); }
-
-restriction<std::ostream> 
-restrict(std::ostream<Ch, Tr>& os, stream_offset off, stream_offset len = -1)
-{ return restriction<std::ostream>(os, off, len); }
-
-restriction<std::iostream> 
-restrict(std::iostream<Ch, Tr>& io, stream_offset off, stream_offset len = -1)
-{ return restriction<std::iostream>(io, off, len); }
-
-# endif // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //--------------------//
-#else // #ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //----------------//
-
-template<typename T>
-restriction<T> 
-restrict(const T& t, stream_offset off, stream_offset len, mpl::true_)
-{   // Bad overload resolution.
-    return restriction<T>(const_cast<T&>(t, off, len));
-}
-
-template<typename T>
-restriction<T> 
-restrict(const T& t, stream_offset off, stream_offset len, mpl::false_)
-{ return restriction<T>(t, off, len); }
-
-template<typename T>
-restriction<T> 
-restrict( const T& t, stream_offset off, stream_offset len = -1
-          BOOST_IOSTREAMS_DISABLE_IF_STREAM(T) )
-{ return restrict(t, off, len, is_std_io<T>()); }
-
-# if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && \
-     !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && \
-     !defined(__GNUC__) // ---------------------------------------------------//
-
-template<typename T>
-restriction<T>
-restrict(T& t, stream_offset off, stream_offset len = -1)
-{ return restriction<T>(t, off, len); }
-
-# endif // Borland 5.x, VC6-7.0 or GCC 2.9x //--------------------------------//
-#endif // #ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //---------------//
-//----------------------------------------------------------------------------//
-
-namespace detail {
-
-//--------------Implementation of restricted_indirect_device------------------//
-
-template<typename Device>
-restricted_indirect_device<Device>::restricted_indirect_device
-    (param_type dev, stream_offset off, stream_offset len)
-    : device_adapter<Device>(dev), beg_(off), pos_(off), 
-      end_(len != -1 ? off + len : -1)
-{
-    if (len < -1 || off < 0)
-        throw BOOST_IOSTREAMS_FAILURE("bad offset");
-    iostreams::skip(this->component(), off);
-}
-
-template<typename Device>
-inline std::streamsize restricted_indirect_device<Device>::read
-    (char_type* s, std::streamsize n)
-{
-    using namespace std;
-    std::streamsize amt =
-        end_ != -1 ?
-            (std::min) (n, static_cast<std::streamsize>(end_ - pos_)) :
-            n;
-    std::streamsize result = iostreams::read(this->component(), s, amt);
-    if (result != -1)
-        pos_ += result;
-    return result;
-}
-
-template<typename Device>
-inline std::streamsize restricted_indirect_device<Device>::write
-    (const char_type* s, std::streamsize n)
-{
-    if (end_ != -1 && pos_ + n >= end_)
-        bad_write();
-    std::streamsize result = iostreams::write(this->component(), s, n);
-    pos_ += result;
-    return result;
-}
-
-template<typename Device>
-std::streampos restricted_indirect_device<Device>::seek
-    (stream_offset off, BOOST_IOS::seekdir way)
-{
-    stream_offset next;
-    if (way == BOOST_IOS::beg) {
-        next = beg_ + off;
-    } else if (way == BOOST_IOS::cur) {
-        next = pos_ + off;
-    } else if (end_ != -1) {
-        next = end_ + off;
-    } else {
-        // Restriction is half-open; seek relative to the actual end.
-        pos_ = iostreams::seek(this->component(), off, BOOST_IOS::end);
-        if (pos_ < beg_)
-            bad_seek();
-        return offset_to_position(pos_ - beg_);
-    }
-    if (next < beg_ || end_ != -1 && next >= end_)
-        bad_seek();
-    pos_ = iostreams::seek(this->component(), next - pos_, BOOST_IOS::cur);
-    return offset_to_position(pos_ - beg_);
-}
-
-//--------------Implementation of restricted_direct_device--------------------//
-
-template<typename Device>
-restricted_direct_device<Device>::restricted_direct_device
-    (const Device& dev, stream_offset off, stream_offset len)
-    : device_adapter<Device>(dev), beg_(0), end_(0)
-{
-    std::pair<char_type*, char_type*> seq =
-        sequence(is_convertible<category, input>());
-    if ( off < 0 || len < -1 || 
-         len != -1 && off + len > seq.second - seq.first )
-    {
-        throw BOOST_IOSTREAMS_FAILURE("bad offset");
-    }
-    beg_ = seq.first + off;
-    end_ = len != -1 ? 
-        seq.first + off + len :
-        seq.second;
-}
-
-template<typename Device>
-typename restricted_direct_device<Device>::pair_type
-restricted_direct_device<Device>::input_sequence()
-{
-    BOOST_STATIC_ASSERT((is_convertible<category, input>::value));
-    return std::make_pair(beg_, end_);
-}
-
-template<typename Device>
-typename restricted_direct_device<Device>::pair_type
-restricted_direct_device<Device>::output_sequence()
-{
-    BOOST_STATIC_ASSERT((is_convertible<category, output>::value));
-    return std::make_pair(beg_, end_);
-}
-
-template<typename Device>
-typename restricted_direct_device<Device>::pair_type
-restricted_direct_device<Device>::sequence(mpl::true_)
-{ return iostreams::input_sequence(this->component()); }
-
-template<typename Device>
-typename restricted_direct_device<Device>::pair_type
-restricted_direct_device<Device>::sequence(mpl::false_)
-{ return iostreams::output_sequence(this->component()); }
-
-//--------------Implementation of restricted_filter---------------------------//
-
-template<typename Filter>
-restricted_filter<Filter>::restricted_filter
-    (const Filter& flt, stream_offset off, stream_offset len)
-    : filter_adapter<Filter>(flt), beg_(off),
-      pos_(off), end_(len != -1 ? off + len : -1), open_(false)
-{
-    if (len < -1 || off < 0)
-        throw BOOST_IOSTREAMS_FAILURE("bad offset");
-}
-
-} // End namespace detail.
-
-} } // End namespaces iostreams, boost.
-
+#include <boost/iostreams/detail/restrict_impl.hpp>
+#define BOOST_IOSTREAMS_RESTRICT restrict
+#include <boost/iostreams/detail/restrict_impl.hpp>
+#undef BOOST_IOSTREAMS_RESTRICT
 
 #endif // #ifndef BOOST_IOSTREAMS_RESTRICT_HPP_INCLUDED
Modified: trunk/libs/iostreams/test/Jamfile.v2
==============================================================================
--- trunk/libs/iostreams/test/Jamfile.v2	(original)
+++ trunk/libs/iostreams/test/Jamfile.v2	2008-01-07 00:20:32 EST (Mon, 07 Jan 2008)
@@ -70,6 +70,7 @@
           [ test-iostreams seekable_file_test.cpp ]
           [ test-iostreams seekable_filter_test.cpp ]
           [ test-iostreams sequence_test.cpp ]
+          [ test-iostreams slice_test.cpp ]
           [ test-iostreams stdio_filter_test.cpp ]
           [ test-iostreams stream_offset_32bit_test.cpp ]
           [ test-iostreams stream_offset_64bit_test.cpp ]
Modified: trunk/libs/iostreams/test/restrict_test.cpp
==============================================================================
--- trunk/libs/iostreams/test/restrict_test.cpp	(original)
+++ trunk/libs/iostreams/test/restrict_test.cpp	2008-01-07 00:20:32 EST (Mon, 07 Jan 2008)
@@ -4,17 +4,25 @@
 
 // See http://www.boost.org/libs/iostreams for documentation.
 
-// Todo: add tests for direct devices.
+// Allow this file to be used by slice_test.hpp. It is important not to 
+// replace BOOST_RESTRICT with BOOST_IOSTREAMS_RESTRICT here, since that
+// would interfere with the oepration of the header 
+// <boost/iostreams/restrict.hpp>
+
+#ifndef BOOST_RESTRICT
+# define BOOST_RESTRICT restrict
+# define BOOST_RESTRICT_HEADER <boost/iostreams/restrict.hpp>
+#endif
+#include BOOST_RESTRICT_HEADER
 
-#include <algorithm>  // equal.
+#include <algorithm>         // equal.
 #include <cctype>
-#include <iterator>   // back_inserter.
+#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/restrict.hpp>
 #include <boost/test/test_tools.hpp>
 #include <boost/test/unit_test.hpp>
 #include "detail/closable.hpp"
@@ -125,8 +133,8 @@
         test_file              src2;
         stream_offset          off = small_padding,
                                len = data_reps * data_length();
-        filtering_istream first( restrict( file_source(src1.name(), in_mode), 
-                                           off, len ) );
+        filtering_istream      first( 
+            BOOST_RESTRICT(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),
@@ -139,8 +147,8 @@
         test_file              src2;
         stream_offset          off = large_padding,
                                len = data_reps * data_length();
-        filtering_istream first( restrict( file_source(src1.name(), in_mode), 
-                                           off, len ) );
+        filtering_istream      first(
+            BOOST_RESTRICT(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),
@@ -152,7 +160,8 @@
         restricted_test_file   src1(small_padding, true);
         test_file              src2;
         stream_offset          off = small_padding;
-        filtering_istream first(restrict(file_source(src1.name(), in_mode), off));
+        filtering_istream      first(
+            BOOST_RESTRICT(file_source(src1.name(), in_mode), off));
         ifstream               second(src2.name().c_str(), in_mode);
         BOOST_CHECK_MESSAGE(
             compare_streams_in_chunks(first, second),
@@ -165,7 +174,8 @@
         restricted_test_file   src1(large_padding, true);
         test_file              src2;
         stream_offset          off = large_padding;
-        filtering_istream first(restrict(file_source(src1.name(), in_mode), off));
+        filtering_istream      first(
+            BOOST_RESTRICT(file_source(src1.name(), in_mode), off));
         ifstream               second(src2.name().c_str(), in_mode);
         BOOST_CHECK_MESSAGE(
             compare_streams_in_chunks(first, second),
@@ -183,7 +193,7 @@
         array_source              array_src(&src[0], &src[0] + src.size());
         stream_offset             off = small_padding,
                                   len = data_reps * data_length();
-        filtering_istream         second(restrict(array_src, off, len));
+        filtering_istream         second(BOOST_RESTRICT(array_src, off, len));
         BOOST_CHECK_MESSAGE(
             compare_container_and_stream(first, second),
             "failed reading from restriction<Direct>"
@@ -195,7 +205,7 @@
         restricted_test_sequence  src(small_padding, true);
         array_source              array_src(&src[0], &src[0] + src.size());
         stream_offset             off = small_padding;
-        filtering_istream         second(restrict(array_src, off));
+        filtering_istream         second(BOOST_RESTRICT(array_src, off));
         BOOST_CHECK_MESSAGE(
             compare_container_and_stream(first, second),
             "failed reading from half-open restriction<Direct>"
@@ -211,7 +221,7 @@
         stream_offset          off = small_padding,
                                len = data_reps * data_length();
         filtering_istream      first;
-        first.push(restrict(toupper_filter(), off, len));
+        first.push(BOOST_RESTRICT(toupper_filter(), off, len));
         first.push(file_source(src1.name(), in_mode));
         ifstream           second(src2.name().c_str(), in_mode);
         BOOST_CHECK_MESSAGE(
@@ -226,7 +236,7 @@
         stream_offset          off = large_padding,
                                len = data_reps * data_length();
         filtering_istream      first;
-        first.push(restrict(toupper_filter(), off, len));
+        first.push(BOOST_RESTRICT(toupper_filter(), off, len));
         first.push(file_source(src1.name(), in_mode));
         ifstream           second(src2.name().c_str(), in_mode);
         BOOST_CHECK_MESSAGE(
@@ -240,7 +250,7 @@
         uppercase_file         src2;
         stream_offset          off = small_padding;
         filtering_istream      first;
-        first.push(restrict(toupper_filter(), off));
+        first.push(BOOST_RESTRICT(toupper_filter(), off));
         first.push(file_source(src1.name(), in_mode));
         ifstream           second(src2.name().c_str(), in_mode);
         BOOST_CHECK_MESSAGE(
@@ -255,7 +265,7 @@
         uppercase_file         src2;
         stream_offset          off = large_padding;
         filtering_istream      first;
-        first.push(restrict(toupper_filter(), off));
+        first.push(BOOST_RESTRICT(toupper_filter(), off));
         first.push(file_source(src1.name(), in_mode));
         ifstream           second(src2.name().c_str(), in_mode);
         BOOST_CHECK_MESSAGE(
@@ -273,8 +283,8 @@
         restricted_test_file       dest2(small_padding);
         stream_offset              off = small_padding,
                                    len = data_reps * data_length();
-        filtering_ostream out( restrict( file(dest1.name(), BOOST_IOS::binary),
-                                         off, len ) );
+        filtering_ostream          out(
+            BOOST_RESTRICT(file(dest1.name(), BOOST_IOS::binary), off, len));
         write_data_in_chunks(out);
         out.reset();
         ifstream                   first(dest1.name().c_str(), in_mode);
@@ -290,8 +300,8 @@
         restricted_test_file       dest2(large_padding);
         stream_offset              off = large_padding,
                                    len = data_reps * data_length();
-        filtering_ostream out( restrict( file(dest1.name(), BOOST_IOS::binary), 
-                                         off, len ) );
+        filtering_ostream          out
+            (BOOST_RESTRICT(file(dest1.name(), BOOST_IOS::binary), off, len));
         write_data_in_chunks(out);
         out.reset();
         ifstream                   first(dest1.name().c_str(), in_mode);
@@ -306,7 +316,8 @@
         restricted_uppercase_file  dest1(small_padding, true);
         restricted_test_file       dest2(small_padding, true);
         stream_offset              off = small_padding;
-        filtering_ostream out(restrict(file(dest1.name(), BOOST_IOS::binary), off));
+        filtering_ostream          out
+            (BOOST_RESTRICT(file(dest1.name(), BOOST_IOS::binary), off));
         write_data_in_chunks(out);
         out.reset();
         ifstream                   first(dest1.name().c_str(), in_mode);
@@ -322,7 +333,8 @@
         restricted_uppercase_file  dest1(large_padding, true);
         restricted_test_file       dest2(large_padding, true);
         stream_offset              off = large_padding;
-        filtering_ostream out(restrict(file(dest1.name(), BOOST_IOS::binary), off));
+        filtering_ostream          out
+            (BOOST_RESTRICT(file(dest1.name(), BOOST_IOS::binary), off));
         write_data_in_chunks(out);
         out.reset();
         ifstream                   first(dest1.name().c_str(), in_mode);
@@ -345,7 +357,7 @@
         stream_offset             off = small_padding,
                                   len = data_reps * data_length();
         array_sink                array(&dest1[0], &dest1[0] + dest1.size());
-        filtering_ostream         out(restrict(array, off, len));
+        filtering_ostream         out(BOOST_RESTRICT(array, off, len));
         write_data_in_chunks(out);
         out.reset();
         BOOST_CHECK_MESSAGE(
@@ -355,12 +367,12 @@
     }
 
     {
-        vector<char>              dest1( data_reps * data_length() + small_padding,
-                                         '\n' );
+        vector<char>              dest1(
+            data_reps * data_length() + small_padding, '\n');
         restricted_test_sequence  dest2(small_padding, true);
         stream_offset             off = small_padding;
         array_sink                array(&dest1[0], &dest1[0] + dest1.size());
-        filtering_ostream         out(restrict(array, off));
+        filtering_ostream         out(BOOST_RESTRICT(array, off));
         write_data_in_chunks(out);
         out.reset();
         BOOST_CHECK_MESSAGE(
@@ -378,7 +390,7 @@
         stream_offset              off = small_padding,
                                    len = data_reps * data_length();
         filtering_ostream          out;
-        out.push(restrict(tolower_seekable_filter(), off, len));
+        out.push(BOOST_RESTRICT(tolower_seekable_filter(), off, len));
         out.push(file(dest1.name(), BOOST_IOS::binary));
         write_data_in_chunks(out);
         out.reset();
@@ -396,7 +408,7 @@
         stream_offset              off = large_padding,
                                    len = data_reps * data_length();
         filtering_ostream          out;
-        out.push(restrict(tolower_seekable_filter(), off, len));
+        out.push(BOOST_RESTRICT(tolower_seekable_filter(), off, len));
         out.push(file(dest1.name(), BOOST_IOS::binary));
         write_data_in_chunks(out);
         out.reset();
@@ -413,7 +425,7 @@
         restricted_lowercase_file  dest2(small_padding, true);
         stream_offset              off = small_padding;
         filtering_ostream          out;
-        out.push(restrict(tolower_seekable_filter(), off));
+        out.push(BOOST_RESTRICT(tolower_seekable_filter(), off));
         out.push(file(dest1.name(), BOOST_IOS::binary));
         write_data_in_chunks(out);
         out.reset();
@@ -430,7 +442,7 @@
         restricted_lowercase_file  dest2(large_padding, true);
         stream_offset              off = large_padding;
         filtering_ostream          out;
-        out.push(restrict(tolower_seekable_filter(), off));
+        out.push(BOOST_RESTRICT(tolower_seekable_filter(), off));
         out.push(file(dest1.name(), BOOST_IOS::binary));
         write_data_in_chunks(out);
         out.reset();
@@ -449,8 +461,8 @@
         restricted_test_file       src(large_padding);
         stream_offset              off = large_padding,
                                    len = data_reps * data_length();
-        filtering_stream<seekable> io( restrict( file(src.name(), BOOST_IOS::binary),
-                                                 off, len ) );
+        filtering_stream<seekable> io(
+            BOOST_RESTRICT(file(src.name(), BOOST_IOS::binary), off, len));
         BOOST_CHECK_MESSAGE(
             test_seekable_in_chunks(io),
             "failed seeking within restriction<Device>"
@@ -460,7 +472,8 @@
     {
         restricted_test_file       src(large_padding, true);
         stream_offset              off = large_padding;
-        filtering_stream<seekable> io(restrict(file(src.name(), BOOST_IOS::binary), off));
+        filtering_stream<seekable> io(
+            BOOST_RESTRICT(file(src.name(), BOOST_IOS::binary), off));
         BOOST_CHECK_MESSAGE(
             test_seekable_in_chunks(io),
             "failed seeking within half-open restriction<Device>"
@@ -471,11 +484,12 @@
 void seek_direct_device()
 {
     {
-        vector<char>               src(data_reps * data_length() + 2 * small_padding, '\n');
+        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(restrict(ar, off, len));
+        filtering_stream<seekable> io(BOOST_RESTRICT(ar, off, len));
         BOOST_CHECK_MESSAGE(
             test_seekable_in_chars(io),
             "failed seeking within restriction<Direct> with small padding"
@@ -483,10 +497,11 @@
     }
 
     {
-        vector<char>               src(data_reps * data_length() + small_padding, '\n');
+        vector<char>               src(
+            data_reps * data_length() + small_padding, '\n');
         stream_offset              off = small_padding;
         array                      ar(&src[0], &src[0] + src.size());
-        filtering_stream<seekable> io(restrict(ar, off));
+        filtering_stream<seekable> io(BOOST_RESTRICT(ar, off));
         BOOST_CHECK_MESSAGE(
             test_seekable_in_chars(io),
             "failed seeking within half-open restriction<Direct> "
@@ -500,9 +515,9 @@
     {
         restricted_test_file       src(small_padding);
         stream_offset              off = large_padding,
-                                len = data_reps * data_length();
+                                   len = data_reps * data_length();
         filtering_stream<seekable> io;
-        io.push(restrict(identity_seekable_filter(), off, len));
+        io.push(BOOST_RESTRICT(identity_seekable_filter(), off, len));
         io.push(file(src.name(), BOOST_IOS::binary));
         BOOST_CHECK_MESSAGE(
             test_seekable_in_chars(io),
@@ -514,7 +529,7 @@
         restricted_test_file       src(small_padding, true);
         stream_offset              off = large_padding;
         filtering_stream<seekable> io;
-        io.push(restrict(identity_seekable_filter(), off));
+        io.push(BOOST_RESTRICT(identity_seekable_filter(), off));
         io.push(file(src.name(), BOOST_IOS::binary));
         BOOST_CHECK_MESSAGE(
             test_seekable_in_chars(io),
@@ -529,7 +544,12 @@
     {
         operation_sequence  seq;
         chain<input>        ch;
-        ch.push(io::restrict(closable_device<input>(seq.new_operation(1)), 0));
+        ch.push(
+            io::BOOST_RESTRICT(
+                closable_device<input>(seq.new_operation(1)), 
+                0
+            )
+        );
         BOOST_CHECK_NO_THROW(ch.reset());
         BOOST_CHECK_OPERATION_SEQUENCE(seq);
     }
@@ -539,7 +559,10 @@
         operation_sequence  seq;
         chain<seekable>     ch;
         ch.push(
-            io::restrict(closable_device<seekable>(seq.new_operation(1)), 0)
+            io::BOOST_RESTRICT(
+                closable_device<seekable>(seq.new_operation(1)), 
+                0
+            )
         );
         BOOST_CHECK_NO_THROW(ch.reset());
         BOOST_CHECK_OPERATION_SEQUENCE(seq);
@@ -550,7 +573,10 @@
         operation_sequence  seq;
         chain<input>        ch;
         ch.push(
-            io::restrict(closable_device<direct_input>(seq.new_operation(1)), 0)
+            io::BOOST_RESTRICT(
+                closable_device<direct_input>(seq.new_operation(1)), 
+                0
+            )
         );
         BOOST_CHECK_NO_THROW(ch.reset());
         BOOST_CHECK_OPERATION_SEQUENCE(seq);
@@ -561,7 +587,7 @@
         operation_sequence  seq;
         chain<seekable>     ch;
         ch.push(
-            io::restrict(
+            io::BOOST_RESTRICT(
                 closable_device<direct_seekable>(seq.new_operation(1)), 
                 0
             )
@@ -577,7 +603,12 @@
     {
         operation_sequence  seq;
         chain<input>        ch;
-        ch.push(io::restrict(closable_filter<input>(seq.new_operation(2)), 0));
+        ch.push(
+            io::BOOST_RESTRICT(
+                closable_filter<input>(seq.new_operation(2)), 
+                0
+            )
+        );
         ch.push(closable_device<input>(seq.new_operation(1)));
         BOOST_CHECK_NO_THROW(ch.reset());
         BOOST_CHECK_OPERATION_SEQUENCE(seq);
@@ -588,7 +619,10 @@
         operation_sequence  seq;
         chain<seekable>     ch;
         ch.push(
-            io::restrict(closable_filter<seekable>(seq.new_operation(1)), 0)
+            io::BOOST_RESTRICT(
+                closable_filter<seekable>(seq.new_operation(1)), 
+                0
+            )
         );
         ch.push(closable_device<seekable>(seq.new_operation(2)));
         BOOST_CHECK_NO_THROW(ch.reset());
@@ -600,7 +634,7 @@
         operation_sequence  seq;
         chain<input>        ch;
         ch.push(
-            io::restrict(
+            io::BOOST_RESTRICT(
                 closable_filter<dual_use>(
                     seq.new_operation(2),
                     seq.new_operation(3)
@@ -618,7 +652,7 @@
         operation_sequence  seq;
         chain<output>       ch;
         ch.push(
-            io::restrict(
+            io::BOOST_RESTRICT(
                 closable_filter<dual_use>(
                     seq.new_operation(1),
                     seq.new_operation(2)
@@ -634,7 +668,8 @@
 
 test_suite* init_unit_test_suite(int, char* []) 
 {
-    test_suite* test = BOOST_TEST_SUITE("restrict test");
+    test_suite* test = 
+        BOOST_TEST_SUITE(BOOST_STRINGIZE(BOOST_RESTRICT) " test");
     test->add(BOOST_TEST_CASE(&read_device));
     test->add(BOOST_TEST_CASE(&read_direct_device));
     test->add(BOOST_TEST_CASE(&read_filter));
Modified: trunk/libs/iostreams/test/stream_offset_64bit_test.cpp
==============================================================================
--- trunk/libs/iostreams/test/stream_offset_64bit_test.cpp	(original)
+++ trunk/libs/iostreams/test/stream_offset_64bit_test.cpp	2008-01-07 00:20:32 EST (Mon, 07 Jan 2008)
@@ -13,8 +13,11 @@
  * with large (64-bit) file offsets.
  */
 
+#include <cstdio>            // fpos_t
+#include <iostream>
 #include <sstream>
 #include <boost/config.hpp>  // BOOST_MSVC
+#include <boost/iostreams/detail/ios.hpp>
 #include <boost/iostreams/positioning.hpp>
 #include <boost/test/test_tools.hpp>
 #include <boost/test/unit_test.hpp>
@@ -29,7 +32,7 @@
 #endif
 
 void stream_offset_64bit_test()
-{    
+{
     stream_offset  large_file = (stream_offset) 100 *
                                 (stream_offset) 1024 *
                                 (stream_offset) 1024 *
@@ -40,11 +43,18 @@
     for (stream_offset off = first; off < last; off += 10000000)
     {
         if (off != position_to_offset(offset_to_position(off))) {
+            cout << "****************************************\n"
+                 << "* sizeof(fpos_t) = " << sizeof(fpos_t) << "\n"
+                 << "* sizeof(streamoff) = " << sizeof(streamoff) << "\n"
+                 << "* sizeof(stream_offset) = " 
+                 << sizeof(stream_offset) << "\n"
+                 << "****************************************\n";
             stringstream s;
             s << "off != position_to_offset(offset_to_position(off)) "
-                 "failed for (off >> 32) == " 
+                 "failed for (off >> 32) == 0x" 
+              << hex
               << static_cast<unsigned int>(off >> 32) 
-              << " and (off & 0xFFFFFFFF) == "
+              << " and (off & 0xFFFFFFFF) == 0x"
               << static_cast<unsigned int>(off & 0xFFFFFFFF);
             BOOST_REQUIRE_MESSAGE(0, s.str().c_str());
         }