summaryrefslogtreecommitdiff
path: root/xfa/fde
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-06-02 15:48:15 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-02 15:48:16 -0700
commitdb444d2063df6c574882d9263e885c4fe1134133 (patch)
tree27ce4a3f181ae0b5ad4eff6893016e7d49dfce0a /xfa/fde
parentad700c2c1fc3c3843dae71e5982f462e42efc987 (diff)
downloadpdfium-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')
-rw-r--r--xfa/fde/cfde_txtedtengine.cpp8
-rw-r--r--xfa/fde/cfx_wordbreak.cpp12
-rw-r--r--xfa/fde/tto/fde_textout.cpp20
3 files changed, 16 insertions, 24 deletions
diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp
index ecdaf67120..4bdf8df1c0 100644
--- a/xfa/fde/cfde_txtedtengine.cpp
+++ b/xfa/fde/cfde_txtedtengine.cpp
@@ -899,10 +899,10 @@ void CFDE_TxtEdtEngine::Inner_DeleteRange(int32_t nStart, int32_t nCount) {
int32_t nTotalCharCount = 0;
int32_t i = 0;
for (i = ParagPosBgn.nParagIndex; i <= ParagPosEnd.nParagIndex; i++) {
- CFDE_TxtEdtParag* pParag = m_ParagPtrArray[i];
- pParag->CalcLines();
- nTotalLineCount += pParag->GetLineCount();
- nTotalCharCount += pParag->GetTextLength();
+ CFDE_TxtEdtParag* pTextParag = m_ParagPtrArray[i];
+ pTextParag->CalcLines();
+ nTotalLineCount += pTextParag->GetLineCount();
+ nTotalCharCount += pTextParag->GetTextLength();
}
m_pTxtBuf->Delete(nStart, nCount);
int32_t nNextParagIndex = (ParagPosBgn.nCharIndex == 0 && bLastParag)
diff --git a/xfa/fde/cfx_wordbreak.cpp b/xfa/fde/cfx_wordbreak.cpp
index 5b220df60e..a9aa75b622 100644
--- a/xfa/fde/cfx_wordbreak.cpp
+++ b/xfa/fde/cfx_wordbreak.cpp
@@ -2859,17 +2859,14 @@ FX_BOOL CFX_WordBreak::FindNextBreakPos(IFX_CharIter* pIter,
}
if (!(bFromNext || pIter->IsEOF(bPrev))) {
pIter->Next(!bPrev);
- FX_WCHAR wcTemp = pIter->GetChar();
- ePreType = GetWordBreakProperty(wcTemp);
+ ePreType = GetWordBreakProperty(pIter->GetChar());
pIter->Next(bPrev);
}
- FX_WCHAR wcTemp = pIter->GetChar();
- eCurType = GetWordBreakProperty(wcTemp);
+ eCurType = GetWordBreakProperty(pIter->GetChar());
FX_BOOL bFirst = TRUE;
do {
pIter->Next(bPrev);
- FX_WCHAR wcTemp = pIter->GetChar();
- eNextType = GetWordBreakProperty(wcTemp);
+ eNextType = GetWordBreakProperty(pIter->GetChar());
uint16_t wBreak =
gs_FX_WordBreak_Table[eCurType] & ((uint16_t)(1 << eNextType));
if (wBreak) {
@@ -2929,8 +2926,7 @@ FX_BOOL CFX_WordBreak::FindNextBreakPos(IFX_CharIter* pIter,
}
ASSERT(nFlags <= 2);
pIter->Next(bPrev);
- wcTemp = pIter->GetChar();
- eNextType = (FX_WordBreakProp)GetWordBreakProperty(wcTemp);
+ eNextType = (FX_WordBreakProp)GetWordBreakProperty(pIter->GetChar());
if (!((nFlags == 1 && eNextType == FX_WordBreakProp_ALetter) ||
(nFlags == 2 && eNextType == FX_WordBreakProp_Numberic))) {
pIter->Next(!bPrev);
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;
- }
}
}
}