aboutsummaryrefslogtreecommitdiffstats
path: root/src/3rdparty/masm/yarr
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2014-03-05 15:34:08 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-07 11:00:45 +0100
commit90487ebb7584bde9283e154228b9494e3b7bd8fe (patch)
treeacf5e57172e48feaf69cda001ec69f554c85f155 /src/3rdparty/masm/yarr
parent1ca5e82cccae04b3f0e91f6445811b967018b477 (diff)
Fix more MSVC2012 compiler warnings.
All are conversions from size_t to int or to unsigned. Change-Id: Ic94c938dcad6d50a32dd6ec62da2341869cf994d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/3rdparty/masm/yarr')
-rw-r--r--src/3rdparty/masm/yarr/YarrInterpreter.cpp39
-rw-r--r--src/3rdparty/masm/yarr/YarrPattern.cpp9
2 files changed, 32 insertions, 16 deletions
diff --git a/src/3rdparty/masm/yarr/YarrInterpreter.cpp b/src/3rdparty/masm/yarr/YarrInterpreter.cpp
index f0312ea251..4a789f6f28 100644
--- a/src/3rdparty/masm/yarr/YarrInterpreter.cpp
+++ b/src/3rdparty/masm/yarr/YarrInterpreter.cpp
@@ -1544,7 +1544,8 @@ public:
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;
@@ -1557,7 +1558,8 @@ public:
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;
@@ -1574,7 +1576,8 @@ public:
// 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;
@@ -1587,7 +1590,8 @@ public:
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;
@@ -1602,7 +1606,8 @@ public:
{
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);
@@ -1628,7 +1633,8 @@ public:
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);
@@ -1653,7 +1659,8 @@ public:
{
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;
@@ -1679,7 +1686,8 @@ public:
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;
@@ -1700,7 +1708,8 @@ public:
{
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);
@@ -1734,7 +1743,8 @@ public:
{
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);
@@ -1756,7 +1766,8 @@ public:
{
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);
@@ -1789,7 +1800,8 @@ public:
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));
@@ -1798,7 +1810,8 @@ public:
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());
diff --git a/src/3rdparty/masm/yarr/YarrPattern.cpp b/src/3rdparty/masm/yarr/YarrPattern.cpp
index 3ce0216e5f..ae527f065f 100644
--- a/src/3rdparty/masm/yarr/YarrPattern.cpp
+++ b/src/3rdparty/masm/yarr/YarrPattern.cpp
@@ -191,7 +191,8 @@ private:
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) {
@@ -216,7 +217,8 @@ private:
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).
@@ -427,7 +429,8 @@ public:
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++) {