From bd56755ba86f2d87e24a3cee5cb92aa14a81bb27 Mon Sep 17 00:00:00 2001 From: tsepez Date: Tue, 29 Mar 2016 14:51:50 -0700 Subject: Rename GetElementValue() to GetDirectObject{By,At}(). Every time I read this code, I have to make the mental substituion that "Element value" means "de-ref indirect object", so it might as well just say so. BUG= Review URL: https://codereview.chromium.org/1841173002 --- .../fpdf_edit/cpdf_pagecontentgenerator.cpp | 6 +-- core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 12 ++--- core/fpdfapi/fpdf_font/cpdf_cidfont.cpp | 6 +-- core/fpdfapi/fpdf_font/cpdf_font.cpp | 2 +- core/fpdfapi/fpdf_font/cpdf_simplefont.cpp | 2 +- core/fpdfapi/fpdf_font/cpdf_type3font.cpp | 4 +- core/fpdfapi/fpdf_page/cpdf_colorspace.cpp | 20 ++++---- core/fpdfapi/fpdf_page/cpdf_page.cpp | 2 +- core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp | 8 +-- core/fpdfapi/fpdf_page/fpdf_page_doc.cpp | 10 ++-- core/fpdfapi/fpdf_page/fpdf_page_func.cpp | 2 +- core/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 16 +++--- core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 6 +-- core/fpdfapi/fpdf_parser/cpdf_array.cpp | 10 ++-- core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp | 60 +++++++++++----------- core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp | 34 ++++++------ core/fpdfapi/fpdf_parser/cpdf_document.cpp | 8 +-- core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp | 22 ++++---- core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp | 34 ++++++------ core/fpdfapi/fpdf_parser/cpdf_parser.cpp | 30 +++++------ core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp | 2 +- core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp | 4 +- core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp | 4 +- core/fpdfapi/fpdf_parser/include/cpdf_array.h | 8 +-- core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h | 4 +- core/fpdfapi/fpdf_render/fpdf_render.cpp | 9 ++-- core/fpdfapi/fpdf_render/fpdf_render_image.cpp | 8 +-- core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 12 ++--- core/fpdfdoc/doc_action.cpp | 20 ++++---- core/fpdfdoc/doc_annot.cpp | 6 +-- core/fpdfdoc/doc_ap.cpp | 4 +- core/fpdfdoc/doc_basic.cpp | 12 ++--- core/fpdfdoc/doc_bookmark.cpp | 4 +- core/fpdfdoc/doc_form.cpp | 12 ++--- core/fpdfdoc/doc_formfield.cpp | 10 ++-- core/fpdfdoc/doc_link.cpp | 2 +- core/fpdfdoc/doc_ocg.cpp | 8 +-- core/fpdfdoc/doc_tagged.cpp | 34 ++++++------ core/fpdfdoc/doc_utils.cpp | 4 +- core/fpdftext/fpdf_text_int.cpp | 2 +- fpdfsdk/formfiller/cba_fontmap.cpp | 2 +- fpdfsdk/fpdf_ext.cpp | 2 +- fpdfsdk/fpdf_flatten.cpp | 2 +- fpdfsdk/fpdf_transformpage.cpp | 4 +- fpdfsdk/fpdfdoc.cpp | 2 +- fpdfsdk/fpdfeditpage.cpp | 26 +++++----- fpdfsdk/fpdfppo.cpp | 14 ++--- fpdfsdk/fpdfsave.cpp | 8 +-- fpdfsdk/fpdfview.cpp | 2 +- fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp | 12 ++--- fpdfsdk/fsdk_baseannot.cpp | 2 +- fpdfsdk/fsdk_baseform.cpp | 4 +- xfa/fxfa/app/xfa_ffdoc.cpp | 2 +- 53 files changed, 273 insertions(+), 272 deletions(-) diff --git a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp index 5f53afd210..6c5339128b 100644 --- a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp @@ -47,7 +47,7 @@ void CPDF_PageContentGenerator::GenerateContent() { ProcessImage(buf, pPageObj->AsImage()); } CPDF_Object* pContent = - pPageDict ? pPageDict->GetElementValue("Contents") : NULL; + pPageDict ? pPageDict->GetDirectObjectBy("Contents") : NULL; if (pContent) { pPageDict->RemoveAt("Contents"); } @@ -122,7 +122,7 @@ void CPDF_PageContentGenerator::ProcessForm(CFX_ByteTextBuf& buf, } void CPDF_PageContentGenerator::TransformContent(CFX_Matrix& matrix) { CPDF_Dictionary* pDict = m_pPage->m_pFormDict; - CPDF_Object* pContent = pDict ? pDict->GetElementValue("Contents") : NULL; + CPDF_Object* pContent = pDict ? pDict->GetDirectObjectBy("Contents") : NULL; if (!pContent) return; @@ -133,7 +133,7 @@ void CPDF_PageContentGenerator::TransformContent(CFX_Matrix& matrix) { int size = 0; int i = 0; for (i = 0; i < iCount; ++i) { - pContent = pArray->GetElement(i); + pContent = pArray->GetObjectAt(i); CPDF_Stream* pStream = ToStream(pContent); if (!pStream) continue; diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index 7dc90601c4..0f087d980a 100644 --- a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -96,7 +96,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, offset += 1; const CPDF_Array* p = pObj->AsArray(); for (uint32_t i = 0; i < p->GetCount(); i++) { - CPDF_Object* pElement = p->GetElement(i); + CPDF_Object* pElement = p->GetObjectAt(i); if (pElement->GetObjNum()) { if (pFile->AppendString(" ") < 0) { return -1; @@ -1199,7 +1199,7 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum, m_Offset += 1; const CPDF_Array* p = pObj->AsArray(); for (uint32_t i = 0; i < p->GetCount(); i++) { - CPDF_Object* pElement = p->GetElement(i); + CPDF_Object* pElement = p->GetObjectAt(i); if (pElement->GetObjNum()) { if (m_File.AppendString(" ") < 0) { return -1; @@ -1493,7 +1493,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) { m_dwFlags &= ~FPDFCREATE_INCREMENTAL; } CPDF_Dictionary* pDict = m_pDocument->GetRoot(); - m_pMetadata = pDict ? pDict->GetElementValue("Metadata") : NULL; + m_pMetadata = pDict ? pDict->GetDirectObjectBy("Metadata") : NULL; if (m_dwFlags & FPDFCREATE_OBJECTSTREAM) { m_pXRefStream = new CPDF_XRefStream; m_pXRefStream->Start(); @@ -1979,7 +1979,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault) { FX_BOOL bNewId = !m_pIDArray; if (!m_pIDArray) { m_pIDArray = new CPDF_Array; - CPDF_Object* pID1 = pOldIDArray ? pOldIDArray->GetElement(0) : NULL; + CPDF_Object* pID1 = pOldIDArray ? pOldIDArray->GetObjectAt(0) : NULL; if (pID1) { m_pIDArray->Add(pID1->Clone()); } else { @@ -1993,7 +1993,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault) { return; } if (pOldIDArray) { - CPDF_Object* pID2 = pOldIDArray->GetElement(1); + CPDF_Object* pID2 = pOldIDArray->GetObjectAt(1); if ((m_dwFlags & FPDFCREATE_INCREMENTAL) && m_pEncryptDict && pID2) { m_pIDArray->Add(pID2->Clone()); return; @@ -2004,7 +2004,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault) { m_pIDArray->Add(new CPDF_String(bsBuffer, TRUE), m_pDocument); return; } - m_pIDArray->Add(m_pIDArray->GetElement(0)->Clone()); + m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone()); if (m_pEncryptDict && !pOldIDArray && m_pParser && bNewId) { if (m_pEncryptDict->GetStringBy("Filter") == "Standard") { CPDF_StandardSecurityHandler handler; diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp index 9dd045ede9..de119b75d1 100644 --- a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp @@ -373,7 +373,7 @@ FX_BOOL CPDF_CIDFont::Load() { if (pFontDesc) { LoadFontDescriptor(pFontDesc); } - CPDF_Object* pEncoding = m_pFontDict->GetElementValue("Encoding"); + CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectBy("Encoding"); if (!pEncoding) { return FALSE; } @@ -431,7 +431,7 @@ FX_BOOL CPDF_CIDFont::Load() { } if (1) { if (m_pFontFile || (GetSubstFont()->m_SubstFlags & FXFONT_SUBST_EXACT)) { - CPDF_Object* pmap = pCIDFontDict->GetElementValue("CIDToGIDMap"); + CPDF_Object* pmap = pCIDFontDict->GetDirectObjectBy("CIDToGIDMap"); if (pmap) { if (CPDF_Stream* pStream = pmap->AsStream()) { m_pCIDToGIDMap = new CPDF_StreamAcc; @@ -820,7 +820,7 @@ void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray, int last_code = 0; uint32_t count = pArray->GetCount(); for (uint32_t i = 0; i < count; i++) { - CPDF_Object* pObj = pArray->GetElementValue(i); + CPDF_Object* pObj = pArray->GetDirectObjectAt(i); if (!pObj) continue; diff --git a/core/fpdfapi/fpdf_font/cpdf_font.cpp b/core/fpdfapi/fpdf_font/cpdf_font.cpp index c52ce8ff93..fd6a9c9814 100644 --- a/core/fpdfapi/fpdf_font/cpdf_font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_font.cpp @@ -452,7 +452,7 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding, pCharNames = new CFX_ByteString[256]; uint32_t cur_code = 0; for (uint32_t i = 0; i < pDiffs->GetCount(); i++) { - CPDF_Object* pElement = pDiffs->GetElementValue(i); + CPDF_Object* pElement = pDiffs->GetDirectObjectAt(i); if (!pElement) continue; diff --git a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp index baac366e2a..53bbd93d6c 100644 --- a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp @@ -146,7 +146,7 @@ FX_BOOL CPDF_SimpleFont::LoadCommon() { if (!(m_Flags & PDFFONT_SYMBOLIC)) { m_BaseEncoding = PDFFONT_ENCODING_STANDARD; } - CPDF_Object* pEncoding = m_pFontDict->GetElementValue("Encoding"); + CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectBy("Encoding"); LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, m_pFontFile != NULL, m_Font.IsTTFont()); LoadGlyphMap(); diff --git a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp index 8591b87be4..9f37d4adee 100644 --- a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp @@ -70,7 +70,7 @@ FX_BOOL CPDF_Type3Font::Load() { } } m_pCharProcs = m_pFontDict->GetDictBy("CharProcs"); - CPDF_Object* pEncoding = m_pFontDict->GetElementValue("Encoding"); + CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectBy("Encoding"); if (pEncoding) { LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, FALSE, FALSE); if (m_pCharNames) { @@ -103,7 +103,7 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode, int level) { return nullptr; CPDF_Stream* pStream = - ToStream(m_pCharProcs ? m_pCharProcs->GetElementValue(name) : nullptr); + ToStream(m_pCharProcs ? m_pCharProcs->GetDirectObjectBy(name) : nullptr); if (!pStream) return nullptr; diff --git a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp index 213d777ecb..c5aa5e3905 100644 --- a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp @@ -355,7 +355,7 @@ CPDF_ColorSpace* CPDF_ColorSpace::Load(CPDF_Document* pDoc, CPDF_Object* pObj) { if (!pArray || pArray->GetCount() == 0) return nullptr; - CPDF_Object* pFamilyObj = pArray->GetElementValue(0); + CPDF_Object* pFamilyObj = pArray->GetDirectObjectAt(0); if (!pFamilyObj) return nullptr; @@ -802,7 +802,7 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { CPDF_Dictionary* pDict = pStream->GetDict(); if (!m_pProfile->m_pTransform) { // No valid ICC profile or using sRGB CPDF_Object* pAlterCSObj = - pDict ? pDict->GetElementValue("Alternate") : nullptr; + pDict ? pDict->GetDirectObjectBy("Alternate") : nullptr; if (pAlterCSObj) { CPDF_ColorSpace* pAlterCS = CPDF_ColorSpace::Load(pDoc, pAlterCSObj); if (pAlterCS) { @@ -978,7 +978,7 @@ FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { if (pArray->GetCount() < 4) { return FALSE; } - CPDF_Object* pBaseObj = pArray->GetElementValue(1); + CPDF_Object* pBaseObj = pArray->GetDirectObjectAt(1); if (pBaseObj == m_pArray) { return FALSE; } @@ -998,7 +998,7 @@ FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { } m_MaxIndex = pArray->GetIntegerAt(2); - CPDF_Object* pTableObj = pArray->GetElementValue(3); + CPDF_Object* pTableObj = pArray->GetDirectObjectAt(3); if (!pTableObj) return FALSE; @@ -1062,7 +1062,7 @@ CPDF_PatternCS::~CPDF_PatternCS() { } FX_BOOL CPDF_PatternCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { - CPDF_Object* pBaseCS = pArray->GetElementValue(1); + CPDF_Object* pBaseCS = pArray->GetDirectObjectAt(1); if (pBaseCS == m_pArray) { return FALSE; } @@ -1129,7 +1129,7 @@ FX_BOOL CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { m_Type = None; } else { m_Type = Colorant; - CPDF_Object* pAltCS = pArray->GetElementValue(2); + CPDF_Object* pAltCS = pArray->GetDirectObjectAt(2); if (pAltCS == m_pArray) { return FALSE; } @@ -1137,7 +1137,7 @@ FX_BOOL CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { if (!m_pAltCS) { return FALSE; } - CPDF_Object* pFuncObj = pArray->GetElementValue(3); + CPDF_Object* pFuncObj = pArray->GetDirectObjectAt(3); if (pFuncObj && !pFuncObj->IsName()) m_pFunc = CPDF_Function::Load(pFuncObj); @@ -1209,17 +1209,17 @@ void CPDF_DeviceNCS::GetDefaultValue(int iComponent, } FX_BOOL CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { - CPDF_Array* pObj = ToArray(pArray->GetElementValue(1)); + CPDF_Array* pObj = ToArray(pArray->GetDirectObjectAt(1)); if (!pObj) return FALSE; m_nComponents = pObj->GetCount(); - CPDF_Object* pAltCS = pArray->GetElementValue(2); + CPDF_Object* pAltCS = pArray->GetDirectObjectAt(2); if (!pAltCS || pAltCS == m_pArray) { return FALSE; } m_pAltCS = Load(pDoc, pAltCS); - m_pFunc = CPDF_Function::Load(pArray->GetElementValue(3)); + m_pFunc = CPDF_Function::Load(pArray->GetDirectObjectAt(3)); if (!m_pAltCS || !m_pFunc) { return FALSE; } diff --git a/core/fpdfapi/fpdf_page/cpdf_page.cpp b/core/fpdfapi/fpdf_page/cpdf_page.cpp index 6fd9b0a9b3..dd298f382f 100644 --- a/core/fpdfapi/fpdf_page/cpdf_page.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_page.cpp @@ -18,7 +18,7 @@ CPDF_Object* FPDFAPI_GetPageAttr(CPDF_Dictionary* pPageDict, const CFX_ByteStringC& name) { int level = 0; while (1) { - CPDF_Object* pObj = pPageDict->GetElementValue(name); + CPDF_Object* pObj = pPageDict->GetDirectObjectBy(name); if (pObj) { return pObj; } diff --git a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp index 6ccf1403f9..4ca9acbea7 100644 --- a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp @@ -39,7 +39,7 @@ CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc, if (!bShading) { CPDF_Dictionary* pDict = m_pPatternObj->GetDict(); m_Pattern2Form = pDict->GetMatrixBy("Matrix"); - m_pShadingObj = pDict->GetElementValue("Shading"); + m_pShadingObj = pDict->GetDirectObjectBy("Shading"); if (parentMatrix) m_Pattern2Form.Concat(*parentMatrix); } @@ -70,19 +70,19 @@ FX_BOOL CPDF_ShadingPattern::Load() { delete m_pFunctions[i]; m_nFuncs = 0; } - CPDF_Object* pFunc = pShadingDict->GetElementValue("Function"); + CPDF_Object* pFunc = pShadingDict->GetDirectObjectBy("Function"); if (pFunc) { if (CPDF_Array* pArray = pFunc->AsArray()) { m_nFuncs = std::min(pArray->GetCount(), 4); for (int i = 0; i < m_nFuncs; i++) - m_pFunctions[i] = CPDF_Function::Load(pArray->GetElementValue(i)); + m_pFunctions[i] = CPDF_Function::Load(pArray->GetDirectObjectAt(i)); } else { m_pFunctions[0] = CPDF_Function::Load(pFunc); m_nFuncs = 1; } } - CPDF_Object* pCSObj = pShadingDict->GetElementValue("ColorSpace"); + CPDF_Object* pCSObj = pShadingDict->GetDirectObjectBy("ColorSpace"); if (!pCSObj) return FALSE; diff --git a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp index d762e1aa53..9f4ad5a7d5 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp @@ -331,7 +331,7 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace( if (!pCS && pResources) { CPDF_Dictionary* pList = pResources->GetDictBy("ColorSpace"); if (pList) { - pCSObj = pList->GetElementValue(name); + pCSObj = pList->GetDirectObjectBy(name); return GetColorSpace(pCSObj, nullptr); } } @@ -345,13 +345,13 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace( CPDF_Object* pDefaultCS = nullptr; switch (pCS->GetFamily()) { case PDFCS_DEVICERGB: - pDefaultCS = pColorSpaces->GetElementValue("DefaultRGB"); + pDefaultCS = pColorSpaces->GetDirectObjectBy("DefaultRGB"); break; case PDFCS_DEVICEGRAY: - pDefaultCS = pColorSpaces->GetElementValue("DefaultGray"); + pDefaultCS = pColorSpaces->GetDirectObjectBy("DefaultGray"); break; case PDFCS_DEVICECMYK: - pDefaultCS = pColorSpaces->GetElementValue("DefaultCMYK"); + pDefaultCS = pColorSpaces->GetDirectObjectBy("DefaultCMYK"); break; } return pDefaultCS ? GetColorSpace(pDefaultCS, nullptr) : pCS; @@ -361,7 +361,7 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace( if (!pArray || pArray->GetCount() == 0) return nullptr; if (pArray->GetCount() == 1) - return GetColorSpace(pArray->GetElementValue(0), pResources); + return GetColorSpace(pArray->GetDirectObjectAt(0), pResources); CPDF_CountedColorSpace* csData = nullptr; auto it = m_ColorSpaceMap.find(pCSObj); diff --git a/core/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/fpdfapi/fpdf_page/fpdf_page_func.cpp index 0fa2dd7712..7d396ed032 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -776,7 +776,7 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) { } m_nOutputs = 0; for (uint32_t i = 0; i < nSubs; i++) { - CPDF_Object* pSub = pArray->GetElementValue(i); + CPDF_Object* pSub = pArray->GetDirectObjectAt(i); if (pSub == pObj) { return FALSE; } diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 75b745222f..32517d6b54 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -584,7 +584,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() { PDF_ReplaceAbbr(pDict); CPDF_Object* pCSObj = NULL; if (pDict->KeyExist("ColorSpace")) { - pCSObj = pDict->GetElementValue("ColorSpace"); + pCSObj = pDict->GetDirectObjectBy("ColorSpace"); if (pCSObj->IsName()) { CFX_ByteString name = pCSObj->GetString(); if (name != "DeviceRGB" && name != "DeviceGray" && name != "DeviceCMYK") { @@ -731,7 +731,7 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() { pList = m_pPageResources->GetDictBy("XObject"); if (!pList) return; - CPDF_Reference* pRes = ToReference(pList->GetElement(name)); + CPDF_Reference* pRes = ToReference(pList->GetObjectBy(name)); if (!pRes) return; @@ -1268,7 +1268,7 @@ CPDF_Object* CPDF_StreamContentParser::FindResourceObj( if (!pList) { return NULL; } - CPDF_Object* pRes = pList->GetElementValue(name); + CPDF_Object* pRes = pList->GetDirectObjectBy(name); return pRes; } CPDF_Dictionary* pList = m_pResources->GetDictBy(type); @@ -1280,10 +1280,10 @@ CPDF_Object* CPDF_StreamContentParser::FindResourceObj( if (!pList) { return NULL; } - CPDF_Object* pRes = pList->GetElementValue(name); + CPDF_Object* pRes = pList->GetDirectObjectBy(name); return pRes; } - CPDF_Object* pRes = pList->GetElementValue(name); + CPDF_Object* pRes = pList->GetDirectObjectBy(name); return pRes; } @@ -1432,7 +1432,7 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() { int n = pArray->GetCount(); int nsegs = 0; for (int i = 0; i < n; i++) { - if (pArray->GetElementValue(i)->IsString()) + if (pArray->GetDirectObjectAt(i)->IsString()) nsegs++; } if (nsegs == 0) { @@ -1448,7 +1448,7 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() { int iSegment = 0; FX_FLOAT fInitKerning = 0; for (int i = 0; i < n; i++) { - CPDF_Object* pObj = pArray->GetElementValue(i); + CPDF_Object* pObj = pArray->GetDirectObjectAt(i); if (pObj->IsString()) { CFX_ByteString str = pObj->GetString(); if (str.IsEmpty()) { @@ -1811,7 +1811,7 @@ void PDF_ReplaceAbbr(CPDF_Object* pObj) { case CPDF_Object::ARRAY: { CPDF_Array* pArray = pObj->AsArray(); for (uint32_t i = 0; i < pArray->GetCount(); i++) { - CPDF_Object* pElement = pArray->GetElement(i); + CPDF_Object* pElement = pArray->GetObjectAt(i); if (pElement->IsName()) { CFX_ByteString name = pElement->GetString(); CFX_ByteStringC fullname = PDF_FindFullName( diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index 8bff5445ff..a5db2d6d20 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -134,7 +134,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CFX_ByteString Decoder; CPDF_Dictionary* pParam = nullptr; - CPDF_Object* pFilter = pDict->GetElementValue("Filter"); + CPDF_Object* pFilter = pDict->GetDirectObjectBy("Filter"); if (pFilter) { if (CPDF_Array* pArray = pFilter->AsArray()) { Decoder = pArray->GetStringAt(0); @@ -712,7 +712,7 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions) { m_InternalStage = STAGE_GETCONTENT; m_CurrentOffset = 0; - CPDF_Object* pContent = pPage->m_pFormDict->GetElementValue("Contents"); + CPDF_Object* pContent = pPage->m_pFormDict->GetDirectObjectBy("Contents"); if (!pContent) { m_Status = Done; return; @@ -826,7 +826,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) { m_pObjectHolder->m_pFormDict->GetArrayBy("Contents"); m_StreamArray[m_CurrentOffset].reset(new CPDF_StreamAcc); CPDF_Stream* pStreamObj = ToStream( - pContent ? pContent->GetElementValue(m_CurrentOffset) : nullptr); + pContent ? pContent->GetDirectObjectAt(m_CurrentOffset) : nullptr); m_StreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, FALSE); m_CurrentOffset++; } diff --git a/core/fpdfapi/fpdf_parser/cpdf_array.cpp b/core/fpdfapi/fpdf_parser/cpdf_array.cpp index 544469916b..7ea2734745 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_array.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_array.cpp @@ -76,13 +76,13 @@ CFX_Matrix CPDF_Array::GetMatrix() { return matrix; } -CPDF_Object* CPDF_Array::GetElement(uint32_t i) const { +CPDF_Object* CPDF_Array::GetObjectAt(uint32_t i) const { if (i >= (uint32_t)m_Objects.GetSize()) return nullptr; return m_Objects.GetAt(i); } -CPDF_Object* CPDF_Array::GetElementValue(uint32_t i) const { +CPDF_Object* CPDF_Array::GetDirectObjectAt(uint32_t i) const { if (i >= (uint32_t)m_Objects.GetSize()) return nullptr; return m_Objects.GetAt(i)->GetDirect(); @@ -113,7 +113,7 @@ FX_FLOAT CPDF_Array::GetNumberAt(uint32_t i) const { } CPDF_Dictionary* CPDF_Array::GetDictAt(uint32_t i) const { - CPDF_Object* p = GetElementValue(i); + CPDF_Object* p = GetDirectObjectAt(i); if (!p) return NULL; if (CPDF_Dictionary* pDict = p->AsDictionary()) @@ -124,11 +124,11 @@ CPDF_Dictionary* CPDF_Array::GetDictAt(uint32_t i) const { } CPDF_Stream* CPDF_Array::GetStreamAt(uint32_t i) const { - return ToStream(GetElementValue(i)); + return ToStream(GetDirectObjectAt(i)); } CPDF_Array* CPDF_Array::GetArrayAt(uint32_t i) const { - return ToArray(GetElementValue(i)); + return ToArray(GetDirectObjectAt(i)); } void CPDF_Array::RemoveAt(uint32_t i, int nCount) { diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp index 858133d58e..a4b85a34fa 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp @@ -153,7 +153,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail( case CPDF_Object::ARRAY: { CPDF_Array* pArray = pObj->GetArray(); for (uint32_t k = 0; k < pArray->GetCount(); ++k) - new_obj_array.Add(pArray->GetElement(k)); + new_obj_array.Add(pArray->GetObjectAt(k)); } break; case CPDF_Object::STREAM: pObj = pObj->GetDict(); @@ -451,7 +451,7 @@ FX_BOOL CPDF_DataAvail::CheckRoot(IPDF_DataAvail::DownloadHints* pHints) { return FALSE; } - CPDF_Reference* pRef = ToReference(pDict->GetElement("Pages")); + CPDF_Reference* pRef = ToReference(pDict->GetObjectBy("Pages")); if (!pRef) { m_docStatus = PDF_DATAAVAIL_ERROR; return FALSE; @@ -459,7 +459,7 @@ FX_BOOL CPDF_DataAvail::CheckRoot(IPDF_DataAvail::DownloadHints* pHints) { m_PagesObjNum = pRef->GetRefObjNum(); CPDF_Reference* pAcroFormRef = - ToReference(m_pRoot->GetDict()->GetElement("AcroForm")); + ToReference(m_pRoot->GetDict()->GetObjectBy("AcroForm")); if (pAcroFormRef) { m_bHaveAcroForm = TRUE; m_dwAcroFormObjNum = pAcroFormRef->GetRefObjNum(); @@ -477,7 +477,7 @@ FX_BOOL CPDF_DataAvail::CheckRoot(IPDF_DataAvail::DownloadHints* pHints) { FX_BOOL CPDF_DataAvail::PreparePageItem() { CPDF_Dictionary* pRoot = m_pDocument->GetRoot(); CPDF_Reference* pRef = - ToReference(pRoot ? pRoot->GetElement("Pages") : nullptr); + ToReference(pRoot ? pRoot->GetObjectBy("Pages") : nullptr); if (!pRef) { m_docStatus = PDF_DATAAVAIL_ERROR; return FALSE; @@ -515,7 +515,7 @@ FX_BOOL CPDF_DataAvail::CheckPage(IPDF_DataAvail::DownloadHints* pHints) { if (pArray) { int32_t iSize = pArray->GetCount(); for (int32_t j = 0; j < iSize; ++j) { - if (CPDF_Reference* pRef = ToReference(pArray->GetElement(j))) + if (CPDF_Reference* pRef = ToReference(pArray->GetObjectAt(j))) UnavailObjList.Add(pRef->GetRefObjNum()); } } @@ -573,7 +573,7 @@ FX_BOOL CPDF_DataAvail::GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages) { } CPDF_Dictionary* pDict = pPages->GetDict(); - CPDF_Object* pKids = pDict ? pDict->GetElement("Kids") : NULL; + CPDF_Object* pKids = pDict ? pDict->GetObjectBy("Kids") : NULL; if (!pKids) return TRUE; @@ -584,7 +584,7 @@ FX_BOOL CPDF_DataAvail::GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages) { case CPDF_Object::ARRAY: { CPDF_Array* pKidsArray = pKids->AsArray(); for (uint32_t i = 0; i < pKidsArray->GetCount(); ++i) { - if (CPDF_Reference* pRef = ToReference(pKidsArray->GetElement(i))) + if (CPDF_Reference* pRef = ToReference(pKidsArray->GetObjectAt(i))) m_PageObjList.Add(pRef->GetRefObjNum()); } } break; @@ -647,19 +647,19 @@ FX_BOOL CPDF_DataAvail::CheckHeader(IPDF_DataAvail::DownloadHints* pHints) { FX_BOOL CPDF_DataAvail::CheckFirstPage(IPDF_DataAvail::DownloadHints* pHints) { CPDF_Dictionary* pDict = m_pLinearized->GetDict(); - CPDF_Object* pEndOffSet = pDict ? pDict->GetElement("E") : NULL; + CPDF_Object* pEndOffSet = pDict ? pDict->GetObjectBy("E") : NULL; if (!pEndOffSet) { m_docStatus = PDF_DATAAVAIL_ERROR; return FALSE; } - CPDF_Object* pXRefOffset = pDict ? pDict->GetElement("T") : NULL; + CPDF_Object* pXRefOffset = pDict ? pDict->GetObjectBy("T") : NULL; if (!pXRefOffset) { m_docStatus = PDF_DATAAVAIL_ERROR; return FALSE; } - CPDF_Object* pFileLen = pDict ? pDict->GetElement("L") : NULL; + CPDF_Object* pFileLen = pDict ? pDict->GetObjectBy("L") : NULL; if (!pFileLen) { m_docStatus = PDF_DATAAVAIL_ERROR; return FALSE; @@ -746,7 +746,7 @@ FX_BOOL CPDF_DataAvail::CheckHintTables(IPDF_DataAvail::DownloadHints* pHints) { return FALSE; } - int nPageCount = pDict->GetElementValue("N")->GetInteger(); + int nPageCount = pDict->GetDirectObjectBy("N")->GetInteger(); if (nPageCount <= 1) { m_docStatus = PDF_DATAAVAIL_DONE; return TRUE; @@ -754,12 +754,12 @@ FX_BOOL CPDF_DataAvail::CheckHintTables(IPDF_DataAvail::DownloadHints* pHints) { CPDF_Array* pHintStreamRange = pDict->GetArrayBy("H"); FX_FILESIZE szHSStart = - pHintStreamRange->GetElementValue(0) - ? pHintStreamRange->GetElementValue(0)->GetInteger() + pHintStreamRange->GetDirectObjectAt(0) + ? pHintStreamRange->GetDirectObjectAt(0)->GetInteger() : 0; FX_FILESIZE szHSLength = - pHintStreamRange->GetElementValue(1) - ? pHintStreamRange->GetElementValue(1)->GetInteger() + pHintStreamRange->GetDirectObjectAt(1) + ? pHintStreamRange->GetDirectObjectAt(1)->GetInteger() : 0; if (szHSStart < 0 || szHSLength <= 0) { m_docStatus = PDF_DATAAVAIL_ERROR; @@ -864,8 +864,8 @@ FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) { return FALSE; CPDF_Dictionary* pDict = m_pLinearized->GetDict(); - if (pDict && pDict->GetElement("Linearized")) { - CPDF_Object* pLen = pDict->GetElement("L"); + if (pDict && pDict->GetObjectBy("Linearized")) { + CPDF_Object* pLen = pDict->GetObjectBy("L"); if (!pLen) return FALSE; @@ -874,7 +874,7 @@ FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) { m_bLinearized = TRUE; - if (CPDF_Number* pNo = ToNumber(pDict->GetElement("P"))) + if (CPDF_Number* pNo = ToNumber(pDict->GetObjectBy("P"))) m_dwFirstPageNo = pNo->GetInteger(); return TRUE; @@ -954,7 +954,7 @@ int32_t CPDF_DataAvail::CheckCrossRefStream( } CPDF_Dictionary* pDict = pObj->GetDict(); - CPDF_Name* pName = ToName(pDict ? pDict->GetElement("Type") : nullptr); + CPDF_Name* pName = ToName(pDict ? pDict->GetObjectBy("Type") : nullptr); if (pName) { if (pName->GetString() == "XRef") { m_Pos += m_parser.m_pSyntax->SavePos(); @@ -1204,7 +1204,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IPDF_DataAvail::DownloadHints* pHints) { return FALSE; CPDF_Dictionary* pTrailerDict = pTrailer->GetDict(); - CPDF_Object* pEncrypt = pTrailerDict->GetElement("Encrypt"); + CPDF_Object* pEncrypt = pTrailerDict->GetObjectBy("Encrypt"); if (ToReference(pEncrypt)) { m_docStatus = PDF_DATAAVAIL_LOADALLFILE; return TRUE; @@ -1286,7 +1286,7 @@ FX_BOOL CPDF_DataAvail::CheckArrayPageNode( pPageNode->m_type = PDF_PAGENODE_PAGES; for (uint32_t i = 0; i < pArray->GetCount(); ++i) { - CPDF_Reference* pKid = ToReference(pArray->GetElement(i)); + CPDF_Reference* pKid = ToReference(pArray->GetObjectAt(i)); if (!pKid) continue; @@ -1333,7 +1333,7 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode( CFX_ByteString type = pDict->GetStringBy("Type"); if (type == "Pages") { pPageNode->m_type = PDF_PAGENODE_PAGES; - CPDF_Object* pKids = pDict->GetElement("Kids"); + CPDF_Object* pKids = pDict->GetObjectBy("Kids"); if (!pKids) { m_docStatus = PDF_DATAAVAIL_PAGE; return TRUE; @@ -1349,7 +1349,7 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode( case CPDF_Object::ARRAY: { CPDF_Array* pKidsArray = pKids->AsArray(); for (uint32_t i = 0; i < pKidsArray->GetCount(); ++i) { - CPDF_Reference* pKid = ToReference(pKidsArray->GetElement(i)); + CPDF_Reference* pKid = ToReference(pKidsArray->GetObjectAt(i)); if (!pKid) continue; @@ -1544,7 +1544,7 @@ FX_BOOL CPDF_DataAvail::CheckPageAnnots(int32_t iPage, if (!pPageDict) return TRUE; - CPDF_Object* pAnnots = pPageDict->GetElement("Annots"); + CPDF_Object* pAnnots = pPageDict->GetObjectBy("Annots"); if (!pAnnots) return TRUE; @@ -1587,7 +1587,7 @@ FX_BOOL CPDF_DataAvail::HaveResourceAncestor(CPDF_Dictionary* pDict) { if (++s_CurrentDataAvailRecursionDepth > kMaxDataAvailRecursionDepth) return FALSE; - CPDF_Object* pParent = pDict->GetElement("Parent"); + CPDF_Object* pParent = pDict->GetObjectBy("Parent"); if (!pParent) return FALSE; @@ -1595,7 +1595,7 @@ FX_BOOL CPDF_DataAvail::HaveResourceAncestor(CPDF_Dictionary* pDict) { if (!pParentDict) return FALSE; - CPDF_Object* pRet = pParentDict->GetElement("Resources"); + CPDF_Object* pRet = pParentDict->GetObjectBy("Resources"); if (pRet) { m_pPageResource = pRet; return TRUE; @@ -1709,7 +1709,7 @@ IPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail( } if (m_pPageDict && !m_bNeedDownLoadResource) { - m_pPageResource = m_pPageDict->GetElement("Resources"); + m_pPageResource = m_pPageDict->GetObjectBy("Resources"); if (!m_pPageResource) m_bNeedDownLoadResource = HaveResourceAncestor(m_pPageDict); else @@ -1763,7 +1763,7 @@ void CPDF_DataAvail::GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, int CPDF_DataAvail::GetPageCount() const { if (m_pLinearized) { CPDF_Dictionary* pDict = m_pLinearized->GetDict(); - CPDF_Object* pObj = pDict ? pDict->GetElementValue("N") : nullptr; + CPDF_Object* pObj = pDict ? pDict->GetDirectObjectBy("N") : nullptr; return pObj ? pObj->GetInteger() : 0; } return m_pDocument ? m_pDocument->GetPageCount() : 0; @@ -1775,7 +1775,7 @@ CPDF_Dictionary* CPDF_DataAvail::GetPage(int index) { if (m_pLinearized) { CPDF_Dictionary* pDict = m_pLinearized->GetDict(); - CPDF_Object* pObj = pDict ? pDict->GetElementValue("P") : nullptr; + CPDF_Object* pObj = pDict ? pDict->GetDirectObjectBy("P") : nullptr; int pageNum = pObj ? pObj->GetInteger() : 0; if (m_pHintTables && index != pageNum) { @@ -1810,7 +1810,7 @@ IPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail( if (!pRoot) return FormAvailable; - CPDF_Object* pAcroForm = pRoot->GetElement("AcroForm"); + CPDF_Object* pAcroForm = pRoot->GetObjectBy("AcroForm"); if (!pAcroForm) return FormNotExist; diff --git a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp index 75730e5754..5f86a7bbc2 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp @@ -51,32 +51,32 @@ CPDF_Object* CPDF_Dictionary::Clone(FX_BOOL bDirect) const { return pCopy; } -CPDF_Object* CPDF_Dictionary::GetElement(const CFX_ByteStringC& key) const { +CPDF_Object* CPDF_Dictionary::GetObjectBy(const CFX_ByteStringC& key) const { auto it = m_Map.find(key); if (it == m_Map.end()) return nullptr; return it->second; } -CPDF_Object* CPDF_Dictionary::GetElementValue( +CPDF_Object* CPDF_Dictionary::GetDirectObjectBy( const CFX_ByteStringC& key) const { - CPDF_Object* p = GetElement(key); + CPDF_Object* p = GetObjectBy(key); return p ? p->GetDirect() : nullptr; } CFX_ByteString CPDF_Dictionary::GetStringBy(const CFX_ByteStringC& key) const { - CPDF_Object* p = GetElement(key); + CPDF_Object* p = GetObjectBy(key); return p ? p->GetString() : CFX_ByteString(); } CFX_ByteStringC CPDF_Dictionary::GetConstStringBy( const CFX_ByteStringC& key) const { - CPDF_Object* p = GetElement(key); + CPDF_Object* p = GetObjectBy(key); return p ? p->GetConstString() : CFX_ByteStringC(); } CFX_WideString CPDF_Dictionary::GetUnicodeTextBy( const CFX_ByteStringC& key) const { - CPDF_Object* p = GetElement(key); + CPDF_Object* p = GetObjectBy(key); if (CPDF_Reference* pRef = ToReference(p)) p = pRef->GetDirect(); return p ? p->GetUnicodeText() : CFX_WideString(); @@ -84,40 +84,40 @@ CFX_WideString CPDF_Dictionary::GetUnicodeTextBy( CFX_ByteString CPDF_Dictionary::GetStringBy(const CFX_ByteStringC& key, const CFX_ByteStringC& def) const { - CPDF_Object* p = GetElement(key); + CPDF_Object* p = GetObjectBy(key); return p ? p->GetString() : CFX_ByteString(def); } CFX_ByteStringC CPDF_Dictionary::GetConstStringBy( const CFX_ByteStringC& key, const CFX_ByteStringC& def) const { - CPDF_Object* p = GetElement(key); + CPDF_Object* p = GetObjectBy(key); return p ? p->GetConstString() : CFX_ByteStringC(def); } int CPDF_Dictionary::GetIntegerBy(const CFX_ByteStringC& key) const { - CPDF_Object* p = GetElement(key); + CPDF_Object* p = GetObjectBy(key); return p ? p->GetInteger() : 0; } int CPDF_Dictionary::GetIntegerBy(const CFX_ByteStringC& key, int def) const { - CPDF_Object* p = GetElement(key); + CPDF_Object* p = GetObjectBy(key); return p ? p->GetInteger() : def; } FX_FLOAT CPDF_Dictionary::GetNumberBy(const CFX_ByteStringC& key) const { - CPDF_Object* p = GetElement(key); + CPDF_Object* p = GetObjectBy(key); return p ? p->GetNumber() : 0; } FX_BOOL CPDF_Dictionary::GetBooleanBy(const CFX_ByteStringC& key, FX_BOOL bDefault) const { - CPDF_Object* p = GetElement(key); + CPDF_Object* p = GetObjectBy(key); return ToBoolean(p) ? p->GetInteger() : bDefault; } CPDF_Dictionary* CPDF_Dictionary::GetDictBy(const CFX_ByteStringC& key) const { - CPDF_Object* p = GetElementValue(key); + CPDF_Object* p = GetDirectObjectBy(key); if (!p) return nullptr; if (CPDF_Dictionary* pDict = p->AsDictionary()) @@ -128,11 +128,11 @@ CPDF_Dictionary* CPDF_Dictionary::GetDictBy(const CFX_ByteStringC& key) const { } CPDF_Array* CPDF_Dictionary::GetArrayBy(const CFX_ByteStringC& key) const { - return ToArray(GetElementValue(key)); + return ToArray(GetDirectObjectBy(key)); } CPDF_Stream* CPDF_Dictionary::GetStreamBy(const CFX_ByteStringC& key) const { - return ToStream(GetElementValue(key)); + return ToStream(GetDirectObjectBy(key)); } CFX_FloatRect CPDF_Dictionary::GetRectBy(const CFX_ByteStringC& key) const { @@ -156,9 +156,9 @@ FX_BOOL CPDF_Dictionary::KeyExist(const CFX_ByteStringC& key) const { } bool CPDF_Dictionary::IsSignatureDict() const { - CPDF_Object* pType = GetElementValue("Type"); + CPDF_Object* pType = GetDirectObjectBy("Type"); if (!pType) - pType = GetElementValue("FT"); + pType = GetDirectObjectBy("FT"); return pType && pType->GetString() == "Sig"; } diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp index 9ed8b3fac6..9058ed6767 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp @@ -115,16 +115,16 @@ void CPDF_Document::LoadAsynDoc(CPDF_Dictionary* pLinearized) { m_ID2 = pIDArray->GetStringAt(1); } uint32_t dwPageCount = 0; - CPDF_Object* pCount = pLinearized->GetElement("N"); + CPDF_Object* pCount = pLinearized->GetObjectBy("N"); if (ToNumber(pCount)) dwPageCount = pCount->GetInteger(); m_PageList.SetSize(dwPageCount); - CPDF_Object* pNo = pLinearized->GetElement("P"); + CPDF_Object* pNo = pLinearized->GetObjectBy("P"); if (ToNumber(pNo)) m_dwFirstPageNo = pNo->GetInteger(); - CPDF_Object* pObjNum = pLinearized->GetElement("O"); + CPDF_Object* pObjNum = pLinearized->GetObjectBy("O"); if (ToNumber(pObjNum)) m_dwFirstPageObjNum = pObjNum->GetInteger(); } @@ -236,7 +236,7 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode, } if (count && count == pKidList->GetCount()) { for (uint32_t i = 0; i < count; i++) { - if (CPDF_Reference* pKid = ToReference(pKidList->GetElement(i))) { + if (CPDF_Reference* pKid = ToReference(pKidList->GetObjectAt(i))) { if (pKid->GetRefObjNum() == objnum) { m_PageList.SetAt(index + i, objnum); return index + i; diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp index 147ae37ed0..d81725d06f 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp @@ -102,7 +102,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) { // Item 13: Skip Item 13 which has 16 bits. hStream->SkipBits(16); - CPDF_Object* pPageNum = m_pLinearizedDict->GetElementValue("N"); + CPDF_Object* pPageNum = m_pLinearizedDict->GetDirectObjectBy("N"); int nPages = pPageNum ? pPageNum->GetInteger() : 0; if (nPages < 1) return FALSE; @@ -135,12 +135,12 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) { dwPageLenArray.Add(safePageLen.ValueOrDie()); } - CPDF_Object* pOffsetE = m_pLinearizedDict->GetElementValue("E"); + CPDF_Object* pOffsetE = m_pLinearizedDict->GetDirectObjectBy("E"); int nOffsetE = pOffsetE ? pOffsetE->GetInteger() : -1; if (nOffsetE < 0) return FALSE; - CPDF_Object* pFirstPageNum = m_pLinearizedDict->GetElementValue("P"); + CPDF_Object* pFirstPageNum = m_pLinearizedDict->GetDirectObjectBy("P"); int nFirstPageNum = pFirstPageNum ? pFirstPageNum->GetInteger() : 0; for (int i = 0; i < nPages; ++i) { if (i == nFirstPageNum) { @@ -256,7 +256,7 @@ FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream, // Item 7: The number of bits needed to represent the difference between the // greatest and least length of a shared object group, in bytes. uint32_t dwDeltaGroupLen = hStream->GetBits(16); - CPDF_Object* pFirstPageObj = m_pLinearizedDict->GetElementValue("O"); + CPDF_Object* pFirstPageObj = m_pLinearizedDict->GetDirectObjectBy("O"); int nFirstPageObjNum = pFirstPageObj ? pFirstPageObj->GetInteger() : -1; if (nFirstPageObjNum < 0) return FALSE; @@ -331,10 +331,10 @@ FX_BOOL CPDF_HintTables::GetPagePos(int index, szPageStartPos = m_szPageOffsetArray[index]; szPageLength = GetItemLength(index, m_szPageOffsetArray); - CPDF_Object* pFirstPageNum = m_pLinearizedDict->GetElementValue("P"); + CPDF_Object* pFirstPageNum = m_pLinearizedDict->GetDirectObjectBy("P"); int nFirstPageNum = pFirstPageNum ? pFirstPageNum->GetInteger() : 0; - CPDF_Object* pFirstPageObjNum = m_pLinearizedDict->GetElementValue("O"); + CPDF_Object* pFirstPageObjNum = m_pLinearizedDict->GetDirectObjectBy("O"); if (!pFirstPageObjNum) return FALSE; @@ -360,7 +360,7 @@ IPDF_DataAvail::DocAvailStatus CPDF_HintTables::CheckPage( if (!m_pLinearizedDict || !pHints) return IPDF_DataAvail::DataError; - CPDF_Object* pFirstAvailPage = m_pLinearizedDict->GetElementValue("P"); + CPDF_Object* pFirstAvailPage = m_pLinearizedDict->GetDirectObjectBy("P"); int nFirstAvailPage = pFirstAvailPage ? pFirstAvailPage->GetInteger() : 0; if (index == nFirstAvailPage) return IPDF_DataAvail::DataAvailable; @@ -378,7 +378,7 @@ IPDF_DataAvail::DocAvailStatus CPDF_HintTables::CheckPage( for (int i = 0; i < index; ++i) offset += m_dwNSharedObjsArray[i]; - CPDF_Object* pFirstPageObj = m_pLinearizedDict->GetElementValue("O"); + CPDF_Object* pFirstPageObj = m_pLinearizedDict->GetDirectObjectBy("O"); int nFirstPageObjNum = pFirstPageObj ? pFirstPageObj->GetInteger() : -1; if (nFirstPageObjNum < 0) return IPDF_DataAvail::DataError; @@ -414,7 +414,7 @@ FX_BOOL CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) { return FALSE; CPDF_Dictionary* pDict = pHintStream->GetDict(); - CPDF_Object* pOffset = pDict ? pDict->GetElement("S") : nullptr; + CPDF_Object* pOffset = pDict ? pDict->GetObjectBy("S") : nullptr; if (!pOffset || !pOffset->IsNumber()) return FALSE; @@ -447,7 +447,7 @@ int CPDF_HintTables::ReadPrimaryHintStreamOffset() const { if (!pRange) return -1; - CPDF_Object* pStreamOffset = pRange->GetElementValue(0); + CPDF_Object* pStreamOffset = pRange->GetDirectObjectAt(0); if (!pStreamOffset) return -1; @@ -462,7 +462,7 @@ int CPDF_HintTables::ReadPrimaryHintStreamLength() const { if (!pRange) return -1; - CPDF_Object* pStreamLen = pRange->GetElementValue(1); + CPDF_Object* pStreamLen = pRange->GetDirectObjectAt(1); if (!pStreamLen) return -1; diff --git a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp index 84ad7cfc32..2069a161ea 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp @@ -123,7 +123,7 @@ class PDFObjectsTest : public testing::Test { if (array1->GetCount() != array2->GetCount()) return false; for (size_t i = 0; i < array1->GetCount(); ++i) { - if (!Equal(array1->GetElement(i), array2->GetElement(i))) + if (!Equal(array1->GetObjectAt(i), array2->GetObjectAt(i))) return false; } return true; @@ -135,7 +135,7 @@ class PDFObjectsTest : public testing::Test { return false; for (CPDF_Dictionary::const_iterator it = dict1->begin(); it != dict1->end(); ++it) { - if (!Equal(it->second, dict2->GetElement(it->first))) + if (!Equal(it->second, dict2->GetObjectBy(it->first))) return false; } return true; @@ -706,8 +706,8 @@ TEST(PDFArrayTest, AddNumber) { for (size_t i = 0; i < FX_ArraySize(vals); ++i) arr->AddNumber(vals[i]); for (size_t i = 0; i < FX_ArraySize(vals); ++i) { - EXPECT_EQ(CPDF_Object::NUMBER, arr->GetElement(i)->GetType()); - EXPECT_EQ(vals[i], arr->GetElement(i)->GetNumber()); + EXPECT_EQ(CPDF_Object::NUMBER, arr->GetObjectAt(i)->GetType()); + EXPECT_EQ(vals[i], arr->GetObjectAt(i)->GetNumber()); } } @@ -717,8 +717,8 @@ TEST(PDFArrayTest, AddInteger) { for (size_t i = 0; i < FX_ArraySize(vals); ++i) arr->AddInteger(vals[i]); for (size_t i = 0; i < FX_ArraySize(vals); ++i) { - EXPECT_EQ(CPDF_Object::NUMBER, arr->GetElement(i)->GetType()); - EXPECT_EQ(vals[i], arr->GetElement(i)->GetNumber()); + EXPECT_EQ(CPDF_Object::NUMBER, arr->GetObjectAt(i)->GetType()); + EXPECT_EQ(vals[i], arr->GetObjectAt(i)->GetNumber()); } } @@ -732,14 +732,14 @@ TEST(PDFArrayTest, AddStringAndName) { name_array->AddName(vals[i]); } for (size_t i = 0; i < FX_ArraySize(vals); ++i) { - EXPECT_EQ(CPDF_Object::STRING, string_array->GetElement(i)->GetType()); - EXPECT_STREQ(vals[i], string_array->GetElement(i)->GetString().c_str()); - EXPECT_EQ(CPDF_Object::NAME, name_array->GetElement(i)->GetType()); - EXPECT_STREQ(vals[i], name_array->GetElement(i)->GetString().c_str()); + EXPECT_EQ(CPDF_Object::STRING, string_array->GetObjectAt(i)->GetType()); + EXPECT_STREQ(vals[i], string_array->GetObjectAt(i)->GetString().c_str()); + EXPECT_EQ(CPDF_Object::NAME, name_array->GetObjectAt(i)->GetType()); + EXPECT_STREQ(vals[i], name_array->GetObjectAt(i)->GetString().c_str()); } } -TEST(PDFArrayTest, AddReferenceAndGetElement) { +TEST(PDFArrayTest, AddReferenceAndGetObjectAt) { std::unique_ptr holder( new CPDF_IndirectObjectHolder(nullptr)); CPDF_Boolean* boolean_obj = new CPDF_Boolean(true); @@ -766,11 +766,11 @@ TEST(PDFArrayTest, AddReferenceAndGetElement) { // Check arrays. EXPECT_EQ(arr->GetCount(), arr1->GetCount()); for (size_t i = 0; i < arr->GetCount(); ++i) { - EXPECT_EQ(CPDF_Object::REFERENCE, arr->GetElement(i)->GetType()); - EXPECT_EQ(indirect_objs[i], arr->GetElement(i)->GetDirect()); - EXPECT_EQ(indirect_objs[i], arr->GetElementValue(i)); - EXPECT_EQ(CPDF_Object::REFERENCE, arr1->GetElement(i)->GetType()); - EXPECT_EQ(indirect_objs[i], arr1->GetElement(i)->GetDirect()); - EXPECT_EQ(indirect_objs[i], arr1->GetElementValue(i)); + EXPECT_EQ(CPDF_Object::REFERENCE, arr->GetObjectAt(i)->GetType()); + EXPECT_EQ(indirect_objs[i], arr->GetObjectAt(i)->GetDirect()); + EXPECT_EQ(indirect_objs[i], arr->GetDirectObjectAt(i)); + EXPECT_EQ(CPDF_Object::REFERENCE, arr1->GetObjectAt(i)->GetType()); + EXPECT_EQ(indirect_objs[i], arr1->GetObjectAt(i)->GetDirect()); + EXPECT_EQ(indirect_objs[i], arr1->GetDirectObjectAt(i)); } } diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp index bebd3d62be..305401525c 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp @@ -249,7 +249,7 @@ CPDF_Parser::Error CPDF_Parser::StartParse(IFX_FileRead* pFileAccess) { } if (m_pSecurityHandler && !m_pSecurityHandler->IsMetadataEncrypted()) { CPDF_Reference* pMetadata = - ToReference(m_pDocument->GetRoot()->GetElement("Metadata")); + ToReference(m_pDocument->GetRoot()->GetObjectBy("Metadata")); if (pMetadata) m_pSyntax->m_MetadataObjnum = pMetadata->GetRefObjNum(); } @@ -262,7 +262,7 @@ CPDF_Parser::Error CPDF_Parser::SetEncryptHandler() { if (!m_pTrailer) return FORMAT_ERROR; - CPDF_Object* pEncryptObj = m_pTrailer->GetElement("Encrypt"); + CPDF_Object* pEncryptObj = m_pTrailer->GetObjectBy("Encrypt"); if (pEncryptObj) { if (CPDF_Dictionary* pEncryptDict = pEncryptObj->AsDictionary()) { SetEncryptDictionary(pEncryptDict); @@ -743,9 +743,9 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() { if ((pDict->KeyExist("Type")) && (pDict->GetStringBy("Type") == "XRef" && pDict->KeyExist("Size"))) { - CPDF_Object* pRoot = pDict->GetElement("Root"); + CPDF_Object* pRoot = pDict->GetObjectBy("Root"); if (pRoot && pRoot->GetDict() && - pRoot->GetDict()->GetElement("Pages")) { + pRoot->GetDict()->GetObjectBy("Pages")) { if (m_pTrailer) m_pTrailer->Release(); m_pTrailer = ToDictionary(pDict->Clone()); @@ -809,7 +809,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() { if (CPDF_Dictionary* pTrailer = pStream ? pStream->GetDict() : pObj->AsDictionary()) { if (m_pTrailer) { - CPDF_Object* pRoot = pTrailer->GetElement("Root"); + CPDF_Object* pRoot = pTrailer->GetObjectBy("Root"); CPDF_Reference* pRef = ToReference(pRoot); if (!pRoot || (pRef && IsValidObjectNumber(pRef->GetRefObjNum()) && @@ -989,8 +989,8 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) { if (pArray) { uint32_t nPairSize = pArray->GetCount() / 2; for (uint32_t i = 0; i < nPairSize; i++) { - CPDF_Object* pStartNumObj = pArray->GetElement(i * 2); - CPDF_Object* pCountObj = pArray->GetElement(i * 2 + 1); + CPDF_Object* pStartNumObj = pArray->GetObjectAt(i * 2); + CPDF_Object* pCountObj = pArray->GetObjectAt(i * 2 + 1); if (ToNumber(pStartNumObj) && ToNumber(pCountObj)) { int nStartNum = pStartNumObj->GetInteger(); @@ -1095,7 +1095,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) { } CPDF_Array* CPDF_Parser::GetIDArray() { - CPDF_Object* pID = m_pTrailer ? m_pTrailer->GetElement("ID") : nullptr; + CPDF_Object* pID = m_pTrailer ? m_pTrailer->GetObjectBy("ID") : nullptr; if (!pID) return nullptr; @@ -1108,13 +1108,13 @@ CPDF_Array* CPDF_Parser::GetIDArray() { uint32_t CPDF_Parser::GetRootObjNum() { CPDF_Reference* pRef = - ToReference(m_pTrailer ? m_pTrailer->GetElement("Root") : nullptr); + ToReference(m_pTrailer ? m_pTrailer->GetObjectBy("Root") : nullptr); return pRef ? pRef->GetRefObjNum() : 0; } uint32_t CPDF_Parser::GetInfoObjNum() { CPDF_Reference* pRef = - ToReference(m_pTrailer ? m_pTrailer->GetElement("Info") : nullptr); + ToReference(m_pTrailer ? m_pTrailer->GetObjectBy("Info") : nullptr); return pRef ? pRef->GetRefObjNum() : 0; } @@ -1493,10 +1493,10 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess, return FALSE; CPDF_Dictionary* pDict = m_pLinearized->GetDict(); - if (pDict && pDict->GetElement("Linearized")) { + if (pDict && pDict->GetObjectBy("Linearized")) { m_pSyntax->GetNextWord(nullptr); - CPDF_Object* pLen = pDict->GetElement("L"); + CPDF_Object* pLen = pDict->GetObjectBy("L"); if (!pLen) { m_pLinearized->Release(); m_pLinearized = nullptr; @@ -1506,10 +1506,10 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess, if (pLen->GetInteger() != (int)pFileAccess->GetSize()) return FALSE; - if (CPDF_Number* pNo = ToNumber(pDict->GetElement("P"))) + if (CPDF_Number* pNo = ToNumber(pDict->GetObjectBy("P"))) m_dwFirstPageNo = pNo->GetInteger(); - if (CPDF_Number* pTable = ToNumber(pDict->GetElement("T"))) + if (CPDF_Number* pTable = ToNumber(pDict->GetObjectBy("T"))) m_LastXRefOffset = pTable->GetInteger(); return TRUE; @@ -1591,7 +1591,7 @@ CPDF_Parser::Error CPDF_Parser::StartAsyncParse(IFX_FileRead* pFileAccess) { if (m_pSecurityHandler && m_pSecurityHandler->IsMetadataEncrypted()) { if (CPDF_Reference* pMetadata = - ToReference(m_pDocument->GetRoot()->GetElement("Metadata"))) + ToReference(m_pDocument->GetRoot()->GetObjectBy("Metadata"))) m_pSyntax->m_MetadataObjnum = pMetadata->GetRefObjNum(); } return SUCCESS; diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp index d14eeb991c..5a3db292e0 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp @@ -630,7 +630,7 @@ unsigned int CPDF_SyntaxParser::ReadEOLMarkers(FX_FILESIZE pos) { CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, uint32_t objnum, uint32_t gennum) { - CPDF_Object* pLenObj = pDict->GetElement("Length"); + CPDF_Object* pLenObj = pDict->GetObjectBy("Length"); FX_FILESIZE len = -1; CPDF_Reference* pLenObjRef = ToReference(pLenObj); diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp index 346476b62b..5d9254901a 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp @@ -336,12 +336,12 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf, CPDF_Dictionary*& pImageParms, uint32_t last_estimated_size, FX_BOOL bImageAcc) { - CPDF_Object* pDecoder = pDict ? pDict->GetElementValue("Filter") : nullptr; + CPDF_Object* pDecoder = pDict ? pDict->GetDirectObjectBy("Filter") : nullptr; if (!pDecoder || (!pDecoder->IsArray() && !pDecoder->IsName())) return FALSE; CPDF_Object* pParams = - pDict ? pDict->GetElementValue("DecodeParms") : nullptr; + pDict ? pDict->GetDirectObjectBy("DecodeParms") : nullptr; std::vector DecoderList; CFX_ArrayTemplate ParamList; if (CPDF_Array* pDecoders = pDecoder->AsArray()) { diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp index 5bfbfaebac..8228c497e9 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp @@ -82,7 +82,7 @@ int32_t GetHeaderOffset(IFX_FileRead* pFile) { } int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteStringC& key) { - CPDF_Number* pObj = ToNumber(pDict->GetElement(key)); + CPDF_Number* pObj = ToNumber(pDict->GetObjectBy(key)); return pObj ? pObj->GetInteger() : 0; } @@ -180,7 +180,7 @@ CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj) { const CPDF_Array* p = pObj->AsArray(); buf << "["; for (uint32_t i = 0; i < p->GetCount(); i++) { - CPDF_Object* pElement = p->GetElement(i); + CPDF_Object* pElement = p->GetObjectAt(i); if (pElement->GetObjNum()) { buf << " " << pElement->GetObjNum() << " 0 R"; } else { diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_array.h b/core/fpdfapi/fpdf_parser/include/cpdf_array.h index 3efa03e0d5..ea367785ed 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_array.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_array.h @@ -25,10 +25,8 @@ class CPDF_Array : public CPDF_Object { const CPDF_Array* AsArray() const override; uint32_t GetCount() const { return m_Objects.GetSize(); } - CPDF_Object* GetElement(uint32_t index) const; - CPDF_Object* GetElementValue(uint32_t index) const; - CFX_Matrix GetMatrix(); - CFX_FloatRect GetRect(); + CPDF_Object* GetObjectAt(uint32_t index) const; + CPDF_Object* GetDirectObjectAt(uint32_t index) const; CFX_ByteString GetStringAt(uint32_t index) const; CFX_ByteStringC GetConstStringAt(uint32_t index) const; int GetIntegerAt(uint32_t index) const; @@ -37,6 +35,8 @@ class CPDF_Array : public CPDF_Object { CPDF_Stream* GetStreamAt(uint32_t index) const; CPDF_Array* GetArrayAt(uint32_t index) const; FX_FLOAT GetFloatAt(uint32_t index) const { return GetNumberAt(index); } + CFX_Matrix GetMatrix(); + CFX_FloatRect GetRect(); void SetAt(uint32_t index, CPDF_Object* pObj, diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h b/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h index 73eabf9368..82abc35c02 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h @@ -31,8 +31,8 @@ class CPDF_Dictionary : public CPDF_Object { const CPDF_Dictionary* AsDictionary() const override; size_t GetCount() const { return m_Map.size(); } - CPDF_Object* GetElement(const CFX_ByteStringC& key) const; - CPDF_Object* GetElementValue(const CFX_ByteStringC& key) const; + CPDF_Object* GetObjectBy(const CFX_ByteStringC& key) const; + CPDF_Object* GetDirectObjectBy(const CFX_ByteStringC& key) const; CFX_ByteString GetStringBy(const CFX_ByteStringC& key) const; CFX_ByteStringC GetConstStringBy(const CFX_ByteStringC& key) const; CFX_ByteString GetStringBy(const CFX_ByteStringC& key, diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp index 216613cc61..52f29477a9 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp @@ -777,9 +777,10 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, pDocument = pPageObj->AsImage()->m_pImage->GetDocument(); } CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : NULL; - CPDF_Object* pCSObj = - pPageObj->AsImage()->m_pImage->GetStream()->GetDict()->GetElementValue( - "ColorSpace"); + CPDF_Object* pCSObj = pPageObj->AsImage() + ->m_pImage->GetStream() + ->GetDict() + ->GetDirectObjectBy("ColorSpace"); CPDF_ColorSpace* pColorSpace = pDocument->LoadColorSpace(pCSObj, pPageResources); if (pColorSpace) { @@ -1157,7 +1158,7 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) { return nullptr; for (uint32_t i = 0; i < 3; ++i) { - pFuncs[2 - i].reset(CPDF_Function::Load(pArray->GetElementValue(i))); + pFuncs[2 - i].reset(CPDF_Function::Load(pArray->GetDirectObjectAt(i))); if (!pFuncs[2 - i]) return nullptr; } diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp index ef452daa4e..ef2109a02f 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -408,7 +408,7 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { } if (m_pRenderStatus->m_pDevice->GetDeviceClass() != FXDC_DISPLAY) { CPDF_Object* pFilters = - m_pImageObject->m_pImage->GetStream()->GetDict()->GetElementValue( + m_pImageObject->m_pImage->GetStream()->GetDict()->GetDirectObjectBy( "Filter"); if (pFilters) { if (pFilters->IsName()) { @@ -452,7 +452,7 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { } CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : NULL; CPDF_Object* pCSObj = - m_pImageObject->m_pImage->GetStream()->GetDict()->GetElementValue( + m_pImageObject->m_pImage->GetStream()->GetDict()->GetDirectObjectBy( "ColorSpace"); CPDF_ColorSpace* pColorSpace = pDocument->LoadColorSpace(pCSObj, pPageResources); @@ -889,7 +889,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, return NULL; } std::unique_ptr pFunc; - CPDF_Object* pFuncObj = pSMaskDict->GetElementValue("TR"); + CPDF_Object* pFuncObj = pSMaskDict->GetDirectObjectBy("TR"); if (pFuncObj && (pFuncObj->IsDictionary() || pFuncObj->IsStream())) pFunc.reset(CPDF_Function::Load(pFuncObj)); @@ -919,7 +919,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, if (pBC) { CPDF_Dictionary* pDict = pGroup->GetDict(); if (pDict && pDict->GetDictBy("Group")) - pCSObj = pDict->GetDictBy("Group")->GetElementValue("CS"); + pCSObj = pDict->GetDictBy("Group")->GetDirectObjectBy("CS"); else pCSObj = NULL; pCS = m_pContext->GetDocument()->LoadColorSpace(pCSObj); diff --git a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index 6ed50ead56..144de779e9 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -420,7 +420,7 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources, if (m_bImageMask || !m_pDict->KeyExist("ColorSpace")) { if (!m_bImageMask) { - CPDF_Object* pFilter = m_pDict->GetElementValue("Filter"); + CPDF_Object* pFilter = m_pDict->GetDirectObjectBy("Filter"); if (pFilter) { CFX_ByteString filter; if (pFilter->IsName()) { @@ -442,7 +442,7 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources, return true; } - CPDF_Object* pCSObj = m_pDict->GetElementValue("ColorSpace"); + CPDF_Object* pCSObj = m_pDict->GetDirectObjectBy("ColorSpace"); if (!pCSObj) return false; @@ -508,7 +508,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, } } if (!m_pDict->KeyExist("SMask")) { - CPDF_Object* pMask = m_pDict->GetElementValue("Mask"); + CPDF_Object* pMask = m_pDict->GetDirectObjectBy("Mask"); if (!pMask) { return pCompData; } @@ -727,7 +727,7 @@ CPDF_DIBSource* CPDF_DIBSource::LoadMask(uint32_t& MatteColor) { return LoadMaskDIB(pSoftMask); } - if (CPDF_Stream* pStream = ToStream(m_pDict->GetElementValue("Mask"))) + if (CPDF_Stream* pStream = ToStream(m_pDict->GetDirectObjectBy("Mask"))) return LoadMaskDIB(pStream); return nullptr; @@ -752,7 +752,7 @@ int CPDF_DIBSource::StratLoadMask() { return StartLoadMaskDIB(); } - m_pMaskStream = ToStream(m_pDict->GetElementValue("Mask")); + m_pMaskStream = ToStream(m_pDict->GetDirectObjectBy("Mask")); return m_pMaskStream ? StartLoadMaskDIB() : 1; } @@ -879,7 +879,7 @@ void CPDF_DIBSource::LoadPalette() { void CPDF_DIBSource::ValidateDictParam() { m_bpc = m_bpc_orig; - CPDF_Object* pFilter = m_pDict->GetElementValue("Filter"); + CPDF_Object* pFilter = m_pDict->GetDirectObjectBy("Filter"); if (pFilter) { if (pFilter->IsName()) { CFX_ByteString filter = pFilter->GetString(); diff --git a/core/fpdfdoc/doc_action.cpp b/core/fpdfdoc/doc_action.cpp index ce37e1e9c9..2f08bfa3af 100644 --- a/core/fpdfdoc/doc_action.cpp +++ b/core/fpdfdoc/doc_action.cpp @@ -32,7 +32,7 @@ CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const { if (type != "GoTo" && type != "GoToR") { return CPDF_Dest(); } - CPDF_Object* pDest = m_pDict->GetElementValue("D"); + CPDF_Object* pDest = m_pDict->GetDirectObjectBy("D"); if (!pDest) { return CPDF_Dest(); } @@ -67,7 +67,7 @@ CFX_WideString CPDF_Action::GetFilePath() const { type != "ImportData") { return CFX_WideString(); } - CPDF_Object* pFile = m_pDict->GetElementValue("F"); + CPDF_Object* pFile = m_pDict->GetDirectObjectBy("F"); CFX_WideString path; if (!pFile) { if (type == "Launch") { @@ -111,7 +111,7 @@ uint32_t CPDF_ActionFields::GetFieldsCount() const { CFX_ByteString csType = pDict->GetStringBy("S"); CPDF_Object* pFields = NULL; if (csType == "Hide") { - pFields = pDict->GetElementValue("T"); + pFields = pDict->GetDirectObjectBy("T"); } else { pFields = pDict->GetArrayBy("Fields"); } @@ -138,7 +138,7 @@ std::vector CPDF_ActionFields::GetAllFields() const { CFX_ByteString csType = pDict->GetStringBy("S"); CPDF_Object* pFields; if (csType == "Hide") - pFields = pDict->GetElementValue("T"); + pFields = pDict->GetDirectObjectBy("T"); else pFields = pDict->GetArrayBy("Fields"); if (!pFields) @@ -149,7 +149,7 @@ std::vector CPDF_ActionFields::GetAllFields() const { } else if (CPDF_Array* pArray = pFields->AsArray()) { uint32_t iCount = pArray->GetCount(); for (uint32_t i = 0; i < iCount; ++i) { - CPDF_Object* pObj = pArray->GetElementValue(i); + CPDF_Object* pObj = pArray->GetDirectObjectAt(i); if (pObj) { fields.push_back(pObj); } @@ -169,7 +169,7 @@ CPDF_Object* CPDF_ActionFields::GetField(uint32_t iIndex) const { CFX_ByteString csType = pDict->GetStringBy("S"); CPDF_Object* pFields = NULL; if (csType == "Hide") { - pFields = pDict->GetElementValue("T"); + pFields = pDict->GetDirectObjectBy("T"); } else { pFields = pDict->GetArrayBy("Fields"); } @@ -181,7 +181,7 @@ CPDF_Object* CPDF_ActionFields::GetField(uint32_t iIndex) const { if (iIndex == 0) pFindObj = pFields; } else if (CPDF_Array* pArray = pFields->AsArray()) { - pFindObj = pArray->GetElementValue(iIndex); + pFindObj = pArray->GetDirectObjectAt(iIndex); } return pFindObj; } @@ -191,7 +191,7 @@ CFX_WideString CPDF_Action::GetJavaScript() const { if (!m_pDict) { return csJS; } - CPDF_Object* pJS = m_pDict->GetElementValue("JS"); + CPDF_Object* pJS = m_pDict->GetDirectObjectBy("JS"); return pJS ? pJS->GetUnicodeText() : csJS; } CPDF_Dictionary* CPDF_Action::GetAnnot() const { @@ -236,7 +236,7 @@ uint32_t CPDF_Action::GetSubActionsCount() const { if (!m_pDict || !m_pDict->KeyExist("Next")) return 0; - CPDF_Object* pNext = m_pDict->GetElementValue("Next"); + CPDF_Object* pNext = m_pDict->GetDirectObjectBy("Next"); if (!pNext) return 0; if (pNext->IsDictionary()) @@ -249,7 +249,7 @@ CPDF_Action CPDF_Action::GetSubAction(uint32_t iIndex) const { if (!m_pDict || !m_pDict->KeyExist("Next")) { return CPDF_Action(); } - CPDF_Object* pNext = m_pDict->GetElementValue("Next"); + CPDF_Object* pNext = m_pDict->GetDirectObjectBy("Next"); if (CPDF_Dictionary* pDict = ToDictionary(pNext)) { if (iIndex == 0) return CPDF_Action(pDict); diff --git a/core/fpdfdoc/doc_annot.cpp b/core/fpdfdoc/doc_annot.cpp index e6e441f237..1ea6c8b5a8 100644 --- a/core/fpdfdoc/doc_annot.cpp +++ b/core/fpdfdoc/doc_annot.cpp @@ -29,7 +29,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) FX_BOOL bRegenerateAP = pAcroForm && pAcroForm->GetBooleanBy("NeedAppearances"); for (uint32_t i = 0; i < pAnnots->GetCount(); ++i) { - CPDF_Dictionary* pDict = ToDictionary(pAnnots->GetElementValue(i)); + CPDF_Dictionary* pDict = ToDictionary(pAnnots->GetDirectObjectAt(i)); if (!pDict) continue; @@ -166,7 +166,7 @@ CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, if (!pAP->KeyExist(ap_entry)) ap_entry = "N"; - CPDF_Object* psub = pAP->GetElementValue(ap_entry); + CPDF_Object* psub = pAP->GetDirectObjectBy(ap_entry); if (!psub) return nullptr; if (CPDF_Stream* pStream = psub->AsStream()) @@ -288,7 +288,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, int nLen = pDashArray->GetCount(); int i = 0; for (; i < nLen; ++i) { - CPDF_Object* pObj = pDashArray->GetElementValue(i); + CPDF_Object* pObj = pDashArray->GetDirectObjectAt(i); if (pObj && pObj->GetInteger()) { break; } diff --git a/core/fpdfdoc/doc_ap.cpp b/core/fpdfdoc/doc_ap.cpp index 87edcd9836..e87b21b8ec 100644 --- a/core/fpdfdoc/doc_ap.cpp +++ b/core/fpdfdoc/doc_ap.cpp @@ -616,12 +616,12 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, if (IsFloatSmaller(fy, rcBody.bottom)) { break; } - if (CPDF_Object* pOpt = pOpts->GetElementValue(i)) { + if (CPDF_Object* pOpt = pOpts->GetDirectObjectAt(i)) { CFX_WideString swItem; if (pOpt->IsString()) swItem = pOpt->GetUnicodeText(); else if (CPDF_Array* pArray = pOpt->AsArray()) - swItem = pArray->GetElementValue(1)->GetUnicodeText(); + swItem = pArray->GetDirectObjectAt(1)->GetUnicodeText(); FX_BOOL bSelected = FALSE; if (pSels) { diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp index 08d07e6c66..c711709e73 100644 --- a/core/fpdfdoc/doc_basic.cpp +++ b/core/fpdfdoc/doc_basic.cpp @@ -22,7 +22,7 @@ int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc) { if (!pArray) return 0; - CPDF_Object* pPage = pArray->GetElementValue(0); + CPDF_Object* pPage = pArray->GetDirectObjectAt(0); if (!pPage) return 0; if (pPage->IsNumber()) @@ -36,7 +36,7 @@ uint32_t CPDF_Dest::GetPageObjNum() { if (!pArray) return 0; - CPDF_Object* pPage = pArray->GetElementValue(0); + CPDF_Object* pPage = pArray->GetDirectObjectAt(0); if (!pPage) return 0; if (pPage->IsNumber()) @@ -51,7 +51,7 @@ int CPDF_Dest::GetZoomMode() { if (!pArray) return 0; - CPDF_Object* pObj = pArray->GetElementValue(1); + CPDF_Object* pObj = pArray->GetDirectObjectAt(1); if (!pObj) return 0; @@ -116,7 +116,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, break; } nIndex += i; - return pNames->GetElementValue(i * 2 + 1); + return pNames->GetDirectObjectAt(i * 2 + 1); } nIndex += dwCount; return NULL; @@ -158,7 +158,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, *ppFind = pNames; } csName = pNames->GetStringAt((nIndex - nCurIndex) * 2); - return pNames->GetElementValue((nIndex - nCurIndex) * 2 + 1); + return pNames->GetDirectObjectAt((nIndex - nCurIndex) * 2 + 1); } CPDF_Array* pKids = pNode->GetArrayBy("Kids"); if (!pKids) { @@ -237,7 +237,7 @@ CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc, CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDictBy("Dests"); if (!pDests) return nullptr; - pValue = pDests->GetElementValue(sName); + pValue = pDests->GetDirectObjectBy(sName); } if (!pValue) return nullptr; diff --git a/core/fpdfdoc/doc_bookmark.cpp b/core/fpdfdoc/doc_bookmark.cpp index 0ad7b5b70d..22ff7921ef 100644 --- a/core/fpdfdoc/doc_bookmark.cpp +++ b/core/fpdfdoc/doc_bookmark.cpp @@ -55,7 +55,7 @@ CFX_WideString CPDF_Bookmark::GetTitle() const { if (!m_pDict) { return CFX_WideString(); } - CPDF_String* pString = ToString(m_pDict->GetElementValue("Title")); + CPDF_String* pString = ToString(m_pDict->GetDirectObjectBy("Title")); if (!pString) return CFX_WideString(); @@ -75,7 +75,7 @@ CPDF_Dest CPDF_Bookmark::GetDest(CPDF_Document* pDocument) const { if (!m_pDict) return CPDF_Dest(); - CPDF_Object* pDest = m_pDict->GetElementValue("Dest"); + CPDF_Object* pDest = m_pDict->GetDirectObjectBy("Dest"); if (!pDest) return CPDF_Dest(); if (pDest->IsString() || pDest->IsName()) { diff --git a/core/fpdfdoc/doc_form.cpp b/core/fpdfdoc/doc_form.cpp index 7642fac6bf..2a6d739549 100644 --- a/core/fpdfdoc/doc_form.cpp +++ b/core/fpdfdoc/doc_form.cpp @@ -756,7 +756,7 @@ CPDF_FormField* CPDF_InterForm::GetFieldInCalculationOrder(int index) { return NULL; } if (CPDF_Dictionary* pElement = - ToDictionary(pArray->GetElementValue(index))) { + ToDictionary(pArray->GetDirectObjectAt(index))) { return GetFieldByDict(pElement); } return NULL; @@ -770,7 +770,7 @@ int CPDF_InterForm::FindFieldInCalculationOrder(const CPDF_FormField* pField) { return -1; } for (uint32_t i = 0; i < pArray->GetCount(); i++) { - CPDF_Object* pElement = pArray->GetElementValue(i); + CPDF_Object* pElement = pArray->GetDirectObjectAt(i); if (pElement == pField->m_pDict) { return i; } @@ -953,20 +953,20 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) { } if (pParent && pParent != pFieldDict && !pParent->KeyExist("FT")) { if (pFieldDict->KeyExist("FT")) { - CPDF_Object* pFTValue = pFieldDict->GetElementValue("FT"); + CPDF_Object* pFTValue = pFieldDict->GetDirectObjectBy("FT"); if (pFTValue) { pParent->SetAt("FT", pFTValue->Clone()); } } if (pFieldDict->KeyExist("Ff")) { - CPDF_Object* pFfValue = pFieldDict->GetElementValue("Ff"); + CPDF_Object* pFfValue = pFieldDict->GetDirectObjectBy("Ff"); if (pFfValue) { pParent->SetAt("Ff", pFfValue->Clone()); } } } pField = new CPDF_FormField(this, pParent); - CPDF_Object* pTObj = pDict->GetElement("T"); + CPDF_Object* pTObj = pDict->GetObjectBy("T"); if (ToReference(pTObj)) { CPDF_Object* pClone = pTObj->Clone(TRUE); if (pClone) @@ -1157,7 +1157,7 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict, if ((eType == CPDF_FormField::ListBox || eType == CPDF_FormField::ComboBox) && pFieldDict->KeyExist("Opt")) { pField->m_pDict->SetAt("Opt", - pFieldDict->GetElementValue("Opt")->Clone(TRUE)); + pFieldDict->GetDirectObjectBy("Opt")->Clone(TRUE)); } if (bNotify && m_pFormNotify) { if (iType == FIELDTYPE_CHECKBOX || iType == FIELDTYPE_RADIOBUTTON) { diff --git a/core/fpdfdoc/doc_formfield.cpp b/core/fpdfdoc/doc_formfield.cpp index 88d35d8a11..cc34a9d297 100644 --- a/core/fpdfdoc/doc_formfield.cpp +++ b/core/fpdfdoc/doc_formfield.cpp @@ -305,7 +305,7 @@ CFX_WideString CPDF_FormField::GetValue(FX_BOOL bDefault) { case CPDF_Object::STREAM: return pValue->GetUnicodeText(); case CPDF_Object::ARRAY: - pValue = pValue->AsArray()->GetElementValue(0); + pValue = pValue->AsArray()->GetDirectObjectAt(0); if (pValue) return pValue->GetUnicodeText(); break; @@ -447,7 +447,7 @@ int CPDF_FormField::GetSelectedIndex(int index) { if (!pArray || index < 0) return -1; - CPDF_Object* elementValue = pArray->GetElementValue(index); + CPDF_Object* elementValue = pArray->GetDirectObjectAt(index); sel_value = elementValue ? elementValue->GetUnicodeText() : CFX_WideString(); } @@ -538,7 +538,7 @@ FX_BOOL CPDF_FormField::IsItemSelected(int index) { } } for (uint32_t i = 0; i < pArray->GetCount(); i++) - if (pArray->GetElementValue(i)->GetUnicodeText() == opt_value && + if (pArray->GetDirectObjectAt(i)->GetUnicodeText() == opt_value && (int)i == iPos) { return TRUE; } @@ -691,11 +691,11 @@ CFX_WideString CPDF_FormField::GetOptionText(int index, int sub_index) { if (!pArray) return CFX_WideString(); - CPDF_Object* pOption = pArray->GetElementValue(index); + CPDF_Object* pOption = pArray->GetDirectObjectAt(index); if (!pOption) return CFX_WideString(); if (CPDF_Array* pOptionArray = pOption->AsArray()) - pOption = pOptionArray->GetElementValue(sub_index); + pOption = pOptionArray->GetDirectObjectAt(sub_index); CPDF_String* pString = ToString(pOption); return pString ? pString->GetUnicodeText() : CFX_WideString(); diff --git a/core/fpdfdoc/doc_link.cpp b/core/fpdfdoc/doc_link.cpp index 3f97024237..723955f9ea 100644 --- a/core/fpdfdoc/doc_link.cpp +++ b/core/fpdfdoc/doc_link.cpp @@ -75,7 +75,7 @@ CFX_FloatRect CPDF_Link::GetRect() { return m_pDict->GetRectBy("Rect"); } CPDF_Dest CPDF_Link::GetDest(CPDF_Document* pDoc) { - CPDF_Object* pDest = m_pDict->GetElementValue("Dest"); + CPDF_Object* pDest = m_pDict->GetDirectObjectBy("Dest"); if (!pDest) return CPDF_Dest(); diff --git a/core/fpdfdoc/doc_ocg.cpp b/core/fpdfdoc/doc_ocg.cpp index 43ccc3fd8d..a739c1675c 100644 --- a/core/fpdfdoc/doc_ocg.cpp +++ b/core/fpdfdoc/doc_ocg.cpp @@ -26,7 +26,7 @@ static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object* pObject, static FX_BOOL FPDFDOC_OCG_HasIntent(const CPDF_Dictionary* pDict, const CFX_ByteStringC& csElement, const CFX_ByteStringC& csDef = "") { - CPDF_Object* pIntent = pDict->GetElementValue("Intent"); + CPDF_Object* pIntent = pDict->GetDirectObjectBy("Intent"); if (!pIntent) { return csElement == csDef; } @@ -198,7 +198,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression, CPDF_Object* pOCGObj; CFX_ByteString csOperator = pExpression->GetStringAt(0); if (csOperator == "Not") { - pOCGObj = pExpression->GetElementValue(1); + pOCGObj = pExpression->GetDirectObjectAt(1); if (!pOCGObj) return FALSE; if (CPDF_Dictionary* pDict = pOCGObj->AsDictionary()) @@ -210,7 +210,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression, if (csOperator == "Or" || csOperator == "And") { FX_BOOL bValue = FALSE; for (int32_t i = 1; i < iCount; i++) { - pOCGObj = pExpression->GetElementValue(1); + pOCGObj = pExpression->GetDirectObjectAt(1); if (!pOCGObj) { continue; } @@ -241,7 +241,7 @@ FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict, return GetOCGVE(pVE, bFromConfig); } CFX_ByteString csP = pOCMDDict->GetStringBy("P", "AnyOn"); - CPDF_Object* pOCGObj = pOCMDDict->GetElementValue("OCGs"); + CPDF_Object* pOCGObj = pOCMDDict->GetDirectObjectBy("OCGs"); if (!pOCGObj) return TRUE; if (const CPDF_Dictionary* pDict = pOCGObj->AsDictionary()) diff --git a/core/fpdfdoc/doc_tagged.cpp b/core/fpdfdoc/doc_tagged.cpp index 868031401d..684789acc2 100644 --- a/core/fpdfdoc/doc_tagged.cpp +++ b/core/fpdfdoc/doc_tagged.cpp @@ -57,7 +57,7 @@ void CPDF_StructTreeImpl::LoadDocTree() { if (!m_pTreeRoot) return; - CPDF_Object* pKids = m_pTreeRoot->GetElementValue("K"); + CPDF_Object* pKids = m_pTreeRoot->GetDirectObjectBy("K"); if (!pKids) return; if (CPDF_Dictionary* pDict = pKids->AsDictionary()) { @@ -82,7 +82,7 @@ void CPDF_StructTreeImpl::LoadPageTree(const CPDF_Dictionary* pPageDict) { if (!m_pTreeRoot) return; - CPDF_Object* pKids = m_pTreeRoot->GetElementValue("K"); + CPDF_Object* pKids = m_pTreeRoot->GetDirectObjectBy("K"); if (!pKids) return; @@ -163,7 +163,7 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode( } FX_BOOL CPDF_StructTreeImpl::AddTopLevelNode(CPDF_Dictionary* pDict, CPDF_StructElementImpl* pElement) { - CPDF_Object* pObj = m_pTreeRoot->GetElementValue("K"); + CPDF_Object* pObj = m_pTreeRoot->GetDirectObjectBy("K"); if (!pObj) { return FALSE; } @@ -181,7 +181,7 @@ FX_BOOL CPDF_StructTreeImpl::AddTopLevelNode(CPDF_Dictionary* pDict, uint32_t i; FX_BOOL bSave = FALSE; for (i = 0; i < pTopKids->GetCount(); i++) { - CPDF_Reference* pKidRef = ToReference(pTopKids->GetElement(i)); + CPDF_Reference* pKidRef = ToReference(pTopKids->GetObjectAt(i)); if (!pKidRef) continue; if (pKidRef->GetRefObjNum() != pDict->GetObjNum()) @@ -231,19 +231,19 @@ void CPDF_StructElementImpl::Release() { } } void CPDF_StructElementImpl::LoadKids(CPDF_Dictionary* pDict) { - CPDF_Object* pObj = pDict->GetElement("Pg"); + CPDF_Object* pObj = pDict->GetObjectBy("Pg"); uint32_t PageObjNum = 0; if (CPDF_Reference* pRef = ToReference(pObj)) PageObjNum = pRef->GetRefObjNum(); - CPDF_Object* pKids = pDict->GetElementValue("K"); + CPDF_Object* pKids = pDict->GetDirectObjectBy("K"); if (!pKids) return; if (CPDF_Array* pArray = pKids->AsArray()) { m_Kids.SetSize(pArray->GetCount()); for (uint32_t i = 0; i < pArray->GetCount(); i++) { - CPDF_Object* pKid = pArray->GetElementValue(i); + CPDF_Object* pKid = pArray->GetDirectObjectAt(i); LoadKid(PageObjNum, pKid, &m_Kids[i]); } } else { @@ -272,7 +272,7 @@ void CPDF_StructElementImpl::LoadKid(uint32_t PageObjNum, if (!pKidDict) return; - if (CPDF_Reference* pRef = ToReference(pKidDict->GetElement("Pg"))) + if (CPDF_Reference* pRef = ToReference(pKidDict->GetObjectBy("Pg"))) PageObjNum = pRef->GetRefObjNum(); CFX_ByteString type = pKidDict->GetStringBy("Type"); @@ -281,7 +281,7 @@ void CPDF_StructElementImpl::LoadKid(uint32_t PageObjNum, return; } pKid->m_Type = CPDF_StructKid::StreamContent; - if (CPDF_Reference* pRef = ToReference(pKidDict->GetElement("Stm"))) { + if (CPDF_Reference* pRef = ToReference(pKidDict->GetObjectBy("Stm"))) { pKid->m_StreamContent.m_RefObjNum = pRef->GetRefObjNum(); } else { pKid->m_StreamContent.m_RefObjNum = 0; @@ -293,7 +293,7 @@ void CPDF_StructElementImpl::LoadKid(uint32_t PageObjNum, return; } pKid->m_Type = CPDF_StructKid::Object; - if (CPDF_Reference* pObj = ToReference(pKidDict->GetElement("Obj"))) { + if (CPDF_Reference* pObj = ToReference(pKidDict->GetObjectBy("Obj"))) { pKid->m_Object.m_RefObjNum = pObj->GetRefObjNum(); } else { pKid->m_Object.m_RefObjNum = 0; @@ -325,7 +325,7 @@ static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs, pDict = pStream->GetDict(); } else if (CPDF_Array* pArray = pAttrs->AsArray()) { for (uint32_t i = 0; i < pArray->GetCount(); i++) { - CPDF_Object* pElement = pArray->GetElementValue(i); + CPDF_Object* pElement = pArray->GetDirectObjectAt(i); pDict = FindAttrDict(pElement, owner, nLevel + 1); if (pDict) return pDict; @@ -352,17 +352,17 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, } return m_pParent->GetAttr(owner, name, TRUE, fLevel + 1); } - CPDF_Object* pA = m_pDict->GetElementValue("A"); + CPDF_Object* pA = m_pDict->GetDirectObjectBy("A"); if (pA) { CPDF_Dictionary* pAttrDict = FindAttrDict(pA, owner); if (pAttrDict) { - CPDF_Object* pAttr = pAttrDict->GetElementValue(name); + CPDF_Object* pAttr = pAttrDict->GetDirectObjectBy(name); if (pAttr) { return pAttr; } } } - CPDF_Object* pC = m_pDict->GetElementValue("C"); + CPDF_Object* pC = m_pDict->GetDirectObjectBy("C"); if (!pC) return nullptr; @@ -375,14 +375,14 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, CFX_ByteString class_name = pArray->GetStringAt(i); CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name); if (pClassDict && pClassDict->GetStringBy("O") == owner) - return pClassDict->GetElementValue(name); + return pClassDict->GetDirectObjectBy(name); } return nullptr; } CFX_ByteString class_name = pC->GetString(); CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name); if (pClassDict && pClassDict->GetStringBy("O") == owner) - return pClassDict->GetElementValue(name); + return pClassDict->GetDirectObjectBy(name); return nullptr; } CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, @@ -396,7 +396,7 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, if (subindex >= static_cast(pArray->GetCount())) return pAttr; - return pArray->GetElementValue(subindex); + return pArray->GetDirectObjectAt(subindex); } CFX_ByteString CPDF_StructElementImpl::GetName( const CFX_ByteStringC& owner, diff --git a/core/fpdfdoc/doc_utils.cpp b/core/fpdfdoc/doc_utils.cpp index e2e3e13e8c..f83d001af5 100644 --- a/core/fpdfdoc/doc_utils.cpp +++ b/core/fpdfdoc/doc_utils.cpp @@ -31,7 +31,7 @@ CPDF_Object* SearchNumberNode(const CPDF_Dictionary* pNode, int num) { for (uint32_t i = 0; i < dwCount; i++) { int index = pNumbers->GetIntegerAt(i * 2); if (num == index) { - return pNumbers->GetElementValue(i * 2 + 1); + return pNumbers->GetDirectObjectAt(i * 2 + 1); } if (index > num) { break; @@ -743,7 +743,7 @@ CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, if (!pFieldDict) { return NULL; } - CPDF_Object* pAttr = pFieldDict->GetElementValue(name); + CPDF_Object* pAttr = pFieldDict->GetDirectObjectBy(name); if (pAttr) { return pAttr; } diff --git a/core/fpdftext/fpdf_text_int.cpp b/core/fpdftext/fpdf_text_int.cpp index f8f201b547..8d8fa4e9ed 100644 --- a/core/fpdftext/fpdf_text_int.cpp +++ b/core/fpdftext/fpdf_text_int.cpp @@ -1125,7 +1125,7 @@ int32_t CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) { continue; pDict = item.GetParam(); CPDF_String* temp = - ToString(pDict ? pDict->GetElement("ActualText") : nullptr); + ToString(pDict ? pDict->GetObjectBy("ActualText") : nullptr); if (temp) { bExist = TRUE; actText = temp->GetUnicodeText(); diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp index d32b604b0c..c69dcbebcd 100644 --- a/fpdfsdk/formfiller/cba_fontmap.cpp +++ b/fpdfsdk/formfiller/cba_fontmap.cpp @@ -159,7 +159,7 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, } // to avoid checkbox and radiobutton - CPDF_Object* pObject = pAPDict->GetElement(m_sAPType); + CPDF_Object* pObject = pAPDict->GetObjectBy(m_sAPType); if (ToDictionary(pObject)) return; diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp index 2541bddb50..484993c6a1 100644 --- a/fpdfsdk/fpdf_ext.cpp +++ b/fpdfsdk/fpdf_ext.cpp @@ -200,7 +200,7 @@ DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document) { if (!pRoot) return PAGEMODE_UNKNOWN; - CPDF_Object* pName = pRoot->GetElement("PageMode"); + CPDF_Object* pName = pRoot->GetObjectBy("PageMode"); if (!pName) return PAGEMODE_USENONE; diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp index c2ecbc84a6..46501865e5 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp @@ -96,7 +96,7 @@ int ParserAnnots(CPDF_Document* pSourceDoc, uint32_t dwSize = pAnnots->GetCount(); for (int i = 0; i < (int)dwSize; i++) { - CPDF_Dictionary* pAnnotDic = ToDictionary(pAnnots->GetElementValue(i)); + CPDF_Dictionary* pAnnotDic = ToDictionary(pAnnots->GetDirectObjectAt(i)); if (!pAnnotDic) continue; diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp index 23118b4c3f..d47cb02b1d 100644 --- a/fpdfsdk/fpdf_transformpage.cpp +++ b/fpdfsdk/fpdf_transformpage.cpp @@ -120,7 +120,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, CPDF_Dictionary* pPageDic = pPage->m_pFormDict; CPDF_Object* pContentObj = - pPageDic ? pPageDic->GetElement("Contents") : nullptr; + pPageDic ? pPageDic->GetObjectBy("Contents") : nullptr; if (!pContentObj) pContentObj = pPageDic ? pPageDic->GetArrayBy("Contents") : nullptr; if (!pContentObj) @@ -277,7 +277,7 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page, CPDF_Dictionary* pPageDic = pPage->m_pFormDict; CPDF_Object* pContentObj = - pPageDic ? pPageDic->GetElement("Contents") : nullptr; + pPageDic ? pPageDic->GetObjectBy("Contents") : nullptr; if (!pContentObj) pContentObj = pPageDic ? pPageDic->GetArrayBy("Contents") : nullptr; if (!pContentObj) diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp index 6a65e4ae22..1b2daaeb5a 100644 --- a/fpdfsdk/fpdfdoc.cpp +++ b/fpdfsdk/fpdfdoc.cpp @@ -288,7 +288,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, return FALSE; for (int i = *startPos; i < (int)pAnnots->GetCount(); i++) { CPDF_Dictionary* pDict = - ToDictionary(static_cast(pAnnots->GetElementValue(i))); + ToDictionary(static_cast(pAnnots->GetDirectObjectAt(i))); if (!pDict) continue; if (pDict->GetStringBy("Subtype").Equal("Link")) { diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp index 72148b8e6d..25ace0e039 100644 --- a/fpdfsdk/fpdfeditpage.cpp +++ b/fpdfsdk/fpdfeditpage.cpp @@ -111,8 +111,8 @@ DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) { CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || - !pPage->m_pFormDict->GetElement("Type")->GetDirect() || - pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( + !pPage->m_pFormDict->GetObjectBy("Type")->GetDirect() || + pPage->m_pFormDict->GetObjectBy("Type")->GetDirect()->GetString().Compare( "Page")) { return -1; } @@ -122,13 +122,13 @@ DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) { while (pDict) { if (pDict->KeyExist("Rotate")) { - CPDF_Object* pRotateObj = pDict->GetElement("Rotate")->GetDirect(); + CPDF_Object* pRotateObj = pDict->GetObjectBy("Rotate")->GetDirect(); return pRotateObj ? pRotateObj->GetInteger() / 90 : 0; } if (!pDict->KeyExist("Parent")) break; - pDict = ToDictionary(pDict->GetElement("Parent")->GetDirect()); + pDict = ToDictionary(pDict->GetObjectBy("Parent")->GetDirect()); } return 0; @@ -138,8 +138,8 @@ DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_obj) { CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || - !pPage->m_pFormDict->GetElement("Type")->GetDirect() || - pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( + !pPage->m_pFormDict->GetObjectBy("Type")->GetDirect() || + pPage->m_pFormDict->GetObjectBy("Type")->GetDirect()->GetString().Compare( "Page")) { return; } @@ -182,8 +182,8 @@ DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page) { CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || - !pPage->m_pFormDict->GetElement("Type")->GetDirect() || - pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( + !pPage->m_pFormDict->GetObjectBy("Type")->GetDirect() || + pPage->m_pFormDict->GetObjectBy("Type")->GetDirect()->GetString().Compare( "Page")) { return -1; } @@ -194,7 +194,7 @@ DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, int index) { CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || - pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( + pPage->m_pFormDict->GetObjectBy("Type")->GetDirect()->GetString().Compare( "Page")) { return nullptr; } @@ -247,8 +247,8 @@ FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) { DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page) { CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || - !pPage->m_pFormDict->GetElement("Type")->GetDirect() || - pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( + !pPage->m_pFormDict->GetObjectBy("Type")->GetDirect() || + pPage->m_pFormDict->GetObjectBy("Type")->GetDirect()->GetString().Compare( "Page")) { return FALSE; } @@ -310,8 +310,8 @@ DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page, DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) { CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || - !pPage->m_pFormDict->GetElement("Type")->GetDirect() || - pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( + !pPage->m_pFormDict->GetObjectBy("Type")->GetDirect() || + pPage->m_pFormDict->GetObjectBy("Type")->GetDirect()->GetString().Compare( "Page")) { return; } diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp index 7484a3e85f..94fa6bae84 100644 --- a/fpdfsdk/fpdfppo.cpp +++ b/fpdfsdk/fpdfppo.cpp @@ -69,7 +69,7 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc, pNewRoot->SetAt("Type", new CPDF_Name("Catalog")); } - CPDF_Object* pElement = pNewRoot->GetElement("Pages"); + CPDF_Object* pElement = pNewRoot->GetObjectBy("Pages"); CPDF_Dictionary* pNewPages = pElement ? ToDictionary(pElement->GetDirect()) : nullptr; if (!pNewPages) { @@ -184,25 +184,25 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag( if (!pDict->KeyExist("Parent") || !pDict->KeyExist("Type")) return nullptr; - CPDF_Object* pType = pDict->GetElement("Type")->GetDirect(); + CPDF_Object* pType = pDict->GetObjectBy("Type")->GetDirect(); if (!ToName(pType)) return nullptr; if (pType->GetString().Compare("Page")) return nullptr; - CPDF_Dictionary* pp = ToDictionary(pDict->GetElement("Parent")->GetDirect()); + CPDF_Dictionary* pp = ToDictionary(pDict->GetObjectBy("Parent")->GetDirect()); if (!pp) return nullptr; if (pDict->KeyExist((const char*)nSrctag)) - return pDict->GetElement((const char*)nSrctag); + return pDict->GetObjectBy((const char*)nSrctag); while (pp) { if (pp->KeyExist((const char*)nSrctag)) - return pp->GetElement((const char*)nSrctag); + return pp->GetObjectBy((const char*)nSrctag); if (!pp->KeyExist("Parent")) break; - pp = ToDictionary(pp->GetElement("Parent")->GetDirect()); + pp = ToDictionary(pp->GetObjectBy("Parent")->GetDirect()); } return nullptr; } @@ -243,7 +243,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, CPDF_Array* pArray = pObj->AsArray(); uint32_t count = pArray->GetCount(); for (uint32_t i = 0; i < count; ++i) { - CPDF_Object* pNextObj = pArray->GetElement(i); + CPDF_Object* pNextObj = pArray->GetObjectAt(i); if (!pNextObj) return FALSE; if (!UpdateReference(pNextObj, pDoc, pObjNumberMap)) diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp index 147f147a65..e11e1f2d6d 100644 --- a/fpdfsdk/fpdfsave.cpp +++ b/fpdfsdk/fpdfsave.cpp @@ -101,7 +101,7 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument, if (!pAcroForm) return false; - CPDF_Object* pXFA = pAcroForm->GetElement("XFA"); + CPDF_Object* pXFA = pAcroForm->GetObjectBy("XFA"); if (!pXFA) return true; @@ -118,7 +118,7 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument, int iTemplate = -1; int iLast = size - 2; for (int i = 0; i < size - 1; i++) { - CPDF_Object* pPDFObj = pArray->GetElement(i); + CPDF_Object* pPDFObj = pArray->GetObjectAt(i); if (!pPDFObj->IsString()) continue; if (pPDFObj->GetString() == "form") @@ -146,7 +146,7 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument, CPDF_Stream* pDataSetsStream = NULL; if (iFormIndex != -1) { // Get form CPDF_Stream - CPDF_Object* pFormPDFObj = pArray->GetElement(iFormIndex); + CPDF_Object* pFormPDFObj = pArray->GetObjectAt(iFormIndex); if (pFormPDFObj->IsReference()) { CPDF_Object* pFormDirectObj = pFormPDFObj->GetDirect(); if (pFormDirectObj && pFormDirectObj->IsStream()) { @@ -159,7 +159,7 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument, if (iDataSetsIndex != -1) { // Get datasets CPDF_Stream - CPDF_Object* pDataSetsPDFObj = pArray->GetElement(iDataSetsIndex); + CPDF_Object* pDataSetsPDFObj = pArray->GetObjectAt(iDataSetsIndex); if (pDataSetsPDFObj->IsReference()) { CPDF_Reference* pDataSetsRefObj = (CPDF_Reference*)pDataSetsPDFObj; CPDF_Object* pDataSetsDirectObj = pDataSetsRefObj->GetDirect(); diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 1406939e5d..9995fc0426 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -358,7 +358,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, if (!pAcroForm) return FALSE; - CPDF_Object* pXFA = pAcroForm->GetElement("XFA"); + CPDF_Object* pXFA = pAcroForm->GetObjectBy("XFA"); if (!pXFA) return FALSE; diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp index ac2e77becb..e9c9e61ffc 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp @@ -677,7 +677,7 @@ void CPDFXFA_Document::ExportData(IXFA_Doc* hDoc, CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); if (NULL == pAcroForm) return; - CPDF_Object* pXFA = pAcroForm->GetElement("XFA"); + CPDF_Object* pXFA = pAcroForm->GetObjectBy("XFA"); if (pXFA == NULL) return; if (!pXFA->IsArray()) @@ -687,8 +687,8 @@ void CPDFXFA_Document::ExportData(IXFA_Doc* hDoc, return; int size = pArray->GetCount(); for (int i = 1; i < size; i += 2) { - CPDF_Object* pPDFObj = pArray->GetElement(i); - CPDF_Object* pPrePDFObj = pArray->GetElement(i - 1); + CPDF_Object* pPDFObj = pArray->GetObjectAt(i); + CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1); if (!pPrePDFObj->IsString()) continue; if (!pPDFObj->IsReference()) @@ -982,7 +982,7 @@ FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, fileStream.Flush(); return FALSE; } - CPDF_Object* pXFA = pAcroForm->GetElement("XFA"); + CPDF_Object* pXFA = pAcroForm->GetObjectBy("XFA"); if (pXFA == NULL) { fileStream.Flush(); return FALSE; @@ -998,8 +998,8 @@ FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, } int size = pArray->GetCount(); for (int i = 1; i < size; i += 2) { - CPDF_Object* pPDFObj = pArray->GetElement(i); - CPDF_Object* pPrePDFObj = pArray->GetElement(i - 1); + CPDF_Object* pPDFObj = pArray->GetObjectAt(i); + CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1); if (!pPrePDFObj->IsString()) continue; if (!pPDFObj->IsReference()) diff --git a/fpdfsdk/fsdk_baseannot.cpp b/fpdfsdk/fsdk_baseannot.cpp index ea4e060737..07a47cdff9 100644 --- a/fpdfsdk/fsdk_baseannot.cpp +++ b/fpdfsdk/fsdk_baseannot.cpp @@ -565,7 +565,7 @@ FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { ap_entry = "N"; // Get the AP stream or subdirectory - CPDF_Object* psub = pAP->GetElementValue(ap_entry); + CPDF_Object* psub = pAP->GetDirectObjectBy(ap_entry); return !!psub; } diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp index 1e124623f7..6027eec23d 100644 --- a/fpdfsdk/fsdk_baseform.cpp +++ b/fpdfsdk/fsdk_baseform.cpp @@ -467,7 +467,7 @@ FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid( ap_entry = "N"; // Get the AP stream or subdirectory - CPDF_Object* psub = pAP->GetElementValue(ap_entry); + CPDF_Object* psub = pAP->GetDirectObjectBy(ap_entry); if (!psub) return FALSE; @@ -2119,7 +2119,7 @@ int CPDFSDK_InterForm::GetPageIndexByAnnotDict( if (CPDF_Dictionary* pPageDict = pDocument->GetPage(i)) { if (CPDF_Array* pAnnots = pPageDict->GetArrayBy("Annots")) { for (int j = 0, jsz = pAnnots->GetCount(); j < jsz; j++) { - CPDF_Object* pDict = pAnnots->GetElementValue(j); + CPDF_Object* pDict = pAnnots->GetDirectObjectAt(j); if (pAnnotDict == pDict) { return i; } diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index c130a036b5..0dcf730f2e 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -229,7 +229,7 @@ FX_BOOL CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) { if (pAcroForm == NULL) { return FALSE; } - CPDF_Object* pElementXFA = pAcroForm->GetElementValue("XFA"); + CPDF_Object* pElementXFA = pAcroForm->GetDirectObjectBy("XFA"); if (pElementXFA == NULL) { return FALSE; } -- cgit v1.2.3