From 2b11dc1220746d2f6f97a940fc9e4235c8ed4975 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 22 Oct 2015 15:02:06 -0400 Subject: Merge to XFA: Add type cast definitions for CPDF_Array. This Cl adds ToArray, CPDF_Object::AsArray and CPDF_Object::IsArray and updates the src to use them as needed. BUG=pdfium:201 R=thestig@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/1417893003 . (cherry picked from commit c2bfc000e502c42c9a3017038fd9104c7997d126) Review URL: https://codereview.chromium.org/1419643005 . --- core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'core/src/fpdfapi/fpdf_font') diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp index 81ec84b2db..687e8e1d92 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -1667,14 +1667,13 @@ void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray, FX_DWORD count = pArray->GetCount(); for (FX_DWORD i = 0; i < count; i++) { CPDF_Object* pObj = pArray->GetElementValue(i); - if (pObj == NULL) { + if (!pObj) continue; - } - if (pObj->GetType() == PDFOBJ_ARRAY) { - if (width_status != 1) { + + if (CPDF_Array* pArray = pObj->AsArray()) { + if (width_status != 1) return; - } - CPDF_Array* pArray = (CPDF_Array*)pObj; + FX_DWORD count = pArray->GetCount(); for (FX_DWORD j = 0; j < count; j += nElements) { result.Add(first_code); -- cgit v1.2.3