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

Unified Diff: third_party/re2/re2/testing/regexp_generator.cc

Issue 1516543002: Update re2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated update instructions Created 5 years 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 | « third_party/re2/re2/testing/regexp_generator.h ('k') | third_party/re2/re2/testing/regexp_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/re2/re2/testing/regexp_generator.cc
diff --git a/third_party/re2/re2/testing/regexp_generator.cc b/third_party/re2/re2/testing/regexp_generator.cc
index cf2db11855f5ab12d3068adb4c3cd900352189a5..fd085dbfc13b9447d4d43e56f390fd737b550648 100644
--- a/third_party/re2/re2/testing/regexp_generator.cc
+++ b/third_party/re2/re2/testing/regexp_generator.cc
@@ -111,7 +111,7 @@ void RegexpGenerator::GeneratePostfix(vector<string>* post, int nstk,
// Add atoms if there is room.
if (atoms < maxatoms_) {
- for (int i = 0; i < atoms_.size(); i++) {
+ for (size_t i = 0; i < atoms_.size(); i++) {
post->push_back(atoms_[i]);
GeneratePostfix(post, nstk + 1, ops, atoms + 1);
post->pop_back();
@@ -120,7 +120,7 @@ void RegexpGenerator::GeneratePostfix(vector<string>* post, int nstk,
// Add operators if there are enough arguments.
if (ops < maxops_) {
- for (int i = 0; i < ops_.size(); i++) {
+ for (size_t i = 0; i < ops_.size(); i++) {
const string& fmt = ops_[i];
int nargs = CountArgs(fmt);
if (nargs <= nstk) {
@@ -134,7 +134,7 @@ void RegexpGenerator::GeneratePostfix(vector<string>* post, int nstk,
// Generates a random postfix command sequence.
// Stops and returns true once a single sequence has been generated.
-bool RegexpGenerator::GenerateRandomPostfix(vector<string> *post, int nstk,
+bool RegexpGenerator::GenerateRandomPostfix(vector<string>* post, int nstk,
int ops, int atoms) {
for (;;) {
// Stop if we get to a single element, but only sometimes.
@@ -151,7 +151,7 @@ bool RegexpGenerator::GenerateRandomPostfix(vector<string> *post, int nstk,
// Add operators if there are enough arguments.
if (ops < maxops_ && acm_->Uniform(2) == 0) {
- const string& fmt = ops_[acm_->Uniform(ops_.size())];
+ const string& fmt = ops_[acm_->Uniform(static_cast<int32>(ops_.size()))];
int nargs = CountArgs(fmt);
if (nargs <= nstk) {
post->push_back(fmt);
@@ -165,7 +165,7 @@ bool RegexpGenerator::GenerateRandomPostfix(vector<string> *post, int nstk,
// Add atoms if there is room.
if (atoms < maxatoms_ && acm_->Uniform(2) == 0) {
- post->push_back(atoms_[acm_->Uniform(atoms_.size())]);
+ post->push_back(atoms_[acm_->Uniform(static_cast<int32>(atoms_.size()))]);
bool ret = GenerateRandomPostfix(post, nstk + 1, ops, atoms + 1);
post->pop_back();
if (ret)
@@ -179,7 +179,7 @@ bool RegexpGenerator::GenerateRandomPostfix(vector<string> *post, int nstk,
// in (?: ) to avoid needing to maintain a precedence table.
void RegexpGenerator::RunPostfix(const vector<string>& post) {
stack<string> regexps;
- for (int i = 0; i < post.size(); i++) {
+ for (size_t i = 0; i < post.size(); i++) {
switch (CountArgs(post[i])) {
default:
LOG(FATAL) << "Bad operator: " << post[i];
@@ -208,7 +208,7 @@ void RegexpGenerator::RunPostfix(const vector<string>& post) {
if (regexps.size() != 1) {
// Internal error - should never happen.
printf("Bad regexp program:\n");
- for (int i = 0; i < post.size(); i++) {
+ for (size_t i = 0; i < post.size(); i++) {
printf(" %s\n", CEscape(post[i]).c_str());
}
printf("Stack after running program:\n");
« no previous file with comments | « third_party/re2/re2/testing/regexp_generator.h ('k') | third_party/re2/re2/testing/regexp_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698