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 /core/fpdftext/fpdf_text_int.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 'core/fpdftext/fpdf_text_int.cpp')
-rw-r--r-- | core/fpdftext/fpdf_text_int.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/core/fpdftext/fpdf_text_int.cpp b/core/fpdftext/fpdf_text_int.cpp index 136c44b5ed..1f8ab75e85 100644 --- a/core/fpdftext/fpdf_text_int.cpp +++ b/core/fpdftext/fpdf_text_int.cpp @@ -988,19 +988,16 @@ void CPDF_TextPage::ProcessTextObject( } int i = 0; for (i = count - 1; i >= 0; i--) { - PDFTEXT_Obj prev_Obj = m_LineObj.GetAt(i); - CFX_Matrix prev_matrix; - prev_Obj.m_pTextObj->GetTextMatrix(&prev_matrix); - FX_FLOAT Prev_x = prev_Obj.m_pTextObj->GetPosX(), - Prev_y = prev_Obj.m_pTextObj->GetPosY(); - prev_Obj.m_formMatrix.Transform(Prev_x, Prev_y); + PDFTEXT_Obj prev_text_obj = m_LineObj.GetAt(i); + FX_FLOAT Prev_x = prev_text_obj.m_pTextObj->GetPosX(), + Prev_y = prev_text_obj.m_pTextObj->GetPosY(); + prev_text_obj.m_formMatrix.Transform(Prev_x, Prev_y); m_DisplayMatrix.Transform(Prev_x, Prev_y); if (this_x >= Prev_x) { - if (i == count - 1) { + if (i == count - 1) m_LineObj.Add(Obj); - } else { + else m_LineObj.InsertAt(i + 1, Obj); - } break; } } @@ -1611,9 +1608,9 @@ int CPDF_TextPage::ProcessInsertObject(const CPDF_TextObject* pObj, if (re.Contains(pObj->GetPosX(), pObj->GetPosY())) { bNewline = FALSE; } else { - CFX_FloatRect re(0, pObj->m_Bottom, 1000, pObj->m_Top); - if (re.Contains(m_pPreTextObj->GetPosX(), - m_pPreTextObj->GetPosY())) { + CFX_FloatRect rect(0, pObj->m_Bottom, 1000, pObj->m_Top); + if (rect.Contains(m_pPreTextObj->GetPosX(), + m_pPreTextObj->GetPosY())) { bNewline = FALSE; } } |