diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-10 04:54:20 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-10 04:54:20 +0000 |
commit | 97c5b0f676ac189b02b71baa111c119b8ce5acdc (patch) | |
tree | 75650bccb864a8f0fef23f21afc65be1da8c46f7 /ace/Mem_Map.cpp | |
parent | ebf15c4c63630298289e7ef4e57a39268d477e22 (diff) | |
download | ATCD-97c5b0f676ac189b02b71baa111c119b8ce5acdc.tar.gz |
*** empty log message ***
Diffstat (limited to 'ace/Mem_Map.cpp')
-rw-r--r-- | ace/Mem_Map.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/ace/Mem_Map.cpp b/ace/Mem_Map.cpp index 8cd469585bf..e7d290d9ba0 100644 --- a/ace/Mem_Map.cpp +++ b/ace/Mem_Map.cpp @@ -61,12 +61,15 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle, this->base_addr_ = addr; this->handle_ = handle; - long file_len = ACE_OS::filesize (this->handle_); + long result = ACE_OS::filesize (this->handle_); - if (file_len == -1) + if (result == -1) return -1; - if (this->length_ < ACE_static_cast (size_t, file_len)) + // At this point we know <result> is not negative... + size_t file_len = ACE_static_cast (size_t, result); + + if (this->length_ < file_len) { // If the length of the mapped region is less than the length of // the file then we force a complete new remapping by setting @@ -75,22 +78,21 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle, this->close_filemapping_handle (); } - // At this point we know <file_len> is not negative... - this->length_ = ACE_static_cast (size_t, file_len); - - if (len_request == -1) - len_request = 0; - // Check to see if we need to extend the backing store int extend_backing_store = 0; - if (this->length_ < ACE_static_cast (size_t, len_request)) - extend_backing_store = 1; - - if (len_request > 0) + if (len_request != -1) { - // Set the correct length + if (file_len < ACE_static_cast (size_t, len_request)) + extend_backing_store = 1; + + // Set length to len_request this->length_ = len_request; } + else + { + // Set length to file_request + this->length_ = file_len; + } if (extend_backing_store) // Extend the backing store. |