From c571e8777d15fd1c3f8730a7c1325d75c746333d Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Thu, 19 Jan 2012 22:05:49 -0200 Subject: Fix for fdo43460 Part XLIII getLength() to isEmpty() Part XLIII Modules uui --- uui/source/iahndl-authentication.cxx | 8 ++++---- uui/source/iahndl-errorhandler.cxx | 4 ++-- uui/source/iahndl-filter.cxx | 6 +++--- uui/source/iahndl-locking.cxx | 4 ++-- uui/source/iahndl-ssl.cxx | 2 +- uui/source/iahndl.cxx | 38 +++++++++++++----------------------- uui/source/nameclashdlg.cxx | 4 ++-- uui/source/newerverwarn.cxx | 4 ++-- uui/source/passwordcontainer.cxx | 12 ++++++------ uui/source/passworddlg.cxx | 2 +- 10 files changed, 37 insertions(+), 47 deletions(-) diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx index c76414334057..4a38c2e4b1d0 100644 --- a/uui/source/iahndl-authentication.cxx +++ b/uui/source/iahndl-authentication.cxx @@ -335,7 +335,7 @@ handleAuthenticationRequest_( if (aInfo.GetIsRememberPassword()) { if (!aPwContainerHelper.addRecord( - rURL.getLength() ? rURL : rRequest.ServerName, + !rURL.isEmpty() ? rURL : rRequest.ServerName, rtl::OUString(), // empty u/p -> sys creds uno::Sequence< rtl::OUString >(), xIH, @@ -350,7 +350,7 @@ handleAuthenticationRequest_( == ucb::RememberAuthentication_SESSION) { if (!aPwContainerHelper.addRecord( - rURL.getLength() ? rURL : rRequest.ServerName, + !rURL.isEmpty() ? rURL : rRequest.ServerName, rtl::OUString(), // empty u/p -> sys creds uno::Sequence< rtl::OUString >(), xIH, @@ -373,7 +373,7 @@ handleAuthenticationRequest_( if (aInfo.GetIsRememberPassword()) { if (!aPwContainerHelper.addRecord( - rURL.getLength() ? rURL : rRequest.ServerName, + !rURL.isEmpty() ? rURL : rRequest.ServerName, aInfo.GetUserName(), aPassList, xIH, @@ -388,7 +388,7 @@ handleAuthenticationRequest_( == ucb::RememberAuthentication_SESSION) { if (!aPwContainerHelper.addRecord( - rURL.getLength() ? rURL : rRequest.ServerName, + !rURL.isEmpty() ? rURL : rRequest.ServerName, aInfo.GetUserName(), aPassList, xIH, diff --git a/uui/source/iahndl-errorhandler.cxx b/uui/source/iahndl-errorhandler.cxx index 05530fcb7d1f..328f671bbcdd 100644 --- a/uui/source/iahndl-errorhandler.cxx +++ b/uui/source/iahndl-errorhandler.cxx @@ -61,7 +61,7 @@ executeErrorDialog( SolarMutexGuard aGuard; rtl::OUStringBuffer aText(rContext); - if (rContext.getLength() != 0 && rMessage.getLength() != 0) + if (!rContext.isEmpty() && !rMessage.isEmpty()) aText.appendAscii(RTL_CONSTASCII_STRINGPARAM(":\n")); //TODO! must be internationalized aText.append(rMessage); @@ -265,7 +265,7 @@ UUIInteractionHelper::handleErrorHandlerRequest( //TODO! remove this backwards compatibility? rtl::OUString aContext(getContextProperty()); - if (aContext.getLength() == 0 && nErrorCode != 0) + if (aContext.isEmpty() && nErrorCode != 0) { SolarMutexGuard aGuard; ErrorContext * pContext = ErrorContext::GetContext(); diff --git a/uui/source/iahndl-filter.cxx b/uui/source/iahndl-filter.cxx index 149a60f287af..df3a512bd7c4 100644 --- a/uui/source/iahndl-filter.cxx +++ b/uui/source/iahndl-filter.cxx @@ -193,7 +193,7 @@ handleNoSuchFilterRequest_( // If he doesn't select anyone // -> abort operation - if (sSelectedFilter.getLength()<1) + if (sSelectedFilter.isEmpty()) { xAbort->select(); return; @@ -298,7 +298,7 @@ handleAmbigousFilterRequest_( lNames, sFilter ); - if( sFilter.getLength() > 0 ) + if( !sFilter.isEmpty() ) { xFilterTransport->setFilter( sFilter ); xFilterTransport->select(); @@ -362,7 +362,7 @@ handleFilterOptionsRequest_( { ::rtl::OUString aServiceName; aProps[nProperty].Value >>= aServiceName; - if( aServiceName.getLength() ) + if( !aServiceName.isEmpty() ) { uno::Reference< ui::dialogs::XExecutableDialog > xFilterDialog( diff --git a/uui/source/iahndl-locking.cxx b/uui/source/iahndl-locking.cxx index 79917dee74e7..e03e21714481 100644 --- a/uui/source/iahndl-locking.cxx +++ b/uui/source/iahndl-locking.cxx @@ -96,7 +96,7 @@ handleLockedDocumentRequest_( sal_Int32 nResult = RET_CANCEL; if ( nMode == UUI_DOC_LOAD_LOCK ) { - aArguments.push_back( aInfo.getLength() + aArguments.push_back( !aInfo.isEmpty() ? aInfo : ::rtl::OUString( String( ResId( STR_UNKNOWNUSER, @@ -111,7 +111,7 @@ handleLockedDocumentRequest_( } else if ( nMode == UUI_DOC_SAVE_LOCK ) { - aArguments.push_back( aInfo.getLength() + aArguments.push_back( !aInfo.isEmpty() ? aInfo : ::rtl::OUString( String( ResId( STR_UNKNOWNUSER, diff --git a/uui/source/iahndl-ssl.cxx b/uui/source/iahndl-ssl.cxx index 9fbcf0c9fe93..48d61b12b645 100644 --- a/uui/source/iahndl-ssl.cxx +++ b/uui/source/iahndl-ssl.cxx @@ -92,7 +92,7 @@ isDomainMatch( for ( int i = 0; i < certHostNames.getLength(); i++){ ::rtl::OUString element = certHostNames[i]; - if (element.getLength() == 0) + if (element.isEmpty()) continue; if (hostName.equalsIgnoreAsciiCase( element )) diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 4f6cb6bfc702..345fb489947d 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -499,7 +499,7 @@ UUIInteractionHelper::handleRequest_impl( ErrCode nErrorCode = ERRCODE_UUI_IO_TARGETALREADYEXISTS; std::vector< rtl::OUString > aArguments; - if( aNCException.Name.getLength() ) + if( !aNCException.Name.isEmpty() ) { nErrorCode = ERRCODE_UUI_IO_ALREADYEXISTS; aArguments.push_back( aNCException.Name ); @@ -648,33 +648,25 @@ UUIInteractionHelper::handleRequest_impl( { ErrCode nErrorCode; std::vector< rtl::OUString > aArguments; - if (aWrongJavaVersionException.DetectedVersion.getLength() == 0) - if (aWrongJavaVersionException.LowestSupportedVersion. - getLength() - == 0) + if (aWrongJavaVersionException.DetectedVersion.isEmpty()) + if (aWrongJavaVersionException.LowestSupportedVersion.isEmpty()) nErrorCode = ERRCODE_UUI_WRONGJAVA; else { nErrorCode = ERRCODE_UUI_WRONGJAVA_MIN; - aArguments.push_back(aWrongJavaVersionException. - LowestSupportedVersion); + aArguments.push_back(aWrongJavaVersionException.LowestSupportedVersion); } - else if (aWrongJavaVersionException.LowestSupportedVersion. - getLength() - == 0) + else if (aWrongJavaVersionException.LowestSupportedVersion.isEmpty()) { nErrorCode = ERRCODE_UUI_WRONGJAVA_VERSION; - aArguments.push_back(aWrongJavaVersionException. - DetectedVersion); + aArguments.push_back(aWrongJavaVersionException.DetectedVersion); } else { nErrorCode = ERRCODE_UUI_WRONGJAVA_VERSION_MIN; aArguments.reserve(2); - aArguments.push_back(aWrongJavaVersionException. - DetectedVersion); - aArguments.push_back(aWrongJavaVersionException. - LowestSupportedVersion); + aArguments.push_back(aWrongJavaVersionException.DetectedVersion); + aArguments.push_back(aWrongJavaVersionException.LowestSupportedVersion); } handleErrorHandlerRequest(task::InteractionClassification_ERROR, nErrorCode, @@ -736,7 +728,7 @@ UUIInteractionHelper::handleRequest_impl( const ErrCode nErrorCode = ERRCODE_UUI_CONFIGURATION_BACKENDMISSING; rtl::OUString aStratum = aStratumCreationException.StratumData; - if (aStratum.getLength() == 0) + if (aStratum.isEmpty()) aStratum = aStratumCreationException.StratumService; std::vector< rtl::OUString > aArguments; @@ -827,7 +819,7 @@ UUIInteractionHelper::handleRequest_impl( { std::vector< rtl::OUString > aArguments; - if( aBrokenPackageRequest.aName.getLength() ) + if( !aBrokenPackageRequest.aName.isEmpty() ) aArguments.push_back( aBrokenPackageRequest.aName ); handleBrokenPackageRequest( aArguments, @@ -930,7 +922,7 @@ UUIInteractionHelper::handleRequest_impl( handleMacroConfirmRequest( aMacroConfirmRequest.DocumentURL, aMacroConfirmRequest.DocumentStorage, - aMacroConfirmRequest.DocumentVersion.getLength() ? aMacroConfirmRequest.DocumentVersion : ODFVER_012_TEXT, + !aMacroConfirmRequest.DocumentVersion.isEmpty() ? aMacroConfirmRequest.DocumentVersion : ODFVER_012_TEXT, aMacroConfirmRequest.DocumentSignatureInformation, rRequest->getContinuations()); return true; @@ -1233,12 +1225,10 @@ UUIInteractionHelper::handleNameClashResolveRequest( task::XInteractionContinuation > > const & rContinuations) SAL_THROW((uno::RuntimeException)) { - OSL_ENSURE( - rRequest.TargetFolderURL.getLength() > 0, + OSL_ENSURE(!rRequest.TargetFolderURL.isEmpty(), "NameClashResolveRequest must not contain empty TargetFolderURL" ); - OSL_ENSURE( - rRequest.ClashingName.getLength() > 0, + OSL_ENSURE(!rRequest.ClashingName.isEmpty(), "NameClashResolveRequest must not contain empty ClashingName" ); uno::Reference< task::XInteractionAbort > xAbort; @@ -1332,7 +1322,7 @@ UUIInteractionHelper::handleGenericErrorRequest( : STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE, *xManager.get() ) ); - if ( aTitle.getLength() && aErrTitle.getLength() ) + if ( !aTitle.isEmpty() && !aErrTitle.isEmpty() ) aTitle += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " - " ) ); aTitle += aErrTitle; diff --git a/uui/source/nameclashdlg.cxx b/uui/source/nameclashdlg.cxx index 0ec9cbca4373..f6beaf81df12 100644 --- a/uui/source/nameclashdlg.cxx +++ b/uui/source/nameclashdlg.cxx @@ -42,7 +42,7 @@ IMPL_LINK( NameClashDialog, ButtonHdl_Impl, PushButton *, pBtn ) { nRet = (long) RENAME; rtl::OUString aNewName = maEDNewName.GetText(); - if ( ( aNewName == maNewName ) || !aNewName.getLength() ) + if ( ( aNewName == maNewName ) || aNewName.isEmpty() ) { ErrorBox aError( NULL, WB_OK, maSameName ); aError.Execute(); @@ -100,7 +100,7 @@ NameClashDialog::NameClashDialog( Window* pParent, ResMgr* pResMgr, aInfo.SearchAndReplaceAscii( "%NAME", rClashingName ); aInfo.SearchAndReplaceAscii( "%FOLDER", aPath ); maFTMessage.SetText( aInfo ); - if ( rProposedNewName.getLength() ) + if ( !rProposedNewName.isEmpty() ) maEDNewName.SetText( rProposedNewName ); else maEDNewName.SetText( rClashingName ); diff --git a/uui/source/newerverwarn.cxx b/uui/source/newerverwarn.cxx index 2fd8be760818..d60c3d4ae3e4 100644 --- a/uui/source/newerverwarn.cxx +++ b/uui/source/newerverwarn.cxx @@ -101,7 +101,7 @@ IMPL_LINK( NewerVersionWarningDialog, UpdateHdl, PushButton*, EMPTYARG ) try { - if ( ( sNotifyURL.getLength() > 0 ) && ( m_sVersion.getLength() > 0 ) ) + if ( !sNotifyURL.isEmpty() && !m_sVersion.isEmpty() ) { uno::Reference< lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); @@ -110,7 +110,7 @@ IMPL_LINK( NewerVersionWarningDialog, UpdateHdl, PushButton*, EMPTYARG ) RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ), uno::UNO_QUERY_THROW ); sNotifyURL += m_sVersion; - if ( xSystemShell.is() && sNotifyURL.getLength() ) + if ( xSystemShell.is() && !sNotifyURL.isEmpty() ) { xSystemShell->execute( sNotifyURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS ); diff --git a/uui/source/passwordcontainer.cxx b/uui/source/passwordcontainer.cxx index 359aa977d1f8..2b2483216b21 100644 --- a/uui/source/passwordcontainer.cxx +++ b/uui/source/passwordcontainer.cxx @@ -178,8 +178,8 @@ bool PasswordContainerHelper::handleAuthenticationRequest( // Runtime / Persistent info avail for current auth request? rtl::OUString aResult = xUrlContainer->findUrl( - rURL.getLength() ? rURL : rRequest.ServerName ); - if ( aResult.getLength() > 0 ) + rURL.isEmpty() ? rRequest.ServerName : rURL ); + if ( !aResult.isEmpty() ) { if ( fillContinuation( true, rRequest, @@ -199,10 +199,10 @@ bool PasswordContainerHelper::handleAuthenticationRequest( { try { - if (rRequest.UserName.getLength() == 0) + if (rRequest.UserName.isEmpty()) { task::UrlRecord aRec; - if ( rURL.getLength() ) + if ( !rURL.isEmpty() ) aRec = xContainer->find(rURL, xIH); if ( aRec.UserList.getLength() == 0 ) @@ -225,7 +225,7 @@ bool PasswordContainerHelper::handleAuthenticationRequest( else { task::UrlRecord aRec; - if ( rURL.getLength() ) + if ( !rURL.isEmpty() ) aRec = xContainer->findForName( rURL, rRequest.UserName, xIH); @@ -265,7 +265,7 @@ bool PasswordContainerHelper::addRecord( { try { - if ( rUsername.getLength() ) + if ( !rUsername.isEmpty() ) { OSL_ENSURE( m_xPasswordContainer.is(), "Got no XPasswordContainer!" ); diff --git a/uui/source/passworddlg.cxx b/uui/source/passworddlg.cxx index 908666c686dd..ca94e181fa57 100644 --- a/uui/source/passworddlg.cxx +++ b/uui/source/passworddlg.cxx @@ -120,7 +120,7 @@ PasswordDialog::PasswordDialog( aFTPassword.SetText( aFTPassword.GetText() + aDocURL ); if (bIsSimplePasswordRequest) { - DBG_ASSERT( aDocURL.getLength() == 0, "A simple password request should not have a document URL! Use document password request instead." ); + DBG_ASSERT( aDocURL.isEmpty(), "A simple password request should not have a document URL! Use document password request instead." ); aFTPassword.SetText( String( ResId( STR_ENTER_SIMPLE_PASSWORD, *pResourceMgr ) ) ); } -- cgit