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

Michael Stahl mstahl at redhat.com
Thu Jan 16 12:00:26 PST 2014


 sw/source/core/tox/tox.cxx |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit fce6a11afa46695d59e0654fd5c81a106073f9b2
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jan 14 23:58:11 2014 +0100

    fdo#73162: sw: un-break index entries that contain text separators
    
    SwFormTokensHelper::SearchNextToken() does some check that the ">" token
    terminator is not inside a pair of TOX_STYLE_DELIMITER; this check was
    broken by commit f4fd558ac9d61fe06aa0f56d829916ef9e5ee7b9 and finds a
    ">" outside of TOX_STYLE_DELIMITER bracketing.
    
    Change-Id: Ia8587d496999c561f57fd6f107ed8b9d1e3838d4
    (cherry picked from commit c87f146a0cec31f080386d646bfb786ed6200280)
    Reviewed-on: https://gerrit.libreoffice.org/7439
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit 1fd6ebac89a83e6ceecd69f0c6c807d8ee8b5c81)
    Reviewed-on: https://gerrit.libreoffice.org/7470
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index 43be3a5..a8e2f1a 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -823,8 +823,12 @@ OUString SwFormTokensHelper::SearchNextToken( const OUString & sPattern,
     }
     else
     {
+        // apparently the TOX_STYLE_DELIMITER act as a bracketing for
+        // TOKEN_TEXT tokens so that the user can have '>' inside the text...
         const sal_Int32 nTextSeparatorFirst = sPattern.indexOf( TOX_STYLE_DELIMITER, nStt );
-        if( nTextSeparatorFirst>=0 && nTextSeparatorFirst+1<sPattern.getLength())
+        if (    nTextSeparatorFirst >= 0
+            &&  nTextSeparatorFirst + 1 < sPattern.getLength()
+            &&  nTextSeparatorFirst < nEnd)
         {
             const sal_Int32 nTextSeparatorSecond = sPattern.indexOf( TOX_STYLE_DELIMITER,
                                                                      nTextSeparatorFirst + 1 );
@@ -832,6 +836,7 @@ OUString SwFormTokensHelper::SearchNextToken( const OUString & sPattern,
             if( nEnd < nTextSeparatorSecond )
                 nEnd = sPattern.indexOf( '>', nTextSeparatorSecond );
             // FIXME: No check to verify that nEnd is still >=0?
+            assert(nEnd >= 0);
         }
 
         ++nEnd;


More information about the Libreoffice-commits mailing list