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

Unified Diff: third_party/re2/re2/prog.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/prog.h ('k') | third_party/re2/re2/re2.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/re2/re2/prog.cc
diff --git a/third_party/re2/re2/prog.cc b/third_party/re2/re2/prog.cc
index ef9ef2386cd2edc5da510c9bb528eb7a70d064bc..499f560f8d64fc01752a3501f1f0bd9f14c3b803 100644
--- a/third_party/re2/re2/prog.cc
+++ b/third_party/re2/re2/prog.cc
@@ -25,7 +25,7 @@ void Prog::Inst::InitByteRange(int lo, int hi, int foldcase, uint32 out) {
set_out_opcode(out, kInstByteRange);
lo_ = lo & 0xFF;
hi_ = hi & 0xFF;
- foldcase_ = foldcase;
+ foldcase_ = foldcase & 0xFF;
}
void Prog::Inst::InitCapture(int cap, uint32 out) {
@@ -295,13 +295,15 @@ uint32 Prog::EmptyFlags(const StringPiece& text, const char* p) {
}
void Prog::MarkByteRange(int lo, int hi) {
- CHECK_GE(lo, 0);
- CHECK_GE(hi, 0);
- CHECK_LE(lo, 255);
- CHECK_LE(hi, 255);
- if (lo > 0)
+ DCHECK_GE(lo, 0);
+ DCHECK_GE(hi, 0);
+ DCHECK_LE(lo, 255);
+ DCHECK_LE(hi, 255);
+ DCHECK_LE(lo, hi);
+ if (0 < lo && lo <= 255)
byterange_.Set(lo - 1);
- byterange_.Set(hi);
+ if (0 <= hi && hi <= 255)
+ byterange_.Set(hi);
}
void Prog::ComputeByteMap() {
@@ -325,12 +327,12 @@ void Prog::ComputeByteMap() {
bytemap_range_ = bytemap_[255] + 1;
unbytemap_ = new uint8[bytemap_range_];
for (int i = 0; i < 256; i++)
- unbytemap_[bytemap_[i]] = i;
+ unbytemap_[bytemap_[i]] = static_cast<uint8>(i);
if (0) { // For debugging: use trivial byte map.
for (int i = 0; i < 256; i++) {
- bytemap_[i] = i;
- unbytemap_[i] = i;
+ bytemap_[i] = static_cast<uint8>(i);
+ unbytemap_[i] = static_cast<uint8>(i);
}
bytemap_range_ = 256;
LOG(INFO) << "Using trivial bytemap.";
« no previous file with comments | « third_party/re2/re2/prog.h ('k') | third_party/re2/re2/re2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698