diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-10-23 15:23:09 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-23 15:27:49 +0200 |
commit | a33dbc169037d985f104c83d01d5efd9982413de (patch) | |
tree | 1efe556e2b7a26a750b512dd31b487ba20f4418d /linguistic/source | |
parent | c0f865c9b5a34b272c9e0b22d18969554265914a (diff) |
Related fdo#46808: Fix pre-existing bug identified in previous commit
Assigning to dead xBreakIterator instead of m_xBreakIterator had been introduced
with 9f2fde7ab5de20926bb25a6b298b4e5dffb66eb2 "#i103496#: split svtools; improve
ConfitItems," and just fixing it does not cause any tests to start breaking for
me.
Change-Id: I9a26e8d3924bf15ae948c9c26b70f42f8f0d2f64
Diffstat (limited to 'linguistic/source')
-rw-r--r-- | linguistic/source/gciterator.cxx | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx index f324e514e0fa..b2f41628fd64 100644 --- a/linguistic/source/gciterator.cxx +++ b/linguistic/source/gciterator.cxx @@ -749,33 +749,27 @@ sal_Int32 GrammarCheckingIterator::GetSuggestedEndOfSentence( { // internal method; will always be called with locked mutex - // FIXME! this is a bug, the xBreakIterator var is hiding an issue! - // But if I fix it, the sw/complex tests start failing. - uno::Reference< i18n::XBreakIterator > xBreakIterator; if (!m_xBreakIterator.is()) { uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - xBreakIterator = i18n::BreakIterator::create(xContext); + m_xBreakIterator = i18n::BreakIterator::create(xContext); } sal_Int32 nTextLen = rText.getLength(); - sal_Int32 nEndPosition = nTextLen; - if (m_xBreakIterator.is()) + sal_Int32 nEndPosition; + sal_Int32 nTmpStartPos = nSentenceStartPos; + do { - sal_Int32 nTmpStartPos = nSentenceStartPos; - do - { + nEndPosition = nTextLen; + if (nTmpStartPos < nTextLen) + nEndPosition = m_xBreakIterator->endOfSentence( rText, nTmpStartPos, rLocale ); + if (nEndPosition < 0) nEndPosition = nTextLen; - if (nTmpStartPos < nTextLen) - nEndPosition = m_xBreakIterator->endOfSentence( rText, nTmpStartPos, rLocale ); - if (nEndPosition < 0) - nEndPosition = nTextLen; - ++nTmpStartPos; - } - while (nEndPosition <= nSentenceStartPos && nEndPosition < nTextLen); - if (nEndPosition > nTextLen) - nEndPosition = nTextLen; + ++nTmpStartPos; } + while (nEndPosition <= nSentenceStartPos && nEndPosition < nTextLen); + if (nEndPosition > nTextLen) + nEndPosition = nTextLen; return nEndPosition; } |