Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(529)

Side by Side Diff: runtime/vm/os_win.cc

Issue 1986363002: Fix definition of StrNLen on Windows. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9
10 #include <malloc.h> // NOLINT 10 #include <malloc.h> // NOLINT
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 } 252 }
253 char* result = reinterpret_cast<char*>(malloc(len + 1)); 253 char* result = reinterpret_cast<char*>(malloc(len + 1));
254 if (result == NULL) { 254 if (result == NULL) {
255 return NULL; 255 return NULL;
256 } 256 }
257 result[len] = '\0'; 257 result[len] = '\0';
258 return reinterpret_cast<char*>(memmove(result, s, len)); 258 return reinterpret_cast<char*>(memmove(result, s, len));
259 } 259 }
260 260
261 261
262 intptr_t OS::StrNDup(const char* s, intptr_t n) { 262 intptr_t OS::StrNLen(const char* s, intptr_t n) {
263 return strnlen(s, n); 263 return strnlen(s, n);
264 } 264 }
265 265
266 266
267 void OS::Print(const char* format, ...) { 267 void OS::Print(const char* format, ...) {
268 va_list args; 268 va_list args;
269 va_start(args, format); 269 va_start(args, format);
270 VFPrint(stdout, format, args); 270 VFPrint(stdout, format, args);
271 va_end(args); 271 va_end(args);
272 } 272 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 // TODO(zra): Remove once VM shuts down cleanly. 424 // TODO(zra): Remove once VM shuts down cleanly.
425 private_flag_windows_run_tls_destructors = false; 425 private_flag_windows_run_tls_destructors = false;
426 // On Windows we use ExitProcess so that threads can't clobber the exit_code. 426 // On Windows we use ExitProcess so that threads can't clobber the exit_code.
427 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 427 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870
428 ::ExitProcess(code); 428 ::ExitProcess(code);
429 } 429 }
430 430
431 } // namespace dart 431 } // namespace dart
432 432
433 #endif // defined(TARGET_OS_WINDOWS) 433 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698