summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_page
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/fpdf_page
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/fpdf_page')
-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
7 files changed, 32 insertions, 32 deletions
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++;
}