summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_parser
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-09-15 10:15:32 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-15 10:15:32 -0700
commit38fd84428a1ea007a043be0b7d9b289e47aa5da0 (patch)
tree2bae09e8ae60d6d86e451eb7fa212f7aa9d899a8 /core/fpdfapi/fpdf_parser
parent41d6bbe3d413e7854be89142b70c42a89e315cba (diff)
downloadpdfium-38fd84428a1ea007a043be0b7d9b289e47aa5da0.tar.xz
Rename dictionary set and get methods
This Cl makes the Get and Set methods consistenly use {G|S}et<Type>For. BUG=pdfium:596 Review-Url: https://codereview.chromium.org/2334323005
Diffstat (limited to 'core/fpdfapi/fpdf_parser')
-rw-r--r--core/fpdfapi/fpdf_parser/cfdf_document.cpp4
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp56
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp110
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_document.cpp172
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp12
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp36
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_parser.cpp58
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp74
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_stream.cpp10
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp14
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h6
-rw-r--r--core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp34
-rw-r--r--core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp2
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h66
14 files changed, 327 insertions, 327 deletions
diff --git a/core/fpdfapi/fpdf_parser/cfdf_document.cpp b/core/fpdfapi/fpdf_parser/cfdf_document.cpp
index e2e4d0cf1e..0182948173 100644
--- a/core/fpdfapi/fpdf_parser/cfdf_document.cpp
+++ b/core/fpdfapi/fpdf_parser/cfdf_document.cpp
@@ -26,7 +26,7 @@ CFDF_Document* CFDF_Document::CreateNewDoc() {
pDoc->m_pRootDict = new CPDF_Dictionary;
pDoc->AddIndirectObject(pDoc->m_pRootDict);
CPDF_Dictionary* pFDFDict = new CPDF_Dictionary;
- pDoc->m_pRootDict->SetAt("FDF", pFDFDict);
+ pDoc->m_pRootDict->SetFor("FDF", pFDFDict);
return pDoc;
}
@@ -76,7 +76,7 @@ void CFDF_Document::ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile) {
if (CPDF_Dictionary* pMainDict =
ToDictionary(parser.GetObject(this, 0, 0, true))) {
- m_pRootDict = pMainDict->GetDictBy("Root");
+ m_pRootDict = pMainDict->GetDictFor("Root");
pMainDict->Release();
}
break;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp
index b7395ee7a5..7a9b704f53 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp
@@ -151,7 +151,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(
pObj = pObj->GetDict();
case CPDF_Object::DICTIONARY: {
CPDF_Dictionary* pDict = pObj->GetDict();
- if (pDict && pDict->GetStringBy("Type") == "Page" && !bParsePage)
+ if (pDict && pDict->GetStringFor("Type") == "Page" && !bParsePage)
continue;
for (const auto& it : *pDict) {
@@ -441,7 +441,7 @@ FX_BOOL CPDF_DataAvail::CheckRoot(DownloadHints* pHints) {
return FALSE;
}
- CPDF_Reference* pRef = ToReference(pDict->GetObjectBy("Pages"));
+ CPDF_Reference* pRef = ToReference(pDict->GetObjectFor("Pages"));
if (!pRef) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
@@ -449,7 +449,7 @@ FX_BOOL CPDF_DataAvail::CheckRoot(DownloadHints* pHints) {
m_PagesObjNum = pRef->GetRefObjNum();
CPDF_Reference* pAcroFormRef =
- ToReference(m_pRoot->GetDict()->GetObjectBy("AcroForm"));
+ ToReference(m_pRoot->GetDict()->GetObjectFor("AcroForm"));
if (pAcroFormRef) {
m_bHaveAcroForm = TRUE;
m_dwAcroFormObjNum = pAcroFormRef->GetRefObjNum();
@@ -467,7 +467,7 @@ FX_BOOL CPDF_DataAvail::CheckRoot(DownloadHints* pHints) {
FX_BOOL CPDF_DataAvail::PreparePageItem() {
CPDF_Dictionary* pRoot = m_pDocument->GetRoot();
CPDF_Reference* pRef =
- ToReference(pRoot ? pRoot->GetObjectBy("Pages") : nullptr);
+ ToReference(pRoot ? pRoot->GetObjectFor("Pages") : nullptr);
if (!pRef) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
@@ -513,7 +513,7 @@ FX_BOOL CPDF_DataAvail::CheckPage(DownloadHints* pHints) {
continue;
}
- CFX_ByteString type = pObj->GetDict()->GetStringBy("Type");
+ CFX_ByteString type = pObj->GetDict()->GetStringFor("Type");
if (type == "Pages") {
m_PagesArray.Add(pObj);
continue;
@@ -560,7 +560,7 @@ FX_BOOL CPDF_DataAvail::GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages) {
}
CPDF_Dictionary* pDict = pPages->GetDict();
- CPDF_Object* pKids = pDict ? pDict->GetObjectBy("Kids") : nullptr;
+ CPDF_Object* pKids = pDict ? pDict->GetObjectFor("Kids") : nullptr;
if (!pKids)
return TRUE;
@@ -633,19 +633,19 @@ FX_BOOL CPDF_DataAvail::CheckHeader(DownloadHints* pHints) {
FX_BOOL CPDF_DataAvail::CheckFirstPage(DownloadHints* pHints) {
CPDF_Dictionary* pDict = m_pLinearized->GetDict();
- CPDF_Object* pEndOffSet = pDict ? pDict->GetObjectBy("E") : nullptr;
+ CPDF_Object* pEndOffSet = pDict ? pDict->GetObjectFor("E") : nullptr;
if (!pEndOffSet) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
}
- CPDF_Object* pXRefOffset = pDict ? pDict->GetObjectBy("T") : nullptr;
+ CPDF_Object* pXRefOffset = pDict ? pDict->GetObjectFor("T") : nullptr;
if (!pXRefOffset) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
}
- CPDF_Object* pFileLen = pDict ? pDict->GetObjectBy("L") : nullptr;
+ CPDF_Object* pFileLen = pDict ? pDict->GetObjectFor("L") : nullptr;
if (!pFileLen) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
@@ -728,13 +728,13 @@ FX_BOOL CPDF_DataAvail::CheckHintTables(DownloadHints* pHints) {
}
// The actual value is not required here, but validate its existence and type.
- CPDF_Number* pFirstPage = ToNumber(pDict->GetDirectObjectBy("O"));
+ CPDF_Number* pFirstPage = ToNumber(pDict->GetDirectObjectFor("O"));
if (!pFirstPage || !pFirstPage->IsInteger()) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
}
- CPDF_Number* pPageCount = ToNumber(pDict->GetDirectObjectBy("N"));
+ CPDF_Number* pPageCount = ToNumber(pDict->GetDirectObjectFor("N"));
if (!pPageCount || !pPageCount->IsInteger()) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
@@ -746,7 +746,7 @@ FX_BOOL CPDF_DataAvail::CheckHintTables(DownloadHints* pHints) {
return TRUE;
}
- CPDF_Array* pHintStreamRange = pDict->GetArrayBy("H");
+ CPDF_Array* pHintStreamRange = pDict->GetArrayFor("H");
size_t nHintStreamSize = pHintStreamRange ? pHintStreamRange->GetCount() : 0;
if (nHintStreamSize != 2 && nHintStreamSize != 4) {
m_docStatus = PDF_DATAAVAIL_ERROR;
@@ -869,10 +869,10 @@ FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) {
return FALSE;
CPDF_Dictionary* pDict = m_pLinearized->GetDict();
- if (!pDict || !pDict->GetObjectBy("Linearized"))
+ if (!pDict || !pDict->GetObjectFor("Linearized"))
return FALSE;
- CPDF_Object* pLen = pDict->GetObjectBy("L");
+ CPDF_Object* pLen = pDict->GetObjectFor("L");
if (!pLen)
return FALSE;
@@ -881,7 +881,7 @@ FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) {
m_bLinearized = TRUE;
- if (CPDF_Number* pNo = ToNumber(pDict->GetObjectBy("P")))
+ if (CPDF_Number* pNo = ToNumber(pDict->GetObjectFor("P")))
m_dwFirstPageNo = pNo->GetInteger();
return TRUE;
@@ -958,11 +958,11 @@ int32_t CPDF_DataAvail::CheckCrossRefStream(DownloadHints* pHints,
}
CPDF_Dictionary* pDict = pObj->GetDict();
- CPDF_Name* pName = ToName(pDict ? pDict->GetObjectBy("Type") : nullptr);
+ CPDF_Name* pName = ToName(pDict ? pDict->GetObjectFor("Type") : nullptr);
if (pName) {
if (pName->GetString() == "XRef") {
m_Pos += m_parser.m_pSyntax->SavePos();
- xref_offset = pObj->GetDict()->GetIntegerBy("Prev");
+ xref_offset = pObj->GetDict()->GetIntegerFor("Prev");
pObj->Release();
return 1;
}
@@ -1205,7 +1205,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(DownloadHints* pHints) {
return FALSE;
CPDF_Dictionary* pTrailerDict = pTrailer->GetDict();
- CPDF_Object* pEncrypt = pTrailerDict->GetObjectBy("Encrypt");
+ CPDF_Object* pEncrypt = pTrailerDict->GetObjectFor("Encrypt");
if (ToReference(pEncrypt)) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
return TRUE;
@@ -1328,10 +1328,10 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(uint32_t dwPageNo,
pPageNode->m_dwPageNo = dwPageNo;
CPDF_Dictionary* pDict = pPage->GetDict();
- CFX_ByteString type = pDict->GetStringBy("Type");
+ CFX_ByteString type = pDict->GetStringFor("Type");
if (type == "Pages") {
pPageNode->m_type = PDF_PAGENODE_PAGES;
- CPDF_Object* pKids = pDict->GetObjectBy("Kids");
+ CPDF_Object* pKids = pDict->GetObjectFor("Kids");
if (!pKids) {
m_docStatus = PDF_DATAAVAIL_PAGE;
return TRUE;
@@ -1464,7 +1464,7 @@ FX_BOOL CPDF_DataAvail::CheckPageCount(DownloadHints* pHints) {
return TRUE;
}
- int count = pPagesDict->GetIntegerBy("Count");
+ int count = pPagesDict->GetIntegerFor("Count");
if (count > 0) {
pPages->Release();
return TRUE;
@@ -1544,7 +1544,7 @@ FX_BOOL CPDF_DataAvail::CheckPageAnnots(uint32_t dwPage,
if (!pPageDict)
return TRUE;
- CPDF_Object* pAnnots = pPageDict->GetObjectBy("Annots");
+ CPDF_Object* pAnnots = pPageDict->GetObjectFor("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->GetObjectBy("Parent");
+ CPDF_Object* pParent = pDict->GetObjectFor("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->GetObjectBy("Resources");
+ CPDF_Object* pRet = pParentDict->GetObjectFor("Resources");
if (pRet) {
m_pPageResource = pRet;
return TRUE;
@@ -1710,7 +1710,7 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail(
}
if (m_pPageDict && !m_bNeedDownLoadResource) {
- m_pPageResource = m_pPageDict->GetObjectBy("Resources");
+ m_pPageResource = m_pPageDict->GetObjectFor("Resources");
m_bNeedDownLoadResource =
m_pPageResource || HaveResourceAncestor(m_pPageDict);
}
@@ -1761,7 +1761,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->GetDirectObjectBy("N") : nullptr;
+ CPDF_Object* pObj = pDict ? pDict->GetDirectObjectFor("N") : nullptr;
return pObj ? pObj->GetInteger() : 0;
}
return m_pDocument ? m_pDocument->GetPageCount() : 0;
@@ -1773,7 +1773,7 @@ CPDF_Dictionary* CPDF_DataAvail::GetPage(int index) {
if (m_pLinearized) {
CPDF_Dictionary* pDict = m_pLinearized->GetDict();
- CPDF_Object* pObj = pDict ? pDict->GetDirectObjectBy("P") : nullptr;
+ CPDF_Object* pObj = pDict ? pDict->GetDirectObjectFor("P") : nullptr;
int pageNum = pObj ? pObj->GetInteger() : 0;
if (m_pHintTables && index != pageNum) {
@@ -1810,7 +1810,7 @@ CPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail(
if (!pRoot)
return FormAvailable;
- CPDF_Object* pAcroForm = pRoot->GetObjectBy("AcroForm");
+ CPDF_Object* pAcroForm = pRoot->GetObjectFor("AcroForm");
if (!pAcroForm)
return FormNotExist;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
index e79bac1839..cc395a2e08 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
@@ -71,59 +71,59 @@ CPDF_Object* CPDF_Dictionary::CloneNonCyclic(
return pCopy;
}
-CPDF_Object* CPDF_Dictionary::GetObjectBy(const CFX_ByteString& key) const {
+CPDF_Object* CPDF_Dictionary::GetObjectFor(const CFX_ByteString& key) const {
auto it = m_Map.find(key);
return it != m_Map.end() ? it->second : nullptr;
}
-CPDF_Object* CPDF_Dictionary::GetDirectObjectBy(
+CPDF_Object* CPDF_Dictionary::GetDirectObjectFor(
const CFX_ByteString& key) const {
- CPDF_Object* p = GetObjectBy(key);
+ CPDF_Object* p = GetObjectFor(key);
return p ? p->GetDirect() : nullptr;
}
-CFX_ByteString CPDF_Dictionary::GetStringBy(const CFX_ByteString& key) const {
- CPDF_Object* p = GetObjectBy(key);
+CFX_ByteString CPDF_Dictionary::GetStringFor(const CFX_ByteString& key) const {
+ CPDF_Object* p = GetObjectFor(key);
return p ? p->GetString() : CFX_ByteString();
}
-CFX_WideString CPDF_Dictionary::GetUnicodeTextBy(
+CFX_WideString CPDF_Dictionary::GetUnicodeTextFor(
const CFX_ByteString& key) const {
- CPDF_Object* p = GetObjectBy(key);
+ CPDF_Object* p = GetObjectFor(key);
if (CPDF_Reference* pRef = ToReference(p))
p = pRef->GetDirect();
return p ? p->GetUnicodeText() : CFX_WideString();
}
-CFX_ByteString CPDF_Dictionary::GetStringBy(const CFX_ByteString& key,
- const CFX_ByteString& def) const {
- CPDF_Object* p = GetObjectBy(key);
+CFX_ByteString CPDF_Dictionary::GetStringFor(const CFX_ByteString& key,
+ const CFX_ByteString& def) const {
+ CPDF_Object* p = GetObjectFor(key);
return p ? p->GetString() : CFX_ByteString(def);
}
-int CPDF_Dictionary::GetIntegerBy(const CFX_ByteString& key) const {
- CPDF_Object* p = GetObjectBy(key);
+int CPDF_Dictionary::GetIntegerFor(const CFX_ByteString& key) const {
+ CPDF_Object* p = GetObjectFor(key);
return p ? p->GetInteger() : 0;
}
-int CPDF_Dictionary::GetIntegerBy(const CFX_ByteString& key, int def) const {
- CPDF_Object* p = GetObjectBy(key);
+int CPDF_Dictionary::GetIntegerFor(const CFX_ByteString& key, int def) const {
+ CPDF_Object* p = GetObjectFor(key);
return p ? p->GetInteger() : def;
}
-FX_FLOAT CPDF_Dictionary::GetNumberBy(const CFX_ByteString& key) const {
- CPDF_Object* p = GetObjectBy(key);
+FX_FLOAT CPDF_Dictionary::GetNumberFor(const CFX_ByteString& key) const {
+ CPDF_Object* p = GetObjectFor(key);
return p ? p->GetNumber() : 0;
}
-bool CPDF_Dictionary::GetBooleanBy(const CFX_ByteString& key,
- bool bDefault) const {
- CPDF_Object* p = GetObjectBy(key);
+bool CPDF_Dictionary::GetBooleanFor(const CFX_ByteString& key,
+ bool bDefault) const {
+ CPDF_Object* p = GetObjectFor(key);
return ToBoolean(p) ? p->GetInteger() != 0 : bDefault;
}
-CPDF_Dictionary* CPDF_Dictionary::GetDictBy(const CFX_ByteString& key) const {
- CPDF_Object* p = GetDirectObjectBy(key);
+CPDF_Dictionary* CPDF_Dictionary::GetDictFor(const CFX_ByteString& key) const {
+ CPDF_Object* p = GetDirectObjectFor(key);
if (!p)
return nullptr;
if (CPDF_Dictionary* pDict = p->AsDictionary())
@@ -133,25 +133,25 @@ CPDF_Dictionary* CPDF_Dictionary::GetDictBy(const CFX_ByteString& key) const {
return nullptr;
}
-CPDF_Array* CPDF_Dictionary::GetArrayBy(const CFX_ByteString& key) const {
- return ToArray(GetDirectObjectBy(key));
+CPDF_Array* CPDF_Dictionary::GetArrayFor(const CFX_ByteString& key) const {
+ return ToArray(GetDirectObjectFor(key));
}
-CPDF_Stream* CPDF_Dictionary::GetStreamBy(const CFX_ByteString& key) const {
- return ToStream(GetDirectObjectBy(key));
+CPDF_Stream* CPDF_Dictionary::GetStreamFor(const CFX_ByteString& key) const {
+ return ToStream(GetDirectObjectFor(key));
}
-CFX_FloatRect CPDF_Dictionary::GetRectBy(const CFX_ByteString& key) const {
+CFX_FloatRect CPDF_Dictionary::GetRectFor(const CFX_ByteString& key) const {
CFX_FloatRect rect;
- CPDF_Array* pArray = GetArrayBy(key);
+ CPDF_Array* pArray = GetArrayFor(key);
if (pArray)
rect = pArray->GetRect();
return rect;
}
-CFX_Matrix CPDF_Dictionary::GetMatrixBy(const CFX_ByteString& key) const {
+CFX_Matrix CPDF_Dictionary::GetMatrixFor(const CFX_ByteString& key) const {
CFX_Matrix matrix;
- CPDF_Array* pArray = GetArrayBy(key);
+ CPDF_Array* pArray = GetArrayFor(key);
if (pArray)
matrix = pArray->GetMatrix();
return matrix;
@@ -162,13 +162,13 @@ FX_BOOL CPDF_Dictionary::KeyExist(const CFX_ByteString& key) const {
}
bool CPDF_Dictionary::IsSignatureDict() const {
- CPDF_Object* pType = GetDirectObjectBy("Type");
+ CPDF_Object* pType = GetDirectObjectFor("Type");
if (!pType)
- pType = GetDirectObjectBy("FT");
+ pType = GetDirectObjectFor("FT");
return pType && pType->GetString() == "Sig";
}
-void CPDF_Dictionary::SetAt(const CFX_ByteString& key, CPDF_Object* pObj) {
+void CPDF_Dictionary::SetFor(const CFX_ByteString& key, CPDF_Object* pObj) {
auto it = m_Map.find(key);
if (it == m_Map.end()) {
if (pObj)
@@ -186,7 +186,7 @@ void CPDF_Dictionary::SetAt(const CFX_ByteString& key, CPDF_Object* pObj) {
m_Map.erase(it);
}
-void CPDF_Dictionary::RemoveAt(const CFX_ByteString& key) {
+void CPDF_Dictionary::RemoveFor(const CFX_ByteString& key) {
auto it = m_Map.find(key);
if (it == m_Map.end())
return;
@@ -214,46 +214,46 @@ void CPDF_Dictionary::ReplaceKey(const CFX_ByteString& oldkey,
m_Map.erase(old_it);
}
-void CPDF_Dictionary::SetAtInteger(const CFX_ByteString& key, int i) {
- SetAt(key, new CPDF_Number(i));
+void CPDF_Dictionary::SetIntegerFor(const CFX_ByteString& key, int i) {
+ SetFor(key, new CPDF_Number(i));
}
-void CPDF_Dictionary::SetAtName(const CFX_ByteString& key,
- const CFX_ByteString& name) {
- SetAt(key, new CPDF_Name(name));
+void CPDF_Dictionary::SetNameFor(const CFX_ByteString& key,
+ const CFX_ByteString& name) {
+ SetFor(key, new CPDF_Name(name));
}
-void CPDF_Dictionary::SetAtString(const CFX_ByteString& key,
- const CFX_ByteString& str) {
- SetAt(key, new CPDF_String(str, FALSE));
+void CPDF_Dictionary::SetStringFor(const CFX_ByteString& key,
+ const CFX_ByteString& str) {
+ SetFor(key, new CPDF_String(str, FALSE));
}
-void CPDF_Dictionary::SetAtReference(const CFX_ByteString& key,
- CPDF_IndirectObjectHolder* pDoc,
- uint32_t objnum) {
- SetAt(key, new CPDF_Reference(pDoc, objnum));
+void CPDF_Dictionary::SetReferenceFor(const CFX_ByteString& key,
+ CPDF_IndirectObjectHolder* pDoc,
+ uint32_t objnum) {
+ SetFor(key, new CPDF_Reference(pDoc, objnum));
}
-void CPDF_Dictionary::SetAtNumber(const CFX_ByteString& key, FX_FLOAT f) {
- SetAt(key, new CPDF_Number(f));
+void CPDF_Dictionary::SetNumberFor(const CFX_ByteString& key, FX_FLOAT f) {
+ SetFor(key, new CPDF_Number(f));
}
-void CPDF_Dictionary::SetAtBoolean(const CFX_ByteString& key, bool bValue) {
- SetAt(key, new CPDF_Boolean(bValue));
+void CPDF_Dictionary::SetBooleanFor(const CFX_ByteString& key, bool bValue) {
+ SetFor(key, new CPDF_Boolean(bValue));
}
-void CPDF_Dictionary::SetAtRect(const CFX_ByteString& key,
- const CFX_FloatRect& rect) {
+void CPDF_Dictionary::SetRectFor(const CFX_ByteString& key,
+ const CFX_FloatRect& rect) {
CPDF_Array* pArray = new CPDF_Array;
pArray->AddNumber(rect.left);
pArray->AddNumber(rect.bottom);
pArray->AddNumber(rect.right);
pArray->AddNumber(rect.top);
- SetAt(key, pArray);
+ SetFor(key, pArray);
}
-void CPDF_Dictionary::SetAtMatrix(const CFX_ByteString& key,
- const CFX_Matrix& matrix) {
+void CPDF_Dictionary::SetMatrixFor(const CFX_ByteString& key,
+ const CFX_Matrix& matrix) {
CPDF_Array* pArray = new CPDF_Array;
pArray->AddNumber(matrix.a);
pArray->AddNumber(matrix.b);
@@ -261,5 +261,5 @@ void CPDF_Dictionary::SetAtMatrix(const CFX_ByteString& key,
pArray->AddNumber(matrix.d);
pArray->AddNumber(matrix.e);
pArray->AddNumber(matrix.f);
- SetAt(key, pArray);
+ SetFor(key, pArray);
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
index b3fdc7c07f..9f5a4299e9 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
@@ -255,27 +255,27 @@ int InsertDeletePDFPage(CPDF_Document* pDoc,
CPDF_Dictionary* pPage,
FX_BOOL bInsert,
std::set<CPDF_Dictionary*>* pVisited) {
- CPDF_Array* pKidList = pPages->GetArrayBy("Kids");
+ CPDF_Array* pKidList = pPages->GetArrayFor("Kids");
if (!pKidList)
return -1;
for (size_t i = 0; i < pKidList->GetCount(); i++) {
CPDF_Dictionary* pKid = pKidList->GetDictAt(i);
- if (pKid->GetStringBy("Type") == "Page") {
+ if (pKid->GetStringFor("Type") == "Page") {
if (nPagesToGo == 0) {
if (bInsert) {
pKidList->InsertAt(i, new CPDF_Reference(pDoc, pPage->GetObjNum()));
- pPage->SetAtReference("Parent", pDoc, pPages->GetObjNum());
+ pPage->SetReferenceFor("Parent", pDoc, pPages->GetObjNum());
} else {
pKidList->RemoveAt(i);
}
- pPages->SetAtInteger(
- "Count", pPages->GetIntegerBy("Count") + (bInsert ? 1 : -1));
+ pPages->SetIntegerFor(
+ "Count", pPages->GetIntegerFor("Count") + (bInsert ? 1 : -1));
return 1;
}
nPagesToGo--;
} else {
- int nPages = pKid->GetIntegerBy("Count");
+ int nPages = pKid->GetIntegerFor("Count");
if (nPagesToGo < nPages) {
if (pdfium::ContainsKey(*pVisited, pKid))
return -1;
@@ -285,8 +285,8 @@ int InsertDeletePDFPage(CPDF_Document* pDoc,
pVisited) < 0) {
return -1;
}
- pPages->SetAtInteger(
- "Count", pPages->GetIntegerBy("Count") + (bInsert ? 1 : -1));
+ pPages->SetIntegerFor(
+ "Count", pPages->GetIntegerFor("Count") + (bInsert ? 1 : -1));
return 1;
}
nPagesToGo -= nPages;
@@ -300,7 +300,7 @@ int InsertNewPage(CPDF_Document* pDoc,
CPDF_Dictionary* pPageDict,
CFX_ArrayTemplate<uint32_t>& pageList) {
CPDF_Dictionary* pRoot = pDoc->GetRoot();
- CPDF_Dictionary* pPages = pRoot ? pRoot->GetDictBy("Pages") : nullptr;
+ CPDF_Dictionary* pPages = pRoot ? pRoot->GetDictFor("Pages") : nullptr;
if (!pPages)
return -1;
@@ -309,14 +309,14 @@ int InsertNewPage(CPDF_Document* pDoc,
return -1;
if (iPage == nPages) {
- CPDF_Array* pPagesList = pPages->GetArrayBy("Kids");
+ CPDF_Array* pPagesList = pPages->GetArrayFor("Kids");
if (!pPagesList) {
pPagesList = new CPDF_Array;
- pPages->SetAt("Kids", pPagesList);
+ pPages->SetFor("Kids", pPagesList);
}
pPagesList->Add(pPageDict, pDoc);
- pPages->SetAtInteger("Count", nPages + 1);
- pPageDict->SetAtReference("Parent", pDoc, pPages->GetObjNum());
+ pPages->SetIntegerFor("Count", nPages + 1);
+ pPageDict->SetReferenceFor("Parent", pDoc, pPages->GetObjNum());
} else {
std::set<CPDF_Dictionary*> stack = {pPages};
if (InsertDeletePDFPage(pDoc, pPages, iPage, pPageDict, TRUE, &stack) < 0)
@@ -328,10 +328,10 @@ int InsertNewPage(CPDF_Document* pDoc,
int CountPages(CPDF_Dictionary* pPages,
std::set<CPDF_Dictionary*>* visited_pages) {
- int count = pPages->GetIntegerBy("Count");
+ int count = pPages->GetIntegerFor("Count");
if (count > 0 && count < FPDF_PAGE_MAX_NUM)
return count;
- CPDF_Array* pKidList = pPages->GetArrayBy("Kids");
+ CPDF_Array* pKidList = pPages->GetArrayFor("Kids");
if (!pKidList)
return 0;
count = 0;
@@ -349,7 +349,7 @@ int CountPages(CPDF_Dictionary* pPages,
count++;
}
}
- pPages->SetAtInteger("Count", count);
+ pPages->SetIntegerFor("Count", count);
return count;
}
@@ -388,11 +388,11 @@ void ProcessNonbCJK(CPDF_Dictionary* pBaseDict,
basefont += ",Bold";
else if (italic)
basefont += ",Italic";
- pBaseDict->SetAtName("Subtype", "TrueType");
- pBaseDict->SetAtName("BaseFont", basefont);
- pBaseDict->SetAtNumber("FirstChar", 32);
- pBaseDict->SetAtNumber("LastChar", 255);
- pBaseDict->SetAt("Widths", pWidths);
+ pBaseDict->SetNameFor("Subtype", "TrueType");
+ pBaseDict->SetNameFor("BaseFont", basefont);
+ pBaseDict->SetNumberFor("FirstChar", 32);
+ pBaseDict->SetNumberFor("LastChar", 255);
+ pBaseDict->SetFor("Widths", pWidths);
}
} // namespace
@@ -446,16 +446,16 @@ void CPDF_Document::LoadLinearizedDoc(CPDF_Dictionary* pLinearizationParams) {
LoadDocInternal();
uint32_t dwPageCount = 0;
- CPDF_Object* pCount = pLinearizationParams->GetObjectBy("N");
+ CPDF_Object* pCount = pLinearizationParams->GetObjectFor("N");
if (ToNumber(pCount))
dwPageCount = pCount->GetInteger();
m_PageList.SetSize(dwPageCount);
- CPDF_Object* pNo = pLinearizationParams->GetObjectBy("P");
+ CPDF_Object* pNo = pLinearizationParams->GetObjectFor("P");
if (ToNumber(pNo))
m_iFirstPageNo = pNo->GetInteger();
- CPDF_Object* pObjNum = pLinearizationParams->GetObjectBy("O");
+ CPDF_Object* pObjNum = pLinearizationParams->GetObjectFor("O");
if (ToNumber(pObjNum))
m_dwFirstPageObjNum = pObjNum->GetInteger();
}
@@ -468,7 +468,7 @@ CPDF_Dictionary* CPDF_Document::FindPDFPage(CPDF_Dictionary* pPages,
int iPage,
int nPagesToGo,
int level) {
- CPDF_Array* pKidList = pPages->GetArrayBy("Kids");
+ CPDF_Array* pKidList = pPages->GetArrayFor("Kids");
if (!pKidList)
return nPagesToGo == 0 ? pPages : nullptr;
@@ -490,7 +490,7 @@ CPDF_Dictionary* CPDF_Document::FindPDFPage(CPDF_Dictionary* pPages,
m_PageList.SetAt(iPage - nPagesToGo, pKid->GetObjNum());
nPagesToGo--;
} else {
- int nPages = pKid->GetIntegerBy("Count");
+ int nPages = pKid->GetIntegerFor("Count");
if (nPagesToGo < nPages)
return FindPDFPage(pKid, iPage, nPagesToGo, level + 1);
@@ -502,7 +502,7 @@ CPDF_Dictionary* CPDF_Document::FindPDFPage(CPDF_Dictionary* pPages,
CPDF_Dictionary* CPDF_Document::GetPagesDict() const {
CPDF_Dictionary* pRoot = GetRoot();
- return pRoot ? pRoot->GetDictBy("Pages") : nullptr;
+ return pRoot ? pRoot->GetDictFor("Pages") : nullptr;
}
CPDF_Dictionary* CPDF_Document::GetPage(int iPage) {
@@ -550,14 +550,14 @@ int CPDF_Document::FindPageIndex(CPDF_Dictionary* pNode,
return -1;
}
- CPDF_Array* pKidList = pNode->GetArrayBy("Kids");
+ CPDF_Array* pKidList = pNode->GetArrayFor("Kids");
if (!pKidList)
return -1;
if (level >= FX_MAX_PAGE_LEVEL)
return -1;
- size_t count = pNode->GetIntegerBy("Count");
+ size_t count = pNode->GetIntegerFor("Count");
if (count <= skip_count) {
skip_count -= count;
index += count;
@@ -673,21 +673,21 @@ CPDF_Image* CPDF_Document::LoadImageF(CPDF_Object* pObj) {
void CPDF_Document::CreateNewDoc() {
ASSERT(!m_pRootDict && !m_pInfoDict);
m_pRootDict = new CPDF_Dictionary;
- m_pRootDict->SetAtName("Type", "Catalog");
+ m_pRootDict->SetNameFor("Type", "Catalog");
int objnum = AddIndirectObject(m_pRootDict);
CPDF_Dictionary* pPages = new CPDF_Dictionary;
- pPages->SetAtName("Type", "Pages");
- pPages->SetAtNumber("Count", 0);
- pPages->SetAt("Kids", new CPDF_Array);
+ pPages->SetNameFor("Type", "Pages");
+ pPages->SetNumberFor("Count", 0);
+ pPages->SetFor("Kids", new CPDF_Array);
objnum = AddIndirectObject(pPages);
- m_pRootDict->SetAtReference("Pages", this, objnum);
+ m_pRootDict->SetReferenceFor("Pages", this, objnum);
m_pInfoDict = new CPDF_Dictionary;
AddIndirectObject(m_pInfoDict);
}
CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) {
CPDF_Dictionary* pDict = new CPDF_Dictionary;
- pDict->SetAtName("Type", "Page");
+ pDict->SetNameFor("Type", "Page");
uint32_t dwObjNum = AddIndirectObject(pDict);
if (InsertNewPage(this, iPage, pDict, m_PageList) < 0) {
ReleaseIndirectObject(dwObjNum);
@@ -701,7 +701,7 @@ void CPDF_Document::DeletePage(int iPage) {
if (!pPages)
return;
- int nPages = pPages->GetIntegerBy("Count");
+ int nPages = pPages->GetIntegerFor("Count");
if (iPage < 0 || iPage >= nPages)
return;
@@ -730,7 +730,7 @@ size_t CPDF_Document::CalculateEncodingDict(int charset,
if (i == FX_ArraySize(g_FX_CharsetUnicodes))
return i;
CPDF_Dictionary* pEncodingDict = new CPDF_Dictionary;
- pEncodingDict->SetAtName("BaseEncoding", "WinAnsiEncoding");
+ pEncodingDict->SetNameFor("BaseEncoding", "WinAnsiEncoding");
CPDF_Array* pArray = new CPDF_Array;
pArray->AddInteger(128);
const uint16_t* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes;
@@ -738,9 +738,9 @@ size_t CPDF_Document::CalculateEncodingDict(int charset,
CFX_ByteString name = PDF_AdobeNameFromUnicode(pUnicodes[j]);
pArray->AddName(name.IsEmpty() ? ".notdef" : name);
}
- pEncodingDict->SetAt("Differences", pArray);
+ pEncodingDict->SetFor("Differences", pArray);
AddIndirectObject(pEncodingDict);
- pBaseDict->SetAtReference("Encoding", this, pEncodingDict);
+ pBaseDict->SetReferenceFor("Encoding", this, pEncodingDict);
return i;
}
@@ -759,7 +759,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) {
false, false, charset == FXFONT_SYMBOL_CHARSET);
CPDF_Dictionary* pBaseDict = new CPDF_Dictionary;
- pBaseDict->SetAtName("Type", "Font");
+ pBaseDict->SetNameFor("Type", "Font");
std::unique_ptr<CFX_UnicodeEncoding> pEncoding(
new CFX_UnicodeEncoding(pFont));
CPDF_Dictionary* pFontDict = pBaseDict;
@@ -772,7 +772,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) {
}
if (charset == FXFONT_ANSI_CHARSET || charset == FXFONT_DEFAULT_CHARSET ||
charset == FXFONT_SYMBOL_CHARSET) {
- pBaseDict->SetAtName("Encoding", "WinAnsiEncoding");
+ pBaseDict->SetNameFor("Encoding", "WinAnsiEncoding");
for (int charcode = 128; charcode <= 255; charcode++) {
int glyph_index = pEncoding->GlyphFromCharCode(charcode);
int char_width = pFont->GetGlyphWidth(glyph_index);
@@ -836,33 +836,33 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) {
InsertWidthArray1(pFont, pEncoding.get(), 0x7e, 0x7e, pWidthArray);
break;
}
- pBaseDict->SetAtName("Subtype", "Type0");
- pBaseDict->SetAtName("BaseFont", basefont);
- pBaseDict->SetAtName("Encoding", cmap);
- pFontDict->SetAt("W", pWidthArray);
- pFontDict->SetAtName("Type", "Font");
- pFontDict->SetAtName("Subtype", "CIDFontType2");
- pFontDict->SetAtName("BaseFont", basefont);
+ pBaseDict->SetNameFor("Subtype", "Type0");
+ pBaseDict->SetNameFor("BaseFont", basefont);
+ pBaseDict->SetNameFor("Encoding", cmap);
+ pFontDict->SetFor("W", pWidthArray);
+ pFontDict->SetNameFor("Type", "Font");
+ pFontDict->SetNameFor("Subtype", "CIDFontType2");
+ pFontDict->SetNameFor("BaseFont", basefont);
CPDF_Dictionary* pCIDSysInfo = new CPDF_Dictionary;
- pCIDSysInfo->SetAtString("Registry", "Adobe");
- pCIDSysInfo->SetAtString("Ordering", ordering);
- pCIDSysInfo->SetAtInteger("Supplement", supplement);
- pFontDict->SetAt("CIDSystemInfo", pCIDSysInfo);
+ pCIDSysInfo->SetStringFor("Registry", "Adobe");
+ pCIDSysInfo->SetStringFor("Ordering", ordering);
+ pCIDSysInfo->SetIntegerFor("Supplement", supplement);
+ pFontDict->SetFor("CIDSystemInfo", pCIDSysInfo);
CPDF_Array* pArray = new CPDF_Array;
- pBaseDict->SetAt("DescendantFonts", pArray);
+ pBaseDict->SetFor("DescendantFonts", pArray);
AddIndirectObject(pFontDict);
pArray->AddReference(this, pFontDict);
}
AddIndirectObject(pBaseDict);
CPDF_Dictionary* pFontDesc = new CPDF_Dictionary;
- pFontDesc->SetAtName("Type", "FontDescriptor");
- pFontDesc->SetAtName("FontName", basefont);
- pFontDesc->SetAtInteger("Flags", flags);
- pFontDesc->SetAtInteger(
+ pFontDesc->SetNameFor("Type", "FontDescriptor");
+ pFontDesc->SetNameFor("FontName", basefont);
+ pFontDesc->SetIntegerFor("Flags", flags);
+ pFontDesc->SetIntegerFor(
"ItalicAngle",
pFont->GetSubstFont() ? pFont->GetSubstFont()->m_ItalicAngle : 0);
- pFontDesc->SetAtInteger("Ascent", pFont->GetAscent());
- pFontDesc->SetAtInteger("Descent", pFont->GetDescent());
+ pFontDesc->SetIntegerFor("Ascent", pFont->GetAscent());
+ pFontDesc->SetIntegerFor("Descent", pFont->GetDescent());
FX_RECT bbox;
pFont->GetBBox(bbox);
CPDF_Array* pBBox = new CPDF_Array;
@@ -870,7 +870,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) {
pBBox->AddInteger(bbox.bottom);
pBBox->AddInteger(bbox.right);
pBBox->AddInteger(bbox.top);
- pFontDesc->SetAt("FontBBox", pBBox);
+ pFontDesc->SetFor("FontBBox", pBBox);
int32_t nStemV = 0;
if (pFont->GetSubstFont()) {
nStemV = pFont->GetSubstFont()->m_Weight / 5;
@@ -886,9 +886,9 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) {
nStemV = width;
}
}
- pFontDesc->SetAtInteger("StemV", nStemV);
+ pFontDesc->SetIntegerFor("StemV", nStemV);
AddIndirectObject(pFontDesc);
- pFontDict->SetAtReference("FontDescriptor", this, pFontDesc);
+ pFontDict->SetReferenceFor("FontDescriptor", this, pFontDesc);
return LoadFont(pBaseDict);
}
@@ -951,13 +951,13 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont,
FX_Free(tm_buf);
basefont.Replace(" ", "");
CPDF_Dictionary* pBaseDict = new CPDF_Dictionary;
- pBaseDict->SetAtName("Type", "Font");
+ pBaseDict->SetNameFor("Type", "Font");
CPDF_Dictionary* pFontDict = pBaseDict;
if (!bCJK) {
if (pLogFont->lfCharSet == ANSI_CHARSET ||
pLogFont->lfCharSet == DEFAULT_CHARSET ||
pLogFont->lfCharSet == SYMBOL_CHARSET) {
- pBaseDict->SetAtName("Encoding", "WinAnsiEncoding");
+ pBaseDict->SetNameFor("Encoding", "WinAnsiEncoding");
} else {
CalculateEncodingDict(pLogFont->lfCharSet, pBaseDict);
}
@@ -1011,39 +1011,39 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont,
InsertWidthArray(hDC, 0x7e, 0x7e, pWidthArray);
break;
}
- pBaseDict->SetAtName("Subtype", "Type0");
- pBaseDict->SetAtName("BaseFont", basefont);
- pBaseDict->SetAtName("Encoding", cmap);
- pFontDict->SetAt("W", pWidthArray);
- pFontDict->SetAtName("Type", "Font");
- pFontDict->SetAtName("Subtype", "CIDFontType2");
- pFontDict->SetAtName("BaseFont", basefont);
+ pBaseDict->SetNameFor("Subtype", "Type0");
+ pBaseDict->SetNameFor("BaseFont", basefont);
+ pBaseDict->SetNameFor("Encoding", cmap);
+ pFontDict->SetFor("W", pWidthArray);
+ pFontDict->SetNameFor("Type", "Font");
+ pFontDict->SetNameFor("Subtype", "CIDFontType2");
+ pFontDict->SetNameFor("BaseFont", basefont);
CPDF_Dictionary* pCIDSysInfo = new CPDF_Dictionary;
- pCIDSysInfo->SetAtString("Registry", "Adobe");
- pCIDSysInfo->SetAtString("Ordering", ordering);
- pCIDSysInfo->SetAtInteger("Supplement", supplement);
- pFontDict->SetAt("CIDSystemInfo", pCIDSysInfo);
+ pCIDSysInfo->SetStringFor("Registry", "Adobe");
+ pCIDSysInfo->SetStringFor("Ordering", ordering);
+ pCIDSysInfo->SetIntegerFor("Supplement", supplement);
+ pFontDict->SetFor("CIDSystemInfo", pCIDSysInfo);
CPDF_Array* pArray = new CPDF_Array;
- pBaseDict->SetAt("DescendantFonts", pArray);
+ pBaseDict->SetFor("DescendantFonts", pArray);
AddIndirectObject(pFontDict);
pArray->AddReference(this, pFontDict);
}
AddIndirectObject(pBaseDict);
CPDF_Dictionary* pFontDesc = new CPDF_Dictionary;
- pFontDesc->SetAtName("Type", "FontDescriptor");
- pFontDesc->SetAtName("FontName", basefont);
- pFontDesc->SetAtInteger("Flags", flags);
+ pFontDesc->SetNameFor("Type", "FontDescriptor");
+ pFontDesc->SetNameFor("FontName", basefont);
+ pFontDesc->SetIntegerFor("Flags", flags);
CPDF_Array* pBBox = new CPDF_Array;
for (int i = 0; i < 4; i++)
pBBox->AddInteger(bbox[i]);
- pFontDesc->SetAt("FontBBox", pBBox);
- pFontDesc->SetAtInteger("ItalicAngle", italicangle);
- pFontDesc->SetAtInteger("Ascent", ascend);
- pFontDesc->SetAtInteger("Descent", descend);
- pFontDesc->SetAtInteger("CapHeight", capheight);
- pFontDesc->SetAtInteger("StemV", pLogFont->lfWeight / 5);
+ pFontDesc->SetFor("FontBBox", pBBox);
+ pFontDesc->SetIntegerFor("ItalicAngle", italicangle);
+ pFontDesc->SetIntegerFor("Ascent", ascend);
+ pFontDesc->SetIntegerFor("Descent", descend);
+ pFontDesc->SetIntegerFor("CapHeight", capheight);
+ pFontDesc->SetIntegerFor("StemV", pLogFont->lfWeight / 5);
AddIndirectObject(pFontDesc);
- pFontDict->SetAtReference("FontDescriptor", this, pFontDesc);
+ pFontDict->SetReferenceFor("FontDescriptor", this, pFontDesc);
hFont = SelectObject(hDC, hFont);
DeleteObject(hFont);
DeleteDC(hDC);
diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
index 680939b186..b41d0527fd 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
@@ -455,7 +455,7 @@ bool CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) {
return false;
CPDF_Dictionary* pDict = pHintStream->GetDict();
- CPDF_Object* pOffset = pDict ? pDict->GetObjectBy("S") : nullptr;
+ CPDF_Object* pOffset = pDict ? pDict->GetObjectFor("S") : nullptr;
if (!pOffset || !pOffset->IsNumber())
return false;
@@ -487,22 +487,22 @@ bool CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) {
}
int CPDF_HintTables::GetEndOfFirstPageOffset() const {
- CPDF_Object* pOffsetE = m_pLinearizedDict->GetDirectObjectBy("E");
+ CPDF_Object* pOffsetE = m_pLinearizedDict->GetDirectObjectFor("E");
return pOffsetE ? pOffsetE->GetInteger() : -1;
}
int CPDF_HintTables::GetNumberOfPages() const {
- CPDF_Object* pPageNum = m_pLinearizedDict->GetDirectObjectBy("N");
+ CPDF_Object* pPageNum = m_pLinearizedDict->GetDirectObjectFor("N");
return pPageNum ? pPageNum->GetInteger() : 0;
}
int CPDF_HintTables::GetFirstPageObjectNumber() const {
- CPDF_Object* pFirstPageObj = m_pLinearizedDict->GetDirectObjectBy("O");
+ CPDF_Object* pFirstPageObj = m_pLinearizedDict->GetDirectObjectFor("O");
return pFirstPageObj ? pFirstPageObj->GetInteger() : -1;
}
int CPDF_HintTables::GetFirstPageNumber() const {
- CPDF_Object* pFirstPageNum = m_pLinearizedDict->GetDirectObjectBy("P");
+ CPDF_Object* pFirstPageNum = m_pLinearizedDict->GetDirectObjectFor("P");
return pFirstPageNum ? pFirstPageNum->GetInteger() : 0;
}
@@ -515,7 +515,7 @@ int CPDF_HintTables::ReadPrimaryHintStreamLength() const {
}
int CPDF_HintTables::ReadPrimaryHintStream(int index) const {
- CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H");
+ CPDF_Array* pRange = m_pLinearizedDict->GetArrayFor("H");
if (!pRange)
return -1;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp
index ec982ab58a..5772043367 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp
@@ -67,16 +67,16 @@ class PDFObjectsTest : public testing::Test {
m_ArrayObj->InsertAt(1, new CPDF_Name("address"));
// Dictionary object.
m_DictObj = new CPDF_Dictionary;
- m_DictObj->SetAt("bool", new CPDF_Boolean(false));
- m_DictObj->SetAt("num", new CPDF_Number(0.23f));
+ m_DictObj->SetFor("bool", new CPDF_Boolean(false));
+ m_DictObj->SetFor("num", new CPDF_Number(0.23f));
// Stream object.
const char content[] = "abcdefghijklmnopqrstuvwxyz";
size_t buf_len = FX_ArraySize(content);
uint8_t* buf = reinterpret_cast<uint8_t*>(malloc(buf_len));
memcpy(buf, content, buf_len);
m_StreamDictObj = new CPDF_Dictionary;
- m_StreamDictObj->SetAt("key1", new CPDF_String(L" test dict"));
- m_StreamDictObj->SetAt("key2", new CPDF_Number(-1));
+ m_StreamDictObj->SetFor("key1", new CPDF_String(L" test dict"));
+ m_StreamDictObj->SetFor("key2", new CPDF_Number(-1));
CPDF_Stream* stream_obj = new CPDF_Stream(buf, buf_len, m_StreamDictObj);
// Null Object.
CPDF_Null* null_obj = new CPDF_Null;
@@ -136,7 +136,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->GetObjectBy(it->first)))
+ if (!Equal(it->second, dict2->GetObjectFor(it->first)))
return false;
}
return true;
@@ -559,7 +559,7 @@ TEST(PDFArrayTest, GetTypeAt) {
char buf[33];
key.append(FXSYS_itoa(j, buf, 10));
int value = j + 200;
- vals[i]->SetAt(key.c_str(), new CPDF_Number(value));
+ vals[i]->SetFor(key.c_str(), new CPDF_Number(value));
}
arr->InsertAt(i, vals[i]);
}
@@ -586,7 +586,7 @@ TEST(PDFArrayTest, GetTypeAt) {
char buf[33];
key.append(FXSYS_itoa(j, buf, 10));
int value = j + 200;
- vals[i]->SetAt(key.c_str(), new CPDF_Number(value));
+ vals[i]->SetFor(key.c_str(), new CPDF_Number(value));
}
uint8_t content[] = "content: this is a stream";
size_t data_size = FX_ArraySize(content);
@@ -626,12 +626,12 @@ TEST(PDFArrayTest, GetTypeAt) {
arr_val->AddNumber(2);
arr->InsertAt(11, arr_val);
CPDF_Dictionary* dict_val = new CPDF_Dictionary;
- dict_val->SetAt("key1", new CPDF_String("Linda", false));
- dict_val->SetAt("key2", new CPDF_String("Zoe", false));
+ dict_val->SetFor("key1", new CPDF_String("Linda", false));
+ dict_val->SetFor("key2", new CPDF_String("Zoe", false));
arr->InsertAt(12, dict_val);
CPDF_Dictionary* stream_dict = new CPDF_Dictionary;
- stream_dict->SetAt("key1", new CPDF_String("John", false));
- stream_dict->SetAt("key2", new CPDF_String("King", false));
+ stream_dict->SetFor("key1", new CPDF_String("John", false));
+ stream_dict->SetFor("key2", new CPDF_String("King", false));
uint8_t data[] = "A stream for test";
// The data buffer will be owned by stream object, so it needs to be
// dynamically allocated.
@@ -769,9 +769,9 @@ TEST(PDFArrayTest, CloneDirectObject) {
TEST(PDFDictionaryTest, CloneDirectObject) {
CPDF_IndirectObjectHolder objects_holder;
ScopedDict dict(new CPDF_Dictionary);
- dict->SetAtReference("foo", &objects_holder, 1234);
+ dict->SetReferenceFor("foo", &objects_holder, 1234);
ASSERT_EQ(1U, dict->GetCount());
- CPDF_Object* obj = dict->GetObjectBy("foo");
+ CPDF_Object* obj = dict->GetObjectFor("foo");
ASSERT_TRUE(obj);
EXPECT_TRUE(obj->IsReference());
@@ -781,7 +781,7 @@ TEST(PDFDictionaryTest, CloneDirectObject) {
ScopedDict cloned_dict(cloned_dict_object->AsDictionary());
ASSERT_EQ(1U, cloned_dict->GetCount());
- CPDF_Object* cloned_obj = cloned_dict->GetObjectBy("foo");
+ CPDF_Object* cloned_obj = cloned_dict->GetObjectFor("foo");
EXPECT_FALSE(cloned_obj);
}
@@ -791,7 +791,7 @@ TEST(PDFObjectTest, CloneCheckLoop) {
ScopedArray arr_obj(new CPDF_Array);
// Dictionary object.
CPDF_Dictionary* dict_obj = new CPDF_Dictionary;
- dict_obj->SetAt("arr", arr_obj.get());
+ dict_obj->SetFor("arr", arr_obj.get());
arr_obj->InsertAt(0, dict_obj);
// Clone this object to see whether stack overflow will be triggered.
@@ -803,7 +803,7 @@ TEST(PDFObjectTest, CloneCheckLoop) {
ASSERT_TRUE(cloned_dict);
ASSERT_TRUE(cloned_dict->IsDictionary());
// Recursively referenced object is not cloned.
- EXPECT_EQ(nullptr, cloned_dict->AsDictionary()->GetObjectBy("arr"));
+ EXPECT_EQ(nullptr, cloned_dict->AsDictionary()->GetObjectFor("arr"));
}
{
CPDF_IndirectObjectHolder objects_holder;
@@ -812,7 +812,7 @@ TEST(PDFObjectTest, CloneCheckLoop) {
CPDF_Array* arr_obj = new CPDF_Array;
objects_holder.AddIndirectObject(dict_obj);
EXPECT_EQ(1u, dict_obj->GetObjNum());
- dict_obj->SetAt("arr", arr_obj);
+ dict_obj->SetFor("arr", arr_obj);
arr_obj->InsertAt(0, dict_obj, &objects_holder);
CPDF_Object* elem0 = arr_obj->GetObjectAt(0);
ASSERT_TRUE(elem0);
@@ -824,7 +824,7 @@ TEST(PDFObjectTest, CloneCheckLoop) {
ScopedDict cloned_dict(ToDictionary(dict_obj->CloneDirectObject()));
// Cloned object should be the same as the original.
ASSERT_TRUE(cloned_dict);
- CPDF_Object* cloned_arr = cloned_dict->GetObjectBy("arr");
+ CPDF_Object* cloned_arr = cloned_dict->GetObjectFor("arr");
ASSERT_TRUE(cloned_arr);
ASSERT_TRUE(cloned_arr->IsArray());
EXPECT_EQ(1u, cloned_arr->AsArray()->GetCount());
diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
index 529e751f6c..51ef73cba2 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
@@ -37,11 +37,11 @@ uint32_t GetVarInt(const uint8_t* p, int32_t n) {
}
int32_t GetStreamNCount(CPDF_StreamAcc* pObjStream) {
- return pObjStream->GetDict()->GetIntegerBy("N");
+ return pObjStream->GetDict()->GetIntegerFor("N");
}
int32_t GetStreamFirst(CPDF_StreamAcc* pObjStream) {
- return pObjStream->GetDict()->GetIntegerBy("First");
+ return pObjStream->GetDict()->GetIntegerFor("First");
}
} // namespace
@@ -231,7 +231,7 @@ CPDF_Parser::Error CPDF_Parser::StartParse(IFX_FileRead* pFileAccess,
}
if (m_pSecurityHandler && !m_pSecurityHandler->IsMetadataEncrypted()) {
CPDF_Reference* pMetadata =
- ToReference(m_pDocument->GetRoot()->GetObjectBy("Metadata"));
+ ToReference(m_pDocument->GetRoot()->GetObjectFor("Metadata"));
if (pMetadata)
m_pSyntax->m_MetadataObjnum = pMetadata->GetRefObjNum();
}
@@ -244,7 +244,7 @@ CPDF_Parser::Error CPDF_Parser::SetEncryptHandler() {
if (!m_pTrailer)
return FORMAT_ERROR;
- CPDF_Object* pEncryptObj = m_pTrailer->GetObjectBy("Encrypt");
+ CPDF_Object* pEncryptObj = m_pTrailer->GetObjectFor("Encrypt");
if (pEncryptObj) {
if (CPDF_Dictionary* pEncryptDict = pEncryptObj->AsDictionary()) {
SetEncryptDictionary(pEncryptDict);
@@ -256,7 +256,7 @@ CPDF_Parser::Error CPDF_Parser::SetEncryptHandler() {
}
if (m_pEncryptDict) {
- CFX_ByteString filter = m_pEncryptDict->GetStringBy("Filter");
+ CFX_ByteString filter = m_pEncryptDict->GetStringFor("Filter");
std::unique_ptr<CPDF_SecurityHandler> pSecurityHandler;
Error err = HANDLER_ERROR;
if (filter == "Standard") {
@@ -367,7 +367,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) {
// SLOW ...
XRefStreamList.insert(XRefStreamList.begin(),
- pDict->GetIntegerBy("XRefStm"));
+ pDict->GetIntegerFor("XRefStm"));
m_Trailers.Add(pDict.release());
}
@@ -422,7 +422,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos,
// SLOW ...
XRefStreamList.insert(XRefStreamList.begin(),
- pDict->GetIntegerBy("XRefStm"));
+ pDict->GetIntegerFor("XRefStm"));
m_Trailers.Add(pDict.release());
}
@@ -751,11 +751,11 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
if (CPDF_Stream* pStream = ToStream(pObject)) {
if (CPDF_Dictionary* pDict = pStream->GetDict()) {
if ((pDict->KeyExist("Type")) &&
- (pDict->GetStringBy("Type") == "XRef" &&
+ (pDict->GetStringFor("Type") == "XRef" &&
pDict->KeyExist("Size"))) {
- CPDF_Object* pRoot = pDict->GetObjectBy("Root");
+ CPDF_Object* pRoot = pDict->GetObjectFor("Root");
if (pRoot && pRoot->GetDict() &&
- pRoot->GetDict()->GetObjectBy("Pages")) {
+ pRoot->GetDict()->GetObjectFor("Pages")) {
if (m_pTrailer)
m_pTrailer->Release();
m_pTrailer = ToDictionary(pDict->Clone());
@@ -819,7 +819,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
if (CPDF_Dictionary* pTrailer =
pStream ? pStream->GetDict() : pObj->AsDictionary()) {
if (m_pTrailer) {
- CPDF_Object* pRoot = pTrailer->GetObjectBy("Root");
+ CPDF_Object* pRoot = pTrailer->GetObjectFor("Root");
CPDF_Reference* pRef = ToReference(pRoot);
if (!pRoot ||
(pRef && IsValidObjectNumber(pRef->GetRefObjNum()) &&
@@ -832,10 +832,10 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
uint32_t dwObjNum =
pElement ? pElement->GetObjNum() : 0;
if (dwObjNum) {
- m_pTrailer->SetAtReference(key, m_pDocument,
- dwObjNum);
+ m_pTrailer->SetReferenceFor(key, m_pDocument,
+ dwObjNum);
} else {
- m_pTrailer->SetAt(key, pElement->Clone());
+ m_pTrailer->SetFor(key, pElement->Clone());
}
}
}
@@ -980,8 +980,8 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
return FALSE;
CPDF_Dictionary* pDict = pStream->GetDict();
- *pos = pDict->GetIntegerBy("Prev");
- int32_t size = pDict->GetIntegerBy("Size");
+ *pos = pDict->GetIntegerFor("Prev");
+ int32_t size = pDict->GetIntegerFor("Size");
if (size < 0) {
pStream->Release();
return FALSE;
@@ -998,7 +998,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
}
std::vector<std::pair<int32_t, int32_t>> arrIndex;
- CPDF_Array* pArray = pDict->GetArrayBy("Index");
+ CPDF_Array* pArray = pDict->GetArrayFor("Index");
if (pArray) {
for (size_t i = 0; i < pArray->GetCount() / 2; i++) {
CPDF_Object* pStartNumObj = pArray->GetObjectAt(i * 2);
@@ -1016,7 +1016,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
if (arrIndex.size() == 0)
arrIndex.push_back(std::make_pair(0, size));
- pArray = pDict->GetArrayBy("W");
+ pArray = pDict->GetArrayFor("W");
if (!pArray) {
pStream->Release();
return FALSE;
@@ -1107,26 +1107,26 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
}
CPDF_Array* CPDF_Parser::GetIDArray() {
- CPDF_Object* pID = m_pTrailer ? m_pTrailer->GetObjectBy("ID") : nullptr;
+ CPDF_Object* pID = m_pTrailer ? m_pTrailer->GetObjectFor("ID") : nullptr;
if (!pID)
return nullptr;
if (CPDF_Reference* pRef = pID->AsReference()) {
pID = ParseIndirectObject(nullptr, pRef->GetRefObjNum());
- m_pTrailer->SetAt("ID", pID);
+ m_pTrailer->SetFor("ID", pID);
}
return ToArray(pID);
}
uint32_t CPDF_Parser::GetRootObjNum() {
CPDF_Reference* pRef =
- ToReference(m_pTrailer ? m_pTrailer->GetObjectBy("Root") : nullptr);
+ ToReference(m_pTrailer ? m_pTrailer->GetObjectFor("Root") : nullptr);
return pRef ? pRef->GetRefObjNum() : 0;
}
uint32_t CPDF_Parser::GetInfoObjNum() {
CPDF_Reference* pRef =
- ToReference(m_pTrailer ? m_pTrailer->GetObjectBy("Info") : nullptr);
+ ToReference(m_pTrailer ? m_pTrailer->GetObjectFor("Info") : nullptr);
return pRef ? pRef->GetRefObjNum() : 0;
}
@@ -1446,7 +1446,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict(
return nullptr;
}
- CPDF_Object* pObj = m_pSyntax->GetObjectByStrict(pObjList, objnum, gennum);
+ CPDF_Object* pObj = m_pSyntax->GetObjectForStrict(pObjList, objnum, gennum);
if (pResultPos)
*pResultPos = m_pSyntax->m_Pos;
@@ -1470,7 +1470,7 @@ uint32_t CPDF_Parser::GetPermissions() const {
return 0xFFFFFFFF;
uint32_t dwPermission = m_pSecurityHandler->GetPermissions();
- if (m_pEncryptDict && m_pEncryptDict->GetStringBy("Filter") == "Standard") {
+ if (m_pEncryptDict && m_pEncryptDict->GetStringFor("Filter") == "Standard") {
// See PDF Reference 1.7, page 123, table 3.20.
dwPermission &= 0xFFFFFFFC;
dwPermission |= 0xFFFFF0C0;
@@ -1505,10 +1505,10 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess,
return FALSE;
CPDF_Dictionary* pDict = m_pLinearized->GetDict();
- if (pDict && pDict->GetObjectBy("Linearized")) {
+ if (pDict && pDict->GetObjectFor("Linearized")) {
m_pSyntax->GetNextWord(nullptr);
- CPDF_Object* pLen = pDict->GetObjectBy("L");
+ CPDF_Object* pLen = pDict->GetObjectFor("L");
if (!pLen) {
m_pLinearized->Release();
m_pLinearized = nullptr;
@@ -1518,10 +1518,10 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess,
if (pLen->GetInteger() != (int)pFileAccess->GetSize())
return FALSE;
- if (CPDF_Number* pNo = ToNumber(pDict->GetObjectBy("P")))
+ if (CPDF_Number* pNo = ToNumber(pDict->GetObjectFor("P")))
m_dwFirstPageNo = pNo->GetInteger();
- if (CPDF_Number* pTable = ToNumber(pDict->GetObjectBy("T")))
+ if (CPDF_Number* pTable = ToNumber(pDict->GetObjectFor("T")))
m_LastXRefOffset = pTable->GetInteger();
return TRUE;
@@ -1606,7 +1606,7 @@ CPDF_Parser::Error CPDF_Parser::StartLinearizedParse(IFX_FileRead* pFileAccess,
if (m_pSecurityHandler && m_pSecurityHandler->IsMetadataEncrypted()) {
if (CPDF_Reference* pMetadata =
- ToReference(m_pDocument->GetRoot()->GetObjectBy("Metadata")))
+ ToReference(m_pDocument->GetRoot()->GetObjectFor("Metadata")))
m_pSyntax->m_MetadataObjnum = pMetadata->GetRefObjNum();
}
return SUCCESS;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp
index 65d3173613..bf18028d7a 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp
@@ -29,7 +29,7 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
int keylen,
FX_BOOL bIgnoreMeta,
CPDF_Array* pIdArray) {
- int revision = pEncrypt->GetIntegerBy("R");
+ int revision = pEncrypt->GetIntegerFor("R");
uint8_t passcode[32];
for (uint32_t i = 0; i < 32; i++) {
passcode[i] = i < pass_size ? password[i] : defpasscode[i - pass_size];
@@ -37,16 +37,16 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
uint8_t md5[100];
CRYPT_MD5Start(md5);
CRYPT_MD5Update(md5, passcode, 32);
- CFX_ByteString okey = pEncrypt->GetStringBy("O");
+ CFX_ByteString okey = pEncrypt->GetStringFor("O");
CRYPT_MD5Update(md5, (uint8_t*)okey.c_str(), okey.GetLength());
- uint32_t perm = pEncrypt->GetIntegerBy("P");
+ uint32_t perm = pEncrypt->GetIntegerFor("P");
CRYPT_MD5Update(md5, (uint8_t*)&perm, 4);
if (pIdArray) {
CFX_ByteString id = pIdArray->GetStringAt(0);
CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength());
}
if (!bIgnoreMeta && revision >= 3 &&
- !pEncrypt->GetIntegerBy("EncryptMetadata", 1)) {
+ !pEncrypt->GetIntegerFor("EncryptMetadata", 1)) {
uint32_t tag = (uint32_t)-1;
CRYPT_MD5Update(md5, (uint8_t*)&tag, 4);
}
@@ -115,41 +115,41 @@ static FX_BOOL LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
const CFX_ByteString& name,
int& cipher,
int& keylen) {
- int Version = pEncryptDict->GetIntegerBy("V");
+ int Version = pEncryptDict->GetIntegerFor("V");
cipher = FXCIPHER_RC4;
keylen = 0;
if (Version >= 4) {
- CPDF_Dictionary* pCryptFilters = pEncryptDict->GetDictBy("CF");
+ CPDF_Dictionary* pCryptFilters = pEncryptDict->GetDictFor("CF");
if (!pCryptFilters) {
return FALSE;
}
if (name == "Identity") {
cipher = FXCIPHER_NONE;
} else {
- CPDF_Dictionary* pDefFilter = pCryptFilters->GetDictBy(name);
+ CPDF_Dictionary* pDefFilter = pCryptFilters->GetDictFor(name);
if (!pDefFilter) {
return FALSE;
}
int nKeyBits = 0;
if (Version == 4) {
- nKeyBits = pDefFilter->GetIntegerBy("Length", 0);
+ nKeyBits = pDefFilter->GetIntegerFor("Length", 0);
if (nKeyBits == 0) {
- nKeyBits = pEncryptDict->GetIntegerBy("Length", 128);
+ nKeyBits = pEncryptDict->GetIntegerFor("Length", 128);
}
} else {
- nKeyBits = pEncryptDict->GetIntegerBy("Length", 256);
+ nKeyBits = pEncryptDict->GetIntegerFor("Length", 256);
}
if (nKeyBits < 40) {
nKeyBits *= 8;
}
keylen = nKeyBits / 8;
- CFX_ByteString cipher_name = pDefFilter->GetStringBy("CFM");
+ CFX_ByteString cipher_name = pDefFilter->GetStringFor("CFM");
if (cipher_name == "AESV2" || cipher_name == "AESV3") {
cipher = FXCIPHER_AES;
}
}
} else {
- keylen = Version > 1 ? pEncryptDict->GetIntegerBy("Length", 40) / 8 : 5;
+ keylen = Version > 1 ? pEncryptDict->GetIntegerFor("Length", 40) / 8 : 5;
}
if (keylen > 32 || keylen < 0) {
return FALSE;
@@ -159,14 +159,14 @@ static FX_BOOL LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
FX_BOOL CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) {
m_pEncryptDict = pEncryptDict;
- m_Version = pEncryptDict->GetIntegerBy("V");
- m_Revision = pEncryptDict->GetIntegerBy("R");
- m_Permissions = pEncryptDict->GetIntegerBy("P", -1);
+ m_Version = pEncryptDict->GetIntegerFor("V");
+ m_Revision = pEncryptDict->GetIntegerFor("R");
+ m_Permissions = pEncryptDict->GetIntegerFor("P", -1);
if (m_Version < 4)
return LoadCryptInfo(pEncryptDict, CFX_ByteString(), m_Cipher, m_KeyLen);
- CFX_ByteString stmf_name = pEncryptDict->GetStringBy("StmF");
- CFX_ByteString strf_name = pEncryptDict->GetStringBy("StrF");
+ CFX_ByteString stmf_name = pEncryptDict->GetStringFor("StmF");
+ CFX_ByteString strf_name = pEncryptDict->GetStringFor("StrF");
if (stmf_name != strf_name)
return FALSE;
@@ -178,15 +178,15 @@ FX_BOOL CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict,
int& cipher,
int& key_len) {
m_pEncryptDict = pEncryptDict;
- m_Version = pEncryptDict->GetIntegerBy("V");
- m_Revision = pEncryptDict->GetIntegerBy("R");
- m_Permissions = pEncryptDict->GetIntegerBy("P", -1);
+ m_Version = pEncryptDict->GetIntegerFor("V");
+ m_Revision = pEncryptDict->GetIntegerFor("R");
+ m_Permissions = pEncryptDict->GetIntegerFor("P", -1);
CFX_ByteString strf_name;
CFX_ByteString stmf_name;
if (m_Version >= 4) {
- stmf_name = pEncryptDict->GetStringBy("StmF");
- strf_name = pEncryptDict->GetStringBy("StrF");
+ stmf_name = pEncryptDict->GetStringFor("StmF");
+ strf_name = pEncryptDict->GetStringFor("StrF");
if (stmf_name != strf_name)
return FALSE;
}
@@ -304,12 +304,12 @@ FX_BOOL CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
FX_BOOL bOwner,
uint8_t* key) {
CFX_ByteString okey =
- m_pEncryptDict ? m_pEncryptDict->GetStringBy("O") : CFX_ByteString();
+ m_pEncryptDict ? m_pEncryptDict->GetStringFor("O") : CFX_ByteString();
if (okey.GetLength() < 48) {
return FALSE;
}
CFX_ByteString ukey =
- m_pEncryptDict ? m_pEncryptDict->GetStringBy("U") : CFX_ByteString();
+ m_pEncryptDict ? m_pEncryptDict->GetStringFor("U") : CFX_ByteString();
if (ukey.GetLength() < 48) {
return FALSE;
}
@@ -347,7 +347,7 @@ FX_BOOL CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
CRYPT_SHA256Finish(sha, digest);
}
CFX_ByteString ekey = m_pEncryptDict
- ? m_pEncryptDict->GetStringBy(bOwner ? "OE" : "UE")
+ ? m_pEncryptDict->GetStringFor(bOwner ? "OE" : "UE")
: CFX_ByteString();
if (ekey.GetLength() < 32) {
return FALSE;
@@ -360,7 +360,7 @@ FX_BOOL CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
CRYPT_AESDecrypt(aes, key, ekey.raw_str(), 32);
CRYPT_AESSetKey(aes, 16, key, 32, FALSE);
CRYPT_AESSetIV(aes, iv);
- CFX_ByteString perms = m_pEncryptDict->GetStringBy("Perms");
+ CFX_ByteString perms = m_pEncryptDict->GetStringFor("Perms");
if (perms.IsEmpty()) {
return FALSE;
}
@@ -413,7 +413,7 @@ FX_BOOL CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password,
CalcEncryptKey(m_pEncryptDict, password, pass_size, key, key_len,
bIgnoreEncryptMeta, m_pParser->GetIDArray());
CFX_ByteString ukey =
- m_pEncryptDict ? m_pEncryptDict->GetStringBy("U") : CFX_ByteString();
+ m_pEncryptDict ? m_pEncryptDict->GetStringFor("U") : CFX_ByteString();
if (ukey.GetLength() < 16) {
return FALSE;
}
@@ -454,7 +454,7 @@ FX_BOOL CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password,
CFX_ByteString CPDF_SecurityHandler::GetUserPassword(const uint8_t* owner_pass,
uint32_t pass_size,
int32_t key_len) {
- CFX_ByteString okey = m_pEncryptDict->GetStringBy("O");
+ CFX_ByteString okey = m_pEncryptDict->GetStringFor("O");
uint8_t passcode[32];
for (uint32_t i = 0; i < 32; i++) {
passcode[i] = i < pass_size ? owner_pass[i] : defpasscode[i - pass_size];
@@ -511,7 +511,7 @@ FX_BOOL CPDF_SecurityHandler::CheckOwnerPassword(const uint8_t* password,
}
bool CPDF_SecurityHandler::IsMetadataEncrypted() const {
- return m_pEncryptDict->GetBooleanBy("EncryptMetadata", true);
+ return m_pEncryptDict->GetBooleanFor("EncryptMetadata", true);
}
void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
@@ -543,7 +543,7 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
AES256_SetPassword(pEncryptDict, owner_pass, owner_size, TRUE,
m_EncryptKey);
AES256_SetPerms(pEncryptDict, m_Permissions,
- pEncryptDict->GetBooleanBy("EncryptMetadata", true),
+ pEncryptDict->GetBooleanFor("EncryptMetadata", true),
m_EncryptKey);
}
return;
@@ -574,7 +574,7 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CRYPT_ArcFourCryptBlock(passcode, 32, tempkey, key_len);
}
}
- pEncryptDict->SetAtString("O", CFX_ByteString(passcode, 32));
+ pEncryptDict->SetStringFor("O", CFX_ByteString(passcode, 32));
}
CalcEncryptKey(m_pEncryptDict, (uint8_t*)user_pass, user_size, m_EncryptKey,
key_len, FALSE, pIdArray);
@@ -582,7 +582,7 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
uint8_t tempbuf[32];
FXSYS_memcpy(tempbuf, defpasscode, 32);
CRYPT_ArcFourCryptBlock(tempbuf, 32, m_EncryptKey, key_len);
- pEncryptDict->SetAtString("U", CFX_ByteString(tempbuf, 32));
+ pEncryptDict->SetStringFor("U", CFX_ByteString(tempbuf, 32));
} else {
uint8_t md5[100];
CRYPT_MD5Start(md5);
@@ -602,7 +602,7 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CRYPT_ArcFourCryptBlock(digest, 16, tempkey, key_len);
}
CRYPT_MD5Generate(digest, 16, digest + 16);
- pEncryptDict->SetAtString("U", CFX_ByteString(digest, 32));
+ pEncryptDict->SetStringFor("U", CFX_ByteString(digest, 32));
}
}
void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
@@ -634,7 +634,7 @@ void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict,
CRYPT_SHA1Update(sha, (uint8_t*)"hello", 5);
uint8_t digest[20];
CRYPT_SHA1Finish(sha, digest);
- CFX_ByteString ukey = pEncryptDict->GetStringBy("U");
+ CFX_ByteString ukey = pEncryptDict->GetStringFor("U");
uint8_t digest1[48];
if (m_Revision >= 6) {
Revision6_Hash(password, size, digest, bOwner ? ukey.raw_str() : nullptr,
@@ -649,7 +649,7 @@ void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict,
CRYPT_SHA256Finish(sha, digest1);
}
FXSYS_memcpy(digest1 + 32, digest, 16);
- pEncryptDict->SetAtString(bOwner ? "O" : "U", CFX_ByteString(digest1, 48));
+ pEncryptDict->SetStringFor(bOwner ? "O" : "U", CFX_ByteString(digest1, 48));
if (m_Revision >= 6) {
Revision6_Hash(password, size, digest + 8,
bOwner ? ukey.raw_str() : nullptr, digest1);
@@ -669,7 +669,7 @@ void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict,
CRYPT_AESSetIV(aes, iv);
CRYPT_AESEncrypt(aes, digest1, key, 32);
FX_Free(aes);
- pEncryptDict->SetAtString(bOwner ? "OE" : "UE", CFX_ByteString(digest1, 32));
+ pEncryptDict->SetStringFor(bOwner ? "OE" : "UE", CFX_ByteString(digest1, 32));
}
void CPDF_SecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict,
uint32_t permissions,
@@ -695,5 +695,5 @@ void CPDF_SecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict,
CRYPT_AESSetIV(aes, iv);
CRYPT_AESEncrypt(aes, buf1, buf, 16);
FX_Free(aes);
- pEncryptDict->SetAtString("Perms", CFX_ByteString(buf1, 16));
+ pEncryptDict->SetStringFor("Perms", CFX_ByteString(buf1, 16));
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_stream.cpp b/core/fpdfapi/fpdf_parser/cpdf_stream.cpp
index 58b9767dfb..e25180bedb 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_stream.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_stream.cpp
@@ -70,7 +70,7 @@ void CPDF_Stream::InitStream(const uint8_t* pData,
m_dwSize = size;
if (m_pDict)
- m_pDict->SetAtInteger("Length", size);
+ m_pDict->SetIntegerFor("Length", size);
}
CPDF_Object* CPDF_Stream::Clone() const {
@@ -112,10 +112,10 @@ void CPDF_Stream::SetData(const uint8_t* pData,
m_dwSize = size;
if (!m_pDict)
m_pDict = new CPDF_Dictionary;
- m_pDict->SetAtInteger("Length", size);
+ m_pDict->SetIntegerFor("Length", size);
if (!bCompressed) {
- m_pDict->RemoveAt("Filter");
- m_pDict->RemoveAt("DecodeParms");
+ m_pDict->RemoveFor("Filter");
+ m_pDict->RemoveFor("DecodeParms");
}
}
@@ -137,7 +137,7 @@ void CPDF_Stream::InitStreamFromFile(IFX_FileRead* pFile,
m_pFile = pFile;
m_dwSize = (uint32_t)pFile->GetSize();
if (m_pDict)
- m_pDict->SetAtInteger("Length", m_dwSize);
+ m_pDict->SetIntegerFor("Length", m_dwSize);
}
CFX_WideString CPDF_Stream::GetUnicodeText() const {
diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
index 0eeb4a1afa..4bfaf99ed9 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
@@ -469,7 +469,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
continue;
CFX_ByteString keyNoSlash(key.raw_str() + 1, key.GetLength() - 1);
- pDict->SetAt(keyNoSlash, pObj);
+ pDict->SetFor(keyNoSlash, pObj);
}
// Only when this is a signature dictionary and has contents, we reset the
@@ -477,7 +477,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
if (pDict->IsSignatureDict() && dwSignValuePos) {
CFX_AutoRestorer<FX_FILESIZE> save_pos(&m_Pos);
m_Pos = dwSignValuePos;
- pDict->SetAt("Contents", GetObject(pObjList, objnum, gennum, false));
+ pDict->SetFor("Contents", GetObject(pObjList, objnum, gennum, false));
}
FX_FILESIZE SavedPos = m_Pos;
@@ -495,7 +495,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
return nullptr;
}
-CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
+CPDF_Object* CPDF_SyntaxParser::GetObjectForStrict(
CPDF_IndirectObjectHolder* pObjList,
uint32_t objnum,
uint32_t gennum) {
@@ -587,8 +587,8 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
}
if (key.GetLength() > 1) {
- pDict->SetAt(CFX_ByteString(key.c_str() + 1, key.GetLength() - 1),
- obj.release());
+ pDict->SetFor(CFX_ByteString(key.c_str() + 1, key.GetLength() - 1),
+ obj.release());
}
}
@@ -627,7 +627,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->GetObjectBy("Length");
+ CPDF_Object* pLenObj = pDict->GetObjectFor("Length");
FX_FILESIZE len = -1;
CPDF_Reference* pLenObjRef = ToReference(pLenObj);
@@ -733,7 +733,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
pDict->Release();
return nullptr;
}
- pDict->SetAtInteger("Length", len);
+ pDict->SetIntegerFor("Length", len);
}
m_Pos = streamStartPos;
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h
index 63992a85ab..8ca7e33824 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h
+++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h
@@ -32,9 +32,9 @@ class CPDF_SyntaxParser {
uint32_t objnum,
uint32_t gennum,
FX_BOOL bDecrypt);
- CPDF_Object* GetObjectByStrict(CPDF_IndirectObjectHolder* pObjList,
- uint32_t objnum,
- uint32_t gennum);
+ CPDF_Object* GetObjectForStrict(CPDF_IndirectObjectHolder* pObjList,
+ uint32_t objnum,
+ uint32_t gennum);
CFX_ByteString GetKeyword();
void ToNextLine();
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index 40ba362ad6..72a9518ca9 100644
--- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -239,12 +239,12 @@ CCodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(
int Columns = 1728;
int Rows = 0;
if (pParams) {
- K = pParams->GetIntegerBy("K");
- EndOfLine = pParams->GetIntegerBy("EndOfLine");
- ByteAlign = pParams->GetIntegerBy("EncodedByteAlign");
- BlackIs1 = pParams->GetIntegerBy("BlackIs1");
- Columns = pParams->GetIntegerBy("Columns", 1728);
- Rows = pParams->GetIntegerBy("Rows");
+ K = pParams->GetIntegerFor("K");
+ EndOfLine = pParams->GetIntegerFor("EndOfLine");
+ ByteAlign = pParams->GetIntegerFor("EncodedByteAlign");
+ BlackIs1 = pParams->GetIntegerFor("BlackIs1");
+ Columns = pParams->GetIntegerFor("Columns", 1728);
+ Rows = pParams->GetIntegerFor("Rows");
if (Rows > USHRT_MAX) {
Rows = 0;
}
@@ -290,10 +290,10 @@ CCodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
int predictor = 0;
int Colors = 0, BitsPerComponent = 0, Columns = 0;
if (pParams) {
- predictor = pParams->GetIntegerBy("Predictor");
- Colors = pParams->GetIntegerBy("Colors", 1);
- BitsPerComponent = pParams->GetIntegerBy("BitsPerComponent", 8);
- Columns = pParams->GetIntegerBy("Columns", 1);
+ predictor = pParams->GetIntegerFor("Predictor");
+ Colors = pParams->GetIntegerFor("Colors", 1);
+ BitsPerComponent = pParams->GetIntegerFor("BitsPerComponent", 8);
+ Columns = pParams->GetIntegerFor("Columns", 1);
if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) {
return nullptr;
}
@@ -314,11 +314,11 @@ uint32_t FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
FX_BOOL bEarlyChange = TRUE;
int Colors = 0, BitsPerComponent = 0, Columns = 0;
if (pParams) {
- predictor = pParams->GetIntegerBy("Predictor");
- bEarlyChange = pParams->GetIntegerBy("EarlyChange", 1);
- Colors = pParams->GetIntegerBy("Colors", 1);
- BitsPerComponent = pParams->GetIntegerBy("BitsPerComponent", 8);
- Columns = pParams->GetIntegerBy("Columns", 1);
+ predictor = pParams->GetIntegerFor("Predictor");
+ bEarlyChange = pParams->GetIntegerFor("EarlyChange", 1);
+ Colors = pParams->GetIntegerFor("Colors", 1);
+ BitsPerComponent = pParams->GetIntegerFor("BitsPerComponent", 8);
+ Columns = pParams->GetIntegerFor("Columns", 1);
if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) {
return (uint32_t)-1;
}
@@ -337,12 +337,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->GetDirectObjectBy("Filter") : nullptr;
+ CPDF_Object* pDecoder = pDict ? pDict->GetDirectObjectFor("Filter") : nullptr;
if (!pDecoder || (!pDecoder->IsArray() && !pDecoder->IsName()))
return FALSE;
CPDF_Object* pParams =
- pDict ? pDict->GetDirectObjectBy("DecodeParms") : nullptr;
+ pDict ? pDict->GetDirectObjectFor("DecodeParms") : nullptr;
std::vector<std::pair<CFX_ByteString, CPDF_Object*>> DecoderArray;
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 6b1958298c..a9f20a9093 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_ByteString& key) {
- CPDF_Number* pObj = ToNumber(pDict->GetObjectBy(key));
+ CPDF_Number* pObj = ToNumber(pDict->GetObjectFor(key));
return pObj ? pObj->GetInteger() : 0;
}
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h b/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h
index be79737add..784d49714f 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h
@@ -32,48 +32,48 @@ class CPDF_Dictionary : public CPDF_Object {
const CPDF_Dictionary* AsDictionary() const override;
size_t GetCount() const { return m_Map.size(); }
- CPDF_Object* GetObjectBy(const CFX_ByteString& key) const;
- CPDF_Object* GetDirectObjectBy(const CFX_ByteString& key) const;
- CFX_ByteString GetStringBy(const CFX_ByteString& key) const;
- CFX_ByteString GetStringBy(const CFX_ByteString& key,
- const CFX_ByteString& default_str) const;
- CFX_WideString GetUnicodeTextBy(const CFX_ByteString& key) const;
- int GetIntegerBy(const CFX_ByteString& key) const;
- int GetIntegerBy(const CFX_ByteString& key, int default_int) const;
- bool GetBooleanBy(const CFX_ByteString& key, bool bDefault = false) const;
- FX_FLOAT GetNumberBy(const CFX_ByteString& key) const;
- CPDF_Dictionary* GetDictBy(const CFX_ByteString& key) const;
- CPDF_Stream* GetStreamBy(const CFX_ByteString& key) const;
- CPDF_Array* GetArrayBy(const CFX_ByteString& key) const;
- CFX_FloatRect GetRectBy(const CFX_ByteString& key) const;
- CFX_Matrix GetMatrixBy(const CFX_ByteString& key) const;
- FX_FLOAT GetFloatBy(const CFX_ByteString& key) const {
- return GetNumberBy(key);
+ CPDF_Object* GetObjectFor(const CFX_ByteString& key) const;
+ CPDF_Object* GetDirectObjectFor(const CFX_ByteString& key) const;
+ CFX_ByteString GetStringFor(const CFX_ByteString& key) const;
+ CFX_ByteString GetStringFor(const CFX_ByteString& key,
+ const CFX_ByteString& default_str) const;
+ CFX_WideString GetUnicodeTextFor(const CFX_ByteString& key) const;
+ int GetIntegerFor(const CFX_ByteString& key) const;
+ int GetIntegerFor(const CFX_ByteString& key, int default_int) const;
+ bool GetBooleanFor(const CFX_ByteString& key, bool bDefault = false) const;
+ FX_FLOAT GetNumberFor(const CFX_ByteString& key) const;
+ CPDF_Dictionary* GetDictFor(const CFX_ByteString& key) const;
+ CPDF_Stream* GetStreamFor(const CFX_ByteString& key) const;
+ CPDF_Array* GetArrayFor(const CFX_ByteString& key) const;
+ CFX_FloatRect GetRectFor(const CFX_ByteString& key) const;
+ CFX_Matrix GetMatrixFor(const CFX_ByteString& key) const;
+ FX_FLOAT GetFloatFor(const CFX_ByteString& key) const {
+ return GetNumberFor(key);
}
FX_BOOL KeyExist(const CFX_ByteString& key) const;
bool IsSignatureDict() const;
// Set* functions invalidate iterators for the element with the key |key|.
- void SetAt(const CFX_ByteString& key, CPDF_Object* pObj);
- void SetAtName(const CFX_ByteString& key, const CFX_ByteString& name);
- void SetAtString(const CFX_ByteString& key, const CFX_ByteString& str);
- void SetAtInteger(const CFX_ByteString& key, int i);
- void SetAtNumber(const CFX_ByteString& key, FX_FLOAT f);
- void SetAtReference(const CFX_ByteString& key,
- CPDF_IndirectObjectHolder* pDoc,
- uint32_t objnum);
- void SetAtReference(const CFX_ByteString& key,
- CPDF_IndirectObjectHolder* pDoc,
- CPDF_Object* obj) {
- SetAtReference(key, pDoc, obj->GetObjNum());
+ void SetFor(const CFX_ByteString& key, CPDF_Object* pObj);
+ void SetNameFor(const CFX_ByteString& key, const CFX_ByteString& name);
+ void SetStringFor(const CFX_ByteString& key, const CFX_ByteString& str);
+ void SetIntegerFor(const CFX_ByteString& key, int i);
+ void SetNumberFor(const CFX_ByteString& key, FX_FLOAT f);
+ void SetReferenceFor(const CFX_ByteString& key,
+ CPDF_IndirectObjectHolder* pDoc,
+ uint32_t objnum);
+ void SetReferenceFor(const CFX_ByteString& key,
+ CPDF_IndirectObjectHolder* pDoc,
+ CPDF_Object* obj) {
+ SetReferenceFor(key, pDoc, obj->GetObjNum());
}
- void SetAtRect(const CFX_ByteString& key, const CFX_FloatRect& rect);
- void SetAtMatrix(const CFX_ByteString& key, const CFX_Matrix& matrix);
- void SetAtBoolean(const CFX_ByteString& key, bool bValue);
+ void SetRectFor(const CFX_ByteString& key, const CFX_FloatRect& rect);
+ void SetMatrixFor(const CFX_ByteString& key, const CFX_Matrix& matrix);
+ void SetBooleanFor(const CFX_ByteString& key, bool bValue);
// Invalidates iterators for the element with the key |key|.
- void RemoveAt(const CFX_ByteString& key);
+ void RemoveFor(const CFX_ByteString& key);
// Invalidates iterators for the element with the key |oldkey|.
void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey);