Hello all,
The attached patch is to remove warning about "inefficient checking
for emptiness" from cppcheck.
Please feel free to comment.

Best Regards,
--
Korrawit Pruegsanusak
From e9d8c0fee442f0f6e7cafe06618a340d423ba170 Mon Sep 17 00:00:00 2001
From: Korrawit Pruegsanusak <detective.conan.1...@gmail.com>
Date: Sun, 29 May 2011 11:39:15 +0700
Subject: [PATCH] cppcheck cleanliness
 Remove: (performance) Possible inefficient checking for * emptiness.
 Released under LGPLv3+/MPL

---
 sc/source/ui/vba/vbawindow.cxx     |    2 +-
 sc/source/ui/vba/vbawindows.cxx    |    2 +-
 sc/source/ui/vba/vbaworksheets.cxx |    2 +-
 sc/source/ui/view/gridwin.cxx      |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx
index 1e04b50..da051e9 100644
--- a/sc/source/ui/vba/vbawindow.cxx
+++ b/sc/source/ui/vba/vbawindow.cxx
@@ -166,7 +166,7 @@ public:
 
     virtual ::sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException) 
     { 
-        return (sheets.size() > 0);
+        return ( !sheets.empty() );
     }
 
     //XNameAccess
diff --git a/sc/source/ui/vba/vbawindows.cxx b/sc/source/ui/vba/vbawindows.cxx
index 6ff7bb1..b135895 100644
--- a/sc/source/ui/vba/vbawindows.cxx
+++ b/sc/source/ui/vba/vbawindows.cxx
@@ -178,7 +178,7 @@ public:
 
     virtual ::sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException)
     {
-        return (m_windows.size() > 0);
+        return ( !m_windows.empty() );
     }
 
     //XNameAccess
diff --git a/sc/source/ui/vba/vbaworksheets.cxx b/sc/source/ui/vba/vbaworksheets.cxx
index 2fabece..cf6ffcf 100644
--- a/sc/source/ui/vba/vbaworksheets.cxx
+++ b/sc/source/ui/vba/vbaworksheets.cxx
@@ -115,7 +115,7 @@ public:
     SheetCollectionHelper( const SheetMap& sMap ) : mSheetMap( sMap ), cachePos(mSheetMap.begin()) {}
     // XElementAccess
     virtual uno::Type SAL_CALL getElementType(  ) throw (uno::RuntimeException) { return  sheet::XSpreadsheet::static_type(0); }
-    virtual ::sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException) { return ( mSheetMap.size() > 0 ); }
+    virtual ::sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException) { return ( !mSheetMap.empty() ); }
     // XNameAcess 
     virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
     {
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 08ccbfc..fb2506d 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5277,7 +5277,7 @@ void ScGridWindow::UpdateCursorOverlay()
         }
     }
 
-    if ( aPixelRects.size() )
+    if ( !aPixelRects.empty() )
     {
         // #i70788# get the OverlayManager safely
         ::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager();
-- 
1.7.0.4

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to