diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2013-10-27 01:03:17 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2013-11-14 09:18:49 +0100 |
commit | cd470c64f9b09bb94262c606cfc36c8d923ffc54 (patch) | |
tree | 68eb61cf4cbb88e8d68e74a297d5f80c68dbee45 /editeng | |
parent | 22db67c9b64f6807d071d2c15da58954fb7aa8e9 (diff) |
xub_StrLen to sal_Int32 and minor optimizations
Change-Id: Ie8703ee0ff6c428ed00ffb88749540588e608b43
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/textconv.cxx | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/editeng/source/editeng/textconv.cxx b/editeng/source/editeng/textconv.cxx index bd86bafcdd72..2a315878b14f 100644 --- a/editeng/source/editeng/textconv.cxx +++ b/editeng/source/editeng/textconv.cxx @@ -455,17 +455,15 @@ void TextConvWrapper::ChangeText( const OUString &rNewText, const sal_Int32 nIndices = pOffsets->getLength(); const sal_Int32 *pIndices = pOffsets->getConstArray(); - sal_Int32 nConvTextLen = rNewText.getLength(); + const sal_Int32 nConvTextLen = rNewText.getLength(); sal_Int32 nPos = 0; sal_Int32 nChgPos = -1; - sal_Int32 nChgLen = 0; sal_Int32 nConvChgPos = -1; - sal_Int32 nConvChgLen = 0; // offset to calculate the position in the text taking into // account that text may have been replaced with new text of // different length. Negative values allowed! - long nCorrectionOffset = 0; + sal_Int32 nCorrectionOffset = 0; DBG_ASSERT(nIndices == 0 || nIndices == nConvTextLen, "mismatch between string length and sequence length!" ); @@ -483,14 +481,14 @@ void TextConvWrapper::ChangeText( const OUString &rNewText, nIndex = rOrigText.getLength(); } - if (rOrigText[nIndex] == rNewText[nPos] || - nPos == nConvTextLen /* end of string also terminates non-matching char sequence */) + // end of string also terminates non-matching char sequence + if (rOrigText[nIndex] == rNewText[nPos] || nPos == nConvTextLen) { // substring that needs to be replaced found? - if (nChgPos != -1 && nConvChgPos != -1) + if (nChgPos>=0 && nConvChgPos>=0) { - nChgLen = nIndex - nChgPos; - nConvChgLen = nPos - nConvChgPos; + const sal_Int32 nChgLen = nIndex - nChgPos; + const sal_Int32 nConvChgLen = nPos - nConvChgPos; #ifdef DEBUG OUString aInOrig( rOrigText.copy( nChgPos, nChgLen ) ); #endif @@ -520,7 +518,7 @@ void TextConvWrapper::ChangeText( const OUString &rNewText, else { // begin of non-matching char sequence found ? - if (nChgPos == -1 && nConvChgPos == -1) + if (nChgPos<0 && nConvChgPos<0) { nChgPos = nIndex; nConvChgPos = nPos; |