summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-03-20 11:10:13 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-03-20 12:04:31 +0000
commita2b58dc798bf3cca9a24b7c41a616dc7c3d75f3e (patch)
treef972726dfc903a66be5cf4590945a53a3e5a1e82
parentfa654c2f626dd0d461c3a6c72dc02b83fc50f9f7 (diff)
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/14923 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/source/core/data/table3.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 65e3c37e3837..daf370c91614 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2261,9 +2261,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:
@@ -2281,10 +2281,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:
{