Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73053 - sandbox/mmap/boost/mmap
From: dsaritz_at_[hidden]
Date: 2011-07-13 11:33:47


Author: psiha
Date: 2011-07-13 11:33:46 EDT (Wed, 13 Jul 2011)
New Revision: 73053
URL: http://svn.boost.org/trac/boost/changeset/73053

Log:
Removed the mapping_system_hints parameter from the mapped_view<Element const>::map() member function as it is redundant for read only views.
Fixed the map_file() function.
Minor other refactoring.
Text files modified:
   sandbox/mmap/boost/mmap/memory_mapping.cpp | 14 ++++++++------
   sandbox/mmap/boost/mmap/memory_mapping.hpp | 6 ++----
   2 files changed, 10 insertions(+), 10 deletions(-)

Modified: sandbox/mmap/boost/mmap/memory_mapping.cpp
==============================================================================
--- sandbox/mmap/boost/mmap/memory_mapping.cpp (original)
+++ sandbox/mmap/boost/mmap/memory_mapping.cpp 2011-07-13 11:33:46 EDT (Wed, 13 Jul 2011)
@@ -260,7 +260,7 @@
     mapping_flags flags;
 #ifdef _WIN32
     flags.create_mapping_flags = ( handle_access_flags & handle_access_rights::execute ) ? PAGE_EXECUTE : PAGE_NOACCESS;
- if ( share_mode & share_mode::hidden ) // WRITECOPY
+ if ( share_mode == share_mode::hidden ) // WRITECOPY
         flags.create_mapping_flags *= 8;
     else
     if ( handle_access_flags & handle_access_rights::write )
@@ -360,8 +360,7 @@
     guard::native_handle_t const object_handle,
     std::size_t const desired_size,
     std::size_t const offset,
- bool const map_for_code_execution,
- unsigned int const mapping_system_hints
+ bool const map_for_code_execution
 )
 {
     return mapped_view<unsigned char>::map
@@ -371,7 +370,7 @@
         (
             mapping_flags::handle_access_rights::read | ( map_for_code_execution ? mapping_flags::handle_access_rights::execute : 0 ),
             mapping_flags::share_mode::shared,
- mapping_system_hints
+ mapping_flags::system_hint::uninitialized
         ),
         desired_size,
         offset
@@ -379,7 +378,7 @@
 }
 
 
-basic_mapped_view map_file( char const * const file_name, std::size_t const desired_size )
+basic_mapped_view map_file( char const * const file_name, std::size_t desired_size )
 {
     guard::native_handle const file_handle
     (
@@ -397,7 +396,10 @@
         )
     );
 
- set_file_size( file_handle.handle(), desired_size );
+ if ( desired_size )
+ set_file_size( file_handle.handle(), desired_size );
+ else
+ desired_size = get_file_size( file_handle.handle() );
 
     return basic_mapped_view::map
     (

Modified: sandbox/mmap/boost/mmap/memory_mapping.hpp
==============================================================================
--- sandbox/mmap/boost/mmap/memory_mapping.hpp (original)
+++ sandbox/mmap/boost/mmap/memory_mapping.hpp 2011-07-13 11:33:46 EDT (Wed, 13 Jul 2011)
@@ -367,8 +367,7 @@
         guard::native_handle_t object_handle,
         std::size_t desired_size,
         std::size_t offset = 0,
- bool map_for_code_execution = false,
- unsigned int mapping_system_hints = mapping_flags::system_hint::uninitialized
+ bool map_for_code_execution = false
     );
 
 private:
@@ -415,8 +414,7 @@
     guard::native_handle_t object_handle,
     std::size_t desired_size,
     std::size_t offset,
- bool map_for_code_execution,
- unsigned int mapping_system_hints
+ bool map_for_code_execution
 );
 
 


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