[PATCH] Replace getLength() with isEmpty() where appropriate

Christina Rossmanith ChrRossmanith at web.de
Tue Feb 21 11:57:21 PST 2012


---
 vcl/aqua/source/app/salinst.cxx         |    6 +++---
 vcl/aqua/source/app/salsys.cxx          |    4 ++--
 vcl/aqua/source/dtrans/HtmlFmtFlt.cxx   |    4 ++--
 vcl/aqua/source/dtrans/PictToBmpFlt.cxx |    4 ++--
 vcl/source/gdi/pdfwriter_impl.cxx       |    5 ++---
 vcl/source/gdi/print3.cxx               |    2 +-
 6 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx
index 7a01b0b..794dd84 100644
--- a/vcl/aqua/source/app/salinst.cxx
+++ b/vcl/aqua/source/app/salinst.cxx
@@ -997,7 +997,7 @@ rtl::OUString AquaSalInstance::GetDefaultPrinter()
     // #i113170# may not be the main thread if called from UNO API
     SalData::ensureThreadAutoreleasePool();
 
-    if( ! maDefaultPrinter.getLength() )
+    if( maDefaultPrinter.isEmpty() )
     {
         NSPrintInfo* pPI = [NSPrintInfo sharedPrintInfo];
         DBG_ASSERT( pPI, "no print info" );
@@ -1138,10 +1138,10 @@ void AquaSalInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, con
 {
     // Convert file URL for external use (see above)
     rtl::OUString externalUrl = translateToExternalUrl(rFileUrl);
-    if( 0 == externalUrl.getLength() )
+    if( externalUrl.isEmpty() )
         externalUrl = rFileUrl;
 
-    if( externalUrl.getLength() && !isDangerousUrl( externalUrl ) )
+    if( !externalUrl.isEmpty() && !isDangerousUrl( externalUrl ) )
     {
         NSString* pString = CreateNSString( externalUrl );
         NSURL* pURL = [NSURL URLWithString: pString];
diff --git a/vcl/aqua/source/app/salsys.cxx b/vcl/aqua/source/app/salsys.cxx
index 8a371d6..7c6f683 100644
--- a/vcl/aqua/source/app/salsys.cxx
+++ b/vcl/aqua/source/app/salsys.cxx
@@ -109,7 +109,7 @@ rtl::OUString AquaSalSystem::GetDisplayScreenName( unsigned int nScreen )
 static NSString* getStandardString( int nButtonId )
 {
     rtl::OUString aText( Button::GetStandardText( nButtonId ) );
-    if( ! aText.getLength() ) // this is for bad cases, we might be missing the vcl resource
+    if( aText.isEmpty() ) // this is for bad cases, we might be missing the vcl resource
     {
         switch( nButtonId )
         {
@@ -121,7 +121,7 @@ static NSString* getStandardString( int nButtonId )
         case BUTTON_NO :        aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No" ) );break;
         }
     }
-    return aText.getLength() ? CreateNSString( aText) : nil;
+    return aText.isEmpty() ? nil : CreateNSString( aText);
 }
 
 int AquaSalSystem::ShowNativeMessageBox( const rtl::OUString& rTitle,
diff --git a/vcl/aqua/source/dtrans/HtmlFmtFlt.cxx b/vcl/aqua/source/dtrans/HtmlFmtFlt.cxx
index 0bd461d..275f5a1 100644
--- a/vcl/aqua/source/dtrans/HtmlFmtFlt.cxx
+++ b/vcl/aqua/source/dtrans/HtmlFmtFlt.cxx
@@ -65,9 +65,9 @@ const std::string TAG_END_BODY = std::string("</BODY");
 
 Sequence<sal_Int8> SAL_CALL TextHtmlToHTMLFormat(Sequence<sal_Int8>& aTextHtml)
 {
-    OSL_ASSERT(aTextHtml.getLength() > 0);
+    OSL_ASSERT(!aTextHtml.isEmpty());
 
-    if (!(aTextHtml.getLength() > 0))
+    if (aTextHtml.isEmpty())
         return Sequence<sal_Int8>();
 
     // fill the buffer with dummy values to calc the exact length
diff --git a/vcl/aqua/source/dtrans/PictToBmpFlt.cxx b/vcl/aqua/source/dtrans/PictToBmpFlt.cxx
index 3eb4fb8..4b3d371 100644
--- a/vcl/aqua/source/dtrans/PictToBmpFlt.cxx
+++ b/vcl/aqua/source/dtrans/PictToBmpFlt.cxx
@@ -161,7 +161,7 @@ bool ImageToBMP( com::sun::star::uno::Sequence<sal_Int8>& aPict,
             {
                 aBmp.realloc( [pOut length] );
                 [pOut getBytes: aBmp.getArray() length: aBmp.getLength()];
-                bResult = (aBmp.getLength() != 0);
+                bResult = (!aBmp.isEmpty());
             }
         }
     }
@@ -190,7 +190,7 @@ bool BMPToImage( com::sun::star::uno::Sequence<sal_Int8>& aBmp,
             {
                 aPict.realloc( [pOut length] );
                 [pOut getBytes: aPict.getArray() length: aPict.getLength()];
-                bResult = (aPict.getLength() != 0);
+                bResult = (!aPict.isEmpty());
             }
         }
     }
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 8456d86..3820d81 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6698,11 +6698,10 @@ PDFStreamIf::~PDFStreamIf()
 
 void SAL_CALL  PDFStreamIf::writeBytes( const com::sun::star::uno::Sequence< sal_Int8 >& aData ) throw()
 {
-    if( m_bWrite )
+    if( m_bWrite && aData.getLength() )
     {
         sal_Int32 nBytes = aData.getLength();
-        if( nBytes > 0 )
-            m_pWriter->writeBuffer( aData.getConstArray(), nBytes );
+        m_pWriter->writeBuffer( aData.getConstArray(), nBytes );
     }
 }
 
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 482491d..abdece6 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -1336,7 +1336,7 @@ void PrinterController::setValue( const beans::PropertyValue& i_rValue )
 
 void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_rOptions )
 {
-    DBG_ASSERT( mpImplData->maUIOptions.getLength() == 0, "setUIOptions called twice !" );
+    DBG_ASSERT( mpImplData->maUIOptions.isEmpty(), "setUIOptions called twice !" );
 
     mpImplData->maUIOptions = i_rOptions;
 
-- 
1.7.4.1


--------------040009050600010306060800--


More information about the LibreOffice mailing list