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

Unified Diff: base/test/fuzzed_data_provider.h

Issue 2308443002: Make FuzzedDataProvider vend std::strings (Closed)
Patch Set: thestig review 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..9f048f363e803dcadb12542fc1b5f61dbefe53c8 100644
--- a/base/test/fuzzed_data_provider.h
+++ b/base/test/fuzzed_data_provider.h
@@ -7,6 +7,8 @@
#include <stdint.h>
+#include <string>
+
#include "base/base_export.h"
#include "base/macros.h"
#include "base/strings/string_piece.h"
@@ -23,16 +25,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