summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-03-29 14:51:50 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-29 14:51:50 -0700
commitbd56755ba86f2d87e24a3cee5cb92aa14a81bb27 (patch)
treefb4692dc44cb549b7149be080ec26f4b7cd7b086 /core/fpdfapi
parent7f432a1c87014d6673ee69ff0ffa3724f237acf4 (diff)
downloadpdfium-bd56755ba86f2d87e24a3cee5cb92aa14a81bb27.tar.xz
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
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp6
-rw-r--r--core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp12
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_cidfont.cpp6
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_font.cpp2
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_simplefont.cpp2
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_type3font.cpp4
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_colorspace.cpp20
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_page.cpp2
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp8
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_doc.cpp10
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_func.cpp2
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_parser.cpp16
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp6
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_array.cpp10
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp60
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp34
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_document.cpp8
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp22
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp34
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_parser.cpp30
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp2
-rw-r--r--core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp4
-rw-r--r--core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp4
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_array.h8
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h4
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render.cpp9
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_image.cpp8
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp12
28 files changed, 173 insertions, 172 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<int>(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<CPDF_IndirectObjectHolder> 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<CFX_ByteString> DecoderList;
CFX_ArrayTemplate<CPDF_Object*> 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<CPDF_Function> 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();