diff options
author | weili <weili@chromium.org> | 2016-06-02 15:48:15 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-02 15:48:16 -0700 |
commit | db444d2063df6c574882d9263e885c4fe1134133 (patch) | |
tree | 27ce4a3f181ae0b5ad4eff6893016e7d49dfce0a /xfa/fxfa/parser/xfa_layout_itemlayout.cpp | |
parent | ad700c2c1fc3c3843dae71e5982f462e42efc987 (diff) | |
download | pdfium-db444d2063df6c574882d9263e885c4fe1134133.tar.xz |
Fix all the code which has duplicate variable declarations
When there are duplicate variable declarations, the inner names shadow the
outter ones. This is error prone and harder to read. Remove all the
instances found by /analyze.
BUG=chromium:613623, chromium:427616
Review-Url: https://codereview.chromium.org/2027273002
Diffstat (limited to 'xfa/fxfa/parser/xfa_layout_itemlayout.cpp')
-rw-r--r-- | xfa/fxfa/parser/xfa_layout_itemlayout.cpp | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index 7b7ecf4ba7..509bf630e9 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -154,11 +154,11 @@ FX_BOOL CXFA_ItemLayoutProcessor::FindLayoutItemSplitPos( (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling) { FX_FLOAT fChildOffset = fCurVerticalOffset + fCurTopMargin + pChildItem->m_sPos.y; - FX_BOOL bAppChange = FALSE; + FX_BOOL bChange = FALSE; if (FindLayoutItemSplitPos(pChildItem, fChildOffset, fRelSplitPos, - bAppChange, bCalculateMargin)) { + bChange, bCalculateMargin)) { if (fRelSplitPos - fChildOffset < XFA_LAYOUT_FLOAT_PERCISION && - bAppChange) { + bChange) { fProposedSplitPos = fRelSplitPos - fCurTopMargin; } else { fProposedSplitPos = fRelSplitPos + fCurBottomMargin; @@ -1922,13 +1922,13 @@ void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow( } static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem( CXFA_ItemLayoutProcessor* pThis, - CXFA_ItemLayoutProcessor*& pProcessor, + CXFA_ItemLayoutProcessor* pProcessor, FX_BOOL bContainerWidthAutoSize, FX_BOOL bContainerHeightAutoSize, FX_FLOAT fContainerHeight, XFA_ATTRIBUTEENUM eFlowStrategy, uint8_t& uCurHAlignState, - CFX_ArrayTemplate<CXFA_ContentLayoutItem*>(&rgCurLineLayoutItems)[3], + CFX_ArrayTemplate<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3], FX_BOOL bUseBreakControl, FX_FLOAT fAvailHeight, FX_FLOAT fRealHeight, @@ -2266,6 +2266,7 @@ static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem( } return XFA_ItemLayoutProcessorResult_Done; } + XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( FX_BOOL bUseBreakControl, XFA_ATTRIBUTEENUM eFlowStrategy, @@ -2445,7 +2446,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( pLayoutChild = NULL; } while (m_pCurChildNode) { - CXFA_ItemLayoutProcessor* pProcessor = NULL; + CXFA_ItemLayoutProcessor* pProcessor = nullptr; FX_BOOL bAddedItemInRow = FALSE; fContentCurRowY += XFA_ItemLayoutProcessor_InsertPendingItems(this, m_pFormNode); @@ -2477,18 +2478,16 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( XFA_ItemLayoutProcessor_AddPendingNode(this, pTrailerNode, TRUE); } else { - CXFA_ItemLayoutProcessor* pProcessor = - new CXFA_ItemLayoutProcessor(pTrailerNode, NULL); + std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( + new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); XFA_ItemLayoutProcessor_InsertFlowedItem( - this, pProcessor, bContainerWidthAutoSize, + this, pTempProcessor.get(), bContainerWidthAutoSize, bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, uCurHAlignState, rgCurLineLayoutItems, FALSE, XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, fContentWidthLimit, fContentCurRowAvailWidth, fContentCurRowHeight, bAddedItemInRow, bForceEndPage, pContext); - delete pProcessor; - pProcessor = NULL; } } XFA_ItemLayoutProcessor_GotoNextContainerNode( @@ -2507,18 +2506,16 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( bCreatePage) && m_pFormNode->GetClassID() != XFA_ELEMENT_Form) { if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { - CXFA_ItemLayoutProcessor* pProcessor = - new CXFA_ItemLayoutProcessor(pTrailerNode, NULL); + std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( + new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); XFA_ItemLayoutProcessor_InsertFlowedItem( - this, pProcessor, bContainerWidthAutoSize, + this, pTempProcessor.get(), bContainerWidthAutoSize, bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, uCurHAlignState, rgCurLineLayoutItems, FALSE, XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, fContentWidthLimit, fContentCurRowAvailWidth, fContentCurRowHeight, bAddedItemInRow, bForceEndPage, pContext); - delete pProcessor; - pProcessor = NULL; } if (!bCreatePage) { if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { @@ -2528,18 +2525,16 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( fContentCalculatedWidth, fContentCalculatedHeight, fContentCurRowY, fContentCurRowHeight, fContentWidthLimit); rgCurLineLayoutItems->RemoveAll(); - CXFA_ItemLayoutProcessor* pProcessor = - new CXFA_ItemLayoutProcessor(pLeaderNode, NULL); + std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( + new CXFA_ItemLayoutProcessor(pLeaderNode, nullptr)); XFA_ItemLayoutProcessor_InsertFlowedItem( - this, pProcessor, bContainerWidthAutoSize, + this, pTempProcessor.get(), bContainerWidthAutoSize, bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, uCurHAlignState, rgCurLineLayoutItems, FALSE, XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, fContentWidthLimit, fContentCurRowAvailWidth, fContentCurRowHeight, bAddedItemInRow, bForceEndPage, pContext); - delete pProcessor; - pProcessor = NULL; } } else { if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { @@ -2715,6 +2710,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( : (bIsManualBreak ? XFA_ItemLayoutProcessorResult_ManualBreak : XFA_ItemLayoutProcessorResult_PageFullBreak); } + FX_BOOL CXFA_ItemLayoutProcessor::CalculateRowChildPosition( CFX_ArrayTemplate<CXFA_ContentLayoutItem*>(&rgCurLineLayoutItems)[3], XFA_ATTRIBUTEENUM eFlowStrategy, |