summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-01-15 20:50:50 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-01-16 10:00:45 +0000
commit82276525ada3112d566d0fbf1859788b7867af0e (patch)
tree35a1084a89afd7ace2ba31e25787fd26de0587ba
parentc6a1a8e6f8d97d24b4063909ef22824875326e28 (diff)
coverity#1264391 help coverity out wrt Logically dead code
This reverts commit 95f7a01621dd5cd62190c334fcdf02e3941fdcab. Change-Id: I1712553e592f1313a2591f7dae92453a4a85b7f2
-rw-r--r--sw/source/core/doc/docdesc.cxx35
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..d083b431a012 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();
+ return 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()) ||