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/fgas/font/fgas_gefont.cpp | 8 ++++---- xfa/fgas/layout/fgas_rtfbreak.cpp | 3 +-- xfa/fgas/layout/fgas_textbreak.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 10 deletions(-) (limited to 'xfa/fgas') diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp index 803bede6e5..5432e527d2 100644 --- a/xfa/fgas/font/fgas_gefont.cpp +++ b/xfa/fgas/font/fgas_gefont.cpp @@ -494,11 +494,11 @@ int32_t CFX_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, CFX_WideString wsFamily; GetFamilyName(wsFamily); #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - IFX_Font* pFont = m_pFontMgr->GetDefFontByUnicode(wUnicode, GetFontStyles(), - wsFamily.c_str()); + pFont = m_pFontMgr->GetDefFontByUnicode(wUnicode, GetFontStyles(), + wsFamily.c_str()); #else - IFX_Font* pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), - wsFamily.c_str()); + pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), + wsFamily.c_str()); if (!pFont) pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), NULL); #endif diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp index dcb3c3953a..30a9c5a150 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.cpp +++ b/xfa/fgas/layout/fgas_rtfbreak.cpp @@ -1095,8 +1095,7 @@ void CFX_RTFBreak::SplitTextLine(CFX_RTFLine* pCurLine, pNextLine->m_iStart = pCurLine->m_iStart; pNextLine->m_iWidth = pCurLine->GetLineEnd() - iEndPos; pCurLine->m_iWidth = iEndPos; - CFX_RTFChar* tc = curChars.GetDataPtr(iCharPos - 1); - tc->m_nBreakType = FX_LBT_UNKNOWN; + curChars.GetDataPtr(iCharPos - 1)->m_nBreakType = FX_LBT_UNKNOWN; iCount = nextChars.GetSize(); CFX_RTFChar* pNextChars = nextChars.GetData(); for (int32_t i = 0; i < iCount; i++) { diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp index c5a1c2fdcc..d30d105253 100644 --- a/xfa/fgas/layout/fgas_textbreak.cpp +++ b/xfa/fgas/layout/fgas_textbreak.cpp @@ -1439,10 +1439,10 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, uint32_t dwLastProps = FX_GetUnicodeProperties(wLast); if ((dwLastProps & FX_CHARTYPEBITSMASK) == FX_CHARTYPE_Combination) { - CFX_Rect rtBBox; - rtBBox.Reset(); - if (pFont->GetCharBBox(wLast, rtBBox, FALSE)) { - pCharPos->m_OriginY -= fFontSize * rtBBox.height / iMaxHeight; + CFX_Rect rtBox; + rtBox.Reset(); + if (pFont->GetCharBBox(wLast, rtBox, FALSE)) { + pCharPos->m_OriginY -= fFontSize * rtBox.height / iMaxHeight; } } } -- cgit v1.2.3