summaryrefslogtreecommitdiff
path: root/fpdfsdk
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 /fpdfsdk
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 'fpdfsdk')
-rw-r--r--fpdfsdk/formfiller/cba_fontmap.cpp2
-rw-r--r--fpdfsdk/fpdf_ext.cpp2
-rw-r--r--fpdfsdk/fpdf_flatten.cpp2
-rw-r--r--fpdfsdk/fpdf_transformpage.cpp4
-rw-r--r--fpdfsdk/fpdfdoc.cpp2
-rw-r--r--fpdfsdk/fpdfeditpage.cpp26
-rw-r--r--fpdfsdk/fpdfppo.cpp14
-rw-r--r--fpdfsdk/fpdfsave.cpp8
-rw-r--r--fpdfsdk/fpdfview.cpp2
-rw-r--r--fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp12
-rw-r--r--fpdfsdk/fsdk_baseannot.cpp2
-rw-r--r--fpdfsdk/fsdk_baseform.cpp4
12 files changed, 40 insertions, 40 deletions
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<CPDF_Object*>(pAnnots->GetElementValue(i)));
+ ToDictionary(static_cast<CPDF_Object*>(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;
}