Use static_cast and other style cleanup in YarrInterpreter.cpp
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Feb 2011 17:31:35 +0000 (17:31 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Feb 2011 17:31:35 +0000 (17:31 +0000)
<http://webkit.org/b/53772>

Reviewed by John Sullivan.

* yarr/YarrInterpreter.cpp:
(JSC::Yarr::Interpreter::InputStream::readChecked): Use
static_cast.
(JSC::Yarr::Interpreter::InputStream::checkInput): Remove
unnecessary else block.
(JSC::Yarr::Interpreter::matchAssertionEOL): Ditto.
(JSC::Yarr::Interpreter::backtrackBackReference): Ditto.
(JSC::Yarr::ByteCompiler::emitDisjunction): Use static_cast.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77635 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/yarr/YarrInterpreter.cpp

index 31488194fe35ab7710b13f0073f8979629d85ebd..beaff82d1b15919cc344591da1ff2c450b5bff86 100644 (file)
@@ -1,3 +1,19 @@
+2011-02-04  David Kilzer  <ddkilzer@apple.com>
+
+        Use static_cast and other style cleanup in YarrInterpreter.cpp
+        <http://webkit.org/b/53772>
+
+        Reviewed by John Sullivan.
+
+        * yarr/YarrInterpreter.cpp:
+        (JSC::Yarr::Interpreter::InputStream::readChecked): Use
+        static_cast.
+        (JSC::Yarr::Interpreter::InputStream::checkInput): Remove
+        unnecessary else block.
+        (JSC::Yarr::Interpreter::matchAssertionEOL): Ditto.
+        (JSC::Yarr::Interpreter::backtrackBackReference): Ditto.
+        (JSC::Yarr::ByteCompiler::emitDisjunction): Use static_cast.
+
 2011-02-04  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r77625 and r77626.
index d2dbf237c51f45b506ed1a3e9f15ea0628f1129b..37d44f79a627b45c82bca5895fdb7f2165ed1a83 100644 (file)
@@ -203,7 +203,7 @@ public:
         int readChecked(int position)
         {
             ASSERT(position < 0);
-            ASSERT((unsigned)-position <= pos);
+            ASSERT(static_cast<unsigned>(-position) <= pos);
             unsigned p = pos + position;
             ASSERT(p < length);
             return input[p];
@@ -248,8 +248,8 @@ public:
             if ((pos + count) <= length) {
                 pos += count;
                 return true;
-            } else
-                return false;
+            }
+            return false;
         }
 
         void uncheckInput(int count)
@@ -356,8 +356,8 @@ public:
     {
         if (term.inputPosition)
             return (input.atEnd(term.inputPosition)) || (pattern->m_multiline && testCharacterClass(pattern->newlineCharacterClass, input.readChecked(term.inputPosition)));
-        else
-            return (input.atEnd()) || (pattern->m_multiline && testCharacterClass(pattern->newlineCharacterClass, input.read()));
+
+        return (input.atEnd()) || (pattern->m_multiline && testCharacterClass(pattern->newlineCharacterClass, input.read()));
     }
 
     bool matchAssertionWordBoundary(ByteTerm& term)
@@ -577,8 +577,8 @@ public:
             if ((backTrack->matchAmount < term.atom.quantityCount) && tryConsumeBackReference(matchBegin, matchEnd, term.inputPosition)) {
                 ++backTrack->matchAmount;
                 return true;
-            } else
-                input.setPos(backTrack->begin);
+            }
+            input.setPos(backTrack->begin);
             break;
         }
 
@@ -1412,7 +1412,7 @@ public:
     }
 
 private:
-    BytecodePattern *pattern;
+    BytecodePatternpattern;
     int* output;
     InputStream input;
     BumpPointerPool* allocatorPool;
@@ -1847,7 +1847,7 @@ public:
                 case PatternTerm::TypeParentheticalAssertion: {
                     unsigned alternativeFrameLocation = term.frameLocation + YarrStackSpaceForBackTrackInfoParentheticalAssertion;
 
-                    ASSERT(currentCountAlreadyChecked >= (unsigned)term.inputPosition);
+                    ASSERT(currentCountAlreadyChecked >= static_cast<unsigned>(term.inputPosition));
                     int positiveInputOffset = currentCountAlreadyChecked - term.inputPosition;
 
                     atomParentheticalAssertionBegin(term.parentheses.subpatternId, term.invert(), term.frameLocation, alternativeFrameLocation);