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/fde/tto/fde_textout.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/fde/tto/fde_textout.cpp')
-rw-r--r-- | xfa/fde/tto/fde_textout.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp index c7d82ac0f4..1cf9226409 100644 --- a/xfa/fde/tto/fde_textout.cpp +++ b/xfa/fde/tto/fde_textout.cpp @@ -735,16 +735,14 @@ void CFDE_TextOut::DoAlignment(const CFX_RectF& rect) { FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); FX_FLOAT fLineStopS = bVertical ? rect.right() : rect.bottom(); int32_t iLines = m_ttoLines.GetSize(); - if (iLines < 1) { + if (iLines < 1) return; - } - CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(iLines - 1); - FDE_TTOPIECE* pPiece = pLine->GetPtrAt(0); - if (pPiece == NULL) { + FDE_TTOPIECE* pFirstPiece = m_ttoLines.GetPtrAt(iLines - 1)->GetPtrAt(0); + if (!pFirstPiece) return; - } + FX_FLOAT fLineStopD = - bVertical ? pPiece->rtPiece.right() : pPiece->rtPiece.bottom(); + bVertical ? pFirstPiece->rtPiece.right() : pFirstPiece->rtPiece.bottom(); FX_FLOAT fInc = fLineStopS - fLineStopD; if (m_iAlignment >= FDE_TTOALIGNMENT_CenterLeft && m_iAlignment < FDE_TTOALIGNMENT_BottomLeft) { @@ -752,19 +750,17 @@ void CFDE_TextOut::DoAlignment(const CFX_RectF& rect) { } else if (m_iAlignment < FDE_TTOALIGNMENT_CenterLeft) { fInc = 0.0f; } - if (fInc < 1.0f) { + if (fInc < 1.0f) return; - } for (int32_t i = 0; i < iLines; i++) { CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i); int32_t iPieces = pLine->GetSize(); for (int32_t j = 0; j < iPieces; j++) { FDE_TTOPIECE* pPiece = pLine->GetPtrAt(j); - if (bVertical) { + if (bVertical) pPiece->rtPiece.left += fInc; - } else { + else pPiece->rtPiece.top += fInc; - } } } } |