From 53d3ab125ef583be8cfac907b308a6551b93067a Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 21 Oct 2015 13:08:24 -0400 Subject: Add type cast definitions for CPDF_String. This Cl adds ToString, CPDF_Object::AsString and CPDF_Object::IsString and updates the src to use them as needed. BUG=pdfium:201 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1417933002 . --- core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp') diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp index 3f0de2d416..584f9c24d3 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -906,12 +906,13 @@ FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { m_pCompMinMax[i * 2 + 1] -= m_pCompMinMax[i * 2]; } m_MaxIndex = pArray->GetInteger(2); + CPDF_Object* pTableObj = pArray->GetElementValue(3); - if (pTableObj == NULL) { + if (!pTableObj) return FALSE; - } - if (pTableObj->GetType() == PDFOBJ_STRING) { - m_Table = ((CPDF_String*)pTableObj)->GetString(); + + if (CPDF_String* pString = pTableObj->AsString()) { + m_Table = pString->GetString(); } else if (pTableObj->GetType() == PDFOBJ_STREAM) { CPDF_StreamAcc acc; acc.LoadAllData((CPDF_Stream*)pTableObj, FALSE); -- cgit v1.2.3