From 2ed3d691b42525f6c1cc430d5863febcb102816e Mon Sep 17 00:00:00 2001 From: Arkadiy Illarionov Date: Sat, 4 May 2019 21:20:18 +0300 Subject: Use hasElements to check Sequence emptiness in cppcanvas..desktop Similar to clang-tidy readability-container-size-empty Change-Id: I81c0ff78d2ecc7d984e3ed5e5ce60efe327fc162 Reviewed-on: https://gerrit.libreoffice.org/71799 Tested-by: Jenkins Reviewed-by: Noel Grandin --- cppuhelper/source/component_context.cxx | 6 +++--- cppuhelper/source/factory.cxx | 4 ++-- cppuhelper/source/shlib.cxx | 2 +- cppuhelper/source/tdmgr.cxx | 4 ++-- cppuhelper/source/typemanager.cxx | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'cppuhelper') diff --git a/cppuhelper/source/component_context.cxx b/cppuhelper/source/component_context.cxx index ba0c0635dc89..5d6294704f7f 100644 --- a/cppuhelper/source/component_context.cxx +++ b/cppuhelper/source/component_context.cxx @@ -288,7 +288,7 @@ Any ComponentContext::lookupMap( OUString const & rName ) Reference< lang::XSingleComponentFactory > xFac; if (usesService >>= xFac) // try via factory { - xInstance = args.getLength() + xInstance = args.hasElements() ? xFac->createInstanceWithArgumentsAndContext( args, this ) : xFac->createInstanceWithContext( this ); } @@ -298,7 +298,7 @@ Any ComponentContext::lookupMap( OUString const & rName ) if (usesService >>= xFac2) { // try via old XSingleServiceFactory - xInstance = args.getLength() + xInstance = args.hasElements() ? xFac2->createInstanceWithArguments( args ) : xFac2->createInstance(); } @@ -308,7 +308,7 @@ Any ComponentContext::lookupMap( OUString const & rName ) if ((usesService >>= serviceName) && !serviceName.isEmpty()) { - xInstance = args.getLength() + xInstance = args.hasElements() ? m_xSMgr->createInstanceWithArgumentsAndContext( serviceName, args, this ) : m_xSMgr->createInstanceWithContext( diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx index 43e469d57121..d61639566110 100644 --- a/cppuhelper/source/factory.cxx +++ b/cppuhelper/source/factory.cxx @@ -186,7 +186,7 @@ Reference< XInterface > OSingleFactoryHelper::createInstanceWithArgumentsAndCont } else { - if ( rArguments.getLength() ) + if ( rArguments.hasElements() ) { // dispose the here created UNO object before throwing out exception // to avoid risk of memory leaks #i113722# @@ -747,7 +747,7 @@ Reference< XInterface > ORegistryFactoryHelper::createModuleFactory() Sequence< OUString > ORegistryFactoryHelper::getSupportedServiceNames() { MutexGuard aGuard( aMutex ); - if( aServiceNames.getLength() == 0 ) + if( !aServiceNames.hasElements() ) { // not yet loaded try diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx index 9f23f1160c03..c5979e642393 100644 --- a/cppuhelper/source/shlib.cxx +++ b/cppuhelper/source/shlib.cxx @@ -203,7 +203,7 @@ cppuhelper::WrapperConstructorFn mapConstructorFn( void *const ctxt = mapTo.mapInterface( context, cppu::UnoType::get()); - if (args.getLength() > 0) { + if (args.hasElements()) { std::abort(); // TODO map args } void * instance = nullptr; diff --git a/cppuhelper/source/tdmgr.cxx b/cppuhelper/source/tdmgr.cxx index 288ac9bb6653..8666fadc6554 100644 --- a/cppuhelper/source/tdmgr.cxx +++ b/cppuhelper/source/tdmgr.cxx @@ -122,7 +122,7 @@ static typelib_TypeDescription * createCTD( const Reference< XStructTypeDescription > & xType ) { typelib_TypeDescription * pRet = nullptr; - if (xType.is() && xType->getTypeParameters().getLength() == 0) + if (xType.is() && !xType->getTypeParameters().hasElements()) { typelib_TypeDescription * pBaseType = createCTD( access, xType->getBaseType() ); @@ -171,7 +171,7 @@ static typelib_TypeDescription * createCTD( // string is held by rMemberNames rInit.aBase.pMemberName = pMemberNames[nPos].pData; - rInit.bParameterizedType = templateMemberTypes.getLength() != 0 + rInit.bParameterizedType = templateMemberTypes.hasElements() && (templateMemberTypes[nPos]->getTypeClass() == TypeClass_UNKNOWN); } diff --git a/cppuhelper/source/typemanager.cxx b/cppuhelper/source/typemanager.cxx index 3d4f474f89f0..24fa88db309b 100644 --- a/cppuhelper/source/typemanager.cxx +++ b/cppuhelper/source/typemanager.cxx @@ -1690,7 +1690,7 @@ Enumeration::nextTypeDescription() } bool Enumeration::matches(css::uno::TypeClass tc) const { - if (types_.getLength() == 0) { + if (!types_.hasElements()) { return true; } for (sal_Int32 i = 0; i != types_.getLength(); ++i) { -- cgit