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

Unified Diff: runtime/bin/utils_win.cc

Issue 2285223003: Fix native extension lookup (Closed)
Patch Set: Add back test for '/' Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/utils_win.cc
diff --git a/runtime/bin/utils_win.cc b/runtime/bin/utils_win.cc
index 7e3cfb689a7caf953365ca083faf72e9569070d5..4b0b1fa01e707a20d80d35fd3637990f915a8b98 100644
--- a/runtime/bin/utils_win.cc
+++ b/runtime/bin/utils_win.cc
@@ -159,6 +159,23 @@ const wchar_t* StringUtilsWin::Utf8ToWide(
}
+char* StringUtils::StrNDup(const char* s, intptr_t n) {
+ intptr_t len = strlen(s);
+ if ((n < 0) || (len < 0)) {
+ return NULL;
+ }
+ if (n < len) {
+ len = n;
+ }
+ char* result = reinterpret_cast<char*>(malloc(len + 1));
+ if (result == NULL) {
+ return NULL;
+ }
+ result[len] = '\0';
+ return reinterpret_cast<char*>(memmove(result, s, len));
+}
+
+
bool ShellUtils::GetUtf8Argv(int argc, char** argv) {
wchar_t* command_line = GetCommandLineW();
int unicode_argc;

Powered by Google App Engine
This is Rietveld 408576698