summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-04-12 16:39:03 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-04-18 07:37:31 +0000
commit789055bc2acb4c71483fd60ea258d158bd5aec10 (patch)
tree7849de841a71f667a30b2a971ad0c3d406110396 /i18npool
parent150ac9cf05ed9da6a2af5bc3f820280fd853e519 (diff)
clang-tidy performance-unnecessary-copy-initialization
probably not much performance benefit, but it sure is good at identifying leftover intermediate variables from previous refactorings. Change-Id: I3ce16fe496ac2733c1cb0a35f74c0fc9193cc657 Reviewed-on: https://gerrit.libreoffice.org/24026 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/search/textsearch.cxx50
1 files changed, 22 insertions, 28 deletions
diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx
index dab32d11b1a5..060450947998 100644
--- a/i18npool/source/search/textsearch.cxx
+++ b/i18npool/source/search/textsearch.cxx
@@ -685,8 +685,7 @@ SearchResult TextSearch::NSrchFrwrd( const OUString& searchStr, sal_Int32 startP
OUString sSearchKey = bUsePrimarySrchStr ? sSrchStr : sSrchStr2;
- OUString aStr( searchStr );
- sal_Int32 nSuchIdx = aStr.getLength();
+ sal_Int32 nSuchIdx = searchStr.getLength();
sal_Int32 nEnde = endPos;
if( !nSuchIdx || !sSearchKey.getLength() || sSearchKey.getLength() > nSuchIdx )
return aRet;
@@ -704,15 +703,15 @@ SearchResult TextSearch::NSrchFrwrd( const OUString& searchStr, sal_Int32 startP
for (sal_Int32 nCmpIdx = startPos; // start position for the search
nCmpIdx <= nEnde;
- nCmpIdx += GetDiff( aStr[nCmpIdx + sSearchKey.getLength()-1]))
+ nCmpIdx += GetDiff( searchStr[nCmpIdx + sSearchKey.getLength()-1]))
{
// if the match would be the completed cells, skip it.
- if ( (checkCTLStart && !isCellStart( aStr, nCmpIdx )) || (checkCTLEnd
- && !isCellStart( aStr, nCmpIdx + sSearchKey.getLength())) )
+ if ( (checkCTLStart && !isCellStart( searchStr, nCmpIdx )) || (checkCTLEnd
+ && !isCellStart( searchStr, nCmpIdx + sSearchKey.getLength())) )
continue;
nSuchIdx = sSearchKey.getLength() - 1;
- while( nSuchIdx >= 0 && sSearchKey[nSuchIdx] == aStr[nCmpIdx + nSuchIdx])
+ while( nSuchIdx >= 0 && sSearchKey[nSuchIdx] == searchStr[nCmpIdx + nSuchIdx])
{
if( nSuchIdx == 0 )
{
@@ -721,8 +720,8 @@ SearchResult TextSearch::NSrchFrwrd( const OUString& searchStr, sal_Int32 startP
sal_Int32 nFndEnd = nCmpIdx + sSearchKey.getLength();
bool bAtStart = !nCmpIdx;
bool bAtEnd = nFndEnd == endPos;
- bool bDelimBefore = bAtStart || IsDelimiter( aStr, nCmpIdx-1 );
- bool bDelimBehind = bAtEnd || IsDelimiter( aStr, nFndEnd );
+ bool bDelimBefore = bAtStart || IsDelimiter( searchStr, nCmpIdx-1 );
+ bool bDelimBehind = bAtEnd || IsDelimiter( searchStr, nFndEnd );
// * 1 -> only one word in the paragraph
// * 2 -> at begin of paragraph
// * 3 -> at end of paragraph
@@ -757,8 +756,7 @@ SearchResult TextSearch::NSrchBkwrd( const OUString& searchStr, sal_Int32 startP
OUString sSearchKey = bUsePrimarySrchStr ? sSrchStr : sSrchStr2;
- OUString aStr( searchStr );
- sal_Int32 nSuchIdx = aStr.getLength();
+ sal_Int32 nSuchIdx = searchStr.getLength();
sal_Int32 nEnde = endPos;
if( nSuchIdx == 0 || sSearchKey.isEmpty() || sSearchKey.getLength() > nSuchIdx)
return aRet;
@@ -778,13 +776,13 @@ SearchResult TextSearch::NSrchBkwrd( const OUString& searchStr, sal_Int32 startP
while (nCmpIdx >= nEnde)
{
// if the match would be the completed cells, skip it.
- if ( (!checkCTLStart || isCellStart( aStr, nCmpIdx -
+ if ( (!checkCTLStart || isCellStart( searchStr, nCmpIdx -
sSearchKey.getLength() )) && (!checkCTLEnd ||
- isCellStart( aStr, nCmpIdx)))
+ isCellStart( searchStr, nCmpIdx)))
{
nSuchIdx = 0;
while( nSuchIdx < sSearchKey.getLength() && sSearchKey[nSuchIdx] ==
- aStr[nCmpIdx + nSuchIdx - sSearchKey.getLength()] )
+ searchStr[nCmpIdx + nSuchIdx - sSearchKey.getLength()] )
nSuchIdx++;
if( nSuchIdx >= sSearchKey.getLength() )
{
@@ -793,9 +791,9 @@ SearchResult TextSearch::NSrchBkwrd( const OUString& searchStr, sal_Int32 startP
sal_Int32 nFndStt = nCmpIdx - sSearchKey.getLength();
bool bAtStart = !nFndStt;
bool bAtEnd = nCmpIdx == startPos;
- bool bDelimBehind = bAtEnd || IsDelimiter( aStr, nCmpIdx );
+ bool bDelimBehind = bAtEnd || IsDelimiter( searchStr, nCmpIdx );
bool bDelimBefore = bAtStart || // begin of paragraph
- IsDelimiter( aStr, nFndStt-1 );
+ IsDelimiter( searchStr, nFndStt-1 );
// * 1 -> only one word in the paragraph
// * 2 -> at begin of paragraph
// * 3 -> at end of paragraph
@@ -824,7 +822,7 @@ SearchResult TextSearch::NSrchBkwrd( const OUString& searchStr, sal_Int32 startP
}
}
}
- nSuchIdx = GetDiff( aStr[nCmpIdx - sSearchKey.getLength()] );
+ nSuchIdx = GetDiff( searchStr[nCmpIdx - sSearchKey.getLength()] );
if( nCmpIdx < nSuchIdx )
return aRet;
nCmpIdx -= nSuchIdx;
@@ -1050,11 +1048,9 @@ SearchResult TextSearch::ApproxSrchFrwrd( const OUString& searchStr,
if( !xBreak.is() )
return aRet;
- OUString aWTemp( searchStr );
-
sal_Int32 nStt, nEnd;
- Boundary aWBnd = xBreak->getWordBoundary( aWTemp, startPos,
+ Boundary aWBnd = xBreak->getWordBoundary( searchStr, startPos,
aSrchPara.Locale,
WordType::ANYWORD_IGNOREWHITESPACES, sal_True );
@@ -1066,7 +1062,7 @@ SearchResult TextSearch::ApproxSrchFrwrd( const OUString& searchStr,
nEnd = aWBnd.endPos > endPos ? endPos : aWBnd.endPos;
if( nStt < nEnd &&
- pWLD->WLD( aWTemp.getStr() + nStt, nEnd - nStt ) <= nLimit )
+ pWLD->WLD( searchStr.getStr() + nStt, nEnd - nStt ) <= nLimit )
{
aRet.subRegExpressions = 1;
aRet.startOffset.realloc( 1 );
@@ -1077,10 +1073,10 @@ SearchResult TextSearch::ApproxSrchFrwrd( const OUString& searchStr,
}
nStt = nEnd - 1;
- aWBnd = xBreak->nextWord( aWTemp, nStt, aSrchPara.Locale,
+ aWBnd = xBreak->nextWord( searchStr, nStt, aSrchPara.Locale,
WordType::ANYWORD_IGNOREWHITESPACES);
} while( aWBnd.startPos != aWBnd.endPos ||
- (aWBnd.endPos != aWTemp.getLength() && aWBnd.endPos != nEnd) );
+ (aWBnd.endPos != searchStr.getLength() && aWBnd.endPos != nEnd) );
// #i50244# aWBnd.endPos != nEnd : in case there is _no_ word (only
// whitespace) in searchStr, getWordBoundary() returned startPos,startPos
// and nextWord() does also => don't loop forever.
@@ -1097,11 +1093,9 @@ SearchResult TextSearch::ApproxSrchBkwrd( const OUString& searchStr,
if( !xBreak.is() )
return aRet;
- OUString aWTemp( searchStr );
-
sal_Int32 nStt, nEnd;
- Boundary aWBnd = xBreak->getWordBoundary( aWTemp, startPos,
+ Boundary aWBnd = xBreak->getWordBoundary( searchStr, startPos,
aSrchPara.Locale,
WordType::ANYWORD_IGNOREWHITESPACES, sal_True );
@@ -1113,7 +1107,7 @@ SearchResult TextSearch::ApproxSrchBkwrd( const OUString& searchStr,
nEnd = aWBnd.endPos > startPos ? startPos : aWBnd.endPos;
if( nStt < nEnd &&
- pWLD->WLD( aWTemp.getStr() + nStt, nEnd - nStt ) <= nLimit )
+ pWLD->WLD( searchStr.getStr() + nStt, nEnd - nStt ) <= nLimit )
{
aRet.subRegExpressions = 1;
aRet.startOffset.realloc( 1 );
@@ -1125,9 +1119,9 @@ SearchResult TextSearch::ApproxSrchBkwrd( const OUString& searchStr,
if( !nStt )
break;
- aWBnd = xBreak->previousWord( aWTemp, nStt, aSrchPara.Locale,
+ aWBnd = xBreak->previousWord( searchStr, nStt, aSrchPara.Locale,
WordType::ANYWORD_IGNOREWHITESPACES);
- } while( aWBnd.startPos != aWBnd.endPos || aWBnd.endPos != aWTemp.getLength() );
+ } while( aWBnd.startPos != aWBnd.endPos || aWBnd.endPos != searchStr.getLength() );
return aRet;
}