[Libreoffice-commits] core.git: Branch 'libreoffice-4-4-2' - sc/source

Eike Rathke erack at redhat.com
Sat Mar 21 14:28:07 PDT 2015


 sc/source/core/data/table3.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 7519a534eedc588a1118acacb8d7b5af1950da89
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Mar 20 11:10:13 2015 +0000

    Resolves: tdf#89958 filter ends with / does not end with correction
    
    Regression of 8850633fe4cdac306c35caab1a0d14c13d9df864 String to
    OUString and xub_StrLen to sal_Int32 conversion, it worked by accident
    only anyway..
    
    Change-Id: Id6fea7075949b98e58294d9fdaae4313f69f9b55
    (cherry picked from commit 9e2e9453cbca9399e1c670b354cfc3c23d70307f)
    Reviewed-on: https://gerrit.libreoffice.org/14922
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: David Tardon <dtardon at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 4637e74..4ec4b42 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2509,9 +2509,9 @@ public:
                     OUString aQuer( mpTransliteration->transliterate(
                         aQueryStr, ScGlobal::eLnge, 0, aQueryStr.getLength(),
                         NULL ) );
-                    sal_Int32 nIndex = (rEntry.eOp == SC_ENDS_WITH
-                        || rEntry.eOp == SC_DOES_NOT_END_WITH) ? (aCell.getLength()-aQuer.getLength()) : 0;
-                    sal_Int32 nStrPos = aCell.indexOf( aQuer, nIndex );
+                    sal_Int32 nIndex = (rEntry.eOp == SC_ENDS_WITH || rEntry.eOp == SC_DOES_NOT_END_WITH) ?
+                        (aCell.getLength() - aQuer.getLength()) : 0;
+                    sal_Int32 nStrPos = ((nIndex < 0) ? -1 : aCell.indexOf( aQuer, nIndex ));
                     switch (rEntry.eOp)
                     {
                     case SC_EQUAL:
@@ -2529,10 +2529,10 @@ public:
                         bOk = ( nStrPos != 0 );
                         break;
                     case SC_ENDS_WITH:
-                        bOk = ( nStrPos + aQuer.getLength() == aCell.getLength() );
+                        bOk = (nStrPos >= 0 && nStrPos + aQuer.getLength() == aCell.getLength() );
                         break;
                     case SC_DOES_NOT_END_WITH:
-                        bOk = ( nStrPos + aQuer.getLength() != aCell.getLength() );
+                        bOk = (nStrPos < 0 || nStrPos + aQuer.getLength() != aCell.getLength() );
                         break;
                     default:
                         {


More information about the Libreoffice-commits mailing list