From 2727a29e57cdcd5dddc94a829194f88cfc2808ab Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Tue, 24 Jan 2012 11:44:35 -0200 Subject: Fix for fdo43460 Part XLVI getLength() to isEmpty() Part XLVI Modules xmlhelp --- xmlhelp/source/cxxhelp/provider/databases.cxx | 28 ++++++++++------------ xmlhelp/source/cxxhelp/provider/provider.cxx | 2 +- xmlhelp/source/cxxhelp/provider/resultsetbase.cxx | 2 +- .../source/cxxhelp/provider/resultsetforquery.cxx | 4 ++-- xmlhelp/source/cxxhelp/provider/urlparameter.cxx | 24 +++++++++---------- xmlhelp/source/cxxhelp/provider/urlparameter.hxx | 12 +++++----- xmlhelp/source/treeview/tvfactory.cxx | 2 +- xmlhelp/source/treeview/tvread.cxx | 13 +++++----- 8 files changed, 42 insertions(+), 45 deletions(-) (limited to 'xmlhelp') diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 628732535f05..4a4a756cc0cd 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -243,7 +243,7 @@ static bool impl_getZipFile( for ( int i = 0; i < rImagesZipPaths.getLength(); ++i ) { rtl::OUString aFileName = pPathArray[ i ]; - if ( aFileName.getLength() ) + if ( !aFileName.isEmpty() ) { if ( 1 + aFileName.lastIndexOf( '/' ) != aFileName.getLength() ) { @@ -292,14 +292,14 @@ rtl::OString Databases::getImagesZipFileURL() bChanged = true; } - if ( !m_aImagesZipFileURL.getLength() || bChanged ) + if ( m_aImagesZipFileURL.isEmpty() || bChanged ) { rtl::OUString aImageZip, aSymbolsStyleName; aResult = xAccess->getByHierarchicalName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Misc/SymbolStyle"))); aResult >>= aSymbolsStyleName; bool bFound = false; - if ( aSymbolsStyleName.getLength() != 0 ) + if ( !aSymbolsStyleName.isEmpty() ) { rtl::OUString aZipName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "images_" )); aZipName += aSymbolsStyleName; @@ -594,7 +594,7 @@ Db* Databases::getBerkeley( const rtl::OUString& Database, const rtl::OUString& Language, bool helpText, const rtl::OUString* pExtensionPath ) { - if( ! Database.getLength() || ! Language.getLength() ) + if( Database.isEmpty() || Language.isEmpty() ) return 0; osl::MutexGuard aGuard( m_aMutex ); @@ -668,7 +668,7 @@ Databases::getCollator( const rtl::OUString& Language, m_xContext ), UNO_QUERY ); rtl::OUString langStr = processLang(Language); rtl::OUString countryStr = country(Language); - if( !countryStr.getLength() ) + if( countryStr.isEmpty() ) { if( langStr.compareToAscii("de") == 0 ) countryStr = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DE")); @@ -914,7 +914,7 @@ KeywordInfo* Databases::getKeyword( const rtl::OUString& Database, KeyDataBaseFileIterator aDbFileIt( m_xContext, *this, Database, Language ); rtl::OUString fileURL; bool bExtension = false; - while( (fileURL = aDbFileIt.nextDbFile( bExtension )).getLength() > 0 ) + while( !(fileURL = aDbFileIt.nextDbFile( bExtension )).isEmpty() ) { Db table; @@ -1024,8 +1024,7 @@ KeywordInfo* Databases::getKeyword( const rtl::OUString& Database, Reference< XHierarchicalNameAccess > Databases::jarFile( const rtl::OUString& jar, const rtl::OUString& Language ) { - if( ! jar.getLength() || - ! Language.getLength() ) + if( jar.isEmpty() || Language.isEmpty() ) { return Reference< XHierarchicalNameAccess >( 0 ); } @@ -1114,8 +1113,7 @@ Reference< XHierarchicalNameAccess > Databases::findJarFileForPath rtl::OUString* o_pExtensionRegistryPath ) { Reference< XHierarchicalNameAccess > xNA; - if( ! jar.getLength() || - ! Language.getLength() ) + if( jar.isEmpty() || Language.isEmpty() ) { return xNA; } @@ -1136,7 +1134,7 @@ Reference< XHierarchicalNameAccess > Databases::findJarFileForPath aIdentifierInPath = path.copy( 0, nFindSlash ); beans::Optional aIdentifierOptional = xParentPackageBundle->getIdentifier(); - if( aIdentifierInPath.getLength() && aIdentifierOptional.IsPresent ) + if( !aIdentifierInPath.isEmpty() && aIdentifierOptional.IsPresent ) { rtl::OUString aUnencodedIdentifier = aIdentifierOptional.Value; rtl::OUString aIdentifier = rtl::Uri::encode( aUnencodedIdentifier, @@ -1616,7 +1614,7 @@ rtl::OUString ExtensionIteratorBase::implGetFileFromPackage( const rtl::OUString& rFileExtension, Reference< deployment::XPackage > xPackage ) { // No extension -> search for pure language folder - bool bLangFolderOnly = (rFileExtension.getLength() == 0); + bool bLangFolderOnly = rFileExtension.isEmpty(); rtl::OUString aFile; rtl::OUString aLanguage = m_aLanguage; @@ -1769,7 +1767,7 @@ Db* DataBaseIterator::implGetDbFromPackage( Reference< deployment::XPackage > xP } Db* pRetDb = NULL; - if (optRegData.IsPresent && optRegData.Value.getLength() > 0) + if (optRegData.IsPresent && !optRegData.Value.isEmpty()) { rtl::OUString aRegDataUrl(optRegData.Value); aRegDataUrl += aSlash; @@ -1817,7 +1815,7 @@ rtl::OUString KeyDataBaseFileIterator::nextDbFile( bool& o_rbExtension ) { rtl::OUString aRetFile; - while( !aRetFile.getLength() && m_eState != END_REACHED ) + while( aRetFile.isEmpty() && m_eState != END_REACHED ) { switch( m_eState ) { @@ -2021,7 +2019,7 @@ rtl::OUString IndexFolderIterator::nextIndexFolder( bool& o_rbExtension, bool& o { rtl::OUString aIndexFolder; - while( !aIndexFolder.getLength() && m_eState != END_REACHED ) + while( aIndexFolder.isEmpty() && m_eState != END_REACHED ) { switch( m_eState ) { diff --git a/xmlhelp/source/cxxhelp/provider/provider.cxx b/xmlhelp/source/cxxhelp/provider/provider.cxx index e55fe5d28c0d..9ea2570f7c7b 100644 --- a/xmlhelp/source/cxxhelp/provider/provider.cxx +++ b/xmlhelp/source/cxxhelp/provider/provider.cxx @@ -274,7 +274,7 @@ void ContentProvider::init() "org.openoffice.Office.Common" ) ); rtl::OUString instPath( getKey( xHierAccess,"Path/Current/Help" ) ); - if( ! instPath.getLength() ) + if( instPath.isEmpty() ) // try to determine path from default instPath = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "$(instpath)/help" )); // replace anything like $(instpath); diff --git a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx index f284be50e91d..7a7f93555a7d 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx @@ -410,7 +410,7 @@ ResultSetBase::queryContentIdentifier( if( 0 <= m_nRow && sal::static_int_cast( m_nRow ) < m_aItems.size() ) { rtl::OUString url = queryContentIdentifierString(); - if( ! m_aIdents[m_nRow].is() && url.getLength() ) + if( ! m_aIdents[m_nRow].is() && !url.isEmpty() ) m_aIdents[m_nRow] = uno::Reference< ucb::XContentIdentifier >( new ::ucbhelper::ContentIdentifier( m_xMSF,url ) ); return m_aIdents[m_nRow]; diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx index f3f7d2cedc12..ec175ccb93ef 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx @@ -103,7 +103,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< lang::XMultiServiceF { sal_Int32 idx; rtl::OUString query = m_aURLParameter.get_query(); - while( query.getLength() ) + while( !query.isEmpty() ) { idx = query.indexOf( sal_Unicode( ' ' ) ); if( idx == -1 ) @@ -143,7 +143,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< lang::XMultiServiceF vector< vector* > aIndexFolderResultVectorVector; bool bTemporary; - while( (idxDir = aIndexFolderIt.nextIndexFolder( bExtension, bTemporary )).getLength() > 0 ) + while( !(idxDir = aIndexFolderIt.nextIndexFolder( bExtension, bTemporary )).isEmpty() ) { vector aIndexFolderResultVector; diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index c0f2dfa3fc1f..a7187e71b098 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx @@ -187,7 +187,7 @@ rtl::OUString URLParameter::get_title() rtl::OUString URLParameter::get_language() { - if( m_aLanguage.getLength() == 0 ) + if( m_aLanguage.isEmpty() ) return m_aDefaultLanguage; return m_aLanguage; @@ -196,7 +196,7 @@ rtl::OUString URLParameter::get_language() rtl::OUString URLParameter::get_program() { - if( ! m_aProgram.getLength() ) + if( m_aProgram.isEmpty() ) { StaticModuleInformation* inf = m_pDatabases->getStaticInformationForModule( get_module(), @@ -341,7 +341,7 @@ void URLParameter::readBerkeley() m_pDatabases->replaceName( m_aTitle ); m_aPath = converter.getFile(); m_aJar = converter.getDatabase(); - if( aExtensionPath.getLength() > 0 ) + if( !aExtensionPath.isEmpty() ) { rtl::OUStringBuffer aExtendedJarStrBuf; aExtendedJarStrBuf.append( aQuestionMark ); @@ -550,8 +550,8 @@ void URLParameter::parse() throw( com::sun::star::ucb::IllegalIdentifierExceptio if( ! scheme() || ! name( module() ) || ! query() || - ! m_aLanguage.getLength() || - ! m_aSystem.getLength() ) + m_aLanguage.isEmpty() || + m_aSystem.isEmpty() ) throw com::sun::star::ucb::IllegalIdentifierException(); } @@ -635,7 +635,7 @@ bool URLParameter::query() { rtl::OUString query_; - if( ! m_aExpr.getLength() ) + if( m_aExpr.isEmpty() ) return true; else if( (m_aExpr.getStr())[0] == sal_Unicode( '?' ) ) query_ = m_aExpr.copy( 1 ).trim(); @@ -647,7 +647,7 @@ bool URLParameter::query() sal_Int32 delimIdx,equalIdx; rtl::OUString parameter,value; - while( query_.getLength() != 0 ) + while( !query_.isEmpty() ) { delimIdx = query_.indexOf( sal_Unicode( '&' ) ); equalIdx = query_.indexOf( sal_Unicode( '=' ) ); @@ -677,7 +677,7 @@ bool URLParameter::query() m_aDbPar = value; else if( parameter.compareToAscii( "Query" ) == 0 ) { - if( ! m_aQuery.getLength() ) + if( m_aQuery.isEmpty() ) m_aQuery = value; else m_aQuery += ( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( " " )) + value ); @@ -756,7 +756,7 @@ static void * zipOpen(SAL_UNUSED_PARAMETER const char *) { rtl::OUString language,jar,path; - if( ugblData->m_pInitial->get_eid().getLength() ) + if( !ugblData->m_pInitial->get_eid().isEmpty() ) return (void*)(new Reference< XHierarchicalNameAccess >); else { @@ -839,7 +839,7 @@ helpRead(void * context, char * buffer, int len) { static int zipRead(void * context, char * buffer, int len) { - if( ugblData->m_pInitial->get_eid().getLength() ) + if( !ugblData->m_pInitial->get_eid().isEmpty() ) { ugblData->m_pDatabases->popupDocument( ugblData->m_pInitial,&buffer,&len); return len; @@ -946,7 +946,7 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam, parString[last++] = "hp"; parString[last++] = rtl::OString('\'') + urlParam->getByName( "HelpPrefix" ) + rtl::OString('\''); - if( parString[last-1].getLength() ) + if( !parString[last-1].isEmpty() ) { parString[last++] = "sm"; parString[last++] = "'vnd.sun.star.help%3A%2F%2F'"; @@ -992,7 +992,7 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam, // Path not yet specified, search directly Reference< XHierarchicalNameAccess > xNA = pDatabases->findJarFileForPath ( aJar, urlParam->get_language(), urlParam->get_path(), &aExtensionPath, &aExtensionRegistryPath ); - if( xNA.is() && aExtensionPath.getLength() ) + if( xNA.is() && !aExtensionPath.isEmpty() ) bAddExtensionPath = true; } diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.hxx b/xmlhelp/source/cxxhelp/provider/urlparameter.hxx index 2279378e2a94..67efe6efb732 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.hxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.hxx @@ -127,12 +127,12 @@ namespace chelp { throw( com::sun::star::ucb::IllegalIdentifierException ); bool isPicture() const { return m_aModule.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("picture")); } - bool isActive() const { return m_aActive.getLength() > 0 && m_aActive.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("true")); } - bool isQuery() const { return m_aId.getLength() == 0 && m_aQuery.getLength() != 0; } + bool isActive() const { return !m_aActive.isEmpty() && m_aActive.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("true")); } + bool isQuery() const { return m_aId.isEmpty() && !m_aQuery.isEmpty(); } bool isEntryForModule() const { return m_aId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("start")) || m_bStart; } - bool isFile() const { return m_aId.getLength() != 0; } - bool isModule() const { return m_aId.getLength() == 0 && m_aModule.getLength() != 0; } - bool isRoot() const { return m_aModule.getLength() == 0; } + bool isFile() const { return !m_aId.isEmpty(); } + bool isModule() const { return m_aId.isEmpty() && !m_aModule.isEmpty(); } + bool isRoot() const { return m_aModule.isEmpty(); } bool isErrorDocument(); rtl::OUString get_url() const { return m_aURL; } @@ -157,7 +157,7 @@ namespace chelp { rtl::OUString get_dbpar() const { - if( m_aDbPar.getLength() ) + if( !m_aDbPar.isEmpty() ) return m_aDbPar; else return m_aModule; diff --git a/xmlhelp/source/treeview/tvfactory.cxx b/xmlhelp/source/treeview/tvfactory.cxx index 3a6bcbe09c80..6f8ca210c424 100644 --- a/xmlhelp/source/treeview/tvfactory.cxx +++ b/xmlhelp/source/treeview/tvfactory.cxx @@ -188,7 +188,7 @@ TVFactory::createInstanceWithArguments( break; } - if( hierview.getLength() ) + if( !hierview.isEmpty() ) { Reference< XHierarchicalNameAccess > xhieraccess( m_xHDS,UNO_QUERY ); Any aAny = xhieraccess->getByHierarchicalName( hierview ); diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index ab5d956ae2f8..46736516fdf4 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -135,7 +135,7 @@ namespace treeview { rtl::OUString getTargetURL() { - if( ! targetURL.getLength() ) + if( targetURL.isEmpty() ) { sal_Int32 len; for ( const TVDom* p = this;; p = p->parent ) @@ -307,7 +307,7 @@ TVRead::TVRead( const ConfigData& configData,TVDom* tvDom ) if( tvDom->isLeaf() ) { TargetURL = ( tvDom->getTargetURL() + configData.appendix ); - if( tvDom->anchor.getLength() ) + if( !tvDom->anchor.isEmpty() ) TargetURL += ( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "#" )) + tvDom->anchor ); } @@ -504,8 +504,7 @@ TVChildTarget::TVChildTarget( const Reference< XMultiServiceFactory >& xMSF ) { ConfigData configData = init( xMSF ); - if( ! configData.locale.getLength() || - ! configData.system.getLength() ) + if( configData.locale.isEmpty() || configData.system.isEmpty() ) return; sal_uInt64 ret,len = 0; @@ -665,7 +664,7 @@ ConfigData TVChildTarget::init( const Reference< XMultiServiceFactory >& xSMgr ) rtl::OUString system( getKey( xHierAccess,"Help/System" ) ); sal_Bool showBasic( getBooleanKey(xHierAccess,"Help/ShowBasic") ); rtl::OUString instPath( getKey( xHierAccess,"Path/Current/Help" ) ); - if( ! instPath.getLength() ) + if( instPath.isEmpty() ) // try to determine path from default instPath = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "$(instpath)/help" )); @@ -742,7 +741,7 @@ ConfigData TVChildTarget::init( const Reference< XMultiServiceFactory >& xSMgr ) TreeFileIterator aTreeIt( locale ); rtl::OUString aTreeFile; sal_Int32 nFileSize; - while( (aTreeFile = aTreeIt.nextTreeFile( nFileSize ) ).getLength() > 0 ) + while( !(aTreeFile = aTreeIt.nextTreeFile( nFileSize ) ).isEmpty() ) { configData.vFileLen.push_back( nFileSize ); configData.vFileURL.push_back( aTreeFile ); @@ -1183,7 +1182,7 @@ rtl::OUString TreeFileIterator::nextTreeFile( sal_Int32& rnFileSize ) { rtl::OUString aRetFile; - while( !aRetFile.getLength() && m_eState != END_REACHED ) + while( aRetFile.isEmpty() && m_eState != END_REACHED ) { switch( m_eState ) { -- cgit