Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74051 - sandbox/mmap/boost/mmap/mappble_objects/file/win32
From: dsaritz_at_[hidden]
Date: 2011-08-24 17:35:26


Author: psiha
Date: 2011-08-24 17:35:24 EDT (Wed, 24 Aug 2011)
New Revision: 74051
URL: http://svn.boost.org/trac/boost/changeset/74051

Log:
Added Win64 support.
Text files modified:
   sandbox/mmap/boost/mmap/mappble_objects/file/win32/file.inl | 36 +++++++++++++++++++++++++++++-------
   1 files changed, 29 insertions(+), 7 deletions(-)

Modified: sandbox/mmap/boost/mmap/mappble_objects/file/win32/file.inl
==============================================================================
--- sandbox/mmap/boost/mmap/mappble_objects/file/win32/file.inl (original)
+++ sandbox/mmap/boost/mmap/mappble_objects/file/win32/file.inl 2011-08-24 17:35:24 EDT (Wed, 24 Aug 2011)
@@ -56,13 +56,29 @@
     // It is 'OK' to send null/invalid handles to Windows functions (they will
     // simply fail), this simplifies error handling (it is enough to go through
     // all the logic, inspect the final result and then throw on error).
- DWORD const new_size( ::SetFilePointer( file_handle, desired_size, 0, FILE_BEGIN ) );
- BOOST_ASSERT( ( new_size == desired_size ) || ( file_handle == INVALID_HANDLE_VALUE ) );
- ignore_unused_variable_warning( new_size );
+ #ifdef _WIN64
+ BOOST_VERIFY
+ (
+ ::SetFilePointerEx( file_handle, reinterpret_cast<LARGE_INTEGER const &>( desired_size ), NULL, FILE_BEGIN ) ||
+ ( file_handle == INVALID_HANDLE_VALUE )
+ );
+ #else // _WIN32/64
+ DWORD const new_size( ::SetFilePointer( file_handle, desired_size, NULL, FILE_BEGIN ) );
+ BOOST_ASSERT( ( new_size == desired_size ) || ( file_handle == INVALID_HANDLE_VALUE ) );
+ ignore_unused_variable_warning( new_size );
+ #endif // _WIN32/64
 
     BOOL const success( ::SetEndOfFile( file_handle ) );
 
- BOOST_VERIFY( ( ::SetFilePointer( file_handle, 0, 0, FILE_BEGIN ) == 0 ) || ( file_handle == INVALID_HANDLE_VALUE ) );
+ #ifdef _WIN64
+ BOOST_VERIFY
+ (
+ ::SetFilePointerEx( file_handle, 0, NULL, FILE_BEGIN ) ||
+ ( file_handle == INVALID_HANDLE_VALUE )
+ );
+ #else // _WIN32/64
+ BOOST_VERIFY( ( ::SetFilePointer( file_handle, 0, NULL, FILE_BEGIN ) == 0 ) || ( file_handle == INVALID_HANDLE_VALUE ) );
+ #endif // _WIN32/64
 
     return success != false;
 }
@@ -71,9 +87,15 @@
 BOOST_IMPL_INLINE
 std::size_t get_size( handle<win32>::reference const file_handle )
 {
- DWORD const file_size( ::GetFileSize( file_handle, 0 ) );
- BOOST_ASSERT( ( file_size != INVALID_FILE_SIZE ) || ( file_handle == INVALID_HANDLE_VALUE ) || ( ::GetLastError() == NO_ERROR ) );
- return file_size;
+ #ifdef _WIN64
+ LARGE_INTEGER file_size;
+ BOOST_VERIFY( ::GetFileSizeEx( file_handle, &file_size ) || ( file_handle == INVALID_HANDLE_VALUE ) );
+ return file_size.QuadPart;
+ #else // _WIN32/64
+ DWORD const file_size( ::GetFileSize( file_handle, 0 ) );
+ BOOST_ASSERT( ( file_size != INVALID_FILE_SIZE ) || ( file_handle == INVALID_HANDLE_VALUE ) || ( ::GetLastError() == NO_ERROR ) );
+ return file_size;
+ #endif // _WIN32/64
 }
 
 //------------------------------------------------------------------------------


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