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

Side by Side Diff: runtime/bin/utils_win.cc

Issue 2285223003: Fix native extension lookup (Closed)
Patch Set: Update test for error message change Created 4 years, 3 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 | « runtime/bin/utils_macos.cc ('k') | tests/standalone/io/test_extension_fail_test.dart » ('j') | 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 "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_WINDOWS) 6 #if defined(TARGET_OS_WINDOWS)
7 7
8 #include <errno.h> // NOLINT 8 #include <errno.h> // NOLINT
9 #include <time.h> // NOLINT 9 #include <time.h> // NOLINT
10 10
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 153
154 154
155 const wchar_t* StringUtilsWin::Utf8ToWide( 155 const wchar_t* StringUtilsWin::Utf8ToWide(
156 const char* utf8, intptr_t len, intptr_t* result_len) { 156 const char* utf8, intptr_t len, intptr_t* result_len) {
157 return const_cast<const wchar_t*>( 157 return const_cast<const wchar_t*>(
158 StringUtilsWin::Utf8ToWide(const_cast<char*>(utf8), len, result_len)); 158 StringUtilsWin::Utf8ToWide(const_cast<char*>(utf8), len, result_len));
159 } 159 }
160 160
161 161
162 char* StringUtils::StrNDup(const char* s, intptr_t n) {
163 intptr_t len = strlen(s);
164 if ((n < 0) || (len < 0)) {
165 return NULL;
166 }
167 if (n < len) {
168 len = n;
169 }
170 char* result = reinterpret_cast<char*>(malloc(len + 1));
171 if (result == NULL) {
172 return NULL;
173 }
174 result[len] = '\0';
175 return reinterpret_cast<char*>(memmove(result, s, len));
176 }
177
178
162 bool ShellUtils::GetUtf8Argv(int argc, char** argv) { 179 bool ShellUtils::GetUtf8Argv(int argc, char** argv) {
163 wchar_t* command_line = GetCommandLineW(); 180 wchar_t* command_line = GetCommandLineW();
164 int unicode_argc; 181 int unicode_argc;
165 wchar_t** unicode_argv = CommandLineToArgvW(command_line, &unicode_argc); 182 wchar_t** unicode_argv = CommandLineToArgvW(command_line, &unicode_argc);
166 if (unicode_argv == NULL) { 183 if (unicode_argv == NULL) {
167 return false; 184 return false;
168 } 185 }
169 // The argc passed to main should have the same argc as we get here. 186 // The argc passed to main should have the same argc as we get here.
170 ASSERT(argc == unicode_argc); 187 ASSERT(argc == unicode_argc);
171 if (argc < unicode_argc) { 188 if (argc < unicode_argc) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 259
243 260
244 void TimerUtils::Sleep(int64_t millis) { 261 void TimerUtils::Sleep(int64_t millis) {
245 ::Sleep(millis); 262 ::Sleep(millis);
246 } 263 }
247 264
248 } // namespace bin 265 } // namespace bin
249 } // namespace dart 266 } // namespace dart
250 267
251 #endif // defined(TARGET_OS_WINDOWS) 268 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « runtime/bin/utils_macos.cc ('k') | tests/standalone/io/test_extension_fail_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698