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

Unified Diff: base/test/fuzzed_data_provider.h

Issue 2308443002: Make FuzzedDataProvider vend std::strings (Closed)
Patch Set: no longer header-only Created 4 years, 2 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 | base/test/fuzzed_data_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/fuzzed_data_provider.h
diff --git a/base/test/fuzzed_data_provider.h b/base/test/fuzzed_data_provider.h
index 293d723904f4fec680e603ed711b7c3b1841dac8..06028242a384ade7670ee1bbe5282082fec74a87 100644
--- a/base/test/fuzzed_data_provider.h
+++ b/base/test/fuzzed_data_provider.h
@@ -6,6 +6,7 @@
#define BASE_TEST_FUZZED_DATA_PROVIDER_H_
#include <stdint.h>
+#include <string>
Lei Zhang 2016/10/19 17:49:49 nit: Chromium style still likes to have a separato
Charlie Harrison 2016/10/19 18:00:56 Done.
#include "base/base_export.h"
#include "base/macros.h"
@@ -23,16 +24,13 @@ class FuzzedDataProvider {
FuzzedDataProvider(const uint8_t* data, size_t size);
~FuzzedDataProvider();
- // Returns a StringPiece containing |num_bytes| of input data. If fewer than
- // |num_bytes| of data remain, returns a shorter StringPiece containing all
- // of the data that's left. The data pointed at by the returned StringPiece
- // must not be used after the FuzzedDataProvider is destroyed.
- StringPiece ConsumeBytes(size_t num_bytes);
+ // Returns a std::string containing |num_bytes| of input data. If fewer than
+ // |num_bytes| of data remain, returns a shorter std::string containing all
+ // of the data that's left.
+ std::string ConsumeBytes(size_t num_bytes);
- // Returns a StringPiece containing all remaining bytes of the input data.
- // The data pointed at by the returned StringPiece must not be used after the
- // FuzzedDataProvider is destroyed.
- StringPiece ConsumeRemainingBytes();
+ // Returns a std::string containing all remaining bytes of the input data.
+ std::string ConsumeRemainingBytes();
// Returns a number in the range [min, max] by consuming bytes from the input
// data. The value might not be uniformly distributed in the given range. If
« no previous file with comments | « no previous file | base/test/fuzzed_data_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698