summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_font
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 /core/fpdfapi/fpdf_font
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 'core/fpdfapi/fpdf_font')
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_cidfont.cpp19
1 files changed, 9 insertions, 10 deletions
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;