[jruby-joni] 37/279: String 'end' aware case insensitive multibyte search routines.

Hideki Yamane henrich at moszumanska.debian.org
Mon Nov 16 11:26:37 UTC 2015


This is an automated email from the git hooks/post-receive script.

henrich pushed a commit to branch debian/sid
in repository jruby-joni.

commit f2263d18e239850d6c7bf0c173d5c37c2912a6cb
Author: Marcin Mielżyński <lopx at gazeta.pl>
Date:   Sun Sep 21 14:32:19 2008 +0000

    String 'end' aware case insensitive multibyte search routines.
    
    git-svn-id: http://svn.codehaus.org/jruby/joni/trunk@7748 961051c9-f516-0410-bf72-c9f7e237a7b7
---
 src/org/joni/ByteCodeMachine.java | 15 +++++++--------
 src/org/joni/SearchAlgorithm.java |  1 +
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/org/joni/ByteCodeMachine.java b/src/org/joni/ByteCodeMachine.java
index 3620d34..c4afec8 100644
--- a/src/org/joni/ByteCodeMachine.java
+++ b/src/org/joni/ByteCodeMachine.java
@@ -114,20 +114,19 @@ class ByteCodeMachine extends StackMachine {
         return cfbuf2 == null ? cfbuf2 = new byte[Config.ENC_MBC_CASE_FOLD_MAXLEN] : cfbuf2;
     }
     
-    private boolean stringCmpIC(int caseFlodFlag, int s1, IntHolder ps2, int mbLen) {
+    private boolean stringCmpIC(int caseFlodFlag, int s1, IntHolder ps2, int mbLen, int textEnd) {
         byte[]buf1 = cfbuf();
         byte[]buf2 = cfbuf2();
         
         int s2 = ps2.value;
         int end1 = s1 + mbLen;
-        int end2 = s2 + mbLen;
-        
+
         while (s1 < end1) {
             value = s1;
-            int len1 = enc.mbcCaseFold(caseFlodFlag, bytes, this, end1, buf1);
+            int len1 = enc.mbcCaseFold(caseFlodFlag, bytes, this, textEnd, buf1);
             s1 = value;
             value = s2;
-            int len2 = enc.mbcCaseFold(caseFlodFlag, bytes, this, end2, buf2);
+            int len2 = enc.mbcCaseFold(caseFlodFlag, bytes, this, textEnd, buf2);
             s2 = value;
             
             if (len1 != len2) return false;
@@ -1188,7 +1187,7 @@ class ByteCodeMachine extends StackMachine {
         sprev = s;
         
         value = s;        
-        if (!stringCmpIC(caseFoldFlag, pstart, this, n)) {opFail(); return;}
+        if (!stringCmpIC(caseFoldFlag, pstart, this, n, end)) {opFail(); return;}
         s = value;
         
         int len;
@@ -1249,7 +1248,7 @@ class ByteCodeMachine extends StackMachine {
             sprev = s;
 
             value = s;
-            if (!stringCmpIC(caseFoldFlag, pstart, this, n)) continue loop; // STRING_CMP_VALUE_IC
+            if (!stringCmpIC(caseFoldFlag, pstart, this, n, end)) continue loop; // STRING_CMP_VALUE_IC
             s = value;
 
             int len;
@@ -1294,7 +1293,7 @@ class ByteCodeMachine extends StackMachine {
 
                             value = s;
                             if (ignoreCase) {
-                                if (!stringCmpIC(caseFoldFlag, pstart, this, pend - pstart)) {
+                                if (!stringCmpIC(caseFoldFlag, pstart, this, pend - pstart, end)) {
                                     return false; /* or goto next_mem; */
                                 }
                             } else {
diff --git a/src/org/joni/SearchAlgorithm.java b/src/org/joni/SearchAlgorithm.java
index 2078096..36bf877 100644
--- a/src/org/joni/SearchAlgorithm.java
+++ b/src/org/joni/SearchAlgorithm.java
@@ -468,6 +468,7 @@ public abstract class SearchAlgorithm {
             return "MAP";
         }        
         
+        // TODO: check 1.9 inconsistent calls to map_search
         public final int search(Regex regex, byte[]text, int textP, int textEnd, int textRange) {
             Encoding enc = regex.enc;
             byte[]map = regex.map;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jruby-joni.git



More information about the pkg-java-commits mailing list