Boost logo

Boost-Commit :

From: technews_at_[hidden]
Date: 2007-12-29 23:19:39


Author: turkanis
Date: 2007-12-29 23:19:38 EST (Sat, 29 Dec 2007)
New Revision: 42357
URL: http://svn.boost.org/trac/boost/changeset/42357

Log:
ported changes from branches/iostreams_dev revisions 42343-42356
Text files modified:
   trunk/boost/iostreams/device/mapped_file.hpp | 1 +
   trunk/libs/iostreams/src/file_descriptor.cpp | 2 +-
   trunk/libs/iostreams/src/mapped_file.cpp | 12 ++++++++++--
   trunk/libs/iostreams/test/detail/verification.hpp | 2 +-
   4 files changed, 13 insertions(+), 4 deletions(-)

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-29 23:19:38 EST (Sat, 29 Dec 2007)
@@ -221,6 +221,7 @@
           public closable_tag
         { };
     using mapped_file::close;
+ using mapped_file::size;
     explicit mapped_file_sink(mapped_file_params p);
     explicit mapped_file_sink( const std::string& path,
                                size_type length = max_length,

Modified: trunk/libs/iostreams/src/file_descriptor.cpp
==============================================================================
--- trunk/libs/iostreams/src/file_descriptor.cpp (original)
+++ trunk/libs/iostreams/src/file_descriptor.cpp 2007-12-29 23:19:38 EST (Sat, 29 Dec 2007)
@@ -81,7 +81,7 @@
     HANDLE handle =
         ::CreateFileA( path.c_str(),
                        dwDesiredAccess,
- 0, // dwShareMode
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
                        NULL, // lpSecurityAttributes
                        dwCreationDisposition,
                        FILE_ATTRIBUTE_NORMAL,

Modified: trunk/libs/iostreams/src/mapped_file.cpp
==============================================================================
--- trunk/libs/iostreams/src/mapped_file.cpp (original)
+++ trunk/libs/iostreams/src/mapped_file.cpp 2007-12-29 23:19:38 EST (Sat, 29 Dec 2007)
@@ -22,6 +22,9 @@
 #ifdef BOOST_IOSTREAMS_WINDOWS
 # define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
 # include <windows.h>
+# ifndef INVALID_SET_FILE_POINTER
+# define INVALID_SET_FILE_POINTER ((DWORD)-1)
+# endif
 #else
 # include <errno.h>
 # include <fcntl.h>
@@ -194,9 +197,14 @@
     if (p.new_file_size != 0 && !readonly) {
         LONG sizehigh = (p.new_file_size >> (sizeof(LONG) * 8));
         LONG sizelow = (p.new_file_size & 0xffffffff);
- ::SetFilePointer(pimpl_->handle_, sizelow, &sizehigh, FILE_BEGIN);
- if (::GetLastError() != NO_ERROR || !::SetEndOfFile(pimpl_->handle_))
+ DWORD result =
+ ::SetFilePointer(pimpl_->handle_, sizelow, &sizehigh, FILE_BEGIN);
+ if ( result == INVALID_SET_FILE_POINTER &&
+ ::GetLastError() != NO_ERROR ||
+ !::SetEndOfFile(pimpl_->handle_) )
+ {
             detail::cleanup_and_throw(*pimpl_, "failed setting file size");
+ }
     }
 
     //--------------Create mapping--------------------------------------------//

Modified: trunk/libs/iostreams/test/detail/verification.hpp
==============================================================================
--- trunk/libs/iostreams/test/detail/verification.hpp (original)
+++ trunk/libs/iostreams/test/detail/verification.hpp 2007-12-29 23:19:38 EST (Sat, 29 Dec 2007)
@@ -49,7 +49,7 @@
 BOOST_TEMPLATE_DECL
 bool compare_streams_in_chars(BOOST_ISTREAM& first, BOOST_ISTREAM& second)
 {
- for (int z = 0; z < 10; ++z)
+ for (int z = 0; z < data_reps; ++z)
         for (int w = 0; w < data_length(); ++w)
             if (first.eof() != second.eof() || first.get() != second.get())
                 return false;


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