summaryrefslogtreecommitdiff
path: root/editeng
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 /editeng
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 'editeng')
-rw-r--r--editeng/source/editeng/eehtml.cxx5
-rw-r--r--editeng/source/editeng/impedit3.cxx13
-rw-r--r--editeng/source/misc/svxacorr.cxx20
3 files changed, 16 insertions, 22 deletions
diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx
index d250b7800673..cb3c14442f34 100644
--- a/editeng/source/editeng/eehtml.cxx
+++ b/editeng/source/editeng/eehtml.cxx
@@ -665,15 +665,14 @@ void EditHTMLParser::ImpSetStyleSheet( sal_uInt16 nHLevel )
void EditHTMLParser::ImpInsertText( const OUString& rText )
{
- OUString aText( rText );
if (mpEditEngine->IsImportHandlerSet())
{
ImportInfo aImportInfo(HTMLIMP_INSERTTEXT, this, mpEditEngine->CreateESelection(aCurSel));
- aImportInfo.aText = aText;
+ aImportInfo.aText = rText;
mpEditEngine->CallImportHandler(aImportInfo);
}
- aCurSel = mpEditEngine->InsertText(aCurSel, aText);
+ aCurSel = mpEditEngine->InsertText(aCurSel, rText);
}
void EditHTMLParser::SkipGroup( int nEndToken )
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 07285a99e94b..7a2b9ac1eaed 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -1861,7 +1861,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
if ( ( nWordEnd >= nMaxBreakPos ) && ( nWordLen > 3 ) )
{
// May happen, because getLineBreak may differ from getWordBoudary with DICTIONARY_WORD
- OUString aWord = pNode->GetString().copy(nWordStart, nWordLen);
+ const OUString aWord = pNode->GetString().copy(nWordStart, nWordLen);
sal_Int32 nMinTrail = nWordEnd-nMaxBreakPos+1; //+1: Before the dickey letter
Reference< XHyphenatedWord > xHyphWord;
if (xHyphenator.is())
@@ -1882,12 +1882,11 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
{
// TODO: handle all alternative hyphenations (see hyphen-1.2.8/tests/unicode.*)
OUString aAlt( xHyphWord->getHyphenatedWord() );
- OUString aWord2(aWord);
OUString aAltLeft(aAlt.copy(0, _nWordLen));
OUString aAltRight(aAlt.copy(_nWordLen));
- bAltFullLeft = aWord2.startsWith(aAltLeft);
- bAltFullRight = aWord2.endsWith(aAltRight);
- nAltDelChar = aWord2.getLength() - aAlt.getLength() + static_cast<int>(!bAltFullLeft) + static_cast<int>(!bAltFullRight);
+ bAltFullLeft = aWord.startsWith(aAltLeft);
+ bAltFullRight = aWord.endsWith(aAltRight);
+ nAltDelChar = aWord.getLength() - aAlt.getLength() + static_cast<int>(!bAltFullLeft) + static_cast<int>(!bAltFullRight);
// NOTE: improved for other cases, see fdo#63711
@@ -1900,7 +1899,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
// compound words because the Hyphenator separates
// all position of the word. [This is not true for libhyphen.]
// "Schiffahrtsbrennesseln" -> "Schifffahrtsbrennnesseln"
- // We can thus actually not directly connect the index of the
+ // We can thus actually not directly connect the index of the
// AlternativeWord to aWord. The whole issue will be simplified
// by a function in the Hyphenator as soon as AMA builds this in...
sal_Int32 nAltStart = _nWordLen - 1;
@@ -1935,7 +1934,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
bHyphenated = true;
nBreakPos = nWordStart + nTxtStart;
- if ( cAlternateReplChar || aAlt.getLength() < aWord2.getLength() || !bAltFullRight) // also for "oma-tje", "re-eel"
+ if ( cAlternateReplChar || aAlt.getLength() < aWord.getLength() || !bAltFullRight) // also for "oma-tje", "re-eel"
nBreakPos++;
}
}
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 2ec8405b1881..cafb0c0e5998 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1752,14 +1752,12 @@ bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
// First search for eLang, then primary language of eLang
// and last in LANGUAGE_UNDETERMINED
- OUString sTemp(sWord);
if (m_pLangTable->find(aLanguageTag) != m_pLangTable->end() || CreateLanguageFile(aLanguageTag, false))
{
//the language is available - so bring it on
auto const& pList = m_pLangTable->find(aLanguageTag)->second;
- OUString _sTemp(sWord);
- if(pList->GetWrdSttExceptList()->find(_sTemp) != pList->GetWrdSttExceptList()->end() )
+ if(pList->GetWrdSttExceptList()->find(sWord) != pList->GetWrdSttExceptList()->end() )
return true;
}
@@ -1773,7 +1771,7 @@ bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
{
//the language is available - so bring it on
auto const& pList = m_pLangTable->find(aLanguageTag)->second;
- if(pList->GetWrdSttExceptList()->find(sTemp) != pList->GetWrdSttExceptList()->end() )
+ if(pList->GetWrdSttExceptList()->find(sWord) != pList->GetWrdSttExceptList()->end() )
return true;
}
@@ -1782,7 +1780,7 @@ bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
{
//the language is available - so bring it on
auto const& pList = m_pLangTable->find(aLanguageTag)->second;
- if(pList->GetWrdSttExceptList()->find(sTemp) != pList->GetWrdSttExceptList()->end() )
+ if(pList->GetWrdSttExceptList()->find(sWord) != pList->GetWrdSttExceptList()->end() )
return true;
}
return false;
@@ -1831,13 +1829,12 @@ bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
// First search for eLang, then primary language of eLang
// and last in LANGUAGE_UNDETERMINED
- OUString sTemp( sWord );
if (m_pLangTable->find(aLanguageTag) != m_pLangTable->end() || CreateLanguageFile(aLanguageTag, false))
{
//the language is available - so bring it on
const SvStringsISortDtor* pList = m_pLangTable->find(aLanguageTag)->second->GetCplSttExceptList();
- if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(sTemp) != pList->end() )
+ if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(sWord) != pList->end() )
return true;
}
@@ -1851,7 +1848,7 @@ bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
{
//the language is available - so bring it on
const SvStringsISortDtor* pList = m_pLangTable->find(aLanguageTag)->second->GetCplSttExceptList();
- if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(sTemp) != pList->end() )
+ if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(sWord) != pList->end() )
return true;
}
@@ -1860,7 +1857,7 @@ bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
{
//the language is available - so bring it on
const SvStringsISortDtor* pList = m_pLangTable->find(aLanguageTag)->second->GetCplSttExceptList();
- if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(sTemp) != pList->end() )
+ if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(sWord) != pList->end() )
return true;
}
return false;
@@ -1967,12 +1964,11 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp(
rpLst = new SvStringsISortDtor;
{
- OUString sStrmName( pStrmName, strlen(pStrmName), RTL_TEXTENCODING_MS_1252 );
- OUString sTmp( sStrmName );
+ const OUString sStrmName( pStrmName, strlen(pStrmName), RTL_TEXTENCODING_MS_1252 );
if( rStg.Is() && rStg->IsStream( sStrmName ) )
{
- tools::SvRef<SotStorageStream> xStrm = rStg->OpenSotStream( sTmp,
+ tools::SvRef<SotStorageStream> xStrm = rStg->OpenSotStream( sStrmName,
( StreamMode::READ | StreamMode::SHARE_DENYWRITE | StreamMode::NOCREATE ) );
if( SVSTREAM_OK != xStrm->GetError())
{