diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-05-02 22:56:03 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-03 10:08:31 +0200 |
commit | f20810f7829d9f3b7167df316e1303810b746366 (patch) | |
tree | 8a6eb44060c5b4134c24d794e2af3b02b557d885 /stoc | |
parent | f1ba393af4f08f8502906c9221f8b6f1be2a7bad (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/corereflection/crcomp.cxx | 2 | ||||
-rw-r--r-- | stoc/source/corereflection/criface.cxx | 2 | ||||
-rw-r--r-- | stoc/source/implementationregistration/implreg.cxx | 33 | ||||
-rw-r--r-- | stoc/source/inspect/introspection.cxx | 2 | ||||
-rw-r--r-- | stoc/source/invocation_adapterfactory/iafactory.cxx | 2 | ||||
-rw-r--r-- | stoc/source/servicemanager/servicemanager.cxx | 8 |
6 files changed, 25 insertions, 24 deletions
diff --git a/stoc/source/corereflection/crcomp.cxx b/stoc/source/corereflection/crcomp.cxx index 26e0c8ecf8ad..de73774efef8 100644 --- a/stoc/source/corereflection/crcomp.cxx +++ b/stoc/source/corereflection/crcomp.cxx @@ -268,7 +268,7 @@ sal_Bool CompoundIdlClassImpl::isAssignableFrom( const Reference< XIdlClass > & else { const Sequence< Reference< XIdlClass > > & rSeq = xType->getSuperclasses(); - if (rSeq.getLength()) + if (rSeq.hasElements()) { OSL_ENSURE( rSeq.getLength() == 1, "### unexpected len of super classes!" ); return isAssignableFrom( rSeq[0] ); diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx index c4f5feab38ed..fd0979a64e63 100644 --- a/stoc/source/corereflection/criface.cxx +++ b/stoc/source/corereflection/criface.cxx @@ -739,7 +739,7 @@ InterfaceIdlClassImpl::~InterfaceIdlClassImpl() Sequence< Reference< XIdlClass > > InterfaceIdlClassImpl::getSuperclasses() { ::osl::MutexGuard aGuard(getMutexAccess()); - if (_xSuperClasses.getLength() == 0) { + if (!_xSuperClasses.hasElements()) { typelib_InterfaceTypeDescription * pType = getTypeDescr(); _xSuperClasses.realloc(pType->nBaseTypes); for (sal_Int32 i = 0; i < pType->nBaseTypes; ++i) { diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx index 0fb17520df9f..32c200a2385c 100644 --- a/stoc/source/implementationregistration/implreg.cxx +++ b/stoc/source/implementationregistration/implreg.cxx @@ -105,7 +105,7 @@ void deleteAllLinkReferences(const Reference < XSimpleRegistry >& xReg, Sequence<OUString> linkNames = xKey->getAsciiListValue(); - if (!linkNames.getLength()) + if (!linkNames.hasElements()) return; const OUString* pLinkNames = linkNames.getConstArray(); @@ -156,7 +156,7 @@ void deleteAllLinkReferences(const Reference < XSimpleRegistry >& xReg, { xLinkParent = xReg->getRootKey()->openKey(aLinkParent); - if (xLinkParent.is() && (xLinkParent->getKeyNames().getLength() == 0)) + if (xLinkParent.is() && !xLinkParent->getKeyNames().hasElements()) { aLinkName = aLinkParent; @@ -165,7 +165,8 @@ void deleteAllLinkReferences(const Reference < XSimpleRegistry >& xReg, sEnd = aLinkName.lastIndexOf( '/' ); aLinkParent = aLinkName.copy(0, sEnd); - } else + } + else { break; } @@ -423,7 +424,7 @@ void deletePathIfPossible(const Reference < XRegistryKey >& xRootKey, { Sequence<OUString> keyNames(xRootKey->openKey(path)->getKeyNames()); - if (keyNames.getLength() == 0 && + if (!keyNames.hasElements() && xRootKey->openKey(path)->getValueType() == RegistryValueType_NOT_DEFINED) { xRootKey->deleteKey(path); @@ -555,7 +556,7 @@ void prepareUserKeys(const Reference < XSimpleRegistry >& xDest, Sequence<OUString> keyNames = xKey->getKeyNames(); OUString relativKey; - if (keyNames.getLength()) + if (keyNames.hasElements()) relativKey = keyNames.getConstArray()[0].copy(xKey->getKeyName().getLength()+1); if (keyNames.getLength() == 1 && @@ -579,7 +580,7 @@ void prepareUserKeys(const Reference < XSimpleRegistry >& xDest, { Sequence< Reference < XRegistryKey> > subKeys = xKey->openKeys(); - if (subKeys.getLength()) + if (subKeys.hasElements()) { hasSubKeys = true; const Reference < XRegistryKey > * pSubKeys = subKeys.getConstArray(); @@ -629,7 +630,7 @@ void deleteAllImplementations( const Reference < XSimpleRegistry >& xReg, { Sequence < Reference < XRegistryKey > > subKeys = xSource->openKeys(); - if (subKeys.getLength() > 0) + if (subKeys.hasElements()) { const Reference < XRegistryKey> * pSubKeys = subKeys.getConstArray(); Reference < XRegistryKey > xImplKey; @@ -662,7 +663,7 @@ void deleteAllImplementations( const Reference < XSimpleRegistry >& xReg, { Sequence< Reference < XRegistryKey > > subKeys2 = xKey->openKeys(); - if (subKeys2.getLength()) + if (subKeys2.hasElements()) { const Reference < XRegistryKey > * pSubKeys2 = subKeys2.getConstArray(); @@ -692,7 +693,7 @@ void deleteAllImplementations( const Reference < XSimpleRegistry >& xReg, } subKeys = xSource->openKeys(); - if (subKeys.getLength() == 0) + if (!subKeys.hasElements()) { OUString path(xSource->getKeyName()); xSource->closeKey(); @@ -777,7 +778,7 @@ void deleteAllServiceEntries( const Reference < XSimpleRegistry >& xReg, { Sequence< Reference < XRegistryKey > > subKeys = xSource->openKeys(); - if (subKeys.getLength() > 0) + if (subKeys.hasElements()) { const Reference < XRegistryKey > * pSubKeys = subKeys.getConstArray(); Reference < XRegistryKey > xServiceKey; @@ -832,7 +833,7 @@ void deleteAllServiceEntries( const Reference < XSimpleRegistry >& xReg, } subKeys = xSource->openKeys(); - if (subKeys.getLength() == 0) + if (!subKeys.hasElements()) { OUString path(xSource->getKeyName()); xSource->closeKey(); @@ -992,7 +993,7 @@ void prepareRegistry( { Sequence< Reference < XRegistryKey > > subKeys = xSource->openKeys(); - if (!subKeys.getLength()) + if (!subKeys.hasElements()) { throw InvalidRegistryException( "prepareRegistry(): source registry is empty" ); @@ -1037,7 +1038,7 @@ void prepareRegistry( { Sequence< Reference < XRegistryKey > > subKeys2 = xKey->openKeys(); - if (subKeys2.getLength()) + if (subKeys2.hasElements()) { const Reference < XRegistryKey > * pSubKeys2 = subKeys2.getConstArray(); @@ -1077,7 +1078,7 @@ void prepareRegistry( // update link entries in REGISTRY_LINKS section Sequence<OUString> linkNames = xKey->getAsciiListValue(); - if (linkNames.getLength()) + if (linkNames.hasElements()) { const OUString* pLinkNames = linkNames.getConstArray(); @@ -1103,7 +1104,7 @@ void findImplementations( const Reference < XRegistryKey > & xSource, Reference < XRegistryKey > xKey = xSource->openKey( slash_UNO_slash_SERVICES ); - if (xKey.is() && (xKey->getKeyNames().getLength() > 0)) + if (xKey.is() && xKey->getKeyNames().hasElements()) { isImplKey = true; @@ -1126,7 +1127,7 @@ void findImplementations( const Reference < XRegistryKey > & xSource, { Sequence< Reference < XRegistryKey > > subKeys = xSource->openKeys(); - if (subKeys.getLength() > 0) + if (subKeys.hasElements()) { const Reference < XRegistryKey >* pSubKeys = subKeys.getConstArray(); diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index 8d7c6e1733b7..f8608db19f69 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -1978,7 +1978,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect( { // Get methods must not have any parameters Sequence< Reference<XIdlClass> > getParams = rxMethod_i->getParameterTypes(); - if( getParams.getLength() > 0 ) + if( getParams.hasElements() ) { continue; } diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx index cca99f1ebf20..e74d27f756a4 100644 --- a/stoc/source/invocation_adapterfactory/iafactory.cxx +++ b/stoc/source/invocation_adapterfactory/iafactory.cxx @@ -802,7 +802,7 @@ Reference< XInterface > FactoryImpl::createAdapter( const Sequence< Type > & rTypes ) { Reference< XInterface > xRet; - if (xReceiver.is() && rTypes.getLength()) + if (xReceiver.is() && rTypes.hasElements()) { t_ptr_set * adapter_set; AdapterImpl * that; diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx index 81435c183631..60b637cae609 100644 --- a/stoc/source/servicemanager/servicemanager.cxx +++ b/stoc/source/servicemanager/servicemanager.cxx @@ -90,7 +90,7 @@ Sequence< OUString > retrieveAsciiValueList( { Sequence< OUString > seq2 = retrieveAsciiValueList( xTempReg, keyName ); - if( seq2.getLength() ) + if( seq2.hasElements() ) { sal_Int32 n1Len = seq.getLength(); sal_Int32 n2Len = seq2.getLength(); @@ -978,7 +978,7 @@ Reference<XEnumeration > OServiceManager::createContentEnumeration( check_undisposed(); Sequence< Reference< XInterface > > factories( OServiceManager::queryServiceFactories( aServiceName, m_xContext ) ); - if (factories.getLength()) + if (factories.hasElements()) return new ServiceEnumeration_Impl( factories ); else return Reference< XEnumeration >(); @@ -1371,7 +1371,7 @@ void ORegistryServiceManager::initialize(const Sequence< Any >& Arguments) { check_undisposed(); MutexGuard aGuard( m_mutex ); - if (Arguments.getLength() > 0) + if (Arguments.hasElements()) { m_xRootKey.clear(); Arguments[ 0 ] >>= m_xRegistry; @@ -1413,7 +1413,7 @@ Sequence< Reference< XInterface > > ORegistryServiceManager::queryServiceFactori { Sequence< Reference< XInterface > > ret( OServiceManager::queryServiceFactories( aServiceName, xContext ) ); - if (ret.getLength()) + if (ret.hasElements()) { return ret; } |