loplugin:flatten in lingucomponent

Change-Id: Ic0bf912a22e8efeae1a4f4864397f3f3d474c632
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91803
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2020-04-07 10:55:00 +02:00
parent 27d04f6dbf
commit 35f9dec364
7 changed files with 196 additions and 197 deletions

View File

@@ -736,8 +736,9 @@ void SAL_CALL Hyphenator::initialize( const Sequence< Any >& rArguments )
{ {
MutexGuard aGuard( GetLinguMutex() ); MutexGuard aGuard( GetLinguMutex() );
if (!pPropHelper) if (pPropHelper)
{ return;
sal_Int32 nLen = rArguments.getLength(); sal_Int32 nLen = rArguments.getLength();
if (2 == nLen) if (2 == nLen)
{ {
@@ -755,7 +756,6 @@ void SAL_CALL Hyphenator::initialize( const Sequence< Any >& rArguments )
else { else {
OSL_FAIL( "wrong number of arguments in sequence" ); OSL_FAIL( "wrong number of arguments in sequence" );
} }
}
} }
void SAL_CALL Hyphenator::dispose() void SAL_CALL Hyphenator::dispose()

View File

@@ -58,10 +58,10 @@ Guess::Guess(const char * guess_str)
, country_str(DEFAULT_COUNTRY) , country_str(DEFAULT_COUNTRY)
{ {
//if the guess is not like "UNKNOWN" or "SHORT", go into the brackets //if the guess is not like "UNKNOWN" or "SHORT", go into the brackets
if(strcmp(guess_str + 1, TEXTCAT_RESULT_UNKNOWN_STR) != 0 if(strcmp(guess_str + 1, TEXTCAT_RESULT_UNKNOWN_STR) == 0
&& || strcmp(guess_str + 1, TEXTCAT_RESULT_SHORT_STR) == 0)
strcmp(guess_str + 1, TEXTCAT_RESULT_SHORT_STR) != 0) return;
{
// From how this ctor is called from SimpleGuesser::GuessLanguage and // From how this ctor is called from SimpleGuesser::GuessLanguage and
// SimpleGuesser::GetManagedLanguages in // SimpleGuesser::GetManagedLanguages in
// lingucomponent/source/languageguessing/simpleguesser.cxx, guess_str must start with "[": // lingucomponent/source/languageguessing/simpleguesser.cxx, guess_str must start with "[":
@@ -98,7 +98,6 @@ Guess::Guess(const char * guess_str)
if (dash2 != nullptr) { if (dash2 != nullptr) {
country_str.assign(dash1 + 1, dash2 - (dash1 + 1)); country_str.assign(dash1 + 1, dash2 - (dash1 + 1));
} }
}
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -117,8 +117,9 @@ LangGuess_Impl::LangGuess_Impl() :
void LangGuess_Impl::EnsureInitialized() void LangGuess_Impl::EnsureInitialized()
{ {
if (!m_bInitialized) if (m_bInitialized)
{ return;
// set this to true at the very start to prevent loops because of // set this to true at the very start to prevent loops because of
// implicitly called functions below // implicitly called functions below
m_bInitialized = true; m_bInitialized = true;
@@ -164,7 +165,6 @@ void LangGuess_Impl::EnsureInitialized()
disableLanguages( aDisableSeq ); disableLanguages( aDisableSeq );
DBG_ASSERT( nNum == getDisabledLanguages().getLength(), "size mismatch" ); DBG_ASSERT( nNum == getDisabledLanguages().getLength(), "size mismatch" );
#endif #endif
}
} }
Locale SAL_CALL LangGuess_Impl::guessPrimaryLanguage( Locale SAL_CALL LangGuess_Impl::guessPrimaryLanguage(

View File

@@ -67,8 +67,9 @@ static void GetOldStyleDicsInDir(
std::vector< SvtLinguConfigDictionaryEntry >& aRes ) std::vector< SvtLinguConfigDictionaryEntry >& aRes )
{ {
osl::Directory aSystemDicts(aSystemDir); osl::Directory aSystemDicts(aSystemDir);
if (aSystemDicts.open() == osl::FileBase::E_None) if (aSystemDicts.open() != osl::FileBase::E_None)
{ return;
osl::DirectoryItem aItem; osl::DirectoryItem aItem;
osl::FileStatus aFileStatus(osl_FileStatus_Mask_FileURL); osl::FileStatus aFileStatus(osl_FileStatus_Mask_FileURL);
while (aSystemDicts.getNextItem(aItem) == osl::FileBase::E_None) while (aSystemDicts.getNextItem(aItem) == osl::FileBase::E_None)
@@ -127,7 +128,6 @@ static void GetOldStyleDicsInDir(
} }
} }
} }
}
} }
#endif #endif

View File

@@ -102,8 +102,9 @@ NumberText_Impl::NumberText_Impl()
void NumberText_Impl::EnsureInitialized() void NumberText_Impl::EnsureInitialized()
{ {
if (!m_bInitialized) if (m_bInitialized)
{ return;
// set this to true at the very start to prevent loops because of // set this to true at the very start to prevent loops because of
// implicitly called functions below // implicitly called functions below
m_bInitialized = true; m_bInitialized = true;
@@ -121,7 +122,6 @@ void NumberText_Impl::EnsureInitialized()
OString path = OUStringToOString(aPhysPath, osl_getThreadTextEncoding()); OString path = OUStringToOString(aPhysPath, osl_getThreadTextEncoding());
m_aNumberText.set_prefix(path.getStr()); m_aNumberText.set_prefix(path.getStr());
#endif #endif
}
} }
OUString SAL_CALL NumberText_Impl::getNumberText(const OUString& rText, const Locale& OUString SAL_CALL NumberText_Impl::getNumberText(const OUString& rText, const Locale&

View File

@@ -569,8 +569,9 @@ void SAL_CALL SpellChecker::initialize( const Sequence< Any >& rArguments )
{ {
MutexGuard aGuard( GetLinguMutex() ); MutexGuard aGuard( GetLinguMutex() );
if (!m_pPropHelper) if (m_pPropHelper)
{ return;
sal_Int32 nLen = rArguments.getLength(); sal_Int32 nLen = rArguments.getLength();
if (2 == nLen) if (2 == nLen)
{ {
@@ -588,7 +589,6 @@ void SAL_CALL SpellChecker::initialize( const Sequence< Any >& rArguments )
else { else {
OSL_FAIL( "wrong number of arguments in sequence" ); OSL_FAIL( "wrong number of arguments in sequence" );
} }
}
} }
void SAL_CALL SpellChecker::dispose() void SAL_CALL SpellChecker::dispose()

View File

@@ -470,8 +470,9 @@ void SAL_CALL Thesaurus::initialize( const Sequence< Any >& rArguments )
{ {
MutexGuard aGuard( GetLinguMutex() ); MutexGuard aGuard( GetLinguMutex() );
if (!pPropHelper) if (pPropHelper)
{ return;
sal_Int32 nLen = rArguments.getLength(); sal_Int32 nLen = rArguments.getLength();
if (1 == nLen) if (1 == nLen)
{ {
@@ -487,7 +488,6 @@ void SAL_CALL Thesaurus::initialize( const Sequence< Any >& rArguments )
} }
else else
OSL_FAIL( "wrong number of arguments in sequence" ); OSL_FAIL( "wrong number of arguments in sequence" );
}
} }
OUString Thesaurus::makeLowerCase(const OUString& aTerm, CharClass const * pCC) OUString Thesaurus::makeLowerCase(const OUString& aTerm, CharClass const * pCC)