Boost logo

Boost-Commit :

From: technews_at_[hidden]
Date: 2008-01-11 16:33:28


Author: turkanis
Date: 2008-01-11 16:33:28 EST (Fri, 11 Jan 2008)
New Revision: 42686
URL: http://svn.boost.org/trac/boost/changeset/42686

Log:
reverted last commit, since it is known to fail on 64-bit Windows; instead, added configured fpos_t_to_offset for IMB; added detailed documentation
Text files modified:
   branches/iostreams_dev/boost/iostreams/positioning.hpp | 21 +++++++++++++++------
   1 files changed, 15 insertions(+), 6 deletions(-)

Modified: branches/iostreams_dev/boost/iostreams/positioning.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/positioning.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/positioning.hpp 2008-01-11 16:33:28 EST (Fri, 11 Jan 2008)
@@ -65,17 +65,28 @@
 
 # else // # ifndef BOOST_IOSTREAMS_HAS_DINKUMWARE_FPOS
 
-// Helper function
+// In the Dinkumware standard library, a stream position is represented by two
+// integral stream offsets -- _Fpos, of type std::fpos_t, and _Myoff, of type
+// std::streamoff -- together with a conversion state. The value of _Fpos can be
+// extracted using the implementation-defined member functions seekpos() or
+// get_fpos_t(), depending on the Dinkumware version. The value of _Myoff cannot
+// be extracted directly, but can be calculated as the difference between the
+// result of converting the std::fpos to a std::streamoff and the result of
+// converting the member _Fpos to a long. The latter operation is accomplished
+// with the macro _FPOSOFF, which works correctly on platforms where std::fpos_t
+// is a struct and platforms where it is an integral type.
+
+// Converts a std::fpos_t to a stream_offset
 inline stream_offset fpos_t_to_offset(std::fpos_t pos)
 {
-# if defined(_POSIX_) || (_INTEGRAL_MAX_BITS >= 64)
+# if defined(_POSIX_) || (_INTEGRAL_MAX_BITS >= 64) || defined(__IBMCPP__)
     return pos;
 # else
     return _FPOSOFF(pos);
 # endif
 }
 
-// Helper function
+// Extracts the member _Fpos from a std::fpos
 inline std::fpos_t streampos_to_fpos_t(std::streampos pos)
 {
 # if defined (_CPPLIB_VER) || defined(__IBMCPP__)
@@ -89,9 +100,7 @@
 {
     return fpos_t_to_offset(streampos_to_fpos_t(pos)) +
            static_cast<stream_offset>(static_cast<std::streamoff>(pos)) -
- static_cast<stream_offset>(
- static_cast<std::streamoff>(streampos_to_fpos_t(pos))
- );
+ static_cast<stream_offset>(_FPOSOFF(streampos_to_fpos_t(pos)));
 }
 
 # endif // # ifndef BOOST_IOSTREAMS_HAS_DINKUMWARE_FPOS


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