OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/eventhandler.h" | 8 #include "bin/eventhandler.h" |
9 | 9 |
10 #include <process.h> // NOLINT | 10 #include <process.h> // NOLINT |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 OverlappedBuffer* buffer = | 70 OverlappedBuffer* buffer = |
71 CONTAINING_RECORD(overlapped, OverlappedBuffer, overlapped_); | 71 CONTAINING_RECORD(overlapped, OverlappedBuffer, overlapped_); |
72 return buffer; | 72 return buffer; |
73 } | 73 } |
74 | 74 |
75 | 75 |
76 int OverlappedBuffer::Read(void* buffer, int num_bytes) { | 76 int OverlappedBuffer::Read(void* buffer, int num_bytes) { |
77 if (num_bytes > GetRemainingLength()) { | 77 if (num_bytes > GetRemainingLength()) { |
78 num_bytes = GetRemainingLength(); | 78 num_bytes = GetRemainingLength(); |
79 } | 79 } |
80 memcpy(buffer, GetBufferStart() + index_, num_bytes); | 80 memmove(buffer, GetBufferStart() + index_, num_bytes); |
81 index_ += num_bytes; | 81 index_ += num_bytes; |
82 return num_bytes; | 82 return num_bytes; |
83 } | 83 } |
84 | 84 |
85 | 85 |
86 int OverlappedBuffer::Write(const void* buffer, int num_bytes) { | 86 int OverlappedBuffer::Write(const void* buffer, int num_bytes) { |
87 ASSERT(num_bytes == buflen_); | 87 ASSERT(num_bytes == buflen_); |
88 memcpy(GetBufferStart(), buffer, num_bytes); | 88 memmove(GetBufferStart(), buffer, num_bytes); |
89 data_length_ = num_bytes; | 89 data_length_ = num_bytes; |
90 return num_bytes; | 90 return num_bytes; |
91 } | 91 } |
92 | 92 |
93 | 93 |
94 int OverlappedBuffer::GetRemainingLength() { | 94 int OverlappedBuffer::GetRemainingLength() { |
95 ASSERT(operation_ == kRead); | 95 ASSERT(operation_ == kRead); |
96 return data_length_ - index_; | 96 return data_length_ - index_; |
97 } | 97 } |
98 | 98 |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 | 1059 |
1060 | 1060 |
1061 void EventHandlerImplementation::Shutdown() { | 1061 void EventHandlerImplementation::Shutdown() { |
1062 SendData(kShutdownId, 0, 0); | 1062 SendData(kShutdownId, 0, 0); |
1063 } | 1063 } |
1064 | 1064 |
1065 } // namespace bin | 1065 } // namespace bin |
1066 } // namespace dart | 1066 } // namespace dart |
1067 | 1067 |
1068 #endif // defined(TARGET_OS_WINDOWS) | 1068 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |