[PATCH] Fix for fdo43460 Part VII getLength() to isEmpty()

Olivier Hallot olivier.hallot at alta.org.br
Mon Dec 12 17:01:55 PST 2011


Part VII
Module
comphelper
---
 .../source/container/embeddedobjectcontainer.cxx   |   30 +++++++-------
 .../source/eventattachermgr/eventattachermgr.cxx   |    2 +-
 comphelper/source/misc/docpasswordhelper.cxx       |   16 ++++----
 comphelper/source/misc/documentinfo.cxx            |   18 ++++----
 comphelper/source/misc/locale.cxx                  |    4 +-
 comphelper/source/misc/logging.cxx                 |    4 +-
 comphelper/source/misc/mediadescriptor.cxx         |    4 +-
 comphelper/source/misc/mimeconfighelper.cxx        |   42 ++++++++++----------
 comphelper/source/misc/numbers.cxx                 |    2 +-
 comphelper/source/misc/regpathhelper.cxx           |    8 ++--
 comphelper/source/misc/sequenceashashmap.cxx       |    4 +-
 comphelper/source/misc/storagehelper.cxx           |    4 +-
 comphelper/source/misc/string.cxx                  |    2 +-
 .../officeinstallationdirectories.cxx              |   10 ++--
 comphelper/source/property/genericpropertyset.cxx  |    4 +-
 comphelper/source/property/propagg.cxx             |    2 +-
 comphelper/source/property/property.cxx            |    2 +-
 comphelper/source/property/propertybag.cxx         |    2 +-
 comphelper/source/xml/ofopxmlhelper.cxx            |   16 ++++----
 19 files changed, 88 insertions(+), 88 deletions(-)

diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
index 30edd51..8300443 100644
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
@@ -324,7 +324,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::GetEmbeddedOb
 {
     RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::GetEmbeddedObject" );
 
-    OSL_ENSURE( rName.getLength(), "Empty object name!");
+    OSL_ENSURE( !rName.isEmpty(), "Empty object name!");
 
     uno::Reference < embed::XEmbeddedObject > xObj;
     EmbeddedObjectContainerNameMap::iterator aIt = pImpl->maObjectContainer.find( rName );
@@ -402,7 +402,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CreateEmbedde
 {
     RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::CreateEmbeddedObject" );
 
-    if ( !rNewName.getLength() )
+    if ( rNewName.isEmpty() )
         rNewName = CreateUniqueObjectName();
 
     OSL_ENSURE( !HasEmbeddedObject(rNewName), "Object to create already exists!");
@@ -444,7 +444,7 @@ void EmbeddedObjectContainer::AddEmbeddedObject( const ::com::sun::star::uno::Re
     RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::AddEmbeddedObject" );
 
 #if OSL_DEBUG_LEVEL > 1
-    OSL_ENSURE( rName.getLength(), "Added object doesn't have a name!");
+    OSL_ENSURE( !rName.isEmpty(), "Added object doesn't have a name!");
     uno::Reference < container::XNameAccess > xAccess( pImpl->mxStorage, uno::UNO_QUERY );
     uno::Reference < embed::XEmbedPersist > xEmb( xObj, uno::UNO_QUERY );
     uno::Reference < embed::XLinkageSupport > xLink( xEmb, uno::UNO_QUERY );
@@ -508,7 +508,7 @@ sal_Bool EmbeddedObjectContainer::StoreEmbeddedObject( const uno::Reference < em
     RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::StoreEmbeddedObject" );
 
     uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY );
-    if ( !rName.getLength() )
+    if ( rName.isEmpty() )
         rName = CreateUniqueObjectName();
 
 #if OSL_DEBUG_LEVEL > 1
@@ -561,7 +561,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::InsertEmbedde
 {
     RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::InsertEmbeddedObject( InputStream )" );
 
-    if ( !rNewName.getLength() )
+    if ( rNewName.isEmpty() )
         rNewName = CreateUniqueObjectName();
 
     // store it into the container storage
@@ -623,7 +623,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::InsertEmbedde
 {
     RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::InsertEmbeddedObject( MediaDescriptor )" );
 
-    if ( !rNewName.getLength() )
+    if ( rNewName.isEmpty() )
         rNewName = CreateUniqueObjectName();
 
     uno::Reference < embed::XEmbeddedObject > xObj;
@@ -658,7 +658,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::InsertEmbedde
 {
     RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::InsertEmbeddedLink" );
 
-    if ( !rNewName.getLength() )
+    if ( rNewName.isEmpty() )
         rNewName = CreateUniqueObjectName();
 
     uno::Reference < embed::XEmbeddedObject > xObj;
@@ -698,7 +698,7 @@ sal_Bool EmbeddedObjectContainer::TryToCopyGraphReplacement( EmbeddedObjectConta
 
     sal_Bool bResult = sal_False;
 
-    if ( ( &rSrc != this || !aOrigName.equals( aTargetName ) ) && aOrigName.getLength() && aTargetName.getLength() )
+    if ( ( &rSrc != this || !aOrigName.equals( aTargetName ) ) && !aOrigName.isEmpty() && !aTargetName.isEmpty() )
     {
         ::rtl::OUString aMediaType;
         uno::Reference < io::XInputStream > xGrStream = rSrc.GetGraphicStream( aOrigName, &aMediaType );
@@ -726,7 +726,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmb
     catch( uno::Exception& )
     {}
 
-    if ( !rName.getLength() )
+    if ( rName.isEmpty() )
         rName = CreateUniqueObjectName();
 
     // objects without persistance are not really stored by the method
@@ -744,7 +744,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmb
                 {
                     // this is a OOo link, it has no persistence
                     ::rtl::OUString aURL = xOrigLinkage->getLinkURL();
-                    if ( !aURL.getLength() )
+                    if ( aURL.isEmpty() )
                         throw uno::RuntimeException();
 
                     // create new linked object from the URL the link is based on
@@ -846,7 +846,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmb
     if ( xResult.is() )
     {
         // the object is successfully copied, try to copy graphical replacement
-        if ( aOrigName.getLength() )
+        if ( !aOrigName.isEmpty() )
             TryToCopyGraphReplacement( rSrc, aOrigName, rName );
 
         // the object might need the size to be set
@@ -1058,7 +1058,7 @@ sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < e
                         static const ::rtl::OUString s_sMediaType(RTL_CONSTASCII_USTRINGPARAM("MediaType"));
                         xStorProps->getPropertyValue( s_sMediaType ) >>= aOrigStorMediaType;
 
-                        OSL_ENSURE( aOrigStorMediaType.getLength(), "No valuable media type in the storage!\n" );
+                        OSL_ENSURE( !aOrigStorMediaType.isEmpty(), "No valuable media type in the storage!\n" );
 
                         uno::Reference< beans::XPropertySet > xTargetStorProps(
                                                                     pImpl->mpTempObjectContainer->pImpl->mxStorage,
@@ -1178,8 +1178,8 @@ uno::Reference < io::XInputStream > EmbeddedObjectContainer::GetGraphicStream( c
 
     uno::Reference < io::XInputStream > xStream;
 
-    OSL_ENSURE( aName.getLength(), "Retrieving graphic for unknown object!" );
-    if ( aName.getLength() )
+    OSL_ENSURE( !aName.isEmpty(), "Retrieving graphic for unknown object!" );
+    if ( !aName.isEmpty() )
     {
         try
         {
@@ -1316,7 +1316,7 @@ namespace {
                                             const uno::Reference< io::XInputStream >& xInStream,
                                             const ::rtl::OUString& aStreamName )
     {
-        OSL_ENSURE( aStreamName.getLength() && xInStream.is() && xDocStor.is(), "Misuse of the method!\n" );
+        OSL_ENSURE( !aStreamName.isEmpty() && xInStream.is() && xDocStor.is(), "Misuse of the method!\n" );
 
         try
         {
diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx
index f20b53a..ca6372973 100644
--- a/comphelper/source/eventattachermgr/eventattachermgr.cxx
+++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx
@@ -315,7 +315,7 @@ Any SAL_CALL AttacherAllListener_Impl::approveFiring( const AllEventObject& Even
 
                 case TypeClass_STRING:
                     // none empty string -> return
-                    if( ((OUString*)aRet.getValue())->getLength() > 0 )
+                    if( !((OUString*)aRet.getValue())->isEmpty() )
                         return aRet;
                     break;
 
diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx
index 173b196..3619b28 100644
--- a/comphelper/source/misc/docpasswordhelper.cxx
+++ b/comphelper/source/misc/docpasswordhelper.cxx
@@ -56,7 +56,7 @@ static uno::Sequence< sal_Int8 > GeneratePBKDF2Hash( const ::rtl::OUString& aPas
 {
     uno::Sequence< sal_Int8 > aResult;
 
-    if ( aPassword.getLength() && aSalt.getLength() && nCount && nHashLength )
+    if ( !aPassword.isEmpty() && aSalt.getLength() && nCount && nHashLength )
     {
         ::rtl::OString aBytePass = ::rtl::OUStringToOString( aPassword, RTL_TEXTENCODING_UTF8 );
         aResult.realloc( 16 );
@@ -107,7 +107,7 @@ uno::Sequence< beans::PropertyValue > DocPasswordHelper::GenerateNewModifyPasswo
 sal_Bool DocPasswordHelper::IsModifyPasswordCorrect( const ::rtl::OUString& aPassword, const uno::Sequence< beans::PropertyValue >& aInfo )
 {
     sal_Bool bResult = sal_False;
-    if ( aPassword.getLength() && aInfo.getLength() )
+    if ( !aPassword.isEmpty() && aInfo.getLength() )
     {
         ::rtl::OUString sAlgorithm;
         uno::Sequence< sal_Int8 > aSalt;
@@ -227,7 +227,7 @@ sal_uInt16 DocPasswordHelper::GetXLHashAsUINT16(
 
     ::rtl::OString aString = ::rtl::OUStringToOString( aUString, nEnc );
 
-    if ( aString.getLength() && aString.getLength() <= SAL_MAX_UINT16 )
+    if ( !aString.isEmpty() && aString.getLength() <= SAL_MAX_UINT16 )
     {
         for ( sal_Int32 nInd = aString.getLength() - 1; nInd >= 0; nInd-- )
         {
@@ -276,7 +276,7 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence(
 /*static*/ uno::Sequence< sal_Int8 > DocPasswordHelper::GenerateStd97Key( const ::rtl::OUString& aPassword, const uno::Sequence< sal_Int8 >& aDocId )
 {
     uno::Sequence< sal_Int8 > aResultKey;
-    if ( aPassword.getLength() && aDocId.getLength() == 16 )
+    if ( !aPassword.isEmpty() && aDocId.getLength() == 16 )
     {
         sal_uInt16 pPassData[16];
         rtl_zeroMemory( pPassData, sizeof(pPassData) );
@@ -366,8 +366,8 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence(
     {
         for( ::std::vector< OUString >::const_iterator aIt = pDefaultPasswords->begin(), aEnd = pDefaultPasswords->end(); (eResult == DocPasswordVerifierResult_WRONG_PASSWORD) && (aIt != aEnd); ++aIt )
         {
-            OSL_ENSURE( aIt->getLength() > 0, "DocPasswordHelper::requestAndVerifyDocPassword - unexpected empty default password" );
-            if( aIt->getLength() > 0 )
+            OSL_ENSURE( !aIt->isEmpty(), "DocPasswordHelper::requestAndVerifyDocPassword - unexpected empty default password" );
+            if( !aIt->isEmpty() )
             {
                 eResult = rVerifier.verifyPassword( *aIt, aEncData );
                 if( pbIsDefaultPassword )
@@ -390,7 +390,7 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence(
     // try media password (skip, if result is OK or ABORT)
     if( eResult == DocPasswordVerifierResult_WRONG_PASSWORD )
     {
-        if( rMediaPassword.getLength() > 0 )
+        if( !rMediaPassword.isEmpty() )
             eResult = rVerifier.verifyPassword( rMediaPassword, aEncData );
     }
 
@@ -405,7 +405,7 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence(
             rxInteractHandler->handle( xRequest );
             if( pRequest->isPassword() )
             {
-                if( pRequest->getPassword().getLength() > 0 )
+                if( !pRequest->getPassword().isEmpty() )
                     eResult = rVerifier.verifyPassword( pRequest->getPassword(), aEncData );
             }
             else
diff --git a/comphelper/source/misc/documentinfo.cxx b/comphelper/source/misc/documentinfo.cxx
index 8f5be77..7a7e69b 100644
--- a/comphelper/source/misc/documentinfo.cxx
+++ b/comphelper/source/misc/documentinfo.cxx
@@ -98,12 +98,12 @@ namespace comphelper {
         {
             // 1. ask the model and the controller for their XTitle::getTitle
             sTitle = lcl_getTitle( _rxDocument );
-            if ( sTitle.getLength() )
+            if ( !sTitle.isEmpty() )
                 return sTitle;
 
             Reference< XController > xController( _rxDocument->getCurrentController() );
             sTitle = lcl_getTitle( xController );
-            if ( sTitle.getLength() )
+            if ( !sTitle.isEmpty() )
                 return sTitle;
 
             // work around a problem with embedded objects, which sometimes return
@@ -113,13 +113,13 @@ namespace comphelper {
                 sDocURL = ::rtl::OUString();
 
             // 2. if the document is not saved, yet, check the frame title
-            if ( sDocURL.getLength() == 0 )
+            if ( sDocURL.isEmpty() )
             {
                 Reference< XFrame > xFrame;
                 if ( xController.is() )
                     xFrame.set( xController->getFrame() );
                 sTitle = lcl_getTitle( xFrame );
-                if ( sTitle.getLength() )
+                if ( !sTitle.isEmpty() )
                     return sTitle;
             }
 
@@ -131,14 +131,14 @@ namespace comphelper {
                     xDPS->getDocumentProperties(), UNO_QUERY_THROW );
                 OSL_ENSURE(xDocProps.is(), "no DocumentProperties");
                 sTitle = xDocProps->getTitle();
-                if ( sTitle.getLength() )
+                if ( !sTitle.isEmpty() )
                     return sTitle;
             }
 
             // 4. try model arguments
             NamedValueCollection aModelArgs( _rxDocument->getArgs() );
             sTitle = aModelArgs.getOrDefault( "Title", sTitle );
-            if ( sTitle.getLength() )
+            if ( !sTitle.isEmpty() )
                 return sTitle;
 
             // 5. try the last segment of the document URL
@@ -146,7 +146,7 @@ namespace comphelper {
             // but since we moved this code to comphelper, we do not have access to an INetURLObject anymore
             // This heuristics here should be sufficient - finally, we will get an UNO title API in a not
             // too distant future (hopefully), then  this complete class is superfluous)
-            if ( sDocURL.getLength() == 0 )
+            if ( sDocURL.isEmpty() )
             {
                 Reference< XStorable > xDocStorable( _rxDocument, UNO_QUERY_THROW );
                 sDocURL = xDocStorable->getLocation();
@@ -159,7 +159,7 @@ namespace comphelper {
             }
             sTitle = sDocURL.copy( nLastSepPos + 1 );
 
-            if ( sTitle.getLength() != 0 )
+            if ( !sTitle.isEmpty() )
                 return sTitle;
 
             // 5.
@@ -168,7 +168,7 @@ namespace comphelper {
             Reference< XTitle > xTitle( _rxDocument, UNO_QUERY );
             if ( xTitle.is() )
             {
-                if ( xTitle->getTitle().getLength() != 0 )
+                if ( !xTitle->getTitle().isEmpty() )
                     return xTitle->getTitle();
             }
         }
diff --git a/comphelper/source/misc/locale.cxx b/comphelper/source/misc/locale.cxx
index 4149a0f..6ed05bc 100644
--- a/comphelper/source/misc/locale.cxx
+++ b/comphelper/source/misc/locale.cxx
@@ -187,12 +187,12 @@ void Locale::fromISO(const ::rtl::OUString& sISO)
     ::rtl::OUStringBuffer sISO(64);
 
     sISO.append(m_sLanguage);
-    if (m_sCountry.getLength())
+    if (!m_sCountry.isEmpty())
     {
         sISO.append(SEPERATOR_LC);
         sISO.append(m_sCountry);
 
-        if (m_sVariant.getLength())
+        if (!m_sVariant.isEmpty())
         {
             sISO.append(SEPERATOR_CV);
             sISO.append(m_sVariant);
diff --git a/comphelper/source/misc/logging.cxx b/comphelper/source/misc/logging.cxx
index 6db28d7..1d95b15 100644
--- a/comphelper/source/misc/logging.cxx
+++ b/comphelper/source/misc/logging.cxx
@@ -94,7 +94,7 @@ namespace comphelper
         try
         {
             Reference< XLoggerPool > xPool( LoggerPool::get( m_aContext.getUNOContext() ), UNO_QUERY_THROW );
-            if ( m_sLoggerName.getLength() )
+            if ( !m_sLoggerName.isEmpty() )
                 m_xLogger = xPool->getNamedLogger( m_sLoggerName );
             else
                 m_xLogger = xPool->getDefaultLogger();
@@ -386,7 +386,7 @@ namespace comphelper
         ::rtl::OUString sMessage;
         if ( lcl_loadBundle_nothrow( m_pImpl->getContext(), *m_pData ) )
             sMessage = lcl_loadString_nothrow( m_pData->xBundle, _nMessageResID );
-        if ( sMessage.getLength() == 0 )
+        if ( sMessage.isEmpty() )
         {
             ::rtl::OUStringBuffer aBuffer;
             aBuffer.appendAscii( "<invalid event resource: '" );
diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx
index 7db0956..90b713c 100644
--- a/comphelper/source/misc/mediadescriptor.cxx
+++ b/comphelper/source/misc/mediadescriptor.cxx
@@ -494,7 +494,7 @@ sal_Bool MediaDescriptor::impl_addInputStream( sal_Bool bLockFile )
 
         // b) ... or we must get it from the given URL
         ::rtl::OUString sURL = getUnpackedValueOrDefault(MediaDescriptor::PROP_URL(), ::rtl::OUString());
-        if (!sURL.getLength())
+        if (sURL.isEmpty())
             throw css::uno::Exception(
                     ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Found no URL." )),
                     css::uno::Reference< css::uno::XInterface >());
@@ -540,7 +540,7 @@ sal_Bool MediaDescriptor::impl_openStreamWithPostData( const css::uno::Reference
 
     // media type
     ::rtl::OUString sMediaType = getUnpackedValueOrDefault(MediaDescriptor::PROP_MEDIATYPE(), ::rtl::OUString());
-    if (!sMediaType.getLength())
+    if (sMediaType.isEmpty())
     {
         sMediaType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/x-www-form-urlencoded" ));
         (*this)[MediaDescriptor::PROP_MEDIATYPE()] <<= sMediaType;
diff --git a/comphelper/source/misc/mimeconfighelper.cxx b/comphelper/source/misc/mimeconfighelper.cxx
index 541fa38..4416415 100644
--- a/comphelper/source/misc/mimeconfighelper.cxx
+++ b/comphelper/source/misc/mimeconfighelper.cxx
@@ -207,7 +207,7 @@ sal_Int32 MimeConfigurationHelper::GetFilterFlags( const ::rtl::OUString& aFilte
     sal_Int32 nFlags = 0;
     try
     {
-        if ( aFilterName.getLength() )
+        if ( !aFilterName.isEmpty() )
         {
             uno::Reference< container::XNameAccess > xFilterFactory(
                 GetFilterFactory(),
@@ -280,10 +280,10 @@ sal_Int32 MimeConfigurationHelper::GetFilterFlags( const ::rtl::OUString& aFilte
                     {
                         ::rtl::OUString aFilterName;
                         if ( aType[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PreferredFilter" ) )
-                          && ( aType[nInd].Value >>= aFilterName ) && aFilterName.getLength() )
+                          && ( aType[nInd].Value >>= aFilterName ) && !aFilterName.isEmpty() )
                         {
                             ::rtl::OUString aDocumentName = GetDocServiceNameFromFilter( aFilterName );
-                            if ( aDocumentName.getLength() )
+                            if ( !aDocumentName.isEmpty() )
                                 return aDocumentName;
                         }
                     }
@@ -445,7 +445,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByClas
     }
 
     ::rtl::OUString aStringClassID = GetStringClassIDRepresentation( aClassID );
-    if ( aStringClassID.getLength() )
+    if ( !aStringClassID.isEmpty() )
     {
         uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration();
         uno::Reference< container::XNameAccess > xObjectProps;
@@ -471,7 +471,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByMedi
         return aObject;
 
     ::rtl::OUString aDocumentName = GetDocServiceNameFromMediaType( aMediaType );
-    if ( aDocumentName.getLength() )
+    if ( !aDocumentName.isEmpty() )
         return GetObjectPropsByDocumentName( aDocumentName );
 
     return uno::Sequence< beans::NamedValue >();
@@ -481,7 +481,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByMedi
 uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByFilter( const ::rtl::OUString& aFilterName )
 {
     ::rtl::OUString aDocumentName = GetDocServiceNameFromFilter( aFilterName );
-    if ( aDocumentName.getLength() )
+    if ( !aDocumentName.isEmpty() )
         return GetObjectPropsByDocumentName( aDocumentName );
 
     return uno::Sequence< beans::NamedValue >();
@@ -490,7 +490,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByFilt
 //-----------------------------------------------------------------------
 uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocumentName( const ::rtl::OUString& aDocName )
 {
-    if ( aDocName.getLength() )
+    if ( !aDocName.isEmpty() )
     {
         uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration();
         if ( xObjConfig.is() )
@@ -532,7 +532,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu
 {
     ::rtl::OUString aResult;
 
-    if ( aStringClassID.getLength() )
+    if ( !aStringClassID.isEmpty() )
     {
         uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration();
         uno::Reference< container::XNameAccess > xObjectProps;
@@ -557,7 +557,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu
 {
     ::rtl::OUString aResult;
 
-    if ( aDocName.getLength() )
+    if ( !aDocName.isEmpty() )
     {
         uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration();
         if ( xObjConfig.is() )
@@ -594,10 +594,10 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu
 {
     ::rtl::OUString aResult = GetFactoryNameByStringClassID( GetExplicitlyRegisteredObjClassID( aMediaType ) );
 
-    if ( !aResult.getLength() )
+    if ( aResult.isEmpty() )
     {
         ::rtl::OUString aDocumentName = GetDocServiceNameFromMediaType( aMediaType );
-        if ( aDocumentName.getLength() )
+        if ( !aDocumentName.isEmpty() )
             aResult = GetFactoryNameByDocumentName( aDocumentName );
     }
 
@@ -615,7 +615,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu
         if ( aMediaDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FilterName" ) ) )
             aMediaDescr[nInd].Value >>= aFilterName;
 
-    if ( !aFilterName.getLength() )
+    if ( aFilterName.isEmpty() )
     {
         // filter name is not specified, so type detection should be done
 
@@ -637,7 +637,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu
             if ( aTempMD[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FilterName" ) ) )
                 aTempMD[nInd].Value >>= aFilterName;
 
-        if ( aFilterName.getLength() )
+        if ( !aFilterName.isEmpty() )
         {
             sal_Int32 nOldLen = aMediaDescr.getLength();
             aMediaDescr.realloc( nOldLen + 1 );
@@ -645,7 +645,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu
             aMediaDescr[ nOldLen ].Value <<= aFilterName;
 
         }
-        else if ( aTypeName.getLength() && !bIgnoreType )
+        else if ( !aTypeName.isEmpty() && !bIgnoreType )
         {
             uno::Reference< container::XNameAccess > xNameAccess( xTypeDetection, uno::UNO_QUERY );
             uno::Sequence< beans::PropertyValue > aTypes;
@@ -682,7 +682,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu
             break;
         }
 
-    OSL_ENSURE( aDocName.getLength(), "The name must exist at this point!\n" );
+    OSL_ENSURE( !aDocName.isEmpty(), "The name must exist at this point!\n" );
 
 
     sal_Bool bNeedsAddition = sal_True;
@@ -711,7 +711,7 @@ sal_Bool MimeConfigurationHelper::AddFilterNameCheckOwnFile(
     sal_Bool bResult = sal_False;
 
     ::rtl::OUString aFilterName = UpdateMediaDescriptorWithFilterName( aMediaDescr, sal_False );
-    if ( aFilterName.getLength() )
+    if ( !aFilterName.isEmpty() )
     {
         sal_Int32 nFlags = GetFilterFlags( aFilterName );
         // check the OWN flag
@@ -726,7 +726,7 @@ sal_Bool MimeConfigurationHelper::AddFilterNameCheckOwnFile(
 {
     rtl::OUString aResult;
 
-    if ( aServiceName.getLength() && nVersion )
+    if ( !aServiceName.isEmpty() && nVersion )
         try
         {
             uno::Reference< container::XContainerQuery > xFilterQuery(
@@ -760,7 +760,7 @@ sal_Bool MimeConfigurationHelper::AddFilterNameCheckOwnFile(
                         {
                             // if there are more than one filter the preffered one should be used
                             // if there is no preffered filter the first one will be used
-                            if ( !aResult.getLength() || ( nFlags & SFX_FILTER_PREFERED ) )
+                            if ( aResult.isEmpty() || ( nFlags & SFX_FILTER_PREFERED ) )
                                 aResult = aPropsHM.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" )),
                                                                                 ::rtl::OUString() );
                             if ( nFlags & SFX_FILTER_PREFERED )
@@ -782,7 +782,7 @@ sal_Bool MimeConfigurationHelper::AddFilterNameCheckOwnFile(
 
     try
     {
-        if ( aImportFilterName.getLength() )
+        if ( !aImportFilterName.isEmpty() )
         {
             uno::Reference< container::XNameAccess > xFilterFactory(
                 GetFilterFactory(),
@@ -811,8 +811,8 @@ sal_Bool MimeConfigurationHelper::AddFilterNameCheckOwnFile(
                     ::rtl::OUString aDocumentServiceName = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentService")), ::rtl::OUString() );
                     ::rtl::OUString aTypeName = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Type")), ::rtl::OUString() );
 
-                    OSL_ENSURE( aDocumentServiceName.getLength() && aTypeName.getLength(), "Incomplete filter data!" );
-                    if ( aDocumentServiceName.getLength() && aTypeName.getLength() )
+                    OSL_ENSURE( !aDocumentServiceName.isEmpty() && !aTypeName.isEmpty(), "Incomplete filter data!" );
+                    if ( !(aDocumentServiceName.isEmpty() || aTypeName.isEmpty()) )
                     {
                         uno::Sequence< beans::NamedValue > aSearchRequest( 2 );
                         aSearchRequest[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Type"));
diff --git a/comphelper/source/misc/numbers.cxx b/comphelper/source/misc/numbers.cxx
index 1bc3c74..b2ccad5 100644
--- a/comphelper/source/misc/numbers.cxx
+++ b/comphelper/source/misc/numbers.cxx
@@ -118,7 +118,7 @@ Any getNumberFormatProperty( const Reference< XNumberFormatter >& _rxFormatter,
 {
     Any aReturn;
 
-    OSL_ENSURE( _rxFormatter.is() && _rPropertyName.getLength(), "getNumberFormatProperty: invalid arguments!" );
+    OSL_ENSURE( _rxFormatter.is() && !_rPropertyName.isEmpty(), "getNumberFormatProperty: invalid arguments!" );
     try
     {
         Reference< XNumberFormatsSupplier > xSupplier;
diff --git a/comphelper/source/misc/regpathhelper.cxx b/comphelper/source/misc/regpathhelper.cxx
index a699585..647019e 100644
--- a/comphelper/source/misc/regpathhelper.cxx
+++ b/comphelper/source/misc/regpathhelper.cxx
@@ -107,7 +107,7 @@ static OUString getDefaultLocalRegistry()
 
     if ( bIsPortalUser )
        {
-        if(  portalUserDir.getLength() )
+        if(  !portalUserDir.isEmpty() )
         {
             FileBase::getFileURLFromSystemPath( portalUserDir , portalUserDir );
             userRegistryName = portalUserDir;
@@ -161,7 +161,7 @@ OUString getPathToUserRegistry()
 
     // search the environment STAR_USER_REGISTRY
     OString sBuffer( getenv(USER_REGISTRY_NAME_ENV) );
-    if ( sBuffer.getLength() > 0 )
+    if ( !sBuffer.isEmpty() )
     {
         f = fopen( sBuffer.getStr(), "r" );
 
@@ -172,7 +172,7 @@ OUString getPathToUserRegistry()
         }
     }
 
-    if ( !userRegistryName.getLength() )
+    if ( userRegistryName.isEmpty() )
     {
         userRegistryName = getDefaultLocalRegistry();
     }
@@ -209,7 +209,7 @@ OUString getPathToSystemRegistry()
     {
         // search the environment STAR_REGISTRY
         OString tmpStr( getenv(SYSTEM_REGISTRY_NAME_ENV) );
-        if ( tmpStr.getLength() > 0 )
+        if ( !tmpStr.isEmpty() )
         {
             f = fopen(tmpStr.getStr(), "r");
 
diff --git a/comphelper/source/misc/sequenceashashmap.cxx b/comphelper/source/misc/sequenceashashmap.cxx
index 73884c3..de2715b 100644
--- a/comphelper/source/misc/sequenceashashmap.cxx
+++ b/comphelper/source/misc/sequenceashashmap.cxx
@@ -129,7 +129,7 @@ void SequenceAsHashMap::operator<<(const css::uno::Sequence< css::uno::Any >& lS
         if (lSource[i] >>= lP)
         {
             if (
-                (!lP.Name.getLength()) ||
+                (lP.Name.isEmpty()) ||
                 (!lP.Value.hasValue())
                )
                 throw css::beans::IllegalTypeException(
@@ -143,7 +143,7 @@ void SequenceAsHashMap::operator<<(const css::uno::Sequence< css::uno::Any >& lS
         if (lSource[i] >>= lN)
         {
             if (
-                (!lN.Name.getLength()) ||
+                (lN.Name.isEmpty()) ||
                 (!lN.Value.hasValue())
                )
                 throw css::beans::IllegalTypeException(
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx
index 773ec55..c239e54 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -423,7 +423,7 @@ uno::Sequence< beans::NamedValue > OStorageHelper::CreatePackageEncryptionData(
 {
     // TODO/LATER: Should not the method be part of DocPasswordHelper?
     uno::Sequence< beans::NamedValue > aEncryptionData;
-    if ( aPassword.getLength() )
+    if ( !aPassword.isEmpty() )
     {
         sal_Int32 nSha1Ind = 0;
         // generate SHA256 start key
@@ -522,7 +522,7 @@ sal_Bool OStorageHelper::PathHasSegment( const ::rtl::OUString& aPath, const ::r
     const sal_Int32 nPathLen = aPath.getLength();
     const sal_Int32 nSegLen = aSegment.getLength();
 
-    if ( nSegLen && nPathLen >= nSegLen )
+    if ( !aSegment.isEmpty() && nPathLen >= nSegLen )
     {
         ::rtl::OUString aEndSegment( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
         aEndSegment += aSegment;
diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx
index de94afc..bc3f890 100644
--- a/comphelper/source/misc/string.cxx
+++ b/comphelper/source/misc/string.cxx
@@ -373,7 +373,7 @@ uno::Sequence< ::rtl::OUString >
       ::rtl::OUString kw =
         i_rString.getToken(0, static_cast<sal_Unicode> (','), idx);
       kw = kw.trim();
-      if (kw.getLength() > 0) {
+      if (!kw.isEmpty()) {
           vec.push_back(kw);
       }
     } while (idx >= 0);
diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
index e3712e0..ccdd7ba 100644
--- a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
+++ b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
@@ -72,7 +72,7 @@ static bool makeCanonicalFileURL( rtl::OUString & rURL )
             {
                 aNormalizedURL = aFileStatus.getFileURL();
 
-                if ( aNormalizedURL.getLength() > 0 )
+                if ( !aNormalizedURL.isEmpty() )
                 {
                     if ( aNormalizedURL
                             .getStr()[ aNormalizedURL.getLength() - 1 ]
@@ -147,7 +147,7 @@ rtl::OUString SAL_CALL
 OfficeInstallationDirectories::makeRelocatableURL( const rtl::OUString& URL )
     throw ( uno::RuntimeException )
 {
-    if ( URL.getLength() > 0 )
+    if ( !URL.isEmpty() )
     {
         initDirs();
 
@@ -183,7 +183,7 @@ rtl::OUString SAL_CALL
 OfficeInstallationDirectories::makeAbsoluteURL( const rtl::OUString& URL )
     throw ( uno::RuntimeException )
 {
-    if ( URL.getLength() > 0 )
+    if ( !URL.isEmpty() )
     {
         sal_Int32 nIndex = URL.indexOf( m_aOfficeBrandDirMacro );
         if ( nIndex != -1 )
@@ -321,7 +321,7 @@ void OfficeInstallationDirectories::initDirs()
                     xExpander->expandMacros(
                          rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "$BRAND_BASE_DIR" ) ) );
 
-                OSL_ENSURE( m_pOfficeBrandDir->getLength() > 0,
+                OSL_ENSURE( !m_pOfficeBrandDir->isEmpty(),
                             "Unable to obtain office brand installation directory!" );
 
                 makeCanonicalFileURL( *m_pOfficeBrandDir );
@@ -331,7 +331,7 @@ void OfficeInstallationDirectories::initDirs()
                         rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
                             "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE( "bootstrap" ) ":UserInstallation}" ) ) );
 
-                OSL_ENSURE( m_pUserDir->getLength() > 0,
+                OSL_ENSURE( !m_pUserDir->isEmpty(),
                             "Unable to obtain office user data directory!" );
 
                 makeCanonicalFileURL( *m_pUserDir );
diff --git a/comphelper/source/property/genericpropertyset.cxx b/comphelper/source/property/genericpropertyset.cxx
index 77eb3a5..de1b3d1 100644
--- a/comphelper/source/property/genericpropertyset.cxx
+++ b/comphelper/source/property/genericpropertyset.cxx
@@ -115,7 +115,7 @@ void SAL_CALL GenericPropertySet::addPropertyChangeListener( const ::rtl::OUStri
     Reference < XPropertySetInfo > xInfo = getPropertySetInfo(  );
     if ( xInfo.is() )
     {
-        if ( !aPropertyName.getLength() )
+        if ( aPropertyName.isEmpty() )
         {
             Sequence< Property> aSeq = xInfo->getProperties();
             const Property* pIter = aSeq.getConstArray();
@@ -139,7 +139,7 @@ void SAL_CALL GenericPropertySet::removePropertyChangeListener( const ::rtl::OUS
     aGuard.clear();
     if ( xInfo.is() )
     {
-        if ( !aPropertyName.getLength() )
+        if ( aPropertyName.isEmpty() )
         {
             Sequence< Property> aSeq = xInfo->getProperties();
             const Property* pIter = aSeq.getConstArray();
diff --git a/comphelper/source/property/propagg.cxx b/comphelper/source/property/propagg.cxx
index 2b3b6ed..be24a1d 100644
--- a/comphelper/source/property/propagg.cxx
+++ b/comphelper/source/property/propagg.cxx
@@ -513,7 +513,7 @@ void SAL_CALL OPropertySetAggregationHelper::propertiesChange(const  ::com::sun:
     if (1 == nLen)
     {
         const  ::com::sun::star::beans::PropertyChangeEvent& evt = _rEvents.getConstArray()[0];
-        OSL_ENSURE(evt.PropertyName.getLength() > 0, "OPropertySetAggregationHelper::propertiesChange : invalid event !");
+        OSL_ENSURE(!evt.PropertyName.isEmpty(), "OPropertySetAggregationHelper::propertiesChange : invalid event !");
             // we had a bug where this assertion would have us saved a whole day :) (72514)
         sal_Int32 nHandle = rPH.getHandleByName( evt.PropertyName );
 
diff --git a/comphelper/source/property/property.cxx b/comphelper/source/property/property.cxx
index 50a7f3f..9f54602 100644
--- a/comphelper/source/property/property.cxx
+++ b/comphelper/source/property/property.cxx
@@ -126,7 +126,7 @@ void copyProperties(const Reference<XPropertySet>& _rxSource,
                 aBuffer.append( "'" );
 
                 Exception aBaseException;
-                if ( ( aException >>= aBaseException ) && aBaseException.Message.getLength() )
+                if ( ( aException >>= aBaseException ) && !aBaseException.Message.isEmpty() )
                 {
                     aBuffer.append( ", saying '" );
                     aBuffer.append( ::rtl::OString( aBaseException.Message.getStr(), aBaseException.Message.getLength(), osl_getThreadTextEncoding() ) );
diff --git a/comphelper/source/property/propertybag.cxx b/comphelper/source/property/propertybag.cxx
index 432d97e..4583153 100644
--- a/comphelper/source/property/propertybag.cxx
+++ b/comphelper/source/property/propertybag.cxx
@@ -91,7 +91,7 @@ namespace comphelper
     {
         void    lcl_checkForEmptyName( const bool _allowEmpty, const ::rtl::OUString& _name )
         {
-            if ( !_allowEmpty && !_name.getLength() )
+            if ( !_allowEmpty && _name.isEmpty() )
                 throw IllegalArgumentException(
                         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The property name must not be empty." ) ),
                         // TODO: resource
diff --git a/comphelper/source/xml/ofopxmlhelper.cxx b/comphelper/source/xml/ofopxmlhelper.cxx
index 2de86b2..c1a6a01 100644
--- a/comphelper/source/xml/ofopxmlhelper.cxx
+++ b/comphelper/source/xml/ofopxmlhelper.cxx
@@ -294,7 +294,7 @@ void SAL_CALL OFOPXMLHelper::startElement( const ::rtl::OUString& aName, const u
             m_aResultSeq[nNewEntryNum-1].realloc( 4 ); // the maximal expected number of arguments is 4
 
             ::rtl::OUString aIDValue = xAttribs->getValueByName( m_aIDAttr );
-            if ( !aIDValue.getLength() )
+            if ( aIDValue.isEmpty() )
                 throw xml::sax::SAXException(); // TODO: the ID value must present
 
             ::rtl::OUString aTypeValue = xAttribs->getValueByName( m_aTypeAttr );
@@ -304,19 +304,19 @@ void SAL_CALL OFOPXMLHelper::startElement( const ::rtl::OUString& aName, const u
             m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = m_aIDAttr;
             m_aResultSeq[nNewEntryNum-1][nAttrNum - 1].Second = aIDValue;
 
-            if ( aTypeValue.getLength() )
+            if ( !aTypeValue.isEmpty() )
             {
                 m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = m_aTypeAttr;
                 m_aResultSeq[nNewEntryNum-1][nAttrNum - 1].Second = aTypeValue;
             }
 
-            if ( aTargetValue.getLength() )
+            if ( !aTargetValue.isEmpty() )
             {
                 m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = m_aTargetAttr;
                 m_aResultSeq[nNewEntryNum-1][nAttrNum - 1].Second = aTargetValue;
             }
 
-            if ( aTargetModeValue.getLength() )
+            if ( !aTargetModeValue.isEmpty() )
             {
                 m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = m_aTargetModeAttr;
                 m_aResultSeq[nNewEntryNum-1][nAttrNum - 1].Second = aTargetModeValue;
@@ -360,11 +360,11 @@ void SAL_CALL OFOPXMLHelper::startElement( const ::rtl::OUString& aName, const u
                 throw uno::RuntimeException();
 
             ::rtl::OUString aExtensionValue = xAttribs->getValueByName( m_aExtensionAttr );
-            if ( !aExtensionValue.getLength() )
+            if ( aExtensionValue.isEmpty() )
                 throw xml::sax::SAXException(); // TODO: the Extension value must present
 
             ::rtl::OUString aContentTypeValue = xAttribs->getValueByName( m_aContentTypeAttr );
-            if ( !aContentTypeValue.getLength() )
+            if ( aContentTypeValue.isEmpty() )
                 throw xml::sax::SAXException(); // TODO: the ContentType value must present
 
             sal_Int32 nNewResultLen = m_aResultSeq[0].getLength() + 1;
@@ -389,11 +389,11 @@ void SAL_CALL OFOPXMLHelper::startElement( const ::rtl::OUString& aName, const u
                 throw uno::RuntimeException();
 
             ::rtl::OUString aPartNameValue = xAttribs->getValueByName( m_aPartNameAttr );
-            if ( !aPartNameValue.getLength() )
+            if ( aPartNameValue.isEmpty() )
                 throw xml::sax::SAXException(); // TODO: the PartName value must present
 
             ::rtl::OUString aContentTypeValue = xAttribs->getValueByName( m_aContentTypeAttr );
-            if ( !aContentTypeValue.getLength() )
+            if ( aContentTypeValue.isEmpty() )
                 throw xml::sax::SAXException(); // TODO: the ContentType value must present
 
             sal_Int32 nNewResultLen = m_aResultSeq[1].getLength() + 1;
-- 
1.7.5.4


--------------020608050908090701070006--


More information about the LibreOffice mailing list