[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

gramps gramps at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:49:36 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 0e0cb2a1bd53cac431ad6668bf141a47bd520dcc
Author: gramps <gramps at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 5 20:43:46 2001 +0000

    Fixed stupid off-by-one bug in findRev
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@291 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/kwq/KWQString.mm b/WebCore/kwq/KWQString.mm
index 2e4c8a6..19d05d0 100644
--- a/WebCore/kwq/KWQString.mm
+++ b/WebCore/kwq/KWQString.mm
@@ -447,9 +447,9 @@ int QString::findRev(char ch, int index) const
         if (index < 0) {
             index += len;
         }
-        if (len && (index >= 0) && (index < len)) {
+        if (len && (index <= len)) {
             CFStringInlineBuffer buf;
-            CFStringInitInlineBuffer(s, &buf, CFRangeMake(0, len));
+            CFStringInitInlineBuffer(s, &buf, CFRangeMake(0, index));
             for (CFIndex i = index; i >= 0; i--) {
                 if (ch == CFStringGetCharacterFromInlineBuffer(&buf, i)) {
                     return i;
@@ -468,16 +468,14 @@ int QString::findRev(const char *chs, int index) const
         if (index < 0) {
             index += len;
         }
-        if (len && (index >= 0) && (index < len)) {
+        if (len && (index <= len)) {
             // FIXME: is ISO Latin-1 the correct encoding?
             CFStringRef tmp = CFStringCreateWithCStringNoCopy(
                     kCFAllocatorDefault, chs, kCFStringEncodingISOLatin1,
                     kCFAllocatorNull);
             if (tmp) {
                 CFRange r;
-                // FIXME: is this the right way to specifiy a range for a
-                // reversed search?
-                if (CFStringFindWithOptions(s, tmp, CFRangeMake(0, index + 1),
+                if (CFStringFindWithOptions(s, tmp, CFRangeMake(0, index),
                         kCFCompareBackwards, &r)) {
                     pos = r.location;
                 }
diff --git a/WebCore/src/kwq/KWQString.mm b/WebCore/src/kwq/KWQString.mm
index 2e4c8a6..19d05d0 100644
--- a/WebCore/src/kwq/KWQString.mm
+++ b/WebCore/src/kwq/KWQString.mm
@@ -447,9 +447,9 @@ int QString::findRev(char ch, int index) const
         if (index < 0) {
             index += len;
         }
-        if (len && (index >= 0) && (index < len)) {
+        if (len && (index <= len)) {
             CFStringInlineBuffer buf;
-            CFStringInitInlineBuffer(s, &buf, CFRangeMake(0, len));
+            CFStringInitInlineBuffer(s, &buf, CFRangeMake(0, index));
             for (CFIndex i = index; i >= 0; i--) {
                 if (ch == CFStringGetCharacterFromInlineBuffer(&buf, i)) {
                     return i;
@@ -468,16 +468,14 @@ int QString::findRev(const char *chs, int index) const
         if (index < 0) {
             index += len;
         }
-        if (len && (index >= 0) && (index < len)) {
+        if (len && (index <= len)) {
             // FIXME: is ISO Latin-1 the correct encoding?
             CFStringRef tmp = CFStringCreateWithCStringNoCopy(
                     kCFAllocatorDefault, chs, kCFStringEncodingISOLatin1,
                     kCFAllocatorNull);
             if (tmp) {
                 CFRange r;
-                // FIXME: is this the right way to specifiy a range for a
-                // reversed search?
-                if (CFStringFindWithOptions(s, tmp, CFRangeMake(0, index + 1),
+                if (CFStringFindWithOptions(s, tmp, CFRangeMake(0, index),
                         kCFCompareBackwards, &r)) {
                     pos = r.location;
                 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list