[PATCH] [PATCH] Fix for fdo43460 Part III getLength to isEmpty

Olivier Hallot olivier.hallot at alta.org.br
Sat Dec 10 07:35:14 PST 2011


Part III
Module
basic
---
 basic/source/basmgr/vbahelper.cxx |    4 ++--
 basic/source/classes/image.cxx    |    2 +-
 basic/source/classes/sbunoobj.cxx |   24 ++++++++++++------------
 basic/source/runtime/iosys.cxx    |    2 +-
 basic/source/runtime/methods.cxx  |   10 +++++-----
 basic/source/runtime/methods1.cxx |    6 +++---
 basic/source/runtime/step2.cxx    |    4 ++--
 basic/source/sbx/sbxobj.cxx       |    4 ++--
 basic/source/sbx/sbxstr.cxx       |    2 +-
 basic/source/uno/namecont.cxx     |   18 +++++++++---------
 basic/source/uno/scriptcont.cxx   |   10 +++++-----
 11 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/basic/source/basmgr/vbahelper.cxx b/basic/source/basmgr/vbahelper.cxx
index 352aae1..f581a90 100644
--- a/basic/source/basmgr/vbahelper.cxx
+++ b/basic/source/basmgr/vbahelper.cxx
@@ -223,7 +223,7 @@ void enableContainerWindowsOfAllDocuments( const uno::Reference< frame::XModel >
 
 void registerCurrentDirectory( const uno::Reference< frame::XModel >& rxModel, const ::rtl::OUString& rPath )
 {
-    if( rPath.getLength() > 0 )
+    if( !rPath.isEmpty() )
     {
         CurrDirPool& rPool = StaticCurrDirPool::get();
         ::osl::MutexGuard aGuard( rPool.maMutex );
@@ -231,7 +231,7 @@ void registerCurrentDirectory( const uno::Reference< frame::XModel >& rxModel, c
         {
             uno::Reference< frame::XModuleManager > xModuleManager( lclCreateModuleManager(), uno::UNO_SET_THROW );
             ::rtl::OUString aIdentifier = xModuleManager->identify( rxModel );
-            if( aIdentifier.getLength() > 0 )
+            if( !aIdentifier.isEmpty() )
                 rPool.maCurrDirs[ aIdentifier ] = rPath;
         }
         catch(const uno::Exception& )
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index a1d7332..2e24903 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -287,7 +287,7 @@ sal_Bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
         SbiCloseRecord( r, nPos );
     }
     // Source?
-    if( aOUSource.getLength() && SbiGood( r ) )
+    if( !aOUSource.isEmpty() && SbiGood( r ) )
     {
         nPos = SbiOpenRecord( r, B_SOURCE, 1 );
         String aTmp;
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 5f979e8..605de05 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -128,7 +128,7 @@ bool SbUnoObject::getDefaultPropName( SbUnoObject* pUnoObj, ::rtl::OUString& sDf
     if ( xDefaultProp.is() )
     {
         sDfltProp = xDefaultProp->getDefaultPropertyName();
-        if ( sDfltProp.getLength() )
+        if ( !sDfltProp.isEmpty() )
             result = true;
     }
     return result;
@@ -344,7 +344,7 @@ void implAppendExceptionMsg( ::rtl::OUStringBuffer& _inout_rBuffer, const Except
     lcl_indent( _inout_rBuffer, _nLevel );
     _inout_rBuffer.appendAscii( "Type: " );
 
-    if ( _rExceptionType.getLength() == 0 )
+    if ( _rExceptionType.isEmpty() )
         _inout_rBuffer.appendAscii( "Unknown" );
     else
         _inout_rBuffer.append( _rExceptionType );
@@ -1572,7 +1572,7 @@ void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOL
             bBlockConversionToSmallestType );
 
             ::rtl::OUString aParamName = pNames[iSbx];
-            if( aParamName.getLength() )
+            if( !aParamName.isEmpty() )
             {
                 oleautomation::NamedArgument aNamedArgument;
                 aNamedArgument.Name = aParamName;
@@ -1687,7 +1687,7 @@ rtl::OUString Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Ref
     if( pUnoObj )
     {
         aName = pUnoObj->GetClassName();
-        if( !aName.getLength() )
+        if( aName.isEmpty() )
         {
             Any aToInspectObj = pUnoObj->getUnoAny();
             TypeClass eType = aToInspectObj.getValueType().getTypeClass();
@@ -1708,7 +1708,7 @@ rtl::OUString Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Ref
 ::rtl::OUString getDbgObjectName( SbUnoObject* pUnoObj )
 {
     ::rtl::OUString aName = getDbgObjectNameImpl( pUnoObj );
-    if( !aName.getLength() )
+    if( aName.isEmpty() )
         aName += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown"));
 
     ::rtl::OUStringBuffer aRet;
@@ -1787,7 +1787,7 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj, const ::rtl::OUString& rClass )
                 {
                     rtl::OUString sTypeName;
                     xInv->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$GetTypeName") ) ) >>= sTypeName;
-                    if ( sTypeName.getLength() == 0 || sTypeName.equals(  rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IDispatch") ) ) )
+                    if ( sTypeName.isEmpty() || sTypeName.equals(  rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IDispatch") ) ) )
                         // can't check type, leave it pass
                         result = true;
                     else
@@ -2404,7 +2404,7 @@ SbUnoObject::SbUnoObject( const rtl::OUString& aName_, const Any& aUnoObj_ )
         bFatalError = sal_False;
 
         // insert the real name of the class
-        if( aName_.getLength() == 0 )
+        if( aName_.isEmpty() )
         {
             aClassName_ = aUnoObj_.getValueType().getTypeName();
             bSetClassName = sal_True;
@@ -2655,7 +2655,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
             if( mxExactName.is() )
             {
                 ::rtl::OUString aUExactName = mxExactName->getExactName( aUName );
-                if( aUExactName.getLength() )
+                if( !aUExactName.isEmpty() )
                     aUName = aUExactName;
             }
             if( mxUnoAccess->hasProperty( aUName, PropertyConcept::ALL - PropertyConcept::DANGEROUS ) )
@@ -2731,7 +2731,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
             if( mxExactNameInvocation.is() )
             {
                 ::rtl::OUString aUExactName = mxExactNameInvocation->getExactName( aUName );
-                if( aUExactName.getLength() )
+                if( !aUExactName.isEmpty() )
                     aUName = aUExactName;
             }
 
@@ -3564,13 +3564,13 @@ SbxVariable* SbUnoService::Find( const String& rName, SbxClassType )
                 Reference< XServiceConstructorDescription > xCtor = pCtorSeq[i];
 
                 ::rtl::OUString aName( xCtor->getName() );
-                if( !aName.getLength() )
+                if( aName.isEmpty() )
                 {
                     if( xCtor->isDefaultConstructor() )
                         aName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("create"));
                 }
 
-                if( aName.getLength() )
+                if( !aName.isEmpty() )
                 {
                     // Create and insert SbUnoServiceCtor
                     SbxVariableRef xSbCtorRef = new SbUnoServiceCtor( aName, xCtor );
@@ -4688,7 +4688,7 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
         SbxVariable* pVar = pModIfaces->Get( i );
         ::rtl::OUString aIfaceName = pVar->GetName();
 
-        if( aIfaceName.getLength() != 0 )
+        if( !aIfaceName.isEmpty() )
         {
             ::rtl::OUString aPureIfaceName = aIfaceName;
             sal_Int32 indexLastDot = aIfaceName.lastIndexOf('.');
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 2b14640..a2fe3bd 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -252,7 +252,7 @@ sal_Bool needSecurityRestrictions( void )
             const Reference< XBridge >& rxBridge = pBridges[ i ];
             ::rtl::OUString aDescription = rxBridge->getDescription();
             ::rtl::OUString aPortalUser = findUserInDescription( aDescription );
-            if( aPortalUser.getLength() > 0 )
+            if( !aPortalUser.isEmpty() )
             {
                 // User Found, compare to system user
                 if( aPortalUser == aSystemUser )
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index e3d5d48..b5a04c0 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -189,7 +189,7 @@ String getFullPath( const String& aRelPath )
     INetURLObject aURLObj( aRelPath );
     aFileURL = aURLObj.GetMainURL( INetURLObject::NO_DECODE );
 
-    if( !aFileURL.getLength() )
+    if( aFileURL.isEmpty() )
     {
         File::getFileURLFromSystemPath( aRelPath, aFileURL );
     }
@@ -280,7 +280,7 @@ RTLFUNC(Error)
         if ( bVBA && rPar.Count() > 1 )
         {
             com::sun::star::uno::Reference< ooo::vba::XErrObject > xErrObj( SbxErrObject::getUnoErrObject() );
-            if ( xErrObj.is() && xErrObj->getNumber() == nCode && xErrObj->getDescription().getLength() )
+            if ( xErrObj.is() && xErrObj->getNumber() == nCode && !xErrObj->getDescription().isEmpty() )
                 tmpErrMsg = xErrObj->getDescription();
         }
         rPar.Get( 0 )->PutString( tmpErrMsg );
@@ -655,12 +655,12 @@ RTLFUNC(MkDir)
                         // If aPath is the folder name, not a path, then create the folder under current directory.
                         INetURLObject aTryPathURL( aPath );
                         ::rtl::OUString sPathURL = aTryPathURL.GetMainURL( INetURLObject::NO_DECODE );
-                        if ( !sPathURL.getLength() )
+                        if ( sPathURL.isEmpty() )
                         {
                             File::getFileURLFromSystemPath( aPath, sPathURL );
                         }
                         INetURLObject aPathURL( sPathURL );
-                        if ( !aPathURL.GetPath().getLength() )
+                        if ( aPathURL.GetPath().isEmpty() )
                         {
                             ::rtl::OUString sCurDirURL;
                             SbxArrayRef pPar = new SbxArray;
@@ -673,7 +673,7 @@ RTLFUNC(MkDir)
                             INetURLObject aDirURL( sCurDirURL );
                             aDirURL.Append( aPath );
                             ::rtl::OUString aTmpPath = aDirURL.GetMainURL( INetURLObject::NO_DECODE );
-                            if ( aTmpPath.getLength() > 0 )
+                            if ( !aTmpPath.isEmpty() )
                             {
                                 aPath = aTmpPath;
                             }
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index f4bc91f..2ff6990 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -1568,9 +1568,9 @@ RTLFUNC(ConvertToUrl)
         String aStr = rPar.Get(1)->GetString();
         INetURLObject aURLObj( aStr, INET_PROT_FILE );
         ::rtl::OUString aFileURL = aURLObj.GetMainURL( INetURLObject::NO_DECODE );
-        if( !aFileURL.getLength() )
+        if( aFileURL.isEmpty() )
             ::osl::File::getFileURLFromSystemPath( aFileURL, aFileURL );
-        if( !aFileURL.getLength() )
+        if( aFileURL.isEmpty() )
             aFileURL = aStr;
         rPar.Get(0)->PutString( String(aFileURL) );
     }
@@ -1588,7 +1588,7 @@ RTLFUNC(ConvertFromUrl)
         String aStr = rPar.Get(1)->GetString();
         ::rtl::OUString aSysPath;
         ::osl::File::getSystemPathFromFileURL( aStr, aSysPath );
-        if( !aSysPath.getLength() )
+        if( aSysPath.isEmpty() )
             aSysPath = aStr;
         rPar.Get(0)->PutString( String(aSysPath) );
     }
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index b3dcb6f..cd982af 100644
--- a/basic/source/runtime/step2.cxx
+++ b/basic/source/runtime/step2.cxx
@@ -406,7 +406,7 @@ void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 )
                             rtl::OUString sDefaultMethod;
                             if ( xDfltMethod.is() )
                                 sDefaultMethod = xDfltMethod->getDefaultMethodName();
-                            if ( sDefaultMethod.getLength() )
+                            if ( !sDefaultMethod.isEmpty() )
                             {
                                 SbxVariable* meth = pUnoObj->Find( sDefaultMethod, SbxCLASS_METHOD );
                                 if( meth != NULL )
@@ -572,7 +572,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
                             else if( xIndexAccess.is() )
                                 sDefaultMethod = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getByIndex" ) );
 
-                            if ( sDefaultMethod.getLength() )
+                            if ( !sDefaultMethod.isEmpty() )
                             {
                                 SbxVariable* meth = pUnoObj->Find( sDefaultMethod, SbxCLASS_METHOD );
                                 SbxVariableRef refTemp = meth;
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index 7a30bf8..3afe8ca 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -755,7 +755,7 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill )
     rtl::OString aClassNameStr(rtl::OUStringToOString(aClassName, RTL_TEXTENCODING_ASCII_US));
     rStrm << "Object( "
           << rtl::OString::valueOf(reinterpret_cast<sal_Int64>(this)).getStr()<< "=='"
-          << ( aNameStr.getLength() ? aNameStr.getStr() : "<unnamed>" ) << "', "
+          << ( aNameStr.isEmpty() ?  "<unnamed>" : aNameStr.getStr() ) << "', "
           << "of class '" << aClassNameStr.getStr() << "', "
           << "counts "
           << rtl::OString::valueOf(static_cast<sal_Int64>(GetRefCount())).getStr()
@@ -765,7 +765,7 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill )
         rtl::OString aParentNameStr(rtl::OUStringToOString(GetName(), RTL_TEXTENCODING_ASCII_US));
         rStrm << "in parent "
               << rtl::OString::valueOf(reinterpret_cast<sal_Int64>(GetParent())).getStr()
-              << "=='" << ( aParentNameStr.getLength() ? aParentNameStr.getStr() : "<unnamed>" ) << "'";
+              << "=='" << ( aParentNameStr.isEmpty() ? "<unnamed>" : aParentNameStr.getStr()  ) << "'";
     }
     else
         rStrm << "no parent ";
diff --git a/basic/source/sbx/sbxstr.cxx b/basic/source/sbx/sbxstr.cxx
index a373f84..fc95c576 100644
--- a/basic/source/sbx/sbxstr.cxx
+++ b/basic/source/sbx/sbxstr.cxx
@@ -200,7 +200,7 @@ void ImpPutString( SbxValues* p, const ::rtl::OUString* n )
         case SbxBYREF | SbxSTRING:
         case SbxSTRING:
         case SbxLPSTR:
-            if( n->getLength() )
+            if( !n->isEmpty() )
             {
                 if( !p->pOUString )
                     p->pOUString = new ::rtl::OUString( *n );
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 6f223f8..f65a6eb 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -612,7 +612,7 @@ sal_Bool SfxLibraryContainer::init_Impl(
     meInitMode = DEFAULT;
     INetURLObject aInitUrlInetObj( maInitialDocumentURL );
     OUString aInitFileName = aInitUrlInetObj.GetMainURL( INetURLObject::NO_DECODE );
-    if( aInitFileName.getLength() )
+    if( !aInitFileName.isEmpty() )
     {
         // We need a BasicManager to avoid problems
         StarBASIC* pBas = new StarBASIC();
@@ -836,7 +836,7 @@ sal_Bool SfxLibraryContainer::init_Impl(
 
                 // Check storage URL
                 OUString aStorageURL = rLib.aStorageURL;
-                if( !bStorage && !aStorageURL.getLength() && nPass == 0 )
+                if( !bStorage && aStorageURL.isEmpty() && nPass == 0 )
                 {
                     String aLibraryPath;
                     if( meInitMode == CONTAINER_INIT_FILE )
@@ -1235,7 +1235,7 @@ void SfxLibraryContainer::implScanExtensions( void )
     rtl::OUString aLibURL;
 
     bool bPureDialogLib = false;
-    while( (aLibURL = aScriptIt.nextBasicOrDialogLibrary( bPureDialogLib )).getLength() > 0 )
+    while ( !(aLibURL = aScriptIt.nextBasicOrDialogLibrary( bPureDialogLib )).isEmpty())
     {
         if( bPureDialogLib && maInfoFileName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "script" ) ) )
             continue;
@@ -1347,7 +1347,7 @@ OUString SfxLibraryContainer::createAppLibraryFolder
     ( SfxLibrary* pLib, const OUString& aName )
 {
     OUString aLibDirPath = pLib->maStorageURL;
-    if( !aLibDirPath.getLength() )
+    if( aLibDirPath.isEmpty() )
     {
         INetURLObject aInetObj( String(maLibraryPath).GetToken(1) );
         aInetObj.insertName( aName, sal_True, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
@@ -1448,7 +1448,7 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
     else
     {
         // Export?
-        bool bExport = aTargetURL.getLength();
+        bool bExport = !aTargetURL.isEmpty();
         try
         {
             Reference< XSimpleFileAccess > xSFI = mxSFI;
@@ -1582,7 +1582,7 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
     else
     {
         // Export?
-        bool bExport = aTargetURL.getLength();
+        bool bExport = !aTargetURL.isEmpty();
         Reference< XSimpleFileAccess > xSFI = mxSFI;
         if( xToUseSFI.is() )
             xSFI = xToUseSFI;
@@ -1948,7 +1948,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
 
     // if we did an in-place save into a storage (i.e. a save into the storage we were already based on),
     // then we need to clean up the temporary storage we used for this
-    if ( bInplaceStorage && sTempTargetStorName.getLength() )
+    if ( bInplaceStorage && !sTempTargetStorName.isEmpty() )
     {
         SAL_WARN_IF(
             !xSourceLibrariesStor.is(), "basic",
@@ -3106,7 +3106,7 @@ void SfxLibrary::impl_removeWithoutChecks( const ::rtl::OUString& _rElementName
     implSetModified( sal_True );
 
     // Remove element file
-    if( maStorageURL.getLength() )
+    if( !maStorageURL.isEmpty() )
     {
         INetURLObject aElementInetObj( maStorageURL );
         aElementInetObj.insertName( _rElementName, sal_False,
@@ -3240,7 +3240,7 @@ rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDia
 {
     rtl::OUString aRetLib;
 
-    while( !aRetLib.getLength() && m_eState != END_REACHED )
+    while( aRetLib.isEmpty() && m_eState != END_REACHED )
     {
         switch( m_eState )
         {
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index 977f6bd..c6fbc5d 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -305,7 +305,7 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
     // TODO: Check language
     // aMod.aLanguage
     // aMod.aName ignored
-    if( aMod.aModuleType.getLength() > 0 )
+    if( !aMod.aModuleType.isEmpty() )
     {
         /*  If in VBA compatibility mode, force creation of the VBA Globals
             object. Each application will create an instance of its own
@@ -473,8 +473,8 @@ void SAL_CALL SfxScriptLibraryContainer::changeLibraryPassword( const OUString&
     if( OldPassword == NewPassword )
         return;
 
-    sal_Bool bOldPassword = ( OldPassword.getLength() > 0 );
-    sal_Bool bNewPassword = ( NewPassword.getLength() > 0 );
+    sal_Bool bOldPassword = ( !OldPassword.isEmpty() );
+    sal_Bool bNewPassword = ( !NewPassword.isEmpty() );
     sal_Bool bStorage = mxStorage.is() && !pImplLib->mbLink;
 
     if( pImplLib->mbReadOnly || (bOldPassword && !pImplLib->mbPasswordProtected) )
@@ -592,7 +592,7 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
                         const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
                         const ::rtl::OUString& aTargetURL, const Reference< XSimpleFileAccess > xToUseSFI, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler )
 {
-    bool bExport = aTargetURL.getLength();
+    bool bExport = !aTargetURL.isEmpty();
 
     BasicManager* pBasicMgr = getBasicManager();
     OSL_ENSURE( pBasicMgr, "SfxScriptLibraryContainer::implStorePasswordLibrary: cannot do this without a BasicManager!" );
@@ -1260,7 +1260,7 @@ bool SfxScriptLibrary::containsValidModule( const Any& aElement )
 {
     OUString sModuleText;
     aElement >>= sModuleText;
-    return ( sModuleText.getLength() > 0 );
+    return ( !sModuleText.isEmpty() );
 }
 
 bool SAL_CALL SfxScriptLibrary::isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const
-- 
1.7.5.4


--------------030502000207020104010005--


More information about the LibreOffice mailing list