loplugin:flatten in unotools

Change-Id: I2fad16061bca6dc3e57926863e7a3b71947a8ade
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100139
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2020-08-04 21:29:47 +02:00
parent 48a3d6b85e
commit f3ff488fd4
10 changed files with 366 additions and 366 deletions

View File

@ -537,8 +537,9 @@ bool ConfigItem::EnableNotification(const Sequence< OUString >& rNames,
void ConfigItem::RemoveChangesListener()
{
Reference<XHierarchicalNameAccess> xHierarchyAccess = GetTree();
if(xHierarchyAccess.is())
{
if(!xHierarchyAccess.is())
return;
Reference<XChangesNotifier> xChgNot(xHierarchyAccess, UNO_QUERY);
if(xChgNot.is() && xChangeLstnr.is())
{
@ -552,7 +553,6 @@ void ConfigItem::RemoveChangesListener()
}
}
}
}
static void lcl_normalizeLocalNames(Sequence< OUString >& _rNames, ConfigNameFormat _eFormat, Reference<XInterface> const& _xParentNode)
{

View File

@ -233,8 +233,9 @@ SvtDefaultOptions_Impl::SvtDefaultOptions_Impl() : ConfigItem( "Office.Common/Pa
EnableNotification( aNames );
const Any* pValues = aValues.getConstArray();
DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" );
if ( aValues.getLength() == aNames.getLength() )
{
if ( aValues.getLength() != aNames.getLength() )
return;
SvtPathOptions aPathOpt;
OUString aTempStr;
OUStringBuffer aFullPathBuf;
@ -318,7 +319,6 @@ SvtDefaultOptions_Impl::SvtDefaultOptions_Impl() : ConfigItem( "Office.Common/Pa
}
}
}
}
SvtDefaultOptions_Impl::~SvtDefaultOptions_Impl()
{

View File

@ -974,10 +974,12 @@ ImplFontAttrs FontSubstConfiguration::getSubstType( const css::uno::Reference< X
void FontSubstConfiguration::readLocaleSubst( const OUString& rBcp47 ) const
{
std::unordered_map< OUString, LocaleSubst >::const_iterator it = m_aSubst.find( rBcp47 );
if( it != m_aSubst.end() )
{
if( ! it->second.bConfigRead )
{
if( it == m_aSubst.end() )
return;
if( it->second.bConfigRead )
return;
it->second.bConfigRead = true;
Reference< XNameAccess > xNode;
try
@ -991,8 +993,9 @@ void FontSubstConfiguration::readLocaleSubst( const OUString& rBcp47 ) const
catch (const WrappedTargetException&)
{
}
if( xNode.is() )
{
if( !xNode.is() )
return;
const Sequence< OUString > aFonts = xNode->getElementNames();
int nFonts = aFonts.getLength();
// improve performance, heap fragmentation
@ -1038,9 +1041,6 @@ void FontSubstConfiguration::readLocaleSubst( const OUString& rBcp47 ) const
}
std::sort( it->second.aSubstAttributes.begin(), it->second.aSubstAttributes.end(), StrictStringSort() );
}
}
}
}
const FontNameAttr* FontSubstConfiguration::getSubstInfo( const OUString& rFontName ) const
{

View File

@ -268,8 +268,9 @@ void SvtPathOptions_Impl::SetPath( SvtPathOptions::Paths ePath, const OUString&
{
::osl::MutexGuard aGuard( m_aMutex );
if ( ePath < SvtPathOptions::PATH_COUNT )
{
if ( ePath >= SvtPathOptions::PATH_COUNT )
return;
OUString aResult;
OUString aNewValue;
Any a;
@ -304,7 +305,6 @@ void SvtPathOptions_Impl::SetPath( SvtPathOptions::Paths ePath, const OUString&
TOOLS_WARN_EXCEPTION("unotools.config", "SetPath");
}
}
}
OUString SvtPathOptions_Impl::ExpandMacros( const OUString& rPath ) const
{

View File

@ -412,8 +412,9 @@ void SvtSecurityOptions_Impl::LoadAuthors()
m_seqTrustedAuthors.realloc( 0 ); // first clear
const Sequence< OUString > lAuthors = GetNodeNames( PROPERTYNAME_MACRO_TRUSTEDAUTHORS );
sal_Int32 c1 = lAuthors.getLength();
if( c1 )
{
if( !c1 )
return;
sal_Int32 c2 = c1 * 3; // 3 Properties inside Struct TrustedAuthor
Sequence< OUString > lAllAuthors( c2 );
@ -430,8 +431,9 @@ void SvtSecurityOptions_Impl::LoadAuthors()
}
Sequence< Any > lValues = GetProperties( lAllAuthors );
if( lValues.getLength() == c2 )
{
if( lValues.getLength() != c2 )
return;
std::vector< SvtSecurityOptions::Certificate > v;
SvtSecurityOptions::Certificate aCert( 3 );
i2 = 0;
@ -454,8 +456,6 @@ void SvtSecurityOptions_Impl::LoadAuthors()
}
m_seqTrustedAuthors = comphelper::containerToSequence(v);
}
}
}
sal_Int32 SvtSecurityOptions_Impl::GetHandle( const OUString& rName )
{

View File

@ -520,8 +520,9 @@ bool LocaleDataWrapper::doesSecondaryCalendarUseEC( const OUString& rName ) cons
void LocaleDataWrapper::getDefaultCalendarImpl()
{
if (!xDefaultCalendar)
{
if (xDefaultCalendar)
return;
Sequence< Calendar2 > xCals = getAllCalendars();
auto pCal = xCals.begin();
if (xCals.getLength() > 1)
@ -533,7 +534,6 @@ void LocaleDataWrapper::getDefaultCalendarImpl()
}
xDefaultCalendar = std::make_shared<Calendar2>( *pCal);
}
}
const std::shared_ptr< css::i18n::Calendar2 >& LocaleDataWrapper::getDefaultCalendar() const
{
@ -1061,8 +1061,9 @@ void LocaleDataWrapper::getDigitGroupingImpl()
aGrouping.realloc(3); // room for {3,2,0}
aGrouping[0] = 0; // invalidate
}
if (!aGrouping[0])
{
if (aGrouping[0])
return;
i18n::LanguageCountryInfo aLCInfo( getLanguageCountryInfo());
if (aLCInfo.Country.equalsIgnoreAsciiCase("IN") || // India
aLCInfo.Country.equalsIgnoreAsciiCase("BT") ) // Bhutan
@ -1077,7 +1078,6 @@ void LocaleDataWrapper::getDigitGroupingImpl()
aGrouping[1] = 0;
}
}
}
css::uno::Sequence< sal_Int32 > LocaleDataWrapper::getDigitGrouping() const
{

View File

@ -81,8 +81,9 @@ void ReadWriteGuard::changeReadToWrite()
{
bool bOk = !(nMode & (ReadWriteGuardMode::Write | ReadWriteGuardMode::BlockCritical));
DBG_ASSERT( bOk, "ReadWriteGuard::changeReadToWrite: can't" );
if ( bOk )
{
if ( !bOk )
return;
// MUST release read before acquiring write mutex or dead lock would
// occur if there was a write in another thread waiting for this read
// to complete.
@ -102,7 +103,6 @@ void ReadWriteGuard::changeReadToWrite()
rMutex.maMutex.release();
} while ( bWait );
}
}
} // namespace utl

View File

@ -305,8 +305,9 @@ bool TextSearch::SearchBackward( const OUString & rStr, sal_Int32* pStart,
void TextSearch::ReplaceBackReferences( OUString& rReplaceStr, const OUString &rStr, const SearchResult& rResult ) const
{
if( rResult.subRegExpressions > 0 )
{
if( rResult.subRegExpressions <= 0 )
return;
sal_Unicode sFndChar;
sal_Int32 i;
OUStringBuffer sBuff(rReplaceStr.getLength()*4);
@ -394,7 +395,6 @@ void TextSearch::ReplaceBackReferences( OUString& rReplaceStr, const OUString &r
}
rReplaceStr = sBuff.makeStringAndClear();
}
}
} // namespace utl

View File

@ -432,8 +432,9 @@ void MediaDescriptor::setComponentDataEntry( const OUString& rName, const css::u
void MediaDescriptor::clearComponentDataEntry( const OUString& rName )
{
comphelper::SequenceAsHashMap::iterator aPropertyIter = find( PROP_COMPONENTDATA() );
if( aPropertyIter != end() )
{
if( aPropertyIter == end() )
return;
css::uno::Any& rCompDataAny = aPropertyIter->second;
bool bHasNamedValues = rCompDataAny.has< css::uno::Sequence< css::beans::NamedValue > >();
bool bHasPropValues = rCompDataAny.has< css::uno::Sequence< css::beans::PropertyValue > >();
@ -450,7 +451,6 @@ void MediaDescriptor::clearComponentDataEntry( const OUString& rName )
rCompDataAny = aCompDataMap.getAsConstAny( bHasPropValues );
}
}
}
css::uno::Sequence< css::beans::NamedValue > MediaDescriptor::requestAndVerifyDocPassword(
comphelper::IDocPasswordVerifier& rVerifier,

View File

@ -961,8 +961,9 @@ UcbLockBytes::~UcbLockBytes()
}
}
if ( !m_xInputStream.is() && m_xOutputStream.is() )
{
if ( m_xInputStream.is() || !m_xOutputStream.is() )
return;
try
{
m_xOutputStream->closeOutput();
@ -974,7 +975,6 @@ UcbLockBytes::~UcbLockBytes()
{
}
}
}
Reference < XInputStream > UcbLockBytes::getInputStream()
{