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 "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
7 | 7 |
8 #include "vm/os.h" | 8 #include "vm/os.h" |
9 #include "vm/vtune.h" | 9 #include "vm/vtune.h" |
10 | 10 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 return NULL; | 189 return NULL; |
190 } | 190 } |
191 if (n < len) { | 191 if (n < len) { |
192 len = n; | 192 len = n; |
193 } | 193 } |
194 char* result = reinterpret_cast<char*>(malloc(len + 1)); | 194 char* result = reinterpret_cast<char*>(malloc(len + 1)); |
195 if (result == NULL) { | 195 if (result == NULL) { |
196 return NULL; | 196 return NULL; |
197 } | 197 } |
198 result[len] = '\0'; | 198 result[len] = '\0'; |
199 return reinterpret_cast<char*>(memcpy(result, s, len)); | 199 return reinterpret_cast<char*>(memmove(result, s, len)); |
200 } | 200 } |
201 | 201 |
202 | 202 |
203 void OS::Print(const char* format, ...) { | 203 void OS::Print(const char* format, ...) { |
204 va_list args; | 204 va_list args; |
205 va_start(args, format); | 205 va_start(args, format); |
206 VFPrint(stdout, format, args); | 206 VFPrint(stdout, format, args); |
207 va_end(args); | 207 va_end(args); |
208 } | 208 } |
209 | 209 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 } | 311 } |
312 | 312 |
313 | 313 |
314 void OS::Exit(int code) { | 314 void OS::Exit(int code) { |
315 exit(code); | 315 exit(code); |
316 } | 316 } |
317 | 317 |
318 } // namespace dart | 318 } // namespace dart |
319 | 319 |
320 #endif // defined(TARGET_OS_WINDOWS) | 320 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |