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 --- core/fpdfapi/fpdf_font/cpdf_cidfont.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'core/fpdfapi/fpdf_font') diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp index cde28fd534..194db8b25c 100644 --- a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp @@ -682,17 +682,17 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, FX_BOOL* pVertGlyph) { if (!name) { return charcode == 0 ? -1 : (int)charcode; } - uint16_t unicode = PDF_UnicodeFromAdobeName(name); - if (unicode) { + uint16_t name_unicode = PDF_UnicodeFromAdobeName(name); + if (name_unicode) { if (bMSUnicode) { - index = FXFT_Get_Char_Index(face, unicode); + index = FXFT_Get_Char_Index(face, name_unicode); } else if (bMacRoman) { uint32_t maccode = - FT_CharCodeFromUnicode(FXFT_ENCODING_APPLE_ROMAN, unicode); + FT_CharCodeFromUnicode(FXFT_ENCODING_APPLE_ROMAN, name_unicode); index = !maccode ? FXFT_Get_Name_Index(face, (char*)name) : FXFT_Get_Char_Index(face, maccode); } else { - return FXFT_Get_Char_Index(face, unicode); + return FXFT_Get_Char_Index(face, name_unicode); } } else { return charcode == 0 ? -1 : (int)charcode; @@ -815,16 +815,15 @@ void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray, if (!pObj) continue; - if (CPDF_Array* pArray = pObj->AsArray()) { + if (CPDF_Array* pObjArray = pObj->AsArray()) { if (width_status != 1) return; - for (size_t j = 0; j < pArray->GetCount(); j += nElements) { + for (size_t j = 0; j < pObjArray->GetCount(); j += nElements) { result.Add(first_code); result.Add(first_code); - for (int k = 0; k < nElements; k++) { - result.Add(pArray->GetIntegerAt(j + k)); - } + for (int k = 0; k < nElements; k++) + result.Add(pObjArray->GetIntegerAt(j + k)); first_code++; } width_status = 0; -- cgit v1.2.3