summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-11-23 21:32:29 +0100
committerEike Rathke <erack@redhat.com>2015-11-23 21:33:47 +0100
commitce91f3c1292f3e9b84157acf10b67ad9ca16719d (patch)
treea05f8a0ba362750df6c8e1bb29b785a237e3457c
parent54336499a8bc5fbee2891f0b50f3183d8b83d165 (diff)
similar to searchForward() use the correct offsets, tdf#94810 related
Change-Id: Icb5a45acaad9029e0998594de8b3dc2e9211866e
-rw-r--r--i18npool/source/search/textsearch.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx
index 39d1fd3b10d3..6aedc9b9bed8 100644
--- a/i18npool/source/search/textsearch.cxx
+++ b/i18npool/source/search/textsearch.cxx
@@ -404,15 +404,18 @@ SearchResult TextSearch::searchBackward( const OUString& searchStr, sal_Int32 st
for ( sal_Int32 k = 0; k < nGroups; k++ )
{
const sal_Int32 nStart = sres.startOffset[k];
- if (endPos > 0 || nStart > 0)
+ assert(nStart >= 0);
+ if (nStart > 0)
sres.startOffset[k] = offset[(nStart <= nOffsets ? nStart : nOffsets) - 1] + 1;
+ else
+ sres.startOffset[k] = offset[0];
// JP 20.6.2001: end is ever exclusive and then don't return
// the position of the next character - return the
// next position behind the last found character!
// "a b c" find "b" must return 2,3 and not 2,4!!!
const sal_Int32 nStop = sres.endOffset[k];
- if (endPos > 0 || nStop > 0)
- sres.endOffset[k] = (nStop < nOffsets ? offset[nStop] : (offset[nOffsets - 1] + 1));
+ assert(nStop >= 0);
+ sres.endOffset[k] = (nStop < nOffsets ? offset[nStop] : (offset[nOffsets - 1] + 1));
}
}
}