Boost logo

Boost-Commit :

From: igaztanaga_at_[hidden]
Date: 2007-10-25 11:53:19


Author: igaztanaga
Date: 2007-10-25 11:53:19 EDT (Thu, 25 Oct 2007)
New Revision: 40461
URL: http://svn.boost.org/trac/boost/changeset/40461

Log:
Corrected error when checking file size against maximum address range for 64 bit platforms
Text files modified:
   trunk/boost/interprocess/mapped_region.hpp | 6 +++++-
   1 files changed, 5 insertions(+), 1 deletions(-)

Modified: trunk/boost/interprocess/mapped_region.hpp
==============================================================================
--- trunk/boost/interprocess/mapped_region.hpp (original)
+++ trunk/boost/interprocess/mapped_region.hpp 2007-10-25 11:53:19 EDT (Thu, 25 Oct 2007)
@@ -20,6 +20,7 @@
 #include <boost/interprocess/detail/utilities.hpp>
 #include <boost/interprocess/detail/os_file_functions.hpp>
 #include <string>
+#include <limits>
 
 #if (defined BOOST_WINDOWS) && !(defined BOOST_DISABLE_WIN32)
 # include <boost/interprocess/detail/win32_api.hpp>
@@ -242,7 +243,10 @@
             error_info err(winapi::get_last_error());
             throw interprocess_exception(err);
          }
- if(total_size > (__int64)((std::size_t)(-1))){
+ #ifdef max
+ #undef max
+ #endif
+ if(total_size > std::numeric_limits<std::size_t>::max()){
             error_info err(size_error);
             throw interprocess_exception(err);
          }


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