From 71dc235aba9597c3485a791a319a34e4258138db Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Thu, 12 Jan 2012 17:01:19 -0200 Subject: Fix for fdo43460 Part XXXV getLength() to isEmpty() Part XXXV Modules stoc --- stoc/source/defaultregistry/defaultregistry.cxx | 18 +++++++-------- stoc/source/implementationregistration/implreg.cxx | 16 ++++++------- stoc/source/invocation/invocation.cxx | 4 ++-- stoc/source/javavm/javavm.cxx | 20 ++++++++--------- stoc/source/loader/dllcomponentloader.cxx | 2 +- stoc/source/proxy_factory/proxyfac.cxx | 2 +- .../registry_tdprovider/rdbtdp_tdenumeration.cxx | 2 +- stoc/source/registry_tdprovider/tdcomp.cxx | 2 +- stoc/source/registry_tdprovider/tdef.cxx | 2 +- stoc/source/registry_tdprovider/tdiface.cxx | 4 ++-- stoc/source/registry_tdprovider/tdservice.cxx | 4 ++-- stoc/source/security/access_controller.cxx | 10 ++++----- stoc/source/security/file_policy.cxx | 10 ++++----- stoc/source/security/permissions.cxx | 4 ++-- stoc/source/servicemanager/servicemanager.cxx | 4 ++-- stoc/source/simpleregistry/simpleregistry.cxx | 2 +- stoc/source/simpleregistry/textualservices.cxx | 26 +++++++++++----------- stoc/source/tdmanager/tdmgr.cxx | 2 +- stoc/source/tdmanager/tdmgr_check.cxx | 2 +- .../uriproc/ExternalUriReferenceTranslator.cxx | 4 ++-- stoc/source/uriproc/UriReference.cxx | 16 ++++++------- stoc/source/uriproc/UriReferenceFactory.cxx | 23 +++++++++---------- .../UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx | 7 ++---- .../UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx | 8 +++---- 24 files changed, 95 insertions(+), 99 deletions(-) (limited to 'stoc') diff --git a/stoc/source/defaultregistry/defaultregistry.cxx b/stoc/source/defaultregistry/defaultregistry.cxx index b80167afbfa7..da291d219a03 100644 --- a/stoc/source/defaultregistry/defaultregistry.cxx +++ b/stoc/source/defaultregistry/defaultregistry.cxx @@ -276,7 +276,7 @@ OUString NestedKeyImpl::computeName(const OUString& name) return m_defaultKey->getResolvedName(name); } - if ( resLocalName.getLength() > 0 && m_pRegistry->m_defaultReg->isValid() ) + if ( !resLocalName.isEmpty() && m_pRegistry->m_defaultReg->isValid() ) { Reference localRoot(m_pRegistry->m_localReg->getRootKey()); Reference defaultRoot(m_pRegistry->m_defaultReg->getRootKey()); @@ -289,7 +289,7 @@ OUString NestedKeyImpl::computeName(const OUString& name) { count--; - if (resLocalName.getLength() == 0 || resDefaultName.getLength() == 0) + if (resLocalName.isEmpty() || resDefaultName.isEmpty()) throw InvalidRegistryException(); resLocalName = localRoot->getResolvedName(resDefaultName); @@ -683,7 +683,7 @@ Reference< XRegistryKey > SAL_CALL NestedKeyImpl::openKey( const OUString& aKeyN OUString resolvedName = computeName(aKeyName); - if ( resolvedName.getLength() == 0 ) + if ( resolvedName.isEmpty() ) throw InvalidRegistryException(); Reference localKey, defaultKey; @@ -719,7 +719,7 @@ Reference< XRegistryKey > SAL_CALL NestedKeyImpl::createKey( const OUString& aKe OUString resolvedName = computeName(aKeyName); - if ( resolvedName.getLength() == 0 ) + if ( resolvedName.isEmpty() ) throw InvalidRegistryException(); if ( m_localKey.is() && m_localKey->isValid() ) @@ -788,7 +788,7 @@ void SAL_CALL NestedKeyImpl::deleteKey( const OUString& rKeyName ) { OUString resolvedName = computeName(rKeyName); - if ( resolvedName.getLength() == 0 ) + if ( resolvedName.isEmpty() ) { throw InvalidRegistryException(); } @@ -969,7 +969,7 @@ sal_Bool SAL_CALL NestedKeyImpl::createLink( const OUString& aLinkName, const OU resolvedName = computeName(linkName); - if ( resolvedName.getLength() == 0 ) + if ( resolvedName.isEmpty() ) { throw InvalidRegistryException(); } @@ -1023,7 +1023,7 @@ void SAL_CALL NestedKeyImpl::deleteLink( const OUString& rLinkName ) resolvedName = computeName(linkName); - if ( resolvedName.getLength() == 0 ) + if ( resolvedName.isEmpty() ) { throw InvalidRegistryException(); } @@ -1067,7 +1067,7 @@ OUString SAL_CALL NestedKeyImpl::getLinkTarget( const OUString& rLinkName ) resolvedName = computeName(linkName); - if ( resolvedName.getLength() == 0 ) + if ( resolvedName.isEmpty() ) { throw InvalidRegistryException(); } @@ -1112,7 +1112,7 @@ OUString SAL_CALL NestedKeyImpl::getResolvedName( const OUString& aKeyName ) OUString resolvedName = computeName(aKeyName); - if ( resolvedName.getLength() == 0 ) + if ( resolvedName.isEmpty() ) { throw InvalidRegistryException(); } diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx index 9fb148ca629e..67f9864fe500 100644 --- a/stoc/source/implementationregistration/implreg.cxx +++ b/stoc/source/implementationregistration/implreg.cxx @@ -212,7 +212,7 @@ static void deleteAllLinkReferences(const Reference < XSimpleRegistry >& xReg, aLinkParent = aLinkName.copy(0, sEnd); - while(aLinkParent.getLength()) + while(!aLinkParent.isEmpty()) { xLinkParent = xReg->getRootKey()->openKey(aLinkParent); @@ -485,7 +485,7 @@ static void prepareUserLink(const Reference < XSimpleRegistry >& xDest, { OUString oldImplName(searchImplForLink(xRootKey, linkName, implName)); - if (oldImplName.getLength()) + if (!oldImplName.isEmpty()) { createUniqueSubEntry(xDest->getRootKey()->createKey( linkName + spool().colon_old ), oldImplName); @@ -601,7 +601,7 @@ static void deleteUserLink(const Reference < XRegistryKey >& xRootKey, } OUString oldTarget = searchLinkTargetForImpl(xRootKey, linkName, oldImpl); - if (oldTarget.getLength()) + if (!oldTarget.isEmpty()) { xRootKey->createLink(linkName, oldTarget); } @@ -698,7 +698,7 @@ static void prepareUserKeys(const Reference < XSimpleRegistry >& xDest, } OUString path = keyName.copy(0, keyName.lastIndexOf('/')); - if( path.getLength() ) + if( !path.isEmpty() ) { deletePathIfPossible(xRootKey, path); } @@ -1437,7 +1437,7 @@ void ImplementationRegistration::initialize( if( aArgs.getConstArray()[1].getValueType().getTypeClass() == TypeClass_STRING ) { aArgs.getConstArray()[1] >>= loaderServiceName; } - if( ! loaderServiceName.getLength() ) { + if( loaderServiceName.isEmpty() ) { OUStringBuffer buf; buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ImplementationRegistration::initialize() invalid second parameter," @@ -1452,7 +1452,7 @@ void ImplementationRegistration::initialize( if( aArgs.getConstArray()[2].getValueType().getTypeClass() == TypeClass_STRING ) { aArgs.getConstArray()[2] >>= locationUrl; } - if( ! locationUrl.getLength() ) { + if( locationUrl.isEmpty() ) { OUStringBuffer buf; buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ImplementationRegistration::initialize() invalid third parameter," @@ -1514,7 +1514,7 @@ void ImplementationRegistration::prepareRegister( OUString implLoaderUrl(implementationLoaderUrl); OUString activatorName; - if (implementationLoaderUrl.getLength() > 0) + if (!implementationLoaderUrl.isEmpty()) { OUString tmpActivator(implementationLoaderUrl); sal_Int32 nIndex = 0; @@ -1669,7 +1669,7 @@ Sequence< OUString > ImplementationRegistration::getImplementations( OUString implLoaderUrl(implementationLoaderUrl); OUString activatorName; - if (implementationLoaderUrl.getLength() > 0) + if (!implementationLoaderUrl.isEmpty()) { OUString tmpActivator(implementationLoaderUrl); sal_Int32 nIndex = 0; diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx index 9051aec8a2e7..e54fb6f384d6 100644 --- a/stoc/source/invocation/invocation.cxx +++ b/stoc/source/invocation/invocation.cxx @@ -466,7 +466,7 @@ OUString Invocation_Impl::getExactName( const OUString& rApproximateName ) OUString aRet; if (_xENIntrospection.is()) aRet = _xENIntrospection->getExactName( rApproximateName ); - if (!aRet.getLength() && _xENNameAccess.is()) + if (aRet.isEmpty() && _xENNameAccess.is()) aRet = _xENNameAccess->getExactName( rApproximateName ); return aRet; } @@ -898,7 +898,7 @@ InvocationInfo SAL_CALL Invocation_Impl::getInfoForName( const OUString& aName, if( bExact ) aExactName = getExactName( aName ); - if( aExactName.getLength() > 0 ) + if( !aExactName.isEmpty() ) { if( _xIntrospectionAccess->hasMethod( aExactName, MethodConcept::ALL ^ MethodConcept::DANGEROUS ) ) { diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index 502031d5ef47..14437eec041b 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -316,7 +316,7 @@ void getINetPropsFromConfig(stoc_javavm::JVM * pjvm, { // read ftp proxy name css::uno::Reference ftpProxy_name = xRegistryRootKey->openKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Settings/ooInetFTPProxyName"))); - if(ftpProxy_name.is() && ftpProxy_name->getStringValue().getLength()) { + if(ftpProxy_name.is() && !ftpProxy_name->getStringValue().isEmpty()) { rtl::OUString ftpHost = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ftp.proxyHost=")); ftpHost += ftpProxy_name->getStringValue(); @@ -333,7 +333,7 @@ void getINetPropsFromConfig(stoc_javavm::JVM * pjvm, // read http proxy name css::uno::Reference httpProxy_name = xRegistryRootKey->openKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Settings/ooInetHTTPProxyName"))); - if(httpProxy_name.is() && httpProxy_name->getStringValue().getLength()) { + if(httpProxy_name.is() && !httpProxy_name->getStringValue().isEmpty()) { rtl::OUString httpHost = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("http.proxyHost=")); httpHost += httpProxy_name->getStringValue(); @@ -350,7 +350,7 @@ void getINetPropsFromConfig(stoc_javavm::JVM * pjvm, // read https proxy name css::uno::Reference httpsProxy_name = xRegistryRootKey->openKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Settings/ooInetHTTPSProxyName"))); - if(httpsProxy_name.is() && httpsProxy_name->getStringValue().getLength()) { + if(httpsProxy_name.is() && !httpsProxy_name->getStringValue().isEmpty()) { rtl::OUString httpsHost = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("https.proxyHost=")); httpsHost += httpsProxy_name->getStringValue(); @@ -367,7 +367,7 @@ void getINetPropsFromConfig(stoc_javavm::JVM * pjvm, // read nonProxyHosts css::uno::Reference nonProxies_name = xRegistryRootKey->openKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Settings/ooInetNoProxy"))); - if(nonProxies_name.is() && nonProxies_name->getStringValue().getLength()) { + if(nonProxies_name.is() && !nonProxies_name->getStringValue().isEmpty()) { rtl::OUString httpNonProxyHosts = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("http.nonProxyHosts=")); rtl::OUString ftpNonProxyHosts= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ftp.nonProxyHosts=")); rtl::OUString value= nonProxies_name->getStringValue(); @@ -425,7 +425,7 @@ void getDefaultLocaleFromConfig( // read locale css::uno::Reference locale = xRegistryRootKey->openKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("L10N/ooLocale"))); - if(locale.is() && locale->getStringValue().getLength()) { + if(locale.is() && !locale->getStringValue().isEmpty()) { rtl::OUString language; rtl::OUString country; @@ -435,14 +435,14 @@ void getDefaultLocaleFromConfig( language = locale->getStringValue().copy(0, index); country = locale->getStringValue().copy(index + 1); - if(language.getLength()) { + if(!language.isEmpty()) { rtl::OUString prop(RTL_CONSTASCII_USTRINGPARAM("user.language=")); prop += language; pjvm->pushProp(prop); } - if(country.getLength()) { + if(!country.isEmpty()) { rtl::OUString prop(RTL_CONSTASCII_USTRINGPARAM("user.country=")); prop += country; @@ -1261,7 +1261,7 @@ void SAL_CALL JavaVirtualMachine::elementReplaced( // or if the port is set to 0 aPropertyValue= aPropertyValue.trim(); if( - aPropertyValue.getLength() == 0 || + aPropertyValue.isEmpty() || ( ( aPropertyName.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ftp.proxyPort"))) || @@ -1286,7 +1286,7 @@ void SAL_CALL JavaVirtualMachine::elementReplaced( // special calse for ftp.nonProxyHosts and http.nonProxyHosts. The office only // has a value for two java properties - if (aPropertyName2.getLength() > 0) + if (!aPropertyName2.isEmpty()) { jstring jsPropName2= pJNIEnv->NewString( aPropertyName2.getStr(), aPropertyName2.getLength()); if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JNI:NewString")), 0); @@ -1303,7 +1303,7 @@ void SAL_CALL JavaVirtualMachine::elementReplaced( // special calse for ftp.nonProxyHosts and http.nonProxyHosts. The office only // has a value for two java properties - if (aPropertyName2.getLength() > 0) + if (!aPropertyName2.isEmpty()) { jstring jsPropName2= pJNIEnv->NewString( aPropertyName2.getStr(), aPropertyName2.getLength()); if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JNI:NewString")), 0); diff --git a/stoc/source/loader/dllcomponentloader.cxx b/stoc/source/loader/dllcomponentloader.cxx index 5b0b7217f1b9..cd690a23e563 100644 --- a/stoc/source/loader/dllcomponentloader.cxx +++ b/stoc/source/loader/dllcomponentloader.cxx @@ -212,7 +212,7 @@ Reference SAL_CALL DllComponentLoader::activate( if( xPrefixKey.is() && xPrefixKey->getValueType() == RegistryValueType_ASCII ) { aPrefix = xPrefixKey->getAsciiValue(); - if( aPrefix.getLength() != 0 ) + if( !aPrefix.isEmpty() ) aPrefix = aPrefix + OUSTR("_"); } } diff --git a/stoc/source/proxy_factory/proxyfac.cxx b/stoc/source/proxy_factory/proxyfac.cxx index 3606be1bd019..1c6c5569f213 100644 --- a/stoc/source/proxy_factory/proxyfac.cxx +++ b/stoc/source/proxy_factory/proxyfac.cxx @@ -354,7 +354,7 @@ Any ProxyRoot::queryAggregation( Type const & rType ) static_cast< OWeakObject * >(this), UNO_QUERY_THROW ); OUString oid; (*cpp_env->getObjectIdentifier)( cpp_env, &oid.pData, xRoot.get() ); - OSL_ASSERT( oid.getLength() > 0 ); + OSL_ASSERT( !oid.isEmpty() ); (*cpp_env->getRegisteredInterface)( cpp_env, reinterpret_cast< void ** >( &xProxy ), diff --git a/stoc/source/registry_tdprovider/rdbtdp_tdenumeration.cxx b/stoc/source/registry_tdprovider/rdbtdp_tdenumeration.cxx index 99b97cc92df2..d5bcd9b08575 100644 --- a/stoc/source/registry_tdprovider/rdbtdp_tdenumeration.cxx +++ b/stoc/source/registry_tdprovider/rdbtdp_tdenumeration.cxx @@ -94,7 +94,7 @@ TypeDescriptionEnumerationImpl::createInstance( reflection::InvalidTypeNameException, uno::RuntimeException ) { - if ( rModuleName.getLength() == 0 ) + if ( rModuleName.isEmpty() ) { // Enumeration for root requested. return rtl::Reference< TypeDescriptionEnumerationImpl >( diff --git a/stoc/source/registry_tdprovider/tdcomp.cxx b/stoc/source/registry_tdprovider/tdcomp.cxx index 54c8ddd83369..cd71d4315e0b 100644 --- a/stoc/source/registry_tdprovider/tdcomp.cxx +++ b/stoc/source/registry_tdprovider/tdcomp.cxx @@ -61,7 +61,7 @@ OUString CompoundTypeDescriptionImpl::getName() Reference< XTypeDescription > CompoundTypeDescriptionImpl::getBaseType() throw(::com::sun::star::uno::RuntimeException) { - if (!_xBaseTD.is() && _aBaseType.getLength()) + if (!_xBaseTD.is() && !_aBaseType.isEmpty()) { try { diff --git a/stoc/source/registry_tdprovider/tdef.cxx b/stoc/source/registry_tdprovider/tdef.cxx index 40b432d2d19c..6445191ded60 100644 --- a/stoc/source/registry_tdprovider/tdef.cxx +++ b/stoc/source/registry_tdprovider/tdef.cxx @@ -54,7 +54,7 @@ OUString TypedefTypeDescriptionImpl::getName() Reference< XTypeDescription > TypedefTypeDescriptionImpl::getReferencedType() throw(::com::sun::star::uno::RuntimeException) { - if (!_xRefTD.is() && _aRefName.getLength()) + if (!_xRefTD.is() && !_aRefName.isEmpty()) { try { diff --git a/stoc/source/registry_tdprovider/tdiface.cxx b/stoc/source/registry_tdprovider/tdiface.cxx index f51144e0b088..bed8951a3b69 100644 --- a/stoc/source/registry_tdprovider/tdiface.cxx +++ b/stoc/source/registry_tdprovider/tdiface.cxx @@ -130,7 +130,7 @@ sal_Int32 InterfaceMethodImpl::getPosition() Reference InterfaceMethodImpl::getReturnType() throw(::com::sun::star::uno::RuntimeException) { - if (!_xReturnTD.is() && _aReturnType.getLength()) + if (!_xReturnTD.is() && !_aReturnType.isEmpty()) { try { @@ -315,7 +315,7 @@ sal_Bool InterfaceAttributeImpl::isReadOnly() Reference InterfaceAttributeImpl::getType() throw(::com::sun::star::uno::RuntimeException) { - if (!_xMemberTD.is() && _aMemberTypeName.getLength()) + if (!_xMemberTD.is() && !_aMemberTypeName.isEmpty()) { try { diff --git a/stoc/source/registry_tdprovider/tdservice.cxx b/stoc/source/registry_tdprovider/tdservice.cxx index f7c94675627b..ed2a254de75f 100644 --- a/stoc/source/registry_tdprovider/tdservice.cxx +++ b/stoc/source/registry_tdprovider/tdservice.cxx @@ -56,7 +56,7 @@ public: virtual ~Constructor() {} virtual sal_Bool SAL_CALL isDefaultConstructor() throw (RuntimeException) - { return m_desc.getName().getLength() == 0; } + { return m_desc.getName().isEmpty(); } virtual rtl::OUString SAL_CALL getName() throw (RuntimeException) { return m_desc.getName(); } @@ -351,7 +351,7 @@ ServiceTypeDescriptionImpl::getConstructors() throw (RuntimeException) { if (reader.getMethodFlags(i) != RT_MODE_TWOWAY || (!reader.getMethodReturnTypeName(i).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("void"))) - || (name.getLength() == 0 + || (name.isEmpty() && (ctorCount != 1 || reader.getMethodParameterCount(i) != 0 || reader.getMethodExceptionCount(i) != 0))) { diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx index caa4ae97fbf6..1924db097c24 100644 --- a/stoc/source/security/access_controller.cxx +++ b/stoc/source/security/access_controller.cxx @@ -501,7 +501,7 @@ AccessController::AccessController( Reference< XComponentContext > const & xComp { m_xComponentContext->getValueByName( OUSTR("/services/" SERVICE_NAME "/single-user-id") ) >>= m_singleUserId; - if (! m_singleUserId.getLength()) + if (m_singleUserId.isEmpty()) { throw RuntimeException( OUSTR("expected a user id in component context entry " @@ -560,7 +560,7 @@ void AccessController::initialize( } OUString userId; arguments[ 0 ] >>= userId; - if (! userId.getLength()) + if ( userId.isEmpty() ) { throw RuntimeException( OUSTR("expected a user-id as first argument!"), (OWeakObject *)this ); @@ -602,7 +602,7 @@ static void dumpPermissions( PermissionCollection const & collection, OUString const & userId = OUString() ) SAL_THROW( () ) { OUStringBuffer buf( 48 ); - if (userId.getLength()) + if (!userId.isEmpty()) { buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("> dumping permissions of user \"") ); buf.append( userId ); @@ -662,7 +662,7 @@ void AccessController::checkAndClearPostPoned() SAL_THROW( (RuntimeException) ) for ( size_t nPos = 0; nPos < vec.size(); ++nPos ) { pair< OUString, Any > const & p = vec[ nPos ]; - OSL_ASSERT( !p.first.getLength() ); // default-user + OSL_ASSERT( p.first.isEmpty() ); // default-user m_defaultPermissions.checkPermission( p.second ); } break; @@ -727,7 +727,7 @@ PermissionCollection AccessController::getEffectivePermissions( { xContext->getValueByName( OUSTR(USER_CREDS ".id") ) >>= userId; } - if (! userId.getLength()) + if ( userId.isEmpty() ) { throw SecurityException( OUSTR("cannot determine current user in multi-user ac!"), (OWeakObject *)this ); diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx index 1e40992044ea..9d45741c04e6 100644 --- a/stoc/source/security/file_policy.cxx +++ b/stoc/source/security/file_policy.cxx @@ -244,7 +244,7 @@ OUString PolicyReader::assureQuotedToken() SAL_THROW( (RuntimeException) ) { OUString token( getQuotedToken() ); - if (! token.getLength()) + if (token.isEmpty()) error( OUSTR("unexpected end of file!") ); return token; } @@ -270,7 +270,7 @@ OUString PolicyReader::assureToken() SAL_THROW( (RuntimeException) ) { OUString token( getToken() ); - if (! token.getLength()) + if ( token.isEmpty()) error( OUSTR("unexpected end of file!") ); return token; } @@ -451,7 +451,7 @@ void FilePolicy::refresh() OUString fileName; m_xComponentContext->getValueByName( OUSTR("/implementations/" IMPL_NAME "/file-name") ) >>= fileName; - if (! fileName.getLength()) + if ( fileName.isEmpty() ) { throw RuntimeException( OUSTR("name of policy file unknown!"), @@ -465,7 +465,7 @@ void FilePolicy::refresh() t_permissions userPermissions; OUString token( reader.getToken() ); - while (token.getLength()) + while (!token.isEmpty()) { if (!token.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_grant))) reader.error( OUSTR("expected >grant< token!") ); @@ -518,7 +518,7 @@ void FilePolicy::refresh() reader.assureToken( ';' ); // insert - if (userId.getLength()) + if (!userId.isEmpty()) { Sequence< Any > perms( userPermissions[ userId ] ); sal_Int32 len = perms.getLength(); diff --git a/stoc/source/security/permissions.cxx b/stoc/source/security/permissions.cxx index cf23dc21f114..6b065ede2eb8 100644 --- a/stoc/source/security/permissions.cxx +++ b/stoc/source/security/permissions.cxx @@ -67,7 +67,7 @@ static inline sal_Int32 makeMask( do { OUString item( items.getToken( 0, ',', n ).trim() ); - if (! item.getLength()) + if ( item.isEmpty()) continue; sal_Int32 nPos = 0; while (strings[ nPos ]) @@ -153,7 +153,7 @@ SocketPermission::SocketPermission( , m_upperPort( 65535 ) , m_resolveErr( false ) , m_resolvedHost( false ) - , m_wildCardHost( perm.Host.getLength() && '*' == perm.Host.pData->buffer[ 0 ] ) + , m_wildCardHost( !perm.Host.isEmpty() && '*' == perm.Host.pData->buffer[ 0 ] ) { if (0xe0000000 & m_actions) // if any (except resolve) is given => resolve implied m_actions |= 0x10000000; diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx index f6a25e883b9a..7b1a875fe159 100644 --- a/stoc/source/servicemanager/servicemanager.cxx +++ b/stoc/source/servicemanager/servicemanager.cxx @@ -1486,7 +1486,7 @@ void OServiceManager::insert( const Any & Element ) if( xInfo.is() ) { OUString aImplName = xInfo->getImplementationName(); - if( aImplName.getLength() ) + if( !aImplName.isEmpty() ) m_ImplementationNameMap[ aImplName ] = xEle; //put into the service map @@ -1572,7 +1572,7 @@ void OServiceManager::remove( const Any & Element ) if( xInfo.is() ) { OUString aImplName = xInfo->getImplementationName(); - if( aImplName.getLength() ) + if( !aImplName.isEmpty() ) m_ImplementationNameMap.erase( aImplName ); } diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx index 085b73a22c3b..d396e08f9a64 100644 --- a/stoc/source/simpleregistry/simpleregistry.cxx +++ b/stoc/source/simpleregistry/simpleregistry.cxx @@ -1151,7 +1151,7 @@ void SimpleRegistry::open( "): instance already open"))), static_cast< OWeakObject * >(this)); } - RegError err = (rURL.getLength() == 0 && bCreate) + RegError err = (rURL.isEmpty() && bCreate) ? REG_REGISTRY_NOT_EXISTS : registry_.open(rURL, bReadOnly ? REG_READONLY : REG_READWRITE); if (err == REG_REGISTRY_NOT_EXISTS && bCreate) { diff --git a/stoc/source/simpleregistry/textualservices.cxx b/stoc/source/simpleregistry/textualservices.cxx index 1ea425883aa9..611d0ea7351e 100644 --- a/stoc/source/simpleregistry/textualservices.cxx +++ b/stoc/source/simpleregistry/textualservices.cxx @@ -247,7 +247,7 @@ void Parser::handleComponent() { if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("uri"))) { - if (attrUri_.getLength() != 0) { + if (!attrUri_.isEmpty()) { throw css::registry::InvalidRegistryException( (reader_.getUrl() + rtl::OUString( @@ -256,7 +256,7 @@ void Parser::handleComponent() { css::uno::Reference< css::uno::XInterface >()); } attrUri_ = reader_.getAttributeValue(false).convertFromUtf8(); - if (attrUri_.getLength() == 0) { + if (attrUri_.isEmpty()) { throw css::registry::InvalidRegistryException( (reader_.getUrl() + rtl::OUString( @@ -267,7 +267,7 @@ void Parser::handleComponent() { } else if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("loader"))) { - if (attrLoader_.getLength() != 0) { + if (!attrLoader_.isEmpty()) { throw css::registry::InvalidRegistryException( (reader_.getUrl() + rtl::OUString( @@ -277,7 +277,7 @@ void Parser::handleComponent() { css::uno::Reference< css::uno::XInterface >()); } attrLoader_ = reader_.getAttributeValue(false).convertFromUtf8(); - if (attrLoader_.getLength() == 0) { + if (attrLoader_.isEmpty()) { throw css::registry::InvalidRegistryException( (reader_.getUrl() + rtl::OUString( @@ -288,7 +288,7 @@ void Parser::handleComponent() { } else if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("prefix"))) { - if (attrPrefix_.getLength() != 0) { + if (!attrPrefix_.isEmpty()) { throw css::registry::InvalidRegistryException( (reader_.getUrl() + rtl::OUString( @@ -298,7 +298,7 @@ void Parser::handleComponent() { css::uno::Reference< css::uno::XInterface >()); } attrPrefix_ = reader_.getAttributeValue(false).convertFromUtf8(); - if (attrPrefix_.getLength() == 0) { + if (attrPrefix_.isEmpty()) { throw css::registry::InvalidRegistryException( (reader_.getUrl() + rtl::OUString( @@ -310,7 +310,7 @@ void Parser::handleComponent() { OSL_FAIL ("unexpected component attribute, expected 'uri' or 'loader' or 'prefix'"); } } - if (attrUri_.getLength() == 0) { + if (attrUri_.isEmpty()) { throw css::registry::InvalidRegistryException( (reader_.getUrl() + rtl::OUString( @@ -318,7 +318,7 @@ void Parser::handleComponent() { ": is missing \"uri\" attribute"))), css::uno::Reference< css::uno::XInterface >()); } - if (attrLoader_.getLength() == 0) { + if (attrLoader_.isEmpty()) { throw css::registry::InvalidRegistryException( (reader_.getUrl() + rtl::OUString( @@ -377,7 +377,7 @@ rtl::OUString Parser::getNameAttribute() { if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("name"))) { - if (attrName.getLength() != 0) { + if (!attrName.isEmpty()) { throw css::registry::InvalidRegistryException( (reader_.getUrl() + rtl::OUString( @@ -386,7 +386,7 @@ rtl::OUString Parser::getNameAttribute() { css::uno::Reference< css::uno::XInterface >()); } attrName = reader_.getAttributeValue(false).convertFromUtf8(); - if (attrName.getLength() == 0) { + if (attrName.isEmpty()) { throw css::registry::InvalidRegistryException( (reader_.getUrl() + rtl::OUString( @@ -403,7 +403,7 @@ rtl::OUString Parser::getNameAttribute() { css::uno::Reference< css::uno::XInterface >()); } } - if (attrName.getLength() == 0) { + if (attrName.isEmpty()) { throw css::registry::InvalidRegistryException( (reader_.getUrl() + rtl::OUString( @@ -422,7 +422,7 @@ rtl::OUString pathToString(std::vector< rtl::OUString > const & path) { buf.append(sal_Unicode('/')); buf.append(*i); } - if (buf.getLength() == 0) { + if (buf.isEmpty()) { buf.append(sal_Unicode('/')); } return buf.makeStringAndClear(); @@ -969,7 +969,7 @@ bool Key::find( sal_Int32 i = 0; do { rtl::OUString seg(relative.getToken(0, '/', i)); - if (seg.getLength() != 0) { + if (!seg.isEmpty()) { p.push_back(seg); } } while (i >= 0); diff --git a/stoc/source/tdmanager/tdmgr.cxx b/stoc/source/tdmanager/tdmgr.cxx index 91c5f31bd6db..d3d5ced731d5 100644 --- a/stoc/source/tdmanager/tdmgr.cxx +++ b/stoc/source/tdmanager/tdmgr.cxx @@ -1008,7 +1008,7 @@ Any ManagerImpl::getByHierarchicalName( const OUString & rName ) Any aRet; if (_bCaching) aRet = _aElements.getValue( rName ); - if (rName.getLength() && !aRet.hasValue()) + if (!rName.isEmpty() && !aRet.hasValue()) { sal_Int32 nIndex; if (rName[0] == '[') // test for sequence diff --git a/stoc/source/tdmanager/tdmgr_check.cxx b/stoc/source/tdmanager/tdmgr_check.cxx index e575a2f7de6d..32d8ca1651a7 100644 --- a/stoc/source/tdmanager/tdmgr_check.cxx +++ b/stoc/source/tdmanager/tdmgr_check.cxx @@ -109,7 +109,7 @@ OUString getPropertyFlagsAsString( sal_Int16 attributes ) void typeError( OUString const & msg, OUString const & context ) { OUStringBuffer buf; - if (context.getLength() > 0) { + if (!context.isEmpty()) { buf.append( static_cast('[') ); buf.append( context ); buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("] ") ); diff --git a/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx b/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx index fac7745b9a39..a9a7e0e1f3fc 100644 --- a/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx +++ b/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx @@ -146,7 +146,7 @@ rtl::OUString Translator::translateToInternal( rtl_UriDecodeStrict, encoding), rtl_UriCharClassPchar, rtl_UriEncodeStrict, RTL_TEXTENCODING_UTF8)); - if (seg.getLength() == 0) { + if (seg.isEmpty()) { return rtl::OUString(); } buf.append(seg); @@ -193,7 +193,7 @@ rtl::OUString Translator::translateToExternal( rtl_UriDecodeToIuri, RTL_TEXTENCODING_UTF8), rtl_UriCharClassPchar, rtl_UriEncodeStrictKeepEscapes, encoding)); - if (seg.getLength() == 0) { + if (seg.isEmpty()) { return rtl::OUString(); } buf.append(seg); diff --git a/stoc/source/uriproc/UriReference.cxx b/stoc/source/uriproc/UriReference.cxx index 95427755ad41..3057a1f6464a 100644 --- a/stoc/source/uriproc/UriReference.cxx +++ b/stoc/source/uriproc/UriReference.cxx @@ -52,11 +52,11 @@ UriReference::UriReference( m_hasQuery(bHasQuery), m_hasFragment(false) { - OSL_ASSERT(scheme.getLength() != 0 || bIsHierarchical); + OSL_ASSERT(!scheme.isEmpty() || bIsHierarchical); OSL_ASSERT(!bHasAuthority || bIsHierarchical); - OSL_ASSERT(authority.getLength() == 0 || bHasAuthority); + OSL_ASSERT(authority.isEmpty() || bHasAuthority); OSL_ASSERT(!bHasQuery || bIsHierarchical); - OSL_ASSERT(query.getLength() == 0 || bHasQuery); + OSL_ASSERT(query.isEmpty() || bHasQuery); } UriReference::~UriReference() {} @@ -65,7 +65,7 @@ rtl::OUString UriReference::getUriReference() throw (css::uno::RuntimeException) { osl::MutexGuard g(m_mutex); rtl::OUStringBuffer buf; - if (m_scheme.getLength() != 0) { + if (!m_scheme.isEmpty()) { buf.append(m_scheme); buf.append(static_cast< sal_Unicode >(':')); } @@ -78,7 +78,7 @@ rtl::OUString UriReference::getUriReference() throw (css::uno::RuntimeException) } sal_Bool UriReference::isAbsolute() throw (css::uno::RuntimeException) { - return m_scheme.getLength() != 0; + return !m_scheme.isEmpty(); } rtl::OUString UriReference::getScheme() throw (css::uno::RuntimeException) { @@ -117,13 +117,13 @@ rtl::OUString UriReference::getPath() throw (css::uno::RuntimeException) { sal_Bool UriReference::hasRelativePath() throw (css::uno::RuntimeException) { osl::MutexGuard g(m_mutex); return m_isHierarchical && !m_hasAuthority - && (m_path.getLength() == 0 || m_path[0] != '/'); + && (m_path.isEmpty() || m_path[0] != '/'); } sal_Int32 UriReference::getPathSegmentCount() throw (css::uno::RuntimeException) { osl::MutexGuard g(m_mutex); - if (!m_isHierarchical || m_path.getLength() == 0) { + if (!m_isHierarchical || m_path.isEmpty()) { return 0; } else { sal_Int32 n = m_path[0] == '/' ? 0 : 1; @@ -142,7 +142,7 @@ rtl::OUString UriReference::getPathSegment(sal_Int32 index) throw (css::uno::RuntimeException) { osl::MutexGuard g(m_mutex); - if (m_isHierarchical && m_path.getLength() != 0 && index >= 0) { + if (m_isHierarchical && !m_path.isEmpty() && index >= 0) { for (sal_Int32 i = m_path[0] == '/' ? 1 : 0;; ++i) { if (index-- == 0) { sal_Int32 j = m_path.indexOf('/', i); diff --git a/stoc/source/uriproc/UriReferenceFactory.cxx b/stoc/source/uriproc/UriReferenceFactory.cxx index d06d4018087a..faaa0937f080 100644 --- a/stoc/source/uriproc/UriReferenceFactory.cxx +++ b/stoc/source/uriproc/UriReferenceFactory.cxx @@ -225,10 +225,10 @@ private: css::uno::Reference< css::uri::XUriReference > parseGeneric( rtl::OUString const & scheme, rtl::OUString const & schemeSpecificPart) { - bool isAbsolute = scheme.getLength() != 0; + bool isAbsolute = !scheme.isEmpty(); bool isHierarchical = !isAbsolute - || (schemeSpecificPart.getLength() > 0 && schemeSpecificPart[0] == '/'); + || (!schemeSpecificPart.isEmpty() && schemeSpecificPart[0] == '/'); bool hasAuthority = false; rtl::OUString authority; rtl::OUString path; @@ -260,7 +260,7 @@ css::uno::Reference< css::uri::XUriReference > parseGeneric( query = schemeSpecificPart.copy(i + 1); } } else { - if (schemeSpecificPart.getLength() == 0) { + if (schemeSpecificPart.isEmpty()) { // The scheme-specific part of an opaque URI must not be empty: return 0; } @@ -410,7 +410,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::parse( schemeSpecificPart = uriReference.copy(0, fragment); } css::uno::Reference< css::uri::XUriSchemeParser > parser; - if (serviceName.getLength() != 0) { + if (!serviceName.isEmpty()) { css::uno::Reference< css::lang::XMultiComponentFactory > factory( m_context->getServiceManager()); if (factory.is()) { @@ -464,7 +464,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeAbsolute( } else if (uriReference->isAbsolute()) { return clone(uriReference); } else if (!uriReference->hasAuthority() - && uriReference->getPath().getLength() == 0 + && uriReference->getPath().isEmpty() && !uriReference->hasQuery()) { css::uno::Reference< css::uri::XUriReference > abs( clone(baseUriReference)); @@ -495,7 +495,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeAbsolute( // sure the path component of the resulting URI reference is also // empty (and not "/"). RFC 2396 is unclear about this, and I chose // these rules for consistent results. - bool slash = baseUriReference->getPath().getLength() != 0; + bool slash = !baseUriReference->getPath().isEmpty(); if (slash) { abs.append(static_cast< sal_Unicode >('/')); } @@ -505,7 +505,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeAbsolute( if (*i < -1) { rtl::OUString segment( baseUriReference->getPathSegment(-(*i + 2))); - if (segment.getLength() != 0 || segments.size() > 1) { + if (!segment.isEmpty() || segments.size() > 1) { if (!slash) { abs.append(static_cast< sal_Unicode >('/')); } @@ -515,7 +515,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeAbsolute( } } else if (*i > 1) { rtl::OUString segment(uriReference->getPathSegment(*i - 2)); - if (segment.getLength() != 0 || segments.size() > 1) { + if (!segment.isEmpty() || segments.size() > 1) { if (!slash) { abs.append(static_cast< sal_Unicode >('/')); } @@ -625,7 +625,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeRelative( if (baseUriReference->getPath().getLength() > 1 || uriReference->getPath().getLength() > 1) { - if (uriReference->getPath().getLength() == 0) { + if (uriReference->getPath().isEmpty()) { rel.append(static_cast< sal_Unicode >('/')); } else { OSL_ASSERT(uriReference->getPath()[0] == '/'); @@ -648,11 +648,10 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeRelative( segments = true; } if (i < count2 - 1 - || (uriReference->getPathSegment(count2 - 1).getLength() - != 0)) + || (!uriReference->getPathSegment(count2 - 1).isEmpty())) { if (!segments - && (uriReference->getPathSegment(i).getLength() == 0 + && (uriReference->getPathSegment(i).isEmpty() || (parseScheme(uriReference->getPathSegment(i)) >= 0))) { diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx index de56e4541b05..3f9601d2e4b6 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx @@ -62,11 +62,8 @@ namespace css = ::com::sun::star; bool parseSchemeSpecificPart(::rtl::OUString const & part) { // Liberally accepts both an empty opaque_part and an opaque_part that // starts with a non-escaped "/": - return part.getLength() == 0 - || ((::rtl::Uri::decode( - part, ::rtl_UriDecodeStrict, RTL_TEXTENCODING_UTF8). - getLength()) - != 0); + return part.isEmpty() + || (!::rtl::Uri::decode(part, ::rtl_UriDecodeStrict, RTL_TEXTENCODING_UTF8).isEmpty()); } class UrlReference: diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx index bc5f85dcb41d..882bc7e79947 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx @@ -176,7 +176,7 @@ namespace bool parseSchemeSpecificPart(rtl::OUString const & part) { sal_Int32 len = part.getLength(); sal_Int32 i = 0; - if (parsePart(part, true, &i).getLength() == 0 || part[0] == '/') { + if (parsePart(part, true, &i).isEmpty() || part[0] == '/') { return false; } if (i == len) { @@ -184,7 +184,7 @@ bool parseSchemeSpecificPart(rtl::OUString const & part) { } for (;;) { ++i; // skip '?' or '&' - if (parsePart(part, false, &i).getLength() == 0 || i == len + if (parsePart(part, false, &i).isEmpty() || i == len || part[i] != '=') { return false; @@ -310,7 +310,7 @@ rtl::OUString UrlReference::getName() throw (css::uno::RuntimeException) { void SAL_CALL UrlReference::setName(rtl::OUString const & name) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException) { - if (name.getLength() == 0) + if (name.isEmpty()) throw css::lang::IllegalArgumentException( ::rtl::OUString(), *this, 1); @@ -342,7 +342,7 @@ rtl::OUString UrlReference::getParameter(rtl::OUString const & key) void UrlReference::setParameter(rtl::OUString const & key, rtl::OUString const & value) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException) { - if (key.getLength() == 0) + if (key.isEmpty()) throw css::lang::IllegalArgumentException( ::rtl::OUString(), *this, 1); -- cgit v1.2.3