Address MSVC error and warnings. Sigh.
Change-Id: Ife0b0cf6dac9341397c15624912bb86372056970
Reviewed-on: https://code-review.googlesource.com/32390
Reviewed-by: Paul Wankadia <[email protected]>
diff --git a/re2/bitstate.cc b/re2/bitstate.cc
index c9b4cad..fcb2460 100644
--- a/re2/bitstate.cc
+++ b/re2/bitstate.cc
@@ -76,6 +76,7 @@
endmatch_(false),
submatch_(NULL),
nsubmatch_(0),
+ job_(256), // allocates 4KiB when sizeof(Job) == 16 :)
njob_(0) {
}
@@ -83,7 +84,8 @@
// If so, remember that it was visited so that the next time,
// we don't repeat the visit.
bool BitState::ShouldVisit(int id, const char* p) {
- size_t n = id * (text_.size() + 1) + (p - text_.begin());
+ int n = id * static_cast<int>(text_.size()+1) +
+ static_cast<int>(p-text_.begin());
if (visited_[n/VisitedBits] & (1 << (n & (VisitedBits-1))))
return false;
visited_[n/VisitedBits] |= 1 << (n & (VisitedBits-1));
@@ -320,9 +322,6 @@
cap_ = PODArray<const char*>(ncap);
memset(cap_.data(), 0, ncap*sizeof cap_[0]);
- // When sizeof(Job) == 16, we start with a nice round 4KiB. :)
- job_ = PODArray<Job>(256);
-
// Anchored search must start at text.begin().
if (anchored_) {
cap_[0] = text.begin();