Kaydet (Commit) 4288c320 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

More loplugin:cstylecast: linguistic

auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files

Change-Id: Ic1b6e8fbf3ba8d3477ee3f5539667427d26c2f43
üst ad137adb
...@@ -301,9 +301,9 @@ void ConvDic::AddEntry( const OUString &rLeftText, const OUString &rRightText ) ...@@ -301,9 +301,9 @@ void ConvDic::AddEntry( const OUString &rLeftText, const OUString &rRightText )
if (bMaxCharCountIsValid) if (bMaxCharCountIsValid)
{ {
if (rLeftText.getLength() > nMaxLeftCharCount) if (rLeftText.getLength() > nMaxLeftCharCount)
nMaxLeftCharCount = (sal_Int16) rLeftText.getLength(); nMaxLeftCharCount = static_cast<sal_Int16>(rLeftText.getLength());
if (pFromRight.get() && rRightText.getLength() > nMaxRightCharCount) if (pFromRight.get() && rRightText.getLength() > nMaxRightCharCount)
nMaxRightCharCount = (sal_Int16) rRightText.getLength(); nMaxRightCharCount = static_cast<sal_Int16>(rRightText.getLength());
} }
bIsModified = true; bIsModified = true;
...@@ -513,7 +513,7 @@ sal_Int16 SAL_CALL ConvDic::getMaxCharCount( ConversionDirection eDirection ) ...@@ -513,7 +513,7 @@ sal_Int16 SAL_CALL ConvDic::getMaxCharCount( ConversionDirection eDirection )
ConvMap::iterator aIt = aFromLeft.begin(); ConvMap::iterator aIt = aFromLeft.begin();
while (aIt != aFromLeft.end()) while (aIt != aFromLeft.end())
{ {
sal_Int16 nTmp = (sal_Int16) (*aIt).first.getLength(); sal_Int16 nTmp = static_cast<sal_Int16>((*aIt).first.getLength());
if (nTmp > nMaxLeftCharCount) if (nTmp > nMaxLeftCharCount)
nMaxLeftCharCount = nTmp; nMaxLeftCharCount = nTmp;
++aIt; ++aIt;
...@@ -525,7 +525,7 @@ sal_Int16 SAL_CALL ConvDic::getMaxCharCount( ConversionDirection eDirection ) ...@@ -525,7 +525,7 @@ sal_Int16 SAL_CALL ConvDic::getMaxCharCount( ConversionDirection eDirection )
aIt = pFromRight->begin(); aIt = pFromRight->begin();
while (aIt != pFromRight->end()) while (aIt != pFromRight->end())
{ {
sal_Int16 nTmp = (sal_Int16) (*aIt).first.getLength(); sal_Int16 nTmp = static_cast<sal_Int16>((*aIt).first.getLength());
if (nTmp > nMaxRightCharCount) if (nTmp > nMaxRightCharCount)
nMaxRightCharCount = nTmp; nMaxRightCharCount = nTmp;
++aIt; ++aIt;
......
...@@ -726,14 +726,14 @@ bool DictionaryNeo::addEntry_Impl(const uno::Reference< XDictionaryEntry >& xDic ...@@ -726,14 +726,14 @@ bool DictionaryNeo::addEntry_Impl(const uno::Reference< XDictionaryEntry >& xDic
Reference< XSpellAlternatives > xTmpRes; Reference< XSpellAlternatives > xTmpRes;
xSpell.set( xLngSvcMgr->getSpellChecker(), UNO_QUERY ); xSpell.set( xLngSvcMgr->getSpellChecker(), UNO_QUERY );
Sequence< css::beans::PropertyValue > aEmptySeq; Sequence< css::beans::PropertyValue > aEmptySeq;
if (xSpell.is() && (xSpell->isValid( SPELLML_SUPPORT, (sal_uInt16)nLanguage, aEmptySeq ))) if (xSpell.is() && (xSpell->isValid( SPELLML_SUPPORT, static_cast<sal_uInt16>(nLanguage), aEmptySeq )))
{ {
// "Grammar By" sample word is a Hunspell dictionary word? // "Grammar By" sample word is a Hunspell dictionary word?
if (xSpell->isValid( xDicEntry->getReplacementText(), (sal_uInt16)nLanguage, aEmptySeq )) if (xSpell->isValid( xDicEntry->getReplacementText(), static_cast<sal_uInt16>(nLanguage), aEmptySeq ))
{ {
xTmpRes = xSpell->spell( "<?xml?><query type='add'><word>" + xTmpRes = xSpell->spell( "<?xml?><query type='add'><word>" +
xDicEntry->getDictionaryWord() + "</word><word>" + xDicEntry->getReplacementText() + xDicEntry->getDictionaryWord() + "</word><word>" + xDicEntry->getReplacementText() +
"</word></query>", (sal_uInt16)nLanguage, aEmptySeq ); "</word></query>", static_cast<sal_uInt16>(nLanguage), aEmptySeq );
bRes = true; bRes = true;
} else } else
bRes = false; bRes = false;
...@@ -810,7 +810,7 @@ sal_Int32 SAL_CALL DictionaryNeo::getCount( ) ...@@ -810,7 +810,7 @@ sal_Int32 SAL_CALL DictionaryNeo::getCount( )
if (bNeedEntries) if (bNeedEntries)
loadEntries( aMainURL ); loadEntries( aMainURL );
return (sal_Int32)aEntries.size(); return static_cast<sal_Int32>(aEntries.size());
} }
Locale SAL_CALL DictionaryNeo::getLocale( ) Locale SAL_CALL DictionaryNeo::getLocale( )
...@@ -842,7 +842,7 @@ uno::Reference< XDictionaryEntry > SAL_CALL DictionaryNeo::getEntry( ...@@ -842,7 +842,7 @@ uno::Reference< XDictionaryEntry > SAL_CALL DictionaryNeo::getEntry(
sal_Int32 nPos; sal_Int32 nPos;
bool bFound = seekEntry( aWord, &nPos, true ); bool bFound = seekEntry( aWord, &nPos, true );
DBG_ASSERT(!bFound || nPos < (sal_Int32)aEntries.size(), "lng : index out of range"); DBG_ASSERT(!bFound || nPos < static_cast<sal_Int32>(aEntries.size()), "lng : index out of range");
return bFound ? aEntries[ nPos ] return bFound ? aEntries[ nPos ]
: uno::Reference< XDictionaryEntry >(); : uno::Reference< XDictionaryEntry >();
...@@ -896,7 +896,7 @@ sal_Bool SAL_CALL DictionaryNeo::remove( const OUString& aWord ) ...@@ -896,7 +896,7 @@ sal_Bool SAL_CALL DictionaryNeo::remove( const OUString& aWord )
sal_Int32 nPos; sal_Int32 nPos;
bool bFound = seekEntry( aWord, &nPos ); bool bFound = seekEntry( aWord, &nPos );
DBG_ASSERT(!bFound || nPos < (sal_Int32)aEntries.size(), "lng : index out of range"); DBG_ASSERT(!bFound || nPos < static_cast<sal_Int32>(aEntries.size()), "lng : index out of range");
// remove element if found // remove element if found
if (bFound) if (bFound)
......
...@@ -110,7 +110,7 @@ Reference<XHyphenatedWord> HyphenatorDispatcher::buildHyphWord( ...@@ -110,7 +110,7 @@ Reference<XHyphenatedWord> HyphenatorDispatcher::buildHyphWord(
if (!bSkip && nHyphIdx >= 0) if (!bSkip && nHyphIdx >= 0)
{ {
if (nLeading <= nMaxLeading) { if (nLeading <= nMaxLeading) {
nHyphenationPos = (sal_Int16) nHyphIdx; nHyphenationPos = static_cast<sal_Int16>(nHyphIdx);
nOrigHyphPos = i; nOrigHyphPos = i;
} }
} }
...@@ -220,7 +220,7 @@ Reference< XPossibleHyphens > HyphenatorDispatcher::buildPossHyphens( ...@@ -220,7 +220,7 @@ Reference< XPossibleHyphens > HyphenatorDispatcher::buildPossHyphens(
else else
{ {
if (!bSkip && nHyphIdx >= 0) if (!bSkip && nHyphIdx >= 0)
pPos[ nHyphCount++ ] = (sal_Int16) nHyphIdx; pPos[ nHyphCount++ ] = static_cast<sal_Int16>(nHyphIdx);
bSkip = true; //! multiple '=' should count as one only bSkip = true; //! multiple '=' should count as one only
} }
} }
...@@ -305,7 +305,7 @@ Reference< XHyphenatedWord > SAL_CALL ...@@ -305,7 +305,7 @@ Reference< XHyphenatedWord > SAL_CALL
bWordModified |= RemoveHyphens( aChkWord ); bWordModified |= RemoveHyphens( aChkWord );
if (IsIgnoreControlChars( rProperties, GetPropSet() )) if (IsIgnoreControlChars( rProperties, GetPropSet() ))
bWordModified |= RemoveControlChars( aChkWord ); bWordModified |= RemoveControlChars( aChkWord );
sal_Int16 nChkMaxLeading = (sal_Int16) GetPosInWordToCheck( rWord, nMaxLeading ); sal_Int16 nChkMaxLeading = static_cast<sal_Int16>(GetPosInWordToCheck( rWord, nMaxLeading ));
// check for results from (positive) dictionaries which have precedence! // check for results from (positive) dictionaries which have precedence!
Reference< XDictionaryEntry > xEntry; Reference< XDictionaryEntry > xEntry;
...@@ -379,7 +379,7 @@ Reference< XHyphenatedWord > SAL_CALL ...@@ -379,7 +379,7 @@ Reference< XHyphenatedWord > SAL_CALL
xRes = xHyph->hyphenate( aChkWord, rLocale, nChkMaxLeading, xRes = xHyph->hyphenate( aChkWord, rLocale, nChkMaxLeading,
rProperties ); rProperties );
pEntry->nLastTriedSvcIndex = (sal_Int16) i; pEntry->nLastTriedSvcIndex = static_cast<sal_Int16>(i);
++i; ++i;
// if language is not supported by the services // if language is not supported by the services
...@@ -440,7 +440,7 @@ Reference< XHyphenatedWord > SAL_CALL ...@@ -440,7 +440,7 @@ Reference< XHyphenatedWord > SAL_CALL
bWordModified |= RemoveHyphens( aChkWord ); bWordModified |= RemoveHyphens( aChkWord );
if (IsIgnoreControlChars( rProperties, GetPropSet() )) if (IsIgnoreControlChars( rProperties, GetPropSet() ))
bWordModified |= RemoveControlChars( aChkWord ); bWordModified |= RemoveControlChars( aChkWord );
sal_Int16 nChkIndex = (sal_Int16) GetPosInWordToCheck( rWord, nIndex ); sal_Int16 nChkIndex = static_cast<sal_Int16>(GetPosInWordToCheck( rWord, nIndex ));
// check for results from (positive) dictionaries which have precedence! // check for results from (positive) dictionaries which have precedence!
Reference< XDictionaryEntry > xEntry; Reference< XDictionaryEntry > xEntry;
...@@ -510,7 +510,7 @@ Reference< XHyphenatedWord > SAL_CALL ...@@ -510,7 +510,7 @@ Reference< XHyphenatedWord > SAL_CALL
xRes = xHyph->queryAlternativeSpelling( aChkWord, rLocale, xRes = xHyph->queryAlternativeSpelling( aChkWord, rLocale,
nChkIndex, rProperties ); nChkIndex, rProperties );
pEntry->nLastTriedSvcIndex = (sal_Int16) i; pEntry->nLastTriedSvcIndex = static_cast<sal_Int16>(i);
++i; ++i;
// if language is not supported by the services // if language is not supported by the services
...@@ -631,7 +631,7 @@ Reference< XPossibleHyphens > SAL_CALL ...@@ -631,7 +631,7 @@ Reference< XPossibleHyphens > SAL_CALL
if (xHyph.is() && xHyph->hasLocale( rLocale )) if (xHyph.is() && xHyph->hasLocale( rLocale ))
xRes = xHyph->createPossibleHyphens( aChkWord, rLocale, rProperties ); xRes = xHyph->createPossibleHyphens( aChkWord, rLocale, rProperties );
pEntry->nLastTriedSvcIndex = (sal_Int16) i; pEntry->nLastTriedSvcIndex = static_cast<sal_Int16>(i);
++i; ++i;
// if language is not supported by the services // if language is not supported by the services
......
...@@ -111,23 +111,23 @@ public: ...@@ -111,23 +111,23 @@ public:
virtual sal_Bool SAL_CALL getIsUseDictionaryList() override virtual sal_Bool SAL_CALL getIsUseDictionaryList() override
{ return getPropertyBool(UPN_IS_USE_DICTIONARY_LIST); } { return getPropertyBool(UPN_IS_USE_DICTIONARY_LIST); }
virtual void SAL_CALL setIsUseDictionaryList(sal_Bool p1) override virtual void SAL_CALL setIsUseDictionaryList(sal_Bool p1) override
{ setProperty(UPN_IS_USE_DICTIONARY_LIST, (bool) p1); } { setProperty(UPN_IS_USE_DICTIONARY_LIST, static_cast<bool>(p1)); }
virtual sal_Bool SAL_CALL getIsIgnoreControlCharacters() override virtual sal_Bool SAL_CALL getIsIgnoreControlCharacters() override
{ return getPropertyBool(UPN_IS_IGNORE_CONTROL_CHARACTERS); } { return getPropertyBool(UPN_IS_IGNORE_CONTROL_CHARACTERS); }
virtual void SAL_CALL setIsIgnoreControlCharacters(sal_Bool p1) override virtual void SAL_CALL setIsIgnoreControlCharacters(sal_Bool p1) override
{ setProperty(UPN_IS_IGNORE_CONTROL_CHARACTERS, (bool) p1); } { setProperty(UPN_IS_IGNORE_CONTROL_CHARACTERS, static_cast<bool>(p1)); }
virtual sal_Bool SAL_CALL getIsSpellUpperCase() override virtual sal_Bool SAL_CALL getIsSpellUpperCase() override
{ return getPropertyBool(UPN_IS_SPELL_UPPER_CASE); } { return getPropertyBool(UPN_IS_SPELL_UPPER_CASE); }
virtual void SAL_CALL setIsSpellUpperCase(sal_Bool p1) override virtual void SAL_CALL setIsSpellUpperCase(sal_Bool p1) override
{ setProperty(UPN_IS_SPELL_UPPER_CASE, (bool) p1); } { setProperty(UPN_IS_SPELL_UPPER_CASE, static_cast<bool>(p1)); }
virtual sal_Bool SAL_CALL getIsSpellWithDigits() override virtual sal_Bool SAL_CALL getIsSpellWithDigits() override
{ return getPropertyBool(UPN_IS_SPELL_WITH_DIGITS); } { return getPropertyBool(UPN_IS_SPELL_WITH_DIGITS); }
virtual void SAL_CALL setIsSpellWithDigits(sal_Bool p1) override virtual void SAL_CALL setIsSpellWithDigits(sal_Bool p1) override
{ setProperty(UPN_IS_SPELL_WITH_DIGITS, (bool) p1); } { setProperty(UPN_IS_SPELL_WITH_DIGITS, static_cast<bool>(p1)); }
virtual sal_Bool SAL_CALL getIsSpellCapitalization() override virtual sal_Bool SAL_CALL getIsSpellCapitalization() override
{ return getPropertyBool(UPN_IS_SPELL_CAPITALIZATION); } { return getPropertyBool(UPN_IS_SPELL_CAPITALIZATION); }
virtual void SAL_CALL setIsSpellCapitalization(sal_Bool p1) override virtual void SAL_CALL setIsSpellCapitalization(sal_Bool p1) override
{ setProperty(UPN_IS_SPELL_CAPITALIZATION, (bool) p1); } { setProperty(UPN_IS_SPELL_CAPITALIZATION, static_cast<bool>(p1)); }
virtual sal_Int16 SAL_CALL getHyphMinLeading() override virtual sal_Int16 SAL_CALL getHyphMinLeading() override
{ return getPropertyInt16(UPN_HYPH_MIN_LEADING); } { return getPropertyInt16(UPN_HYPH_MIN_LEADING); }
virtual void SAL_CALL setHyphMinLeading(sal_Int16 p1) override virtual void SAL_CALL setHyphMinLeading(sal_Int16 p1) override
...@@ -147,23 +147,23 @@ public: ...@@ -147,23 +147,23 @@ public:
virtual sal_Bool SAL_CALL getIsHyphAuto() override virtual sal_Bool SAL_CALL getIsHyphAuto() override
{ return getPropertyBool(UPN_IS_HYPH_AUTO); } { return getPropertyBool(UPN_IS_HYPH_AUTO); }
virtual void SAL_CALL setIsHyphAuto(sal_Bool p1) override virtual void SAL_CALL setIsHyphAuto(sal_Bool p1) override
{ setProperty(UPN_IS_HYPH_AUTO, (bool) p1); } { setProperty(UPN_IS_HYPH_AUTO, static_cast<bool>(p1)); }
virtual sal_Bool SAL_CALL getIsHyphSpecial() override virtual sal_Bool SAL_CALL getIsHyphSpecial() override
{ return getPropertyBool(UPN_IS_HYPH_SPECIAL); } { return getPropertyBool(UPN_IS_HYPH_SPECIAL); }
virtual void SAL_CALL setIsHyphSpecial(sal_Bool p1) override virtual void SAL_CALL setIsHyphSpecial(sal_Bool p1) override
{ setProperty(UPN_IS_HYPH_SPECIAL, (bool) p1); } { setProperty(UPN_IS_HYPH_SPECIAL, static_cast<bool>(p1)); }
virtual sal_Bool SAL_CALL getIsSpellAuto() override virtual sal_Bool SAL_CALL getIsSpellAuto() override
{ return getPropertyBool(UPN_IS_SPELL_AUTO); } { return getPropertyBool(UPN_IS_SPELL_AUTO); }
virtual void SAL_CALL setIsSpellAuto(sal_Bool p1) override virtual void SAL_CALL setIsSpellAuto(sal_Bool p1) override
{ setProperty(UPN_IS_SPELL_AUTO, (bool) p1); } { setProperty(UPN_IS_SPELL_AUTO, static_cast<bool>(p1)); }
virtual sal_Bool SAL_CALL getIsSpellSpecial() override virtual sal_Bool SAL_CALL getIsSpellSpecial() override
{ return getPropertyBool(UPN_IS_SPELL_SPECIAL); } { return getPropertyBool(UPN_IS_SPELL_SPECIAL); }
virtual void SAL_CALL setIsSpellSpecial(sal_Bool p1) override virtual void SAL_CALL setIsSpellSpecial(sal_Bool p1) override
{ setProperty(UPN_IS_SPELL_SPECIAL, (bool) p1); } { setProperty(UPN_IS_SPELL_SPECIAL, static_cast<bool>(p1)); }
virtual sal_Bool SAL_CALL getIsWrapReverse() override virtual sal_Bool SAL_CALL getIsWrapReverse() override
{ return getPropertyBool(UPN_IS_WRAP_REVERSE); } { return getPropertyBool(UPN_IS_WRAP_REVERSE); }
virtual void SAL_CALL setIsWrapReverse(sal_Bool p1) override virtual void SAL_CALL setIsWrapReverse(sal_Bool p1) override
{ setProperty(UPN_IS_WRAP_REVERSE, (bool) p1); } { setProperty(UPN_IS_WRAP_REVERSE, static_cast<bool>(p1)); }
virtual css::lang::Locale SAL_CALL getDefaultLocale_CJK() override virtual css::lang::Locale SAL_CALL getDefaultLocale_CJK() override
{ return getPropertyLocale(UPN_DEFAULT_LOCALE_CJK); } { return getPropertyLocale(UPN_DEFAULT_LOCALE_CJK); }
virtual void SAL_CALL setDefaultLocale_CJK(const css::lang::Locale& p1) override virtual void SAL_CALL setDefaultLocale_CJK(const css::lang::Locale& p1) override
......
...@@ -400,7 +400,7 @@ uno::Sequence< sal_Int16 > ...@@ -400,7 +400,7 @@ uno::Sequence< sal_Int16 >
sal_Int16 *pLang = aLangs.getArray(); sal_Int16 *pLang = aLangs.getArray();
for (sal_Int32 i = 0; i < nCount; ++i) for (sal_Int32 i = 0; i < nCount; ++i)
{ {
pLang[i] = (sal_uInt16)LinguLocaleToLanguage( pLocale[i] ); pLang[i] = static_cast<sal_uInt16>(LinguLocaleToLanguage( pLocale[i] ));
} }
return aLangs; return aLangs;
......
...@@ -401,7 +401,7 @@ bool SpellCheckerDispatcher::isValid_Impl( ...@@ -401,7 +401,7 @@ bool SpellCheckerDispatcher::isValid_Impl(
if (bTmpResValid) if (bTmpResValid)
bRes = bTmpRes; bRes = bTmpRes;
pEntry->nLastTriedSvcIndex = (sal_Int16) i; pEntry->nLastTriedSvcIndex = static_cast<sal_Int16>(i);
++i; ++i;
} }
...@@ -603,7 +603,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( ...@@ -603,7 +603,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
nNumSugestions = nTmpNumSugestions; nNumSugestions = nTmpNumSugestions;
} }
pEntry->nLastTriedSvcIndex = (sal_Int16) i; pEntry->nLastTriedSvcIndex = static_cast<sal_Int16>(i);
++i; ++i;
} }
......
...@@ -140,7 +140,7 @@ std::vector< OUString > MergeProposalSeqs( ...@@ -140,7 +140,7 @@ std::vector< OUString > MergeProposalSeqs(
size_t nAltCount1 = rAlt1.size(); size_t nAltCount1 = rAlt1.size();
size_t nAltCount2 = rAlt2.size(); size_t nAltCount2 = rAlt2.size();
sal_Int32 nCountNew = std::min<sal_Int32>( nAltCount1 + nAltCount2, (sal_Int32) MAX_PROPOSALS ); sal_Int32 nCountNew = std::min<sal_Int32>( nAltCount1 + nAltCount2, sal_Int32(MAX_PROPOSALS) );
aMerged.resize( nCountNew ); aMerged.resize( nCountNew );
sal_Int32 nIndex = 0; sal_Int32 nIndex = 0;
...@@ -209,7 +209,7 @@ sal_Int16 SAL_CALL SpellAlternatives::getFailureType() ...@@ -209,7 +209,7 @@ sal_Int16 SAL_CALL SpellAlternatives::getFailureType()
sal_Int16 SAL_CALL SpellAlternatives::getAlternativesCount() sal_Int16 SAL_CALL SpellAlternatives::getAlternativesCount()
{ {
MutexGuard aGuard( GetLinguMutex() ); MutexGuard aGuard( GetLinguMutex() );
return (sal_Int16) aAlt.getLength(); return static_cast<sal_Int16>(aAlt.getLength());
} }
......
...@@ -179,7 +179,7 @@ Sequence< Reference< XMeaning > > SAL_CALL ...@@ -179,7 +179,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
if (xThes.is() && xThes->hasLocale( rLocale )) if (xThes.is() && xThes->hasLocale( rLocale ))
aMeanings = xThes->queryMeanings( aChkWord, rLocale, rProperties ); aMeanings = xThes->queryMeanings( aChkWord, rLocale, rProperties );
pEntry->nLastTriedSvcIndex = (sal_Int16) i; pEntry->nLastTriedSvcIndex = static_cast<sal_Int16>(i);
++i; ++i;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment