| Index: third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc
|
| diff --git a/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc b/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc
|
| index deb3d0f19a12d5eb87a2ad726177291611febeac..fcad6b61652b5e69ca388063a3eb6d7293425d98 100644
|
| --- a/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc
|
| +++ b/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc
|
| @@ -33,6 +33,7 @@
|
| // Sanjay Ghemawat, Jeff Dean, and others.
|
|
|
| #include <google/protobuf/compiler/command_line_interface.h>
|
| +#include <google/protobuf/stubs/platform_macros.h>
|
|
|
| #include <stdio.h>
|
| #include <sys/types.h>
|
| @@ -45,9 +46,14 @@
|
| #include <unistd.h>
|
| #endif
|
| #include <errno.h>
|
| +#include <fstream>
|
| #include <iostream>
|
| #include <ctype.h>
|
|
|
| +#ifdef GOOGLE_PROTOBUF_ARCH_SPARC
|
| +#include <limits.h> //For PATH_MAX
|
| +#endif
|
| +
|
| #include <memory>
|
| #ifndef _SHARED_PTR_H
|
| #include <google/protobuf/stubs/shared_ptr.h>
|
| @@ -943,17 +949,23 @@ bool CommandLineInterface::MakeInputsBeProtoPathRelative(
|
| return true;
|
| }
|
|
|
| +
|
| CommandLineInterface::ParseArgumentStatus
|
| CommandLineInterface::ParseArguments(int argc, const char* const argv[]) {
|
| executable_name_ = argv[0];
|
|
|
| + vector<string> arguments;
|
| + for (int i = 1; i < argc; ++i) {
|
| + arguments.push_back(argv[i]);
|
| + }
|
| +
|
| // Iterate through all arguments and parse them.
|
| - for (int i = 1; i < argc; i++) {
|
| + for (int i = 0; i < arguments.size(); ++i) {
|
| string name, value;
|
|
|
| - if (ParseArgument(argv[i], &name, &value)) {
|
| + if (ParseArgument(arguments[i].c_str(), &name, &value)) {
|
| // Returned true => Use the next argument as the flag value.
|
| - if (i + 1 == argc || argv[i+1][0] == '-') {
|
| + if (i + 1 == arguments.size() || arguments[i + 1][0] == '-') {
|
| std::cerr << "Missing value for flag: " << name << std::endl;
|
| if (name == "--decode") {
|
| std::cerr << "To decode an unknown message, use --decode_raw."
|
| @@ -962,7 +974,7 @@ CommandLineInterface::ParseArguments(int argc, const char* const argv[]) {
|
| return PARSE_ARGUMENT_FAIL;
|
| } else {
|
| ++i;
|
| - value = argv[i];
|
| + value = arguments[i];
|
| }
|
| }
|
|
|
|
|