diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-01-15 20:33:12 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-01-15 20:33:16 +0000 |
commit | 7de5ffbf3de77070a2f71fa3cd0846fc2bef8052 (patch) | |
tree | d2d43b9b3000c3f201b8a53b1e859b57ef1f4a06 /sw/source | |
parent | 674436511d37fe9d777a394c2311da17b6e03c6b (diff) |
coverity#1264391 help coverity out wrt Logically dead code
also
coverity#1264392 Logically dead code
Change-Id: I37c542a6d088a2aca4cf09a341d389efd34f423a
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/doc/docdesc.cxx | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 4f3801d3ad7e..501d849857c0 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -212,12 +212,29 @@ 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 = (bFirst) - ? (bLeft) ? rDesc.GetFirstLeft() : rDesc.GetFirstMaster() - : rDesc.GetLeft(); + SwFrmFmt& rDescFrmFmt = getFrmFmt(rDesc, bLeft, bFirst); if (bFirst && bLeft) { // special case: always shared with something @@ -252,9 +269,7 @@ void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead, if (!aCnt.GetCntntIdx()) { - const SwFrmFmt& rChgedFrmFmt = (bFirst) - ? (bLeft) ? rChged.GetFirstLeft() : rChged.GetFirstMaster() - : rChged.GetLeft(); + const SwFrmFmt& rChgedFrmFmt = getConstFrmFmt(rChged, bLeft, bFirst); rDescFrmFmt.SetFmtAttr( rChgedFrmFmt.GetHeader() ); } else if ((*aRCnt.GetCntntIdx() == *aCnt.GetCntntIdx()) || @@ -292,9 +307,7 @@ 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 = (bFirst) - ? (bLeft) ? rDesc.GetFirstLeft() : rDesc.GetFirstMaster() - : rDesc.GetLeft(); + SwFrmFmt& rDescFrmFmt = getFrmFmt(rDesc, bLeft, bFirst); if (bFirst && bLeft) { // special case: always shared with something @@ -328,9 +341,7 @@ void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot, const SwFmtCntnt &aLCnt = rFmtFoot.GetFooterFmt()->GetCntnt(); if( !aLCnt.GetCntntIdx() ) { - const SwFrmFmt& rChgedFrmFmt = (bFirst) - ? (bLeft) ? rChged.GetFirstLeft() : rChged.GetFirstMaster() - : rChged.GetLeft(); + const SwFrmFmt& rChgedFrmFmt = getConstFrmFmt(rChged, bLeft, bFirst); rDescFrmFmt.SetFmtAttr( rChgedFrmFmt.GetFooter() ); } else if ((*aRCnt.GetCntntIdx() == *aLCnt.GetCntntIdx()) || |