OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits.h> | 5 #include <limits.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <iostream> | 7 #include <iostream> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 return ipc_fuzzer::MessageNames::GetInstance()->TypeToName(msg->type()); | 66 return ipc_fuzzer::MessageNames::GetInstance()->TypeToName(msg->type()); |
67 } | 67 } |
68 | 68 |
69 bool MessageMatches(const IPC::Message* msg, const RE2& pattern) { | 69 bool MessageMatches(const IPC::Message* msg, const RE2& pattern) { |
70 return RE2::FullMatch(MessageName(msg), pattern); | 70 return RE2::FullMatch(MessageName(msg), pattern); |
71 } | 71 } |
72 | 72 |
73 } // namespace | 73 } // namespace |
74 | 74 |
75 int main(int argc, char** argv) { | 75 int main(int argc, char** argv) { |
76 CommandLine::Init(argc, argv); | 76 base::CommandLine::Init(argc, argv); |
77 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 77 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
78 CommandLine::StringVector args = cmd->GetArgs(); | 78 base::CommandLine::StringVector args = cmd->GetArgs(); |
79 | 79 |
80 if (args.size() < 1 || args.size() > 2 || cmd->HasSwitch(kHelpSwitch)) { | 80 if (args.size() < 1 || args.size() > 2 || cmd->HasSwitch(kHelpSwitch)) { |
81 usage(); | 81 usage(); |
82 return EXIT_FAILURE; | 82 return EXIT_FAILURE; |
83 } | 83 } |
84 | 84 |
85 size_t start_index = 0; | 85 size_t start_index = 0; |
86 if (cmd->HasSwitch(kStartSwitch)) { | 86 if (cmd->HasSwitch(kStartSwitch)) { |
87 int temp = atoi(cmd->GetSwitchValueASCII(kStartSwitch).c_str()); | 87 int temp = atoi(cmd->GetSwitchValueASCII(kStartSwitch).c_str()); |
88 if (temp > 0 ) | 88 if (temp > 0 ) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 } else { | 148 } else { |
149 if (!ipc_fuzzer::MessageFile::Write( | 149 if (!ipc_fuzzer::MessageFile::Write( |
150 base::FilePath(output_file_name), output_message_vector)) { | 150 base::FilePath(output_file_name), output_message_vector)) { |
151 return EXIT_FAILURE; | 151 return EXIT_FAILURE; |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 return EXIT_SUCCESS; | 155 return EXIT_SUCCESS; |
156 } | 156 } |
OLD | NEW |