diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-05-04 21:20:18 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-05 19:24:57 +0200 |
commit | 2ed3d691b42525f6c1cc430d5863febcb102816e (patch) | |
tree | 97088acb96f8ad26f2ae67f3f8e5c2f6aab05cf0 /cppuhelper | |
parent | 6c31c2b01dd32cc7ba1230f2c4a98b8f7def219b (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/source/component_context.cxx | 6 | ||||
-rw-r--r-- | cppuhelper/source/factory.cxx | 4 | ||||
-rw-r--r-- | cppuhelper/source/shlib.cxx | 2 | ||||
-rw-r--r-- | cppuhelper/source/tdmgr.cxx | 4 | ||||
-rw-r--r-- | cppuhelper/source/typemanager.cxx | 2 |
5 files changed, 9 insertions, 9 deletions
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<css::uno::XComponentContext>::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) { |