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

Side by Side Diff: net/spdy/fuzzing/hpack_example_generator.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
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 "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "net/spdy/fuzzing/hpack_fuzz_util.h" 10 #include "net/spdy/fuzzing/hpack_fuzz_util.h"
(...skipping 18 matching lines...) Expand all
29 // sequentially encodes each header set with an HpackEncoder. Encoded header 29 // sequentially encodes each header set with an HpackEncoder. Encoded header
30 // sets are written to the output file in length-prefixed blocks. 30 // sets are written to the output file in length-prefixed blocks.
31 int main(int argc, char** argv) { 31 int main(int argc, char** argv) {
32 base::AtExitManager exit_manager; 32 base::AtExitManager exit_manager;
33 33
34 CommandLine::Init(argc, argv); 34 CommandLine::Init(argc, argv);
35 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 35 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
36 36
37 if (!command_line.HasSwitch(kFileToWrite) || 37 if (!command_line.HasSwitch(kFileToWrite) ||
38 !command_line.HasSwitch(kExampleCount)) { 38 !command_line.HasSwitch(kExampleCount)) {
39 LOG(ERROR) << "Usage: " << argv[0] 39 LOG(ERROR) << "Usage: " << argv[0] << " --" << kFileToWrite
40 << " --" << kFileToWrite << "=/path/to/file.out" 40 << "=/path/to/file.out"
41 << " --" << kExampleCount << "=1000"; 41 << " --" << kExampleCount << "=1000";
42 return -1; 42 return -1;
43 } 43 }
44 string file_to_write = command_line.GetSwitchValueASCII(kFileToWrite); 44 string file_to_write = command_line.GetSwitchValueASCII(kFileToWrite);
45 45
46 int example_count = 0; 46 int example_count = 0;
47 base::StringToInt(command_line.GetSwitchValueASCII(kExampleCount), 47 base::StringToInt(command_line.GetSwitchValueASCII(kExampleCount),
48 &example_count); 48 &example_count);
49 49
50 DVLOG(1) << "Writing output to " << file_to_write; 50 DVLOG(1) << "Writing output to " << file_to_write;
(...skipping 14 matching lines...) Expand all
65 65
66 string prefix = HpackFuzzUtil::HeaderBlockPrefix(buffer.size()); 66 string prefix = HpackFuzzUtil::HeaderBlockPrefix(buffer.size());
67 67
68 CHECK_LT(0, file_out.WriteAtCurrentPos(prefix.data(), prefix.size())); 68 CHECK_LT(0, file_out.WriteAtCurrentPos(prefix.data(), prefix.size()));
69 CHECK_LT(0, file_out.WriteAtCurrentPos(buffer.data(), buffer.size())); 69 CHECK_LT(0, file_out.WriteAtCurrentPos(buffer.data(), buffer.size()));
70 } 70 }
71 CHECK(file_out.Flush()); 71 CHECK(file_out.Flush());
72 DVLOG(1) << "Generated " << example_count << " blocks."; 72 DVLOG(1) << "Generated " << example_count << " blocks.";
73 return 0; 73 return 0;
74 } 74 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698