Sending for review. Great weekend for everyone.

revol_
From 8586c03973534c27c6b3fee0ed6dc57125438794 Mon Sep 17 00:00:00 2001
From: Kayo Hamid <kayo.ha...@gekkolinux.com.br>
Date: Fri, 22 Apr 2011 23:40:55 -0400
Subject: [PATCH] [cppcheck] inefficient emptiness check

---
 extensions/source/bibliography/general.cxx         |    4 ++--
 .../source/languageguessing/simpleguesser.cxx      |    2 +-
 xmlsecurity/source/framework/buffernode.cxx        |    8 ++++----
 .../source/framework/saxeventkeeperimpl.cxx        |    6 +++---
 xmlsecurity/tools/demo/performance.cxx             |   16 ++++++++--------
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx
index 37c1424..9c59106 100644
--- a/extensions/source/bibliography/general.cxx
+++ b/extensions/source/bibliography/general.cxx
@@ -849,7 +849,7 @@ sal_Bool BibGeneralPage::HandleShortCutKey( const KeyEvent& rKeyEvent )
                     if( pWindow->HasChildPathFocus() )
                     {	// save focused control
                         DBG_ASSERT( nFocused == 0xFFFF, "+BibGeneralPage::HandleShortCutKey(): more than one with focus?!" );
-                        DBG_ASSERT( aMatchList.size() > 0, "+BibGeneralPage::HandleShortCutKey(): push_back and no content?!" );
+                        DBG_ASSERT( !aMatchList.empty(), "+BibGeneralPage::HandleShortCutKey(): push_back and no content?!" );
                         nFocused = aMatchList.size() - 1;
                     }
                 }
@@ -859,7 +859,7 @@ sal_Bool BibGeneralPage::HandleShortCutKey( const KeyEvent& rKeyEvent )
 
     if( bHandled )
     {
-        DBG_ASSERT( aMatchList.size() > 0, "*BibGeneralPage::HandleShortCutKey(): be prepared to crash..." );
+        DBG_ASSERT( !aMatchList.empty(), "*BibGeneralPage::HandleShortCutKey(): be prepared to crash..." );
 
         if( nFocused >= ( aMatchList.size() - 1 ) )
             // >=... includes 0xFFFF
diff --git a/lingucomponent/source/languageguessing/simpleguesser.cxx b/lingucomponent/source/languageguessing/simpleguesser.cxx
index 8bc444b..68c5331 100644
--- a/lingucomponent/source/languageguessing/simpleguesser.cxx
+++ b/lingucomponent/source/languageguessing/simpleguesser.cxx
@@ -155,7 +155,7 @@ vector<Guess> SimpleGuesser::GuessLanguage(char* text)
 Guess SimpleGuesser::GuessPrimaryLanguage(char* text)
 {
     vector<Guess> ret = GuessLanguage(text);
-    if(ret.size() > 0){
+    if(!ret.empty()){
         return GuessLanguage(text)[0];
     }
     else{
diff --git a/xmlsecurity/source/framework/buffernode.cxx b/xmlsecurity/source/framework/buffernode.cxx
index 60497bb..e6f1c63 100644
--- a/xmlsecurity/source/framework/buffernode.cxx
+++ b/xmlsecurity/source/framework/buffernode.cxx
@@ -325,7 +325,7 @@ bool BufferNode::hasAnything() const
  *	Email: michael...@sun.com
  ******************************************************************************/
 {
-    return (m_pBlocker != NULL || m_vElementCollectors.size() > 0);
+    return (m_pBlocker != NULL || !m_vElementCollectors.empty());
 }
 
 bool BufferNode::hasChildren() const
@@ -352,7 +352,7 @@ bool BufferNode::hasChildren() const
  *	Email: michael...@sun.com
  ******************************************************************************/
 {
-    return (m_vChildren.size() > 0);
+    return (!m_vChildren.empty());
 }
 
 std::vector< const BufferNode* >* BufferNode::getChildren() const
@@ -386,7 +386,7 @@ const BufferNode* BufferNode::getFirstChild() const
 {
     BufferNode* rc = NULL;
     
-    if (m_vChildren.size() > 0)
+    if (!m_vChildren.empty())
     {
         rc = (BufferNode*)m_vChildren.front();
     }
@@ -895,7 +895,7 @@ void BufferNode::elementCollectorNotify()
  *	Email: michael...@sun.com
  ******************************************************************************/
 {
-    if (m_vElementCollectors.size()>0)
+    if (!m_vElementCollectors.empty())
     {
         cssxc::sax::ElementMarkPriority nMaxPriority = cssxc::sax::ElementMarkPriority_MINIMUM;
         cssxc::sax::ElementMarkPriority nPriority;
diff --git a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
index 5a8c286..076128e 100644
--- a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
+++ b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
@@ -163,7 +163,7 @@ BufferNode* SAXEventKeeperImpl::addNewElementMarkBuffers()
 {
     BufferNode* pBufferNode = NULL;
 
-    if ( (m_vNewElementCollectors.size()>0) ||
+    if ( (!m_vNewElementCollectors.empty()) ||
          (m_pNewBlocker != NULL))
     {
         /*
@@ -204,7 +204,7 @@ BufferNode* SAXEventKeeperImpl::addNewElementMarkBuffers()
             m_pNewBlocker = NULL;
         }
         
-        if (m_vNewElementCollectors.size()>0)
+        if (!m_vNewElementCollectors.empty())
         {
             std::vector< const ElementCollector* >::const_iterator ii = m_vNewElementCollectors.begin();
             
@@ -715,7 +715,7 @@ void SAXEventKeeperImpl::releaseElementMarkBuffer()
  ******************************************************************************/
 {
     m_bIsReleasing = true;
-    while (m_vReleasedElementMarkBuffers.size()>0)
+    while (!m_vReleasedElementMarkBuffers.empty())
     {
         std::vector< sal_Int32 >::iterator pId = m_vReleasedElementMarkBuffers.begin();
         sal_Int32 nId = *pId;
diff --git a/xmlsecurity/tools/demo/performance.cxx b/xmlsecurity/tools/demo/performance.cxx
index 489d07c..c30a573 100644
--- a/xmlsecurity/tools/demo/performance.cxx
+++ b/xmlsecurity/tools/demo/performance.cxx
@@ -522,10 +522,10 @@ rtl::OUString XSecTester::parseFile(
             m_bIsBlocking = false;
             m_bIsInsideCollectedElement = false;
             
-            OSL_ASSERT(m_vSignatureList.size() == 0);
-            OSL_ASSERT(m_vUnsolvedReferenceURIs.size() == 0);
-            OSL_ASSERT(m_vUnsolvedReferenceKeeperIds.size() == 0);
-            OSL_ASSERT(m_vUnsolvedReferenceRefNums.size() == 0);
+            OSL_ASSERT(m_vSignatureList.empty());
+            OSL_ASSERT(m_vUnsolvedReferenceURIs.empty());
+            OSL_ASSERT(m_vUnsolvedReferenceKeeperIds.empty());
+            OSL_ASSERT(m_vUnsolvedReferenceRefNums.empty());
             OSL_ASSERT(m_stCurrentPath.empty());
             OSL_ASSERT(m_stCurrentPathType.empty());
             OSL_ASSERT(m_vAncestorEvents.empty());
@@ -1510,9 +1510,9 @@ void XSecTester::checkReference(
 
 void XSecTester::endMission()
 {
-    while (m_vSignatureList.size() > 0)
+    while (!m_vSignatureList.empty())
     {
-        if (m_vSignatureList.size()>0) 
+        if (!m_vSignatureList.empty())
         {
             SignatureEntity * pSignatureEntity = m_vSignatureList.at(0);
             m_vSignatureList.erase(m_vSignatureList.begin());
@@ -1521,7 +1521,7 @@ void XSecTester::endMission()
         }
     }
         
-    while (m_vUnsolvedReferenceURIs.size()>0) 
+    while (!m_vUnsolvedReferenceURIs.empty())
     {
         int nKeeperId = m_vUnsolvedReferenceKeeperIds.at(0);
         m_xSAXEventKeeper->removeElementCollector(nKeeperId);
@@ -1641,7 +1641,7 @@ void XSecTester::flushAncestorEvents(
     /* free the ancestor events list */
     std::vector< AncestorEvent* >::iterator jj;
     
-    while (m_vAncestorEvents.size()>0) 
+    while (!m_vAncestorEvents.empty())
     {
         jj = m_vAncestorEvents.begin();
         delete *jj;
-- 
1.6.4.2

From 9330c3d51cdab8c3a77a007d9fa7ad824da9ec93 Mon Sep 17 00:00:00 2001
From: Kayo Hamid <kayo.ha...@gekkolinux.com.br>
Date: Fri, 22 Apr 2011 23:41:55 -0400
Subject: [PATCH] [cppcheck] inefficient emptiness check

---
 sdext/source/minimizer/pagecollector.cxx      |    2 +-
 sdext/source/pdfimport/tree/pdfiprocessor.cxx |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sdext/source/minimizer/pagecollector.cxx b/sdext/source/minimizer/pagecollector.cxx
index ae1a639..e286737 100644
--- a/sdext/source/minimizer/pagecollector.cxx
+++ b/sdext/source/minimizer/pagecollector.cxx
@@ -96,7 +96,7 @@ void PageCollector::CollectNonCustomShowPages( const com::sun::star::uno::Refere
     {
         std::vector< Reference< XDrawPage > > vUsedPageList;
         PageCollector::CollectCustomShowPages( rxModel, rCustomShowName, vUsedPageList );
-        if ( vUsedPageList.size() )
+        if ( !vUsedPageList.empty() )
         {
             Reference< XDrawPagesSupplier > xDrawPagesSupplier( rxModel, UNO_QUERY_THROW );
             Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY_THROW );
diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
index 806f24a..217e26a 100644
--- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx
+++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
@@ -221,7 +221,7 @@ sal_Int32 PDFIProcessor::getFontId( const FontAttributes& rAttr ) const
 // line diagnose block - start
 void PDFIProcessor::processGlyphLine()
 {
-    if( m_GlyphsList.size()<1 )
+    if( m_GlyphsList.empty() )
         return;
 
     double fPreAvarageSpaceValue= 0.0;
@@ -317,7 +317,7 @@ void PDFIProcessor::processGlyphLine()
     ParagraphElement* pPara= NULL ;
     FrameElement* pFrame= NULL ;
 
-    if(m_GlyphsList.size()>0)
+    if(!m_GlyphsList.empty())
     {
         pFrame = m_pElFactory->createFrameElement( m_GlyphsList[0].getCurElement(), getGCId( getTransformGlyphContext( m_GlyphsList[0])) );
         pFrame->ZOrder = m_nNextZOrder++;
@@ -401,7 +401,7 @@ void PDFIProcessor::processGlyphLine()
 
     }
 
-    if(m_GlyphsList.size()>1)
+    if(!m_GlyphsList.empty())
      processGlyph( 0,
                   m_GlyphsList[m_GlyphsList.size()-1],
                   pPara,
-- 
1.6.4.2

From fb7bd9838209fe0c75b435c28d80e6b20c419b45 Mon Sep 17 00:00:00 2001
From: Kayo Hamid <kayo.ha...@gekkolinux.com.br>
Date: Fri, 22 Apr 2011 23:42:16 -0400
Subject: [PATCH] [cppcheck] inefficient emptiness check

---
 sw/source/core/access/accportions.cxx |    2 +-
 sw/source/core/crsr/crsrsh.cxx        |    2 +-
 sw/source/core/crsr/viscrs.cxx        |    2 +-
 sw/source/core/doc/docnum.cxx         |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx
index a8881df..bee1362 100644
--- a/sw/source/core/access/accportions.cxx
+++ b/sw/source/core/access/accportions.cxx
@@ -228,7 +228,7 @@ void SwAccessiblePortionData::LineBreak()
 void SwAccessiblePortionData::Skip(sal_uInt16 nLength)
 {
     DBG_ASSERT( !bFinished, "We are already done!" );
-    DBG_ASSERT( aModelPositions.size() == 0, "Never Skip() after portions" );
+    DBG_ASSERT( aModelPositions.empty(), "Never Skip() after portions" );
     DBG_ASSERT( nLength <= pTxtNode->GetTxt().Len(), "skip exceeds model string!" );
 
     nModelPosition += nLength;
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index c17ba08..3e48a36 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -3272,7 +3272,7 @@ void lcl_FillRecognizerData( uno::Sequence< rtl::OUString >& rSmartTagTypes,
         }
     }
 
-    if ( aSmartTagTypes.size() )
+    if ( !aSmartTagTypes.empty() )
     {
         rSmartTagTypes.realloc( aSmartTagTypes.size() );
         rStringKeyMaps.realloc( aSmartTagTypes.size() );
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 83796c3..5f4f749 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -339,7 +339,7 @@ void SwSelPaintRects::Show()
 
         if(mpCursorOverlay)
         {
-            if(aNewRanges.size())
+            if(!aNewRanges.empty())
             {
                 static_cast< sdr::overlay::OverlaySelection* >(mpCursorOverlay)->setRanges(aNewRanges);
             }
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 0e09bf6..4830eb6 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1070,7 +1070,7 @@ sal_Bool SwDoc::DelNumRule( const String& rName, sal_Bool bBroadcast )
 
                 ++aListIter;
             }
-            while ( aListsForDeletion.size() > 0 )
+            while ( !aListsForDeletion.empty() )
             {
                 SwList* pList = aListsForDeletion.back();
                 aListsForDeletion.pop_back();
-- 
1.6.4.2

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

Reply via email to