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

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

Issue 14121009: - memmove instead of memcpy. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« 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_MACOS) 6 #if defined(TARGET_OS_MACOS)
7 7
8 #include "vm/os.h" 8 #include "vm/os.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 return NULL; 145 return NULL;
146 } 146 }
147 if (n < len) { 147 if (n < len) {
148 len = n; 148 len = n;
149 } 149 }
150 char* result = reinterpret_cast<char*>(malloc(len + 1)); 150 char* result = reinterpret_cast<char*>(malloc(len + 1));
151 if (result == NULL) { 151 if (result == NULL) {
152 return NULL; 152 return NULL;
153 } 153 }
154 result[len] = '\0'; 154 result[len] = '\0';
155 return reinterpret_cast<char*>(memcpy(result, s, len)); 155 return reinterpret_cast<char*>(memmove(result, s, len));
156 #else // !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || ... 156 #else // !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || ...
157 return strndup(s, n); 157 return strndup(s, n);
158 #endif // !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || ... 158 #endif // !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || ...
159 } 159 }
160 160
161 161
162 void OS::Print(const char* format, ...) { 162 void OS::Print(const char* format, ...) {
163 va_list args; 163 va_list args;
164 va_start(args, format); 164 va_start(args, format);
165 VFPrint(stdout, format, args); 165 VFPrint(stdout, format, args);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 241 }
242 242
243 243
244 void OS::Exit(int code) { 244 void OS::Exit(int code) {
245 exit(code); 245 exit(code);
246 } 246 }
247 247
248 } // namespace dart 248 } // namespace dart
249 249
250 #endif // defined(TARGET_OS_MACOS) 250 #endif // defined(TARGET_OS_MACOS)
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