summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
diff options
context:
space:
mode:
authorWei Li <weili@chromium.org>2016-04-11 10:02:09 -0700
committerWei Li <weili@chromium.org>2016-04-11 10:02:09 -0700
commite1aebd43b0c75133f94f8b141b33d12e2e715524 (patch)
tree863aded8c706db162eb3f69d6482100f9d61b842 /core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
parent2d4a4fc372159ac7562abea48498b6ab72c2f321 (diff)
downloadpdfium-e1aebd43b0c75133f94f8b141b33d12e2e715524.tar.xz
Use std::vector as internal storage for CPDF_Array
Replace the usage of CFX_ArrayTemplate inside CPDF_Array, which has non-standard APIs such as GetSize() returns int. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1867183002 .
Diffstat (limited to 'core/fpdfapi/fpdf_font/cpdf_simplefont.cpp')
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_simplefont.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
index 0b4199aac0..b367184e2e 100644
--- a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
@@ -111,7 +111,6 @@ FX_BOOL CPDF_SimpleFont::LoadCommon() {
LoadFontDescriptor(pFontDesc);
}
CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths");
- int width_start = 0, width_end = -1;
m_bUseFontWidth = TRUE;
if (pWidthArray) {
m_bUseFontWidth = FALSE;
@@ -121,19 +120,15 @@ FX_BOOL CPDF_SimpleFont::LoadCommon() {
m_CharWidth[i] = MissingWidth;
}
}
- width_start = m_pFontDict->GetIntegerBy("FirstChar", 0);
- width_end = m_pFontDict->GetIntegerBy("LastChar", 0);
- if (width_start >= 0 && width_start <= 255) {
- if (width_end <= 0 ||
- width_end >= width_start + (int)pWidthArray->GetCount()) {
+ size_t width_start = m_pFontDict->GetIntegerBy("FirstChar", 0);
+ size_t width_end = m_pFontDict->GetIntegerBy("LastChar", 0);
+ if (width_start <= 255) {
+ if (width_end == 0 || width_end >= width_start + pWidthArray->GetCount())
width_end = width_start + pWidthArray->GetCount() - 1;
- }
- if (width_end > 255) {
+ if (width_end > 255)
width_end = 255;
- }
- for (int i = width_start; i <= width_end; i++) {
+ for (size_t i = width_start; i <= width_end; i++)
m_CharWidth[i] = pWidthArray->GetIntegerAt(i - width_start);
- }
}
}
if (m_pFontFile) {