OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
7 | 7 |
8 #include "bin/file.h" | 8 #include "bin/file.h" |
9 | 9 |
10 #include <fcntl.h> // NOLINT | 10 #include <fcntl.h> // NOLINT |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 if (!result) { | 109 if (!result) { |
110 Log::PrintErr("VirtualProtect failed %d\n", GetLastError()); | 110 Log::PrintErr("VirtualProtect failed %d\n", GetLastError()); |
111 VirtualFree(addr, 0, MEM_RELEASE); | 111 VirtualFree(addr, 0, MEM_RELEASE); |
112 return NULL; | 112 return NULL; |
113 } | 113 } |
114 return new MappedMemory(addr, length); | 114 return new MappedMemory(addr, length); |
115 } | 115 } |
116 | 116 |
117 | 117 |
118 void MappedMemory::Unmap() { | 118 void MappedMemory::Unmap() { |
119 bool result = VirtualFree(address_, size_, MEM_RELEASE); | 119 BOOL result = VirtualFree(address_, 0, MEM_RELEASE); |
120 ASSERT(result); | 120 ASSERT(result); |
121 address_ = 0; | 121 address_ = 0; |
122 size_ = 0; | 122 size_ = 0; |
123 } | 123 } |
124 | 124 |
125 | 125 |
126 int64_t File::Read(void* buffer, int64_t num_bytes) { | 126 int64_t File::Read(void* buffer, int64_t num_bytes) { |
127 ASSERT(handle_->fd() >= 0); | 127 ASSERT(handle_->fd() >= 0); |
128 return read(handle_->fd(), buffer, num_bytes); | 128 return read(handle_->fd(), buffer, num_bytes); |
129 } | 129 } |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 return kIdentical; | 728 return kIdentical; |
729 } else { | 729 } else { |
730 return kDifferent; | 730 return kDifferent; |
731 } | 731 } |
732 } | 732 } |
733 | 733 |
734 } // namespace bin | 734 } // namespace bin |
735 } // namespace dart | 735 } // namespace dart |
736 | 736 |
737 #endif // defined(TARGET_OS_WINDOWS) | 737 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |