Kaydet (Commit) 82276525 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1264391 help coverity out wrt Logically dead code

This reverts commit 95f7a016.

Change-Id: I1712553e592f1313a2591f7dae92453a4a85b7f2
üst c6a1a8e6
......@@ -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()) ||
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment