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

Side by Side Diff: net/spdy/fuzzing/hpack_fuzz_util.h

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 #ifndef NET_SPDY_FUZZING_HPACK_FUZZ_UTIL_H_ 5 #ifndef NET_SPDY_FUZZING_HPACK_FUZZ_UTIL_H_
6 #define NET_SPDY_FUZZING_HPACK_FUZZ_UTIL_H_ 6 #define NET_SPDY_FUZZING_HPACK_FUZZ_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 25 matching lines...) Expand all
36 36
37 // Samples a size from the exponential distribution with mean |mean|, 37 // Samples a size from the exponential distribution with mean |mean|,
38 // upper-bounded by |sanity_bound|. 38 // upper-bounded by |sanity_bound|.
39 static size_t SampleExponential(size_t mean, size_t sanity_bound); 39 static size_t SampleExponential(size_t mean, size_t sanity_bound);
40 40
41 // Holds an input string, and manages an offset into that string. 41 // Holds an input string, and manages an offset into that string.
42 struct NET_EXPORT_PRIVATE Input { 42 struct NET_EXPORT_PRIVATE Input {
43 Input(); // Initializes |offset| to zero. 43 Input(); // Initializes |offset| to zero.
44 ~Input(); 44 ~Input();
45 45
46 size_t remaining() { 46 size_t remaining() { return input.size() - offset; }
47 return input.size() - offset; 47 const char* ptr() { return input.data() + offset; }
48 }
49 const char* ptr() {
50 return input.data() + offset;
51 }
52 48
53 std::string input; 49 std::string input;
54 size_t offset; 50 size_t offset;
55 }; 51 };
56 52
57 // Returns true if the next header block was set at |out|. Returns 53 // Returns true if the next header block was set at |out|. Returns
58 // false if no input header blocks remain. 54 // false if no input header blocks remain.
59 static bool NextHeaderBlock(Input* input, base::StringPiece* out); 55 static bool NextHeaderBlock(Input* input, base::StringPiece* out);
60 56
61 // Returns the serialized header block length prefix for a block of 57 // Returns the serialized header block length prefix for a block of
(...skipping 22 matching lines...) Expand all
84 // |flip_per_thousand| bits for every 1,024 bytes of |buffer_length|, 80 // |flip_per_thousand| bits for every 1,024 bytes of |buffer_length|,
85 // rounding up. 81 // rounding up.
86 static void FlipBits(uint8* buffer, 82 static void FlipBits(uint8* buffer,
87 size_t buffer_length, 83 size_t buffer_length,
88 size_t flip_per_thousand); 84 size_t flip_per_thousand);
89 }; 85 };
90 86
91 } // namespace net 87 } // namespace net
92 88
93 #endif // NET_SPDY_FUZZING_HPACK_FUZZ_UTIL_H_ 89 #endif // NET_SPDY_FUZZING_HPACK_FUZZ_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698