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

Unified Diff: src/IceBrowserCompileServer.cpp

Issue 1041843003: Add argv[0] before parsing commandline flags. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: stuff Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceBrowserCompileServer.cpp
diff --git a/src/IceBrowserCompileServer.cpp b/src/IceBrowserCompileServer.cpp
index 6a9ee65912eaaa27238a1fcbcb9291872070dfbe..85c2efe89ebc11ea1530bd54c89111a747744686 100644
--- a/src/IceBrowserCompileServer.cpp
+++ b/src/IceBrowserCompileServer.cpp
@@ -41,7 +41,7 @@ void getIRTInterfaces() {
}
char *onInitCallback(uint32_t NumThreads, int *ObjFileFDs,
- size_t ObjFileFDCount, char **argv, size_t argc) {
+ size_t ObjFileFDCount, char **CLArgs, size_t CLArgsLen) {
if (ObjFileFDCount < 1) {
std::string Buffer;
llvm::raw_string_ostream StrBuf(Buffer);
@@ -56,8 +56,17 @@ char *onInitCallback(uint32_t NumThreads, int *ObjFileFDs,
StrBuf << "Invalid FD given for onInitCallback " << ObjFileFD << "\n";
return strdup(StrBuf.str().c_str());
}
- // NOTE: argv is owned by the caller, but we parse here before returning.
- gCompileServer->getParsedFlags(NumThreads, argc, argv);
+ // CLArgs is almost an "argv", but is missing the argv[0] program name.
+ std::vector<char *> Argv;
Mircea Trofin 2015/03/31 17:24:04 you could just std::vector<char *> Argv(CLArgsLen
Jim Stichnoth 2015/03/31 17:26:44 True, but then the push_back() calls have to be re
jvoung (off chromium) 2015/03/31 20:41:16 Hmm, I'll stick with reserve() then. Another optio
+ char ProgramName[] = "pnacl-sz.nexe";
+ Argv.reserve(CLArgsLen + 1);
+ Argv.push_back(ProgramName);
+ for (size_t i = 0; i < CLArgsLen; ++i) {
+ Argv.push_back(CLArgs[i]);
+ }
+ // NOTE: strings pointed to by argv are owned by the caller, but we parse
+ // here before returning and don't store them.
+ gCompileServer->getParsedFlags(NumThreads, Argv.size(), Argv.data());
gCompileServer->startCompileThread(ObjFileFD);
return nullptr;
}
« 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