void atomParenthesesOnceBegin(unsigned subpatternId, bool capture, unsigned inputPosition, unsigned frameLocation, unsigned alternativeFrameLocation)
{
- int beginTerm = m_bodyDisjunction->terms.size();
+ ASSERT(m_bodyDisjunction->terms.size() <= INT_MAX);
+ int beginTerm = static_cast<int>(m_bodyDisjunction->terms.size());
m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpatternOnceBegin, subpatternId, capture, false, inputPosition));
m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
void atomParenthesesTerminalBegin(unsigned subpatternId, bool capture, unsigned inputPosition, unsigned frameLocation, unsigned alternativeFrameLocation)
{
- int beginTerm = m_bodyDisjunction->terms.size();
+ ASSERT(m_bodyDisjunction->terms.size() <= INT_MAX);
+ int beginTerm = static_cast<int>(m_bodyDisjunction->terms.size());
m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpatternTerminalBegin, subpatternId, capture, false, inputPosition));
m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
// then fix this up at the end! - simplifying this should make it much clearer.
// https://bugs.webkit.org/show_bug.cgi?id=50136
- int beginTerm = m_bodyDisjunction->terms.size();
+ ASSERT(m_bodyDisjunction->terms.size() <= INT_MAX);
+ int beginTerm = static_cast<int>(m_bodyDisjunction->terms.size());
m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpatternOnceBegin, subpatternId, capture, false, inputPosition));
m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
void atomParentheticalAssertionBegin(unsigned subpatternId, bool invert, unsigned frameLocation, unsigned alternativeFrameLocation)
{
- int beginTerm = m_bodyDisjunction->terms.size();
+ ASSERT(m_bodyDisjunction->terms.size() <= INT_MAX);
+ int beginTerm = static_cast<int>(m_bodyDisjunction->terms.size());
m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParentheticalAssertionBegin, subpatternId, false, invert, 0));
m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
{
unsigned beginTerm = popParenthesesStack();
closeAlternative(beginTerm + 1);
- unsigned endTerm = m_bodyDisjunction->terms.size();
+ ASSERT(m_bodyDisjunction->terms.size() <= INT_MAX);
+ unsigned endTerm = static_cast<int>(m_bodyDisjunction->terms.size());
ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeParentheticalAssertionBegin);
unsigned popParenthesesStack()
{
ASSERT(m_parenthesesStack.size());
- int stackEnd = m_parenthesesStack.size() - 1;
+ ASSERT(m_parenthesesStack.size() <= INT_MAX);
+ int stackEnd = static_cast<int>(m_parenthesesStack.size()) - 1;
unsigned beginTerm = m_parenthesesStack[stackEnd].beginTerm;
m_currentAlternativeIndex = m_parenthesesStack[stackEnd].savedAlternativeIndex;
m_parenthesesStack.shrink(stackEnd);
{
int origBeginTerm = beginTerm;
ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeAlternativeBegin);
- int endIndex = m_bodyDisjunction->terms.size();
+ ASSERT(m_bodyDisjunction->terms.size() <= INT_MAX);
+ int endIndex = static_cast<int>(m_bodyDisjunction->terms.size());
unsigned frameLocation = m_bodyDisjunction->terms[beginTerm].frameLocation;
int beginTerm = 0;
int origBeginTerm = 0;
ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeBodyAlternativeBegin);
- int endIndex = m_bodyDisjunction->terms.size();
+ ASSERT(m_bodyDisjunction->terms.size() <= INT_MAX);
+ int endIndex = static_cast<int>(m_bodyDisjunction->terms.size());
unsigned frameLocation = m_bodyDisjunction->terms[beginTerm].frameLocation;
{
unsigned beginTerm = popParenthesesStack();
closeAlternative(beginTerm + 1);
- unsigned endTerm = m_bodyDisjunction->terms.size();
+ ASSERT(m_bodyDisjunction->terms.size() <= INT_MAX);
+ unsigned endTerm = static_cast<int>(m_bodyDisjunction->terms.size());
ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeParenthesesSubpatternOnceBegin);
{
unsigned beginTerm = popParenthesesStack();
closeAlternative(beginTerm + 1);
- unsigned endTerm = m_bodyDisjunction->terms.size();
+ ASSERT(m_bodyDisjunction->terms.size() <= INT_MAX);
+ unsigned endTerm = static_cast<int>(m_bodyDisjunction->terms.size());
ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeParenthesesSubpatternOnceBegin);
{
unsigned beginTerm = popParenthesesStack();
closeAlternative(beginTerm + 1);
- unsigned endTerm = m_bodyDisjunction->terms.size();
+ ASSERT(m_bodyDisjunction->terms.size() <= INT_MAX);
+ unsigned endTerm = static_cast<int>(m_bodyDisjunction->terms.size());
ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeParenthesesSubpatternTerminalBegin);
void alternativeBodyDisjunction(bool onceThrough)
{
- int newAlternativeIndex = m_bodyDisjunction->terms.size();
+ ASSERT(m_bodyDisjunction->terms.size() <= INT_MAX);
+ int newAlternativeIndex = static_cast<int>(m_bodyDisjunction->terms.size());
m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex;
m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeDisjunction(onceThrough));
void alternativeDisjunction()
{
- int newAlternativeIndex = m_bodyDisjunction->terms.size();
+ ASSERT(m_bodyDisjunction->terms.size() <= INT_MAX);
+ int newAlternativeIndex = static_cast<int>(m_bodyDisjunction->terms.size());
m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex;
m_bodyDisjunction->terms.append(ByteTerm::AlternativeDisjunction());
void addSorted(Vector<UChar>& matches, UChar ch)
{
unsigned pos = 0;
- unsigned range = matches.size();
+ ASSERT(matches.size() <= UINT_MAX);
+ unsigned range = static_cast<unsigned>(matches.size());
// binary chop, find position to insert char.
while (range) {
void addSortedRange(Vector<CharacterRange>& ranges, UChar lo, UChar hi)
{
- unsigned end = ranges.size();
+ ASSERT(ranges.size() <= UINT_MAX);
+ unsigned end = static_cast<unsigned>(ranges.size());
// Simple linear scan - I doubt there are that many ranges anyway...
// feel free to fix this with something faster (eg binary chop).
PatternTerm& lastTerm = m_alternative->lastTerm();
- unsigned numParenAlternatives = parenthesesDisjunction->m_alternatives.size();
+ ASSERT(parenthesesDisjunction->m_alternatives.size() <= UINT_MAX);
+ unsigned numParenAlternatives = static_cast<unsigned>(parenthesesDisjunction->m_alternatives.size());
unsigned numBOLAnchoredAlts = 0;
for (unsigned i = 0; i < numParenAlternatives; i++) {