From db444d2063df6c574882d9263e885c4fe1134133 Mon Sep 17 00:00:00 2001 From: weili Date: Thu, 2 Jun 2016 15:48:15 -0700 Subject: 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 --- xfa/fde/tto/fde_textout.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'xfa/fde/tto') 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; - } } } } -- cgit v1.2.3