From f20810f7829d9f3b7167df316e1303810b746366 Mon Sep 17 00:00:00 2001 From: Arkadiy Illarionov Date: Thu, 2 May 2019 22:56:03 +0300 Subject: Use hasElements to check Sequence emptiness in sfx2..svx Similar to clang-tidy readability-container-size-empty Change-Id: Icabd773f3b924d465b33e8581175f1fcf70c282e Reviewed-on: https://gerrit.libreoffice.org/71704 Tested-by: Jenkins Reviewed-by: Noel Grandin --- svl/source/config/cjkoptions.cxx | 2 +- svl/source/config/ctloptions.cxx | 2 +- svl/source/config/languageoptions.cxx | 2 +- svl/source/fsstor/ostreamcontainer.cxx | 4 ++-- svl/source/items/lckbitem.cxx | 2 +- svl/source/numbers/zforfind.cxx | 8 ++++---- svl/source/passwordcontainer/passwordcontainer.cxx | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) (limited to 'svl') diff --git a/svl/source/config/cjkoptions.cxx b/svl/source/config/cjkoptions.cxx index a0af655e8950..32cd9d5ce834 100644 --- a/svl/source/config/cjkoptions.cxx +++ b/svl/source/config/cjkoptions.cxx @@ -146,7 +146,7 @@ void SvtCJKOptions_Impl::SetAll(bool bSet) void SvtCJKOptions_Impl::Load() { Sequence &rPropertyNames = PropertyNames::get(); - if(!rPropertyNames.getLength()) + if(!rPropertyNames.hasElements()) { rPropertyNames.realloc(9); OUString* pNames = rPropertyNames.getArray(); diff --git a/svl/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx index 801901d33b04..81bb44049a75 100644 --- a/svl/source/config/ctloptions.cxx +++ b/svl/source/config/ctloptions.cxx @@ -230,7 +230,7 @@ void SvtCTLOptions_Impl::ImplCommit() void SvtCTLOptions_Impl::Load() { Sequence< OUString >& rPropertyNames = PropertyNames::get(); - if ( !rPropertyNames.getLength() ) + if ( !rPropertyNames.hasElements() ) { rPropertyNames.realloc(6); OUString* pNames = rPropertyNames.getArray(); diff --git a/svl/source/config/languageoptions.cxx b/svl/source/config/languageoptions.cxx index 23590b2e93bd..f00812b30b8d 100644 --- a/svl/source/config/languageoptions.cxx +++ b/svl/source/config/languageoptions.cxx @@ -199,7 +199,7 @@ SvtSystemLanguageOptions::SvtSystemLanguageOptions() : uno::Sequence< OUString > aPropertyNames { "SystemLocale" }; uno::Sequence< uno::Any > aValues = GetProperties( aPropertyNames ); - if ( aValues.getLength() ) + if ( aValues.hasElements() ) { aValues[0]>>= m_sWin16SystemLocale; } diff --git a/svl/source/fsstor/ostreamcontainer.cxx b/svl/source/fsstor/ostreamcontainer.cxx index d13beb4509d7..ef74bacbe7b0 100644 --- a/svl/source/fsstor/ostreamcontainer.cxx +++ b/svl/source/fsstor/ostreamcontainer.cxx @@ -135,11 +135,11 @@ void SAL_CALL OFSStreamContainer::release() // XTypeProvider uno::Sequence< uno::Type > SAL_CALL OFSStreamContainer::getTypes() { - if ( m_aTypes.getLength() == 0 ) + if ( !m_aTypes.hasElements() ) { ::osl::MutexGuard aGuard( m_aMutex ); - if ( m_aTypes.getLength() == 0 ) + if ( !m_aTypes.hasElements() ) { std::vector tmp; tmp.push_back(cppu::UnoType::get()); diff --git a/svl/source/items/lckbitem.cxx b/svl/source/items/lckbitem.cxx index a610380243cc..46e266d6204c 100644 --- a/svl/source/items/lckbitem.cxx +++ b/svl/source/items/lckbitem.cxx @@ -57,7 +57,7 @@ bool SfxLockBytesItem::PutValue( const css::uno::Any& rVal, sal_uInt8 ) css::uno::Sequence< sal_Int8 > aSeq; if ( rVal >>= aSeq ) { - if ( aSeq.getLength() ) + if ( aSeq.hasElements() ) { SvMemoryStream* pStream = new SvMemoryStream(); pStream->WriteBytes( aSeq.getConstArray(), aSeq.getLength() ); diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index bff0e3efa449..0635739de77e 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -1234,7 +1234,7 @@ bool ImpSvNumberInputScan::IsAcceptedDatePattern( sal_uInt16 nStartPatternAt ) { nAcceptedDatePattern = -1; } - else if (!sDateAcceptancePatterns.getLength()) + else if (!sDateAcceptancePatterns.hasElements()) { // The current locale is the format's locale, if a format is present. const NfEvalDateFormat eEDF = pFormatter->GetEvalDateFormat(); @@ -1276,8 +1276,8 @@ bool ImpSvNumberInputScan::IsAcceptedDatePattern( sal_uInt16 nStartPatternAt ) break; } } - SAL_WARN_IF( !sDateAcceptancePatterns.getLength(), "svl.numbers", "ImpSvNumberInputScan::IsAcceptedDatePattern: no date acceptance patterns"); - nAcceptedDatePattern = (sDateAcceptancePatterns.getLength() ? -2 : -1); + SAL_WARN_IF( !sDateAcceptancePatterns.hasElements(), "svl.numbers", "ImpSvNumberInputScan::IsAcceptedDatePattern: no date acceptance patterns"); + nAcceptedDatePattern = (sDateAcceptancePatterns.hasElements() ? -2 : -1); } if (nAcceptedDatePattern == -1) @@ -3590,7 +3590,7 @@ void ImpSvNumberInputScan::ChangeIntl() void ImpSvNumberInputScan::InvalidateDateAcceptancePatterns() { - if (sDateAcceptancePatterns.getLength()) + if (sDateAcceptancePatterns.hasElements()) { sDateAcceptancePatterns = css::uno::Sequence< OUString >(); } diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 38a6bfd134dc..5c59f976d8ec 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -703,7 +703,7 @@ bool PasswordContainer::createUrlRecord( { Sequence< UserRecord > aUsrRec = FindUsr( rIter->second, aName, aHandler ); - if( aUsrRec.getLength() ) + if( aUsrRec.hasElements() ) { rRec = UrlRecord( rIter->first, aUsrRec ); return true; @@ -1001,7 +1001,7 @@ Sequence< UrlRecord > SAL_CALL PasswordContainer::getAllPersistent( const Refere aUsers[ oldLen ] = UserRecord( aNP.GetUserName(), comphelper::containerToSequence( DecodePasswords( aNP.GetPersPasswords(), GetMasterPassword( xHandler ), css::task::PasswordRequestMode_PASSWORD_ENTER ) ) ); } - if( aUsers.getLength() ) + if( aUsers.hasElements() ) { sal_Int32 oldLen = aResult.getLength(); aResult.realloc( oldLen + 1 ); -- cgit