summaryrefslogtreecommitdiff
path: root/linguistic
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 /linguistic
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 'linguistic')
-rw-r--r--linguistic/source/dicimp.cxx26
-rw-r--r--linguistic/source/lngsvcmgr.cxx12
-rw-r--r--linguistic/source/misc.cxx5
3 files changed, 18 insertions, 25 deletions
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index b243a25cb225..2df71c08f171 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -514,16 +514,14 @@ int DictionaryNeo::cmpDicEntry(const OUString& rWord1,
int nRes = 0;
- OUString aWord1( rWord1 ),
- aWord2( rWord2 );
- sal_Int32 nLen1 = aWord1.getLength(),
- nLen2 = aWord2.getLength();
+ sal_Int32 nLen1 = rWord1.getLength(),
+ nLen2 = rWord2.getLength();
if (bSimilarOnly)
{
const sal_Unicode cChar = '.';
- if (nLen1 && cChar == aWord1[ nLen1 - 1 ])
+ if (nLen1 && cChar == rWord1[ nLen1 - 1 ])
nLen1--;
- if (nLen2 && cChar == aWord2[ nLen2 - 1 ])
+ if (nLen2 && cChar == rWord2[ nLen2 - 1 ])
nLen2--;
}
@@ -543,7 +541,7 @@ int DictionaryNeo::cmpDicEntry(const OUString& rWord1,
{
// skip chars to be ignored
IgnState = false;
- while (nIdx1 < nLen1 && ((cChar1 = aWord1[ nIdx1 ]) == cIgnChar || cChar1 == cIgnBeg || IgnState ))
+ while (nIdx1 < nLen1 && ((cChar1 = rWord1[ nIdx1 ]) == cIgnChar || cChar1 == cIgnBeg || IgnState ))
{
if ( cChar1 == cIgnBeg )
IgnState = true;
@@ -553,7 +551,7 @@ int DictionaryNeo::cmpDicEntry(const OUString& rWord1,
nNumIgnChar1++;
}
IgnState = false;
- while (nIdx2 < nLen2 && ((cChar2 = aWord2[ nIdx2 ]) == cIgnChar || cChar2 == cIgnBeg || IgnState ))
+ while (nIdx2 < nLen2 && ((cChar2 = rWord2[ nIdx2 ]) == cIgnChar || cChar2 == cIgnBeg || IgnState ))
{
if ( cChar2 == cIgnBeg )
IgnState = true;
@@ -584,22 +582,22 @@ int DictionaryNeo::cmpDicEntry(const OUString& rWord1,
IgnState = false;
while (nIdx1 < nLen1 )
{
- if (aWord1[ nIdx1 ] == cIgnBeg)
+ if (rWord1[ nIdx1 ] == cIgnBeg)
IgnState = true;
- if (IgnState || aWord1[ nIdx1 ] == cIgnChar)
+ if (IgnState || rWord1[ nIdx1 ] == cIgnChar)
nNumIgnChar1++;
- if (aWord1[ nIdx1] == cIgnEnd)
+ if (rWord1[ nIdx1] == cIgnEnd)
IgnState = false;
nIdx1++;
}
IgnState = false;
while (nIdx2 < nLen2 )
{
- if (aWord2[ nIdx2 ] == cIgnBeg)
+ if (rWord2[ nIdx2 ] == cIgnBeg)
IgnState = true;
- if (IgnState || aWord2[ nIdx2 ] == cIgnChar)
+ if (IgnState || rWord2[ nIdx2 ] == cIgnChar)
nNumIgnChar2++;
- if (aWord2[ nIdx2 ] == cIgnEnd)
+ if (rWord2[ nIdx2 ] == cIgnEnd)
IgnState = false;
nIdx2++;
}
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index bb83b7a7b730..988bb26a8f27 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -829,10 +829,9 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
// delete old cached data, needs to be acquired new on demand
clearSvcInfoArray(pAvailSpellSvcs);
- OUString aNode( aSpellCheckerList );
if (lcl_SeqHasString( aSpellCheckerListEntries, aKeyText ))
{
- pNames[0] = aNode + "/" + aKeyText;
+ pNames[0] = aSpellCheckerList + "/" + aKeyText;
aValues = /*aCfg.*/GetProperties( aNames );
uno::Sequence< OUString > aSvcImplNames;
if (aValues.getLength())
@@ -853,10 +852,9 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
// delete old cached data, needs to be acquired new on demand
clearSvcInfoArray(pAvailGrammarSvcs);
- OUString aNode( aGrammarCheckerList );
if (lcl_SeqHasString( aGrammarCheckerListEntries, aKeyText ))
{
- pNames[0] = aNode + "/" + aKeyText;
+ pNames[0] = aGrammarCheckerList + "/" + aKeyText;
aValues = /*aCfg.*/GetProperties( aNames );
uno::Sequence< OUString > aSvcImplNames;
if (aValues.getLength())
@@ -880,10 +878,9 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
// delete old cached data, needs to be acquired new on demand
clearSvcInfoArray(pAvailHyphSvcs);
- OUString aNode( aHyphenatorList );
if (lcl_SeqHasString( aHyphenatorListEntries, aKeyText ))
{
- pNames[0] = aNode + "/" + aKeyText;
+ pNames[0] = aHyphenatorList + "/" + aKeyText;
aValues = /*aCfg.*/GetProperties( aNames );
uno::Sequence< OUString > aSvcImplNames;
if (aValues.getLength())
@@ -904,10 +901,9 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
// delete old cached data, needs to be acquired new on demand
clearSvcInfoArray(pAvailThesSvcs);
- OUString aNode( aThesaurusList );
if (lcl_SeqHasString( aThesaurusListEntries, aKeyText ))
{
- pNames[0] = aNode + "/" + aKeyText;
+ pNames[0] = aThesaurusList + "/" + aKeyText;
aValues = /*aCfg.*/GetProperties( aNames );
uno::Sequence< OUString > aSvcImplNames;
if (aValues.getLength())
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index a44fb0ed10ca..4cb427d805be 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -610,11 +610,10 @@ CapType SAL_CALL capitalType(const OUString& aTerm, CharClass * pCC)
sal_Int32 tlen = aTerm.getLength();
if ((pCC) && (tlen))
{
- OUString aStr(aTerm);
sal_Int32 nc = 0;
for (sal_Int32 tindex = 0; tindex < tlen; ++tindex)
{
- if (pCC->getCharacterType(aStr,tindex) &
+ if (pCC->getCharacterType(aTerm,tindex) &
css::i18n::KCharacterType::UPPER) nc++;
}
@@ -622,7 +621,7 @@ CapType SAL_CALL capitalType(const OUString& aTerm, CharClass * pCC)
return CapType::NOCAP;
if (nc == tlen)
return CapType::ALLCAP;
- if ((nc == 1) && (pCC->getCharacterType(aStr,0) &
+ if ((nc == 1) && (pCC->getCharacterType(aTerm,0) &
css::i18n::KCharacterType::UPPER))
return CapType::INITCAP;