[Libreoffice-commits] .: sw/source

Julien Nabet serval2412 at kemper.freedesktop.org
Mon May 16 07:12:30 PDT 2011


 sw/source/core/doc/doclay.cxx               |    3 +--
 sw/source/core/doc/doctxm.cxx               |    2 +-
 sw/source/core/edit/edlingu.cxx             |    8 ++++----
 sw/source/core/frmedt/fefly1.cxx            |    2 +-
 sw/source/core/table/swnewtable.cxx         |    4 ++--
 sw/source/core/table/swtable.cxx            |   12 ++++++------
 sw/source/core/txtnode/ndtxt.cxx            |    2 +-
 sw/source/core/txtnode/txtedt.cxx           |    2 +-
 sw/source/core/unocore/unoportenum.cxx      |    8 ++++----
 sw/source/filter/ww8/WW8TableInfo.cxx       |    4 ++--
 sw/source/filter/ww8/rtfattributeoutput.cxx |    4 ++--
 11 files changed, 25 insertions(+), 26 deletions(-)

New commits:
commit 9bf2de7802f0b2242e55f183bec223d8f5205667
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Mon May 16 16:04:50 2011 +0200

    Some cppcheck cleaning

diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 15cd1b3..66a7af4 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -1884,7 +1884,7 @@ IMPL_LINK( SwDoc, DoIdleJobs, Timer *, pTimer )
         SwFldUpdateFlags nFldUpdFlag;
         std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();//swmod 080320
         std::set<SwRootFrm*>::iterator pLayIter = aAllLayouts.begin();
-        for ( ;pLayIter != aAllLayouts.end();pLayIter++ )
+        for ( ;pLayIter != aAllLayouts.end();++pLayIter )
         {
             if ((*pLayIter)->IsIdleFormat())
             {
@@ -2357,4 +2357,4 @@ std::set<SwRootFrm*> SwDoc::GetAllLayouts()
     return aAllLayouts;
 }//swmod 070825
 
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 1b6013a..c00edab 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1056,7 +1056,7 @@ sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" ));
 
     aN2L.RestoreUpperFrms( pDoc->GetNodes(), nIdx, nIdx + 1 );
     std::set<SwRootFrm*> aAllLayouts = pDoc->GetAllLayouts();
-    for ( std::set<SwRootFrm*>::iterator pLayoutIter = aAllLayouts.begin(); pLayoutIter != aAllLayouts.end(); pLayoutIter++) 
+    for ( std::set<SwRootFrm*>::iterator pLayoutIter = aAllLayouts.begin(); pLayoutIter != aAllLayouts.end(); ++pLayoutIter)
     {
         SwFrm::CheckPageDescs( (SwPageFrm*)(*pLayoutIter)->Lower() );
     }//swmod 080310
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index dcdc438..c2e5aae 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -1305,9 +1305,9 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions,
         sal_uInt32 nRedlinePortions = lcl_CountRedlines(rLastPortions);
         if((rLastPortions.size() - nRedlinePortions) == rNewPortions.size())
         {
-            OSL_ENSURE( rNewPortions.size() > 0, "rNewPortions should not be empty here" );
-            OSL_ENSURE( rLastPortions.size() > 0, "rLastPortions should not be empty here" );
-            OSL_ENSURE( rLastPositions.size() > 0, "rLastPositions should not be empty here" );
+            OSL_ENSURE( !rNewPortions.empty(), "rNewPortions should not be empty here" );
+            OSL_ENSURE( !rLastPortions.empty(), "rLastPortions should not be empty here" );
+            OSL_ENSURE( !rLastPositions.empty(), "rLastPositions should not be empty here" );
 
             //the simple case: the same number of elements on both sides
             //each changed element has to be applied to the corresponding source element
@@ -1372,7 +1372,7 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions,
         }
         else
         {
-            OSL_ENSURE( rLastPositions.size() > 0, "rLastPositions should not be empty here" );
+            OSL_ENSURE( !rLastPositions.empty(), "rLastPositions should not be empty here" );
 
             //select the complete sentence
             SpellContentPositions::const_iterator aCurrentEndPosition = rLastPositions.end();
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 2a0d76a..aec9ebb 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1983,7 +1983,7 @@ void SwFEShell::GetConnectableFrmFmts(SwFrmFmt & rFmt,
 
         ::std::vector< const SwFrmFmt * >::const_iterator aIt;
 
-        for (aIt = aTmpSpzArray.begin(); aIt != aTmpSpzArray.end(); aIt++)
+        for (aIt = aTmpSpzArray.begin(); aIt != aTmpSpzArray.end(); ++aIt)
         {
             String  aString = (*aIt)->GetName();
 
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index 9c950f9..ce1a173 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -73,7 +73,7 @@ public:
     std::vector<const SwSelBoxes*> aBoxes;
     long mnMergeWidth;
     SwBoxSelection() : mnMergeWidth(0) {}
-    bool isEmpty() const { return aBoxes.size() == 0; }
+    bool isEmpty() const { return aBoxes.empty(); }
     void insertBoxes( const SwSelBoxes* pNew ){ aBoxes.insert( aBoxes.end(), pNew ); }
 };
 
@@ -1231,7 +1231,7 @@ void lcl_SophisticatedFillLineIndices( SwLineOffsetArray &rArr,
     // in the resulting array the index has to be _on_ the line
     // nSum is to evaluate the wished value
     sal_uInt16 nSum = 1;
-    while( aBoxes.size() )
+    while( !aBoxes.empty() )
     {
         // I. step:
         // Looking for the "smallest" line end with the smallest row span
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 10cb663..ce6852d 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1131,12 +1131,12 @@ static void lcl_AdjustWidthsInLine( SwTableLine* pLine, ChangeList& rOldNew,
 static void lcl_CalcNewWidths( std::list<sal_uInt16> &rSpanPos, ChangeList& rChanges,
     SwTableLine* pLine, long nWish, long nWidth, bool bTop )
 {
-    if( !rChanges.size() )
+    if( rChanges.empty() )
     {
         rSpanPos.clear();
         return;
     }
-    if( !rSpanPos.size() )
+    if( rSpanPos.empty() )
     {
         rChanges.clear();
         return;
@@ -1332,14 +1332,14 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew,
             }
             lcl_CalcNewWidths( aRowSpanPos, aCopy, rLines[nCurr],
                 rParm.nOldWish, nOldWidth, true );
-            bool bGoOn = aRowSpanPos.size() > 0;
+            bool bGoOn = !aRowSpanPos.empty();
             sal_uInt16 j = nCurr;
             while( bGoOn )
             {
                 lcl_CalcNewWidths( aRowSpanPos, aCopy, rLines[--j],
                     rParm.nOldWish, nOldWidth, true );
                 lcl_AdjustWidthsInLine( rLines[j], aCopy, rParm, 0 );
-                bGoOn = aRowSpanPos.size() > 0 && j > 0;
+                bGoOn = !aRowSpanPos.empty() && j > 0;
             };
             aRowSpanPos.clear();
         }
@@ -1356,14 +1356,14 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew,
             }
             lcl_CalcNewWidths( aRowSpanPos, aCopy, rLines[nCurr],
                 rParm.nOldWish, nOldWidth, false );
-            bool bGoOn = aRowSpanPos.size() > 0;
+            bool bGoOn = !aRowSpanPos.empty();
             sal_uInt16 j = nCurr;
             while( bGoOn )
             {
                 lcl_CalcNewWidths( aRowSpanPos, aCopy, rLines[++j],
                     rParm.nOldWish, nOldWidth, false );
                 lcl_AdjustWidthsInLine( rLines[j], aCopy, rParm, 0 );
-                bGoOn = aRowSpanPos.size() > 0 && j+1 < rLines.Count();
+                bGoOn = !aRowSpanPos.empty() && j+1 < rLines.Count();
             };
         }
         ::lcl_AdjustWidthsInLine( rLines[nCurr], aOldNew, rParm, 1 );
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 8cd7526..a1de353 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2484,7 +2484,7 @@ SwTxtNode* SwTxtNode::_MakeNewTxtNode( const SwNodeIndex& rPos, sal_Bool bNext,
             }
         }
 
-        if ( 0 != aClearWhichIds.size() )
+        if ( !aClearWhichIds.empty() )
             bRemoveFromCache = 0 != ClearItemsFromAttrSet( aClearWhichIds );
 
         if( !bNext && bRemoveFromCache && IsInCache() )
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 29c6260..cf64526 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1730,7 +1730,7 @@ void SwTxtNode::TransliterateText(
             delete pIter;
         }
 
-        if (aChanges.size() > 0)
+        if (!aChanges.empty())
         {
             // now apply the changes from end to start to leave the offsets of the
             // yet unchanged text parts remain the same.
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 753eb11..fa62459 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -965,13 +965,13 @@ lcl_ExportBkmAndRedline(
     SwSoftPageBreakList& rBreakArr,
     const sal_uLong nIndex)
 {
-    if (rBkmArr.size())
+    if (!rBkmArr.empty())
         lcl_ExportBookmark(rPortions, xParent, pUnoCrsr, rBkmArr, nIndex);
 
-    if (rRedlineArr.size())
+    if (!rRedlineArr.empty())
         lcl_ExportRedline(rPortions, xParent, pUnoCrsr, rRedlineArr, nIndex);
 
-    if (rBreakArr.size())
+    if (!rBreakArr.empty())
         lcl_ExportSoftPageBreak(rPortions, xParent, pUnoCrsr, rBreakArr, nIndex);
 }
 
@@ -1013,7 +1013,7 @@ lcl_GetNextIndex(
         SwXBookmarkPortion_ImplSharedPtr pPtr = (*rBkmArr.begin());
         nRet = pPtr->getIndex();
     }
-    if(rRedlineArr.size())
+    if(!rRedlineArr.empty())
     {
         SwXRedlinePortion_ImplSharedPtr pPtr = (*rRedlineArr.begin());
         sal_Int32 nTmp = pPtr->getRealIndex();
diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx
index b711e56..8bbf1dd 100644
--- a/sw/source/filter/ww8/WW8TableInfo.cxx
+++ b/sw/source/filter/ww8/WW8TableInfo.cxx
@@ -486,7 +486,7 @@ WW8TableInfo * WW8TableNodeInfo::getParent() const
 
 sal_uInt32 WW8TableNodeInfo::getDepth() const
 {
-    if (mInners.size() > 0)
+    if (!mInners.empty())
         return mInners.begin()->second->getDepth();
         
     return mnDepth;
@@ -551,7 +551,7 @@ const WW8TableNodeInfoInner::Pointer_t WW8TableNodeInfo::getFirstInner() const
 {
     WW8TableNodeInfoInner::Pointer_t pResult;
     
-    if (mInners.size() > 0)
+    if (!mInners.empty())
         pResult = mInners.begin()->second;
         
     return pResult;
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index c08c704..38d6153 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -980,7 +980,7 @@ void RtfAttributeOutput::EndTableRow( )
         m_aAfterRuns.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_NESTTABLEPROPRS);
         if (m_aRowDefs.getLength() > 0)
             m_aAfterRuns.append(m_aRowDefs.makeStringAndClear());
-        else if (m_aTables.size() > 0)
+        else if (!m_aTables.empty())
         {
             m_aAfterRuns.append(m_aTables.back());
             m_aTables.pop_back();
@@ -989,7 +989,7 @@ void RtfAttributeOutput::EndTableRow( )
     }
     else
     {
-        if (m_aTables.size() > 0)
+        if (!m_aTables.empty())
         {
             m_aAfterRuns.append(m_aTables.back());
             m_aTables.pop_back();


More information about the Libreoffice-commits mailing list