summaryrefslogtreecommitdiff
path: root/linguistic
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-06-23 16:05:57 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-25 17:19:48 +0200
commit93d42c1b23721120fd2b61ee0b8842a14fd9b6b8 (patch)
tree5a2c4108ad65f7171a6c9bbf87199c874693a703 /linguistic
parenta006f60b6ae22db6acb57d06167a3c6fd8bc6f1b (diff)
loplugin:oncevar in l10ntools..mysqlc
Change-Id: Ifd4826f8ba4e10f2e012172fa693794d68bb6b4d Reviewed-on: https://gerrit.libreoffice.org/39188 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'linguistic')
-rw-r--r--linguistic/source/dlistimp.cxx12
-rw-r--r--linguistic/source/iprcache.cxx2
-rw-r--r--linguistic/source/lngopt.cxx3
-rw-r--r--linguistic/source/lngsvcmgr.cxx12
4 files changed, 11 insertions, 18 deletions
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index bff87e2f66ad..02bd690bd314 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -289,8 +289,6 @@ void DicList::SearchForDictionaries(
const OUString *pDirCnt = aDirCnt.getConstArray();
sal_Int32 nEntries = aDirCnt.getLength();
- OUString aDCN("dcn");
- OUString aDCP("dcp");
for (sal_Int32 i = 0; i < nEntries; ++i)
{
OUString aURL( pDirCnt[i] );
@@ -303,9 +301,9 @@ void DicList::SearchForDictionaries(
sal_Int32 nPos = aURL.indexOf('.');
OUString aExt( aURL.copy(nPos + 1).toAsciiLowerCase() );
- if (aDCN.equals(aExt)) // negativ
+ if ("dcn" == aExt) // negativ
bNeg = true;
- else if (aDCP.equals(aExt)) // positiv
+ else if ("dcp" == aExt) // positiv
bNeg = false;
else
continue; // andere Files
@@ -350,7 +348,6 @@ sal_Int32 DicList::GetDicPos(const uno::Reference< XDictionary > &xDic)
{
osl::MutexGuard aGuard( GetLinguMutex() );
- sal_Int32 nPos = -1;
DictionaryVec_t& rDicList = GetOrCreateDicList();
size_t n = rDicList.size();
for (size_t i = 0; i < n; i++)
@@ -358,7 +355,7 @@ sal_Int32 DicList::GetDicPos(const uno::Reference< XDictionary > &xDic)
if ( rDicList[i] == xDic )
return i;
}
- return nPos;
+ return -1;
}
/// @throws Exception
@@ -613,9 +610,8 @@ void DicList::CreateDicList()
// create IgnoreAllList dictionary with empty URL (non persistent)
// and add it to list
- OUString aDicName( "IgnoreAllList" );
uno::Reference< XDictionary > xIgnAll(
- createDictionary( aDicName, LinguLanguageToLocale( LANGUAGE_NONE ),
+ createDictionary( "IgnoreAllList", LinguLanguageToLocale( LANGUAGE_NONE ),
DictionaryType_POSITIVE, OUString() ) );
if (xIgnAll.is())
{
diff --git a/linguistic/source/iprcache.cxx b/linguistic/source/iprcache.cxx
index 1b8881ff7867..2f729de770e0 100644
--- a/linguistic/source/iprcache.cxx
+++ b/linguistic/source/iprcache.cxx
@@ -155,7 +155,7 @@ void SAL_CALL FlushListener::processDictionaryListEvent(
if (rDicListEvent.Source == xDicList)
{
sal_Int16 nEvt = rDicListEvent.nCondensedEvent;
- sal_Int16 nFlushFlags =
+ sal_Int16 const nFlushFlags =
DictionaryListEventFlags::ADD_NEG_ENTRY |
DictionaryListEventFlags::DEL_POS_ENTRY |
DictionaryListEventFlags::ACTIVATE_NEG_DIC |
diff --git a/linguistic/source/lngopt.cxx b/linguistic/source/lngopt.cxx
index 8a7cfb4d7dca..dd70c516be09 100644
--- a/linguistic/source/lngopt.cxx
+++ b/linguistic/source/lngopt.cxx
@@ -126,8 +126,7 @@ OUString LinguOptions::GetName( sal_Int32 nWID )
OUString aRes;
- sal_Int32 nLen = SAL_N_ELEMENTS(aWID_Name);
- if (0 <= nWID && nWID < nLen && aWID_Name[ nWID ].nWID == nWID)
+ if (0 <= nWID && nWID < sal_Int32(SAL_N_ELEMENTS(aWID_Name)) && aWID_Name[ nWID ].nWID == nWID)
aRes = OUString::createFromAscii(aWID_Name[nWID].pPropertyName);
else
OSL_FAIL("lng : unknown WID");
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index dbaf1de9c0d6..e3f91af32ff2 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -308,7 +308,7 @@ void SAL_CALL
// "translate" DictionaryList event into linguistic2::LinguServiceEvent
sal_Int16 nLngSvcEvt = 0;
- sal_Int16 nSpellCorrectFlags =
+ sal_Int16 const nSpellCorrectFlags =
linguistic2::DictionaryListEventFlags::ADD_NEG_ENTRY |
linguistic2::DictionaryListEventFlags::DEL_POS_ENTRY |
linguistic2::DictionaryListEventFlags::ACTIVATE_NEG_DIC |
@@ -316,7 +316,7 @@ void SAL_CALL
if (0 != (nDlEvt & nSpellCorrectFlags))
nLngSvcEvt |= linguistic2::LinguServiceEventFlags::SPELL_CORRECT_WORDS_AGAIN;
- sal_Int16 nSpellWrongFlags =
+ sal_Int16 const nSpellWrongFlags =
linguistic2::DictionaryListEventFlags::ADD_POS_ENTRY |
linguistic2::DictionaryListEventFlags::DEL_NEG_ENTRY |
linguistic2::DictionaryListEventFlags::ACTIVATE_POS_DIC |
@@ -324,7 +324,7 @@ void SAL_CALL
if (0 != (nDlEvt & nSpellWrongFlags))
nLngSvcEvt |= linguistic2::LinguServiceEventFlags::SPELL_WRONG_WORDS_AGAIN;
- sal_Int16 nHyphenateFlags =
+ sal_Int16 const nHyphenateFlags =
linguistic2::DictionaryListEventFlags::ADD_POS_ENTRY |
linguistic2::DictionaryListEventFlags::DEL_POS_ENTRY |
linguistic2::DictionaryListEventFlags::ACTIVATE_POS_DIC |
@@ -392,28 +392,26 @@ void LngSvcMgrListenerHelper::DisposeAndClear( const lang::EventObject &rEvtObj
bool LngSvcMgrListenerHelper::AddLngSvcEvtBroadcaster(
const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster )
{
- bool bRes = false;
if (rxBroadcaster.is())
{
aLngSvcEvtBroadcasters.addInterface( rxBroadcaster );
rxBroadcaster->addLinguServiceEventListener(
static_cast<linguistic2::XLinguServiceEventListener *>(this) );
}
- return bRes;
+ return false;
}
bool LngSvcMgrListenerHelper::RemoveLngSvcEvtBroadcaster(
const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster )
{
- bool bRes = false;
if (rxBroadcaster.is())
{
aLngSvcEvtBroadcasters.removeInterface( rxBroadcaster );
rxBroadcaster->removeLinguServiceEventListener(
static_cast<linguistic2::XLinguServiceEventListener *>(this) );
}
- return bRes;
+ return false;
}