i18npool/source/search/textsearch.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit ce91f3c1292f3e9b84157acf10b67ad9ca16719d
Author: Eike Rathke <er...@redhat.com>
Date:   Mon Nov 23 21:32:29 2015 +0100

    similar to searchForward() use the correct offsets, tdf#94810 related
    
    Change-Id: Icb5a45acaad9029e0998594de8b3dc2e9211866e

diff --git a/i18npool/source/search/textsearch.cxx 
b/i18npool/source/search/textsearch.cxx
index 39d1fd3..6aedc9b 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));
             }
         }
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to