[Libreoffice-commits] core.git: 2 commits - filter/source sw/source

Caolán McNamara caolanm at redhat.com
Thu Jan 15 12:48:34 PST 2015


 filter/source/graphicfilter/icgm/cgm.cxx |    2 -
 sw/source/core/doc/docdesc.cxx           |   35 ++++++++++---------------------
 2 files changed, 13 insertions(+), 24 deletions(-)

New commits:
commit 95f7a01621dd5cd62190c334fcdf02e3941fdcab
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 15 20:47:29 2015 +0000

    Revert "coverity#1264391 help coverity out wrt Logically dead code"
    
    This reverts commit 7de5ffbf3de77070a2f71fa3cd0846fc2bef8052.
    
    Change-Id: I3cf20882dc706700688cbbaea4f45bbe64d7aeca

diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 501d849..4f3801d 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -212,29 +212,12 @@ static void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest,
     rDest.SetPoolHlpFileId( rSource.GetPoolHlpFileId() );
 }
 
-namespace
-{
-    SwFrmFmt& getFrmFmt(SwPageDesc &rDesc, bool bLeft, bool bFirst)
-    {
-        if (bFirst)
-        {
-            if (bLeft)
-                return rDesc.GetFirstLeft();
-            rDesc.GetFirstMaster();
-        }
-        return rDesc.GetLeft();
-    }
-
-    const SwFrmFmt& getConstFrmFmt(const SwPageDesc &rDesc, bool bLeft, bool bFirst)
-    {
-        return getFrmFmt(const_cast<SwPageDesc&>(rDesc), bLeft, bFirst);
-    }
-}
-
 void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead, SwPageDesc &rDesc, bool bLeft, bool bFirst)
 {
     assert(bLeft || bFirst);
-    SwFrmFmt& rDescFrmFmt = getFrmFmt(rDesc, bLeft, bFirst);
+    SwFrmFmt& rDescFrmFmt = (bFirst)
+            ? (bLeft) ? rDesc.GetFirstLeft() : rDesc.GetFirstMaster()
+            : rDesc.GetLeft();
     if (bFirst && bLeft)
     {
         // special case: always shared with something
@@ -269,7 +252,9 @@ void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead,
 
             if (!aCnt.GetCntntIdx())
             {
-                const SwFrmFmt& rChgedFrmFmt = getConstFrmFmt(rChged, bLeft, bFirst);
+                const SwFrmFmt& rChgedFrmFmt = (bFirst)
+                    ? (bLeft) ? rChged.GetFirstLeft() : rChged.GetFirstMaster()
+                    : rChged.GetLeft();
                 rDescFrmFmt.SetFmtAttr( rChgedFrmFmt.GetHeader() );
             }
             else if ((*aRCnt.GetCntntIdx() == *aCnt.GetCntntIdx()) ||
@@ -307,7 +292,9 @@ void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead,
 void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot, SwPageDesc &rDesc, bool bLeft, bool bFirst)
 {
     assert(bLeft || bFirst);
-    SwFrmFmt& rDescFrmFmt = getFrmFmt(rDesc, bLeft, bFirst);
+    SwFrmFmt& rDescFrmFmt = (bFirst)
+            ? (bLeft) ? rDesc.GetFirstLeft() : rDesc.GetFirstMaster()
+            : rDesc.GetLeft();
     if (bFirst && bLeft)
     {
         // special case: always shared with something
@@ -341,7 +328,9 @@ void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot,
             const SwFmtCntnt &aLCnt = rFmtFoot.GetFooterFmt()->GetCntnt();
             if( !aLCnt.GetCntntIdx() )
             {
-                const SwFrmFmt& rChgedFrmFmt = getConstFrmFmt(rChged, bLeft, bFirst);
+                const SwFrmFmt& rChgedFrmFmt = (bFirst)
+                    ? (bLeft) ? rChged.GetFirstLeft() : rChged.GetFirstMaster()
+                    : rChged.GetLeft();
                 rDescFrmFmt.SetFmtAttr( rChgedFrmFmt.GetFooter() );
             }
             else if ((*aRCnt.GetCntntIdx() == *aLCnt.GetCntntIdx()) ||
commit aab24d24d1dde90314bc961e11681f55bcf1f5be
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 15 20:45:55 2015 +0000

    coverity#704228 'Constant' variable guards dead code
    
    Change-Id: I60446644e7700f5c119dd94d4da08bb39f5bd268

diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx
index 45ae54e..f3d370f 100644
--- a/filter/source/graphicfilter/icgm/cgm.cxx
+++ b/filter/source/graphicfilter/icgm/cgm.cxx
@@ -235,7 +235,7 @@ double CGM::ImplGetFloat( RealPrecision eRealPrecision, sal_uInt32 nRealSize )
     else // ->RP_FIXED
     {
         long    nVal;
-        int     nSwitch = ( bCompatible ) ? 0 : 1 ;
+        const int nSwitch = ( bCompatible ) ? 0 : 1 ;
         if ( nRealSize == 4 )
         {
             sal_uInt16* pShort = (sal_uInt16*)pPtr;


More information about the Libreoffice-commits mailing list