From c87f146a0cec31f080386d646bfb786ed6200280 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 14 Jan 2014 23:58:11 +0100 Subject: 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 --- sw/source/core/tox/tox.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx index 9dab768942da..8592046108fa 100644 --- a/sw/source/core/tox/tox.cxx +++ b/sw/source/core/tox/tox.cxx @@ -830,8 +830,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= 0 + && nTextSeparatorFirst + 1 < sPattern.getLength() + && nTextSeparatorFirst < nEnd) { const sal_Int32 nTextSeparatorSecond = sPattern.indexOf( TOX_STYLE_DELIMITER, nTextSeparatorFirst + 1 ); @@ -839,6 +843,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; -- cgit v1.2.3