summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser
diff options
context:
space:
mode:
authorWei Li <weili@chromium.org>2016-01-29 15:44:20 -0800
committerWei Li <weili@chromium.org>2016-01-29 15:44:20 -0800
commit9b76113ae4567eb998618d049afde26d3f0175d5 (patch)
treeede02b9835770dafe91eaee727e328765e4ffd52 /core/src/fpdfapi/fpdf_parser
parent47f7199eee69abdd48c5ab16a5b8f5aef433a003 (diff)
downloadpdfium-9b76113ae4567eb998618d049afde26d3f0175d5.tar.xz
Merge to XFA: Member function name refactoring
This is needed by Cl 1634373003 as the name collision with virtual functions will be shown as warnings on Linux. Also, it is better to use different names for different cases. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1644633003 . (cherry picked from commit d45e7a51904164fb22049f0a7a80d2a94c06936b) Review URL: https://codereview.chromium.org/1648233002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp34
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp34
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp68
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp14
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp64
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp42
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp12
7 files changed, 134 insertions, 134 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index d7783e438b..39139c40ee 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -231,12 +231,12 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(
int Columns = 1728;
int Rows = 0;
if (pParams) {
- K = pParams->GetInteger("K");
- EndOfLine = pParams->GetInteger("EndOfLine");
- ByteAlign = pParams->GetInteger("EncodedByteAlign");
- BlackIs1 = pParams->GetInteger("BlackIs1");
- Columns = pParams->GetInteger("Columns", 1728);
- Rows = pParams->GetInteger("Rows");
+ 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");
if (Rows > USHRT_MAX) {
Rows = 0;
}
@@ -280,10 +280,10 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
int predictor = 0;
int Colors = 0, BitsPerComponent = 0, Columns = 0;
if (pParams) {
- predictor = pParams->GetInteger("Predictor");
- Colors = pParams->GetInteger("Colors", 1);
- BitsPerComponent = pParams->GetInteger("BitsPerComponent", 8);
- Columns = pParams->GetInteger("Columns", 1);
+ predictor = pParams->GetIntegerBy("Predictor");
+ Colors = pParams->GetIntegerBy("Colors", 1);
+ BitsPerComponent = pParams->GetIntegerBy("BitsPerComponent", 8);
+ Columns = pParams->GetIntegerBy("Columns", 1);
if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) {
return NULL;
}
@@ -303,11 +303,11 @@ FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
FX_BOOL bEarlyChange = TRUE;
int Colors = 0, BitsPerComponent = 0, Columns = 0;
if (pParams) {
- predictor = pParams->GetInteger("Predictor");
- bEarlyChange = pParams->GetInteger("EarlyChange", 1);
- Colors = pParams->GetInteger("Colors", 1);
- BitsPerComponent = pParams->GetInteger("BitsPerComponent", 8);
- Columns = pParams->GetInteger("Columns", 1);
+ predictor = pParams->GetIntegerBy("Predictor");
+ bEarlyChange = pParams->GetIntegerBy("EarlyChange", 1);
+ Colors = pParams->GetIntegerBy("Colors", 1);
+ BitsPerComponent = pParams->GetIntegerBy("BitsPerComponent", 8);
+ Columns = pParams->GetIntegerBy("Columns", 1);
if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) {
return (FX_DWORD)-1;
}
@@ -339,9 +339,9 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
pParams = nullptr;
for (FX_DWORD i = 0; i < pDecoders->GetCount(); i++) {
- CFX_ByteStringC str = pDecoders->GetConstString(i);
+ CFX_ByteStringC str = pDecoders->GetConstStringAt(i);
DecoderList.Add(str);
- ParamList.Add(pParams ? pParamsArray->GetDict(i) : nullptr);
+ ParamList.Add(pParams ? pParamsArray->GetDictAt(i) : nullptr);
}
} else {
DecoderList.Add(pDecoder->GetConstString());
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
index 6bb30c085a..be55a56d0f 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
@@ -15,17 +15,17 @@ namespace {
int CountPages(CPDF_Dictionary* pPages,
std::set<CPDF_Dictionary*>* visited_pages) {
- int count = pPages->GetInteger("Count");
+ int count = pPages->GetIntegerBy("Count");
if (count > 0 && count < FPDF_PAGE_MAX_NUM) {
return count;
}
- CPDF_Array* pKidList = pPages->GetArray("Kids");
+ CPDF_Array* pKidList = pPages->GetArrayBy("Kids");
if (!pKidList) {
return 0;
}
count = 0;
for (FX_DWORD i = 0; i < pKidList->GetCount(); i++) {
- CPDF_Dictionary* pKid = pKidList->GetDict(i);
+ CPDF_Dictionary* pKid = pKidList->GetDictAt(i);
if (!pKid || pdfium::ContainsKey(*visited_pages, pKid)) {
continue;
}
@@ -85,8 +85,8 @@ void CPDF_Document::LoadDoc() {
}
CPDF_Array* pIDArray = m_pParser->GetIDArray();
if (pIDArray) {
- m_ID1 = pIDArray->GetString(0);
- m_ID2 = pIDArray->GetString(1);
+ m_ID1 = pIDArray->GetStringAt(0);
+ m_ID2 = pIDArray->GetStringAt(1);
}
m_PageList.SetSize(RetrievePageCount());
}
@@ -102,8 +102,8 @@ void CPDF_Document::LoadAsynDoc(CPDF_Dictionary* pLinearized) {
m_pInfoDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr;
CPDF_Array* pIDArray = m_pParser->GetIDArray();
if (pIDArray) {
- m_ID1 = pIDArray->GetString(0);
- m_ID2 = pIDArray->GetString(1);
+ m_ID1 = pIDArray->GetStringAt(0);
+ m_ID2 = pIDArray->GetStringAt(1);
}
FX_DWORD dwPageCount = 0;
CPDF_Object* pCount = pLinearized->GetElement("N");
@@ -136,7 +136,7 @@ CPDF_Dictionary* CPDF_Document::_FindPDFPage(CPDF_Dictionary* pPages,
int iPage,
int nPagesToGo,
int level) {
- CPDF_Array* pKidList = pPages->GetArray("Kids");
+ CPDF_Array* pKidList = pPages->GetArrayBy("Kids");
if (!pKidList) {
if (nPagesToGo == 0) {
return pPages;
@@ -148,7 +148,7 @@ CPDF_Dictionary* CPDF_Document::_FindPDFPage(CPDF_Dictionary* pPages,
}
int nKids = pKidList->GetCount();
for (int i = 0; i < nKids; i++) {
- CPDF_Dictionary* pKid = pKidList->GetDict(i);
+ CPDF_Dictionary* pKid = pKidList->GetDictAt(i);
if (!pKid) {
nPagesToGo--;
continue;
@@ -163,7 +163,7 @@ CPDF_Dictionary* CPDF_Document::_FindPDFPage(CPDF_Dictionary* pPages,
m_PageList.SetAt(iPage - nPagesToGo, pKid->GetObjNum());
nPagesToGo--;
} else {
- int nPages = pKid->GetInteger("Count");
+ int nPages = pKid->GetIntegerBy("Count");
if (nPagesToGo < nPages) {
return _FindPDFPage(pKid, iPage, nPagesToGo, level + 1);
}
@@ -194,7 +194,7 @@ CPDF_Dictionary* CPDF_Document::GetPage(int iPage) {
if (!pRoot)
return nullptr;
- CPDF_Dictionary* pPages = pRoot->GetDict("Pages");
+ CPDF_Dictionary* pPages = pRoot->GetDictBy("Pages");
if (!pPages)
return nullptr;
@@ -212,14 +212,14 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode,
int& index,
int level) {
if (pNode->KeyExist("Kids")) {
- CPDF_Array* pKidList = pNode->GetArray("Kids");
+ CPDF_Array* pKidList = pNode->GetArrayBy("Kids");
if (!pKidList) {
return -1;
}
if (level >= FX_MAX_PAGE_LEVEL) {
return -1;
}
- FX_DWORD count = pNode->GetInteger("Count");
+ FX_DWORD count = pNode->GetIntegerBy("Count");
if (count <= skip_count) {
skip_count -= count;
index += count;
@@ -236,7 +236,7 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode,
}
}
for (FX_DWORD i = 0; i < pKidList->GetCount(); i++) {
- CPDF_Dictionary* pKid = pKidList->GetDict(i);
+ CPDF_Dictionary* pKid = pKidList->GetDictAt(i);
if (!pKid) {
continue;
}
@@ -278,7 +278,7 @@ int CPDF_Document::GetPageIndex(FX_DWORD objnum) {
if (!pRoot) {
return -1;
}
- CPDF_Dictionary* pPages = pRoot->GetDict("Pages");
+ CPDF_Dictionary* pPages = pRoot->GetDictBy("Pages");
if (!pPages) {
return -1;
}
@@ -294,7 +294,7 @@ int CPDF_Document::RetrievePageCount() const {
if (!pRoot) {
return 0;
}
- CPDF_Dictionary* pPages = pRoot->GetDict("Pages");
+ CPDF_Dictionary* pPages = pRoot->GetDictBy("Pages");
if (!pPages) {
return 0;
}
@@ -321,7 +321,7 @@ FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const {
auto it = m_IndirectObjs.find(objnum);
if (it != m_IndirectObjs.end()) {
CPDF_Stream* pStream = it->second->AsStream();
- bForm = pStream && pStream->GetDict()->GetString("Subtype") == "Form";
+ bForm = pStream && pStream->GetDict()->GetStringBy("Subtype") == "Form";
return TRUE;
}
if (!m_pParser) {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
index 0ee0d9a3e8..595e4d6da6 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
@@ -21,7 +21,7 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
int keylen,
FX_BOOL bIgnoreMeta,
CPDF_Array* pIdArray) {
- int revision = pEncrypt->GetInteger("R");
+ int revision = pEncrypt->GetIntegerBy("R");
uint8_t passcode[32];
for (FX_DWORD i = 0; i < 32; i++) {
passcode[i] = i < pass_size ? password[i] : defpasscode[i - pass_size];
@@ -29,16 +29,16 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
uint8_t md5[100];
CRYPT_MD5Start(md5);
CRYPT_MD5Update(md5, passcode, 32);
- CFX_ByteString okey = pEncrypt->GetString("O");
+ CFX_ByteString okey = pEncrypt->GetStringBy("O");
CRYPT_MD5Update(md5, (uint8_t*)okey.c_str(), okey.GetLength());
- FX_DWORD perm = pEncrypt->GetInteger("P");
+ FX_DWORD perm = pEncrypt->GetIntegerBy("P");
CRYPT_MD5Update(md5, (uint8_t*)&perm, 4);
if (pIdArray) {
- CFX_ByteString id = pIdArray->GetString(0);
+ CFX_ByteString id = pIdArray->GetStringAt(0);
CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength());
}
if (!bIgnoreMeta && revision >= 3 &&
- !pEncrypt->GetInteger("EncryptMetadata", 1)) {
+ !pEncrypt->GetIntegerBy("EncryptMetadata", 1)) {
FX_DWORD tag = (FX_DWORD)-1;
CRYPT_MD5Update(md5, (uint8_t*)&tag, 4);
}
@@ -110,41 +110,41 @@ static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
const CFX_ByteStringC& name,
int& cipher,
int& keylen) {
- int Version = pEncryptDict->GetInteger("V");
+ int Version = pEncryptDict->GetIntegerBy("V");
cipher = FXCIPHER_RC4;
keylen = 0;
if (Version >= 4) {
- CPDF_Dictionary* pCryptFilters = pEncryptDict->GetDict("CF");
+ CPDF_Dictionary* pCryptFilters = pEncryptDict->GetDictBy("CF");
if (!pCryptFilters) {
return FALSE;
}
if (name == "Identity") {
cipher = FXCIPHER_NONE;
} else {
- CPDF_Dictionary* pDefFilter = pCryptFilters->GetDict(name);
+ CPDF_Dictionary* pDefFilter = pCryptFilters->GetDictBy(name);
if (!pDefFilter) {
return FALSE;
}
int nKeyBits = 0;
if (Version == 4) {
- nKeyBits = pDefFilter->GetInteger("Length", 0);
+ nKeyBits = pDefFilter->GetIntegerBy("Length", 0);
if (nKeyBits == 0) {
- nKeyBits = pEncryptDict->GetInteger("Length", 128);
+ nKeyBits = pEncryptDict->GetIntegerBy("Length", 128);
}
} else {
- nKeyBits = pEncryptDict->GetInteger("Length", 256);
+ nKeyBits = pEncryptDict->GetIntegerBy("Length", 256);
}
if (nKeyBits < 40) {
nKeyBits *= 8;
}
keylen = nKeyBits / 8;
- CFX_ByteString cipher_name = pDefFilter->GetString("CFM");
+ CFX_ByteString cipher_name = pDefFilter->GetStringBy("CFM");
if (cipher_name == "AESV2" || cipher_name == "AESV3") {
cipher = FXCIPHER_AES;
}
}
} else {
- keylen = Version > 1 ? pEncryptDict->GetInteger("Length", 40) / 8 : 5;
+ keylen = Version > 1 ? pEncryptDict->GetIntegerBy("Length", 40) / 8 : 5;
}
if (keylen > 32 || keylen < 0) {
return FALSE;
@@ -154,14 +154,14 @@ static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) {
m_pEncryptDict = pEncryptDict;
m_bOwner = FALSE;
- m_Version = pEncryptDict->GetInteger("V");
- m_Revision = pEncryptDict->GetInteger("R");
- m_Permissions = pEncryptDict->GetInteger("P", -1);
+ m_Version = pEncryptDict->GetIntegerBy("V");
+ m_Revision = pEncryptDict->GetIntegerBy("R");
+ m_Permissions = pEncryptDict->GetIntegerBy("P", -1);
if (m_Version < 4) {
return _LoadCryptInfo(pEncryptDict, CFX_ByteString(), m_Cipher, m_KeyLen);
}
- CFX_ByteString stmf_name = pEncryptDict->GetString("StmF");
- CFX_ByteString strf_name = pEncryptDict->GetString("StrF");
+ CFX_ByteString stmf_name = pEncryptDict->GetStringBy("StmF");
+ CFX_ByteString strf_name = pEncryptDict->GetStringBy("StrF");
if (stmf_name != strf_name) {
return FALSE;
}
@@ -176,13 +176,13 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict,
int& key_len) {
m_pEncryptDict = pEncryptDict;
m_bOwner = FALSE;
- m_Version = pEncryptDict->GetInteger("V");
- m_Revision = pEncryptDict->GetInteger("R");
- m_Permissions = pEncryptDict->GetInteger("P", -1);
+ m_Version = pEncryptDict->GetIntegerBy("V");
+ m_Revision = pEncryptDict->GetIntegerBy("R");
+ m_Permissions = pEncryptDict->GetIntegerBy("P", -1);
CFX_ByteString strf_name, stmf_name;
if (m_Version >= 4) {
- stmf_name = pEncryptDict->GetString("StmF");
- strf_name = pEncryptDict->GetString("StrF");
+ stmf_name = pEncryptDict->GetStringBy("StmF");
+ strf_name = pEncryptDict->GetStringBy("StrF");
if (stmf_name != strf_name) {
return FALSE;
}
@@ -302,12 +302,12 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(
FX_BOOL bOwner,
uint8_t* key) {
CFX_ByteString okey =
- m_pEncryptDict ? m_pEncryptDict->GetString("O") : CFX_ByteString();
+ m_pEncryptDict ? m_pEncryptDict->GetStringBy("O") : CFX_ByteString();
if (okey.GetLength() < 48) {
return FALSE;
}
CFX_ByteString ukey =
- m_pEncryptDict ? m_pEncryptDict->GetString("U") : CFX_ByteString();
+ m_pEncryptDict ? m_pEncryptDict->GetStringBy("U") : CFX_ByteString();
if (ukey.GetLength() < 48) {
return FALSE;
}
@@ -345,7 +345,7 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(
CRYPT_SHA256Finish(sha, digest);
}
CFX_ByteString ekey = m_pEncryptDict
- ? m_pEncryptDict->GetString(bOwner ? "OE" : "UE")
+ ? m_pEncryptDict->GetStringBy(bOwner ? "OE" : "UE")
: CFX_ByteString();
if (ekey.GetLength() < 32) {
return FALSE;
@@ -358,7 +358,7 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(
CRYPT_AESDecrypt(aes, key, ekey, 32);
CRYPT_AESSetKey(aes, 16, key, 32, FALSE);
CRYPT_AESSetIV(aes, iv);
- CFX_ByteString perms = m_pEncryptDict->GetString("Perms");
+ CFX_ByteString perms = m_pEncryptDict->GetStringBy("Perms");
if (perms.IsEmpty()) {
return FALSE;
}
@@ -417,7 +417,7 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(
CalcEncryptKey(m_pEncryptDict, password, pass_size, key, key_len,
bIgnoreEncryptMeta, m_pParser->GetIDArray());
CFX_ByteString ukey =
- m_pEncryptDict ? m_pEncryptDict->GetString("U") : CFX_ByteString();
+ m_pEncryptDict ? m_pEncryptDict->GetStringBy("U") : CFX_ByteString();
if (ukey.GetLength() < 16) {
return FALSE;
}
@@ -445,7 +445,7 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(
CRYPT_MD5Update(md5, defpasscode, 32);
CPDF_Array* pIdArray = m_pParser->GetIDArray();
if (pIdArray) {
- CFX_ByteString id = pIdArray->GetString(0);
+ CFX_ByteString id = pIdArray->GetStringAt(0);
CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength());
}
CRYPT_MD5Finish(md5, ukeybuf);
@@ -465,7 +465,7 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(
const uint8_t* owner_pass,
FX_DWORD pass_size,
int32_t key_len) {
- CFX_ByteString okey = m_pEncryptDict->GetString("O");
+ CFX_ByteString okey = m_pEncryptDict->GetStringBy("O");
uint8_t passcode[32];
FX_DWORD i;
for (i = 0; i < 32; i++) {
@@ -524,7 +524,7 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckOwnerPassword(
key_len);
}
FX_BOOL CPDF_StandardSecurityHandler::IsMetadataEncrypted() {
- return m_pEncryptDict->GetBoolean("EncryptMetadata", TRUE);
+ return m_pEncryptDict->GetBooleanBy("EncryptMetadata", TRUE);
}
CPDF_SecurityHandler* FPDF_CreateStandardSecurityHandler() {
return new CPDF_StandardSecurityHandler;
@@ -558,7 +558,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
AES256_SetPassword(pEncryptDict, owner_pass, owner_size, TRUE,
m_EncryptKey);
AES256_SetPerms(pEncryptDict, m_Permissions,
- pEncryptDict->GetBoolean("EncryptMetadata", TRUE),
+ pEncryptDict->GetBooleanBy("EncryptMetadata", TRUE),
m_EncryptKey);
}
return;
@@ -606,7 +606,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CRYPT_MD5Start(md5);
CRYPT_MD5Update(md5, defpasscode, 32);
if (pIdArray) {
- CFX_ByteString id = pIdArray->GetString(0);
+ CFX_ByteString id = pIdArray->GetStringAt(0);
CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength());
}
uint8_t digest[32];
@@ -652,7 +652,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(
CRYPT_SHA1Update(sha, (uint8_t*)"hello", 5);
uint8_t digest[20];
CRYPT_SHA1Finish(sha, digest);
- CFX_ByteString ukey = pEncryptDict->GetString("U");
+ CFX_ByteString ukey = pEncryptDict->GetStringBy("U");
uint8_t digest1[48];
if (m_Revision >= 6) {
Revision6_Hash(password, size, digest,
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
index 137dbb622f..f5701fefff 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
@@ -75,7 +75,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->GetDict("Root");
+ m_pRootDict = pMainDict->GetDictBy("Root");
pMainDict->Release();
}
break;
@@ -95,12 +95,12 @@ FX_BOOL CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const {
return TRUE;
}
CFX_WideString CFDF_Document::GetWin32Path() const {
- CPDF_Dictionary* pDict = m_pRootDict ? m_pRootDict->GetDict("FDF") : NULL;
+ CPDF_Dictionary* pDict = m_pRootDict ? m_pRootDict->GetDictBy("FDF") : NULL;
CPDF_Object* pFileSpec = pDict ? pDict->GetElementValue("F") : NULL;
if (!pFileSpec)
return CFX_WideString();
if (pFileSpec->IsString())
- return FPDF_FileSpec_GetWin32Path(m_pRootDict->GetDict("FDF"));
+ return FPDF_FileSpec_GetWin32Path(m_pRootDict->GetDictBy("FDF"));
return FPDF_FileSpec_GetWin32Path(pFileSpec);
}
static CFX_WideString ChangeSlash(const FX_WCHAR* str) {
@@ -147,15 +147,15 @@ CFX_WideString FPDF_FileSpec_GetWin32Path(const CPDF_Object* pFileSpec) {
if (!pFileSpec) {
wsFileName = CFX_WideString();
} else if (const CPDF_Dictionary* pDict = pFileSpec->AsDictionary()) {
- wsFileName = pDict->GetUnicodeText("UF");
+ wsFileName = pDict->GetUnicodeTextBy("UF");
if (wsFileName.IsEmpty()) {
- wsFileName = CFX_WideString::FromLocal(pDict->GetString("F"));
+ wsFileName = CFX_WideString::FromLocal(pDict->GetStringBy("F"));
}
- if (pDict->GetString("FS") == "URL") {
+ if (pDict->GetStringBy("FS") == "URL") {
return wsFileName;
}
if (wsFileName.IsEmpty() && pDict->KeyExist("DOS")) {
- wsFileName = CFX_WideString::FromLocal(pDict->GetString("DOS"));
+ wsFileName = CFX_WideString::FromLocal(pDict->GetStringBy("DOS"));
}
} else {
wsFileName = CFX_WideString::FromLocal(pFileSpec->GetString());
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
index 15edaf1b66..6b512949ae 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -401,10 +401,10 @@ CFX_FloatRect CPDF_Array::GetRect() {
if (!IsArray() || m_Objects.GetSize() != 4)
return rect;
- rect.left = GetNumber(0);
- rect.bottom = GetNumber(1);
- rect.right = GetNumber(2);
- rect.top = GetNumber(3);
+ rect.left = GetNumberAt(0);
+ rect.bottom = GetNumberAt(1);
+ rect.right = GetNumberAt(2);
+ rect.top = GetNumberAt(3);
return rect;
}
CFX_Matrix CPDF_Array::GetMatrix() {
@@ -412,8 +412,8 @@ CFX_Matrix CPDF_Array::GetMatrix() {
if (!IsArray() || m_Objects.GetSize() != 6)
return matrix;
- matrix.Set(GetNumber(0), GetNumber(1), GetNumber(2), GetNumber(3),
- GetNumber(4), GetNumber(5));
+ matrix.Set(GetNumberAt(0), GetNumberAt(1), GetNumberAt(2), GetNumberAt(3),
+ GetNumberAt(4), GetNumberAt(5));
return matrix;
}
CPDF_Object* CPDF_Array::GetElement(FX_DWORD i) const {
@@ -426,27 +426,27 @@ CPDF_Object* CPDF_Array::GetElementValue(FX_DWORD i) const {
return nullptr;
return m_Objects.GetAt(i)->GetDirect();
}
-CFX_ByteString CPDF_Array::GetString(FX_DWORD i) const {
+CFX_ByteString CPDF_Array::GetStringAt(FX_DWORD i) const {
if (i >= (FX_DWORD)m_Objects.GetSize())
return CFX_ByteString();
return m_Objects.GetAt(i)->GetString();
}
-CFX_ByteStringC CPDF_Array::GetConstString(FX_DWORD i) const {
+CFX_ByteStringC CPDF_Array::GetConstStringAt(FX_DWORD i) const {
if (i >= (FX_DWORD)m_Objects.GetSize())
return CFX_ByteStringC();
return m_Objects.GetAt(i)->GetConstString();
}
-int CPDF_Array::GetInteger(FX_DWORD i) const {
+int CPDF_Array::GetIntegerAt(FX_DWORD i) const {
if (i >= (FX_DWORD)m_Objects.GetSize())
return 0;
return m_Objects.GetAt(i)->GetInteger();
}
-FX_FLOAT CPDF_Array::GetNumber(FX_DWORD i) const {
+FX_FLOAT CPDF_Array::GetNumberAt(FX_DWORD i) const {
if (i >= (FX_DWORD)m_Objects.GetSize())
return 0;
return m_Objects.GetAt(i)->GetNumber();
}
-CPDF_Dictionary* CPDF_Array::GetDict(FX_DWORD i) const {
+CPDF_Dictionary* CPDF_Array::GetDictAt(FX_DWORD i) const {
CPDF_Object* p = GetElementValue(i);
if (!p)
return NULL;
@@ -456,10 +456,10 @@ CPDF_Dictionary* CPDF_Array::GetDict(FX_DWORD i) const {
return pStream->GetDict();
return NULL;
}
-CPDF_Stream* CPDF_Array::GetStream(FX_DWORD i) const {
+CPDF_Stream* CPDF_Array::GetStreamAt(FX_DWORD i) const {
return ToStream(GetElementValue(i));
}
-CPDF_Array* CPDF_Array::GetArray(FX_DWORD i) const {
+CPDF_Array* CPDF_Array::GetArrayAt(FX_DWORD i) const {
return ToArray(GetElementValue(i));
}
void CPDF_Array::RemoveAt(FX_DWORD i, int nCount) {
@@ -555,14 +555,14 @@ CPDF_Object* CPDF_Dictionary::GetElementValue(
CPDF_Object* p = GetElement(key);
return p ? p->GetDirect() : nullptr;
}
-CFX_ByteString CPDF_Dictionary::GetString(const CFX_ByteStringC& key) const {
+CFX_ByteString CPDF_Dictionary::GetStringBy(const CFX_ByteStringC& key) const {
CPDF_Object* p = GetElement(key);
if (p) {
return p->GetString();
}
return CFX_ByteString();
}
-CFX_ByteStringC CPDF_Dictionary::GetConstString(
+CFX_ByteStringC CPDF_Dictionary::GetConstStringBy(
const CFX_ByteStringC& key) const {
CPDF_Object* p = GetElement(key);
if (p) {
@@ -570,22 +570,22 @@ CFX_ByteStringC CPDF_Dictionary::GetConstString(
}
return CFX_ByteStringC();
}
-CFX_WideString CPDF_Dictionary::GetUnicodeText(const CFX_ByteStringC& key,
- CFX_CharMap* pCharMap) const {
+CFX_WideString CPDF_Dictionary::GetUnicodeTextBy(const CFX_ByteStringC& key,
+ CFX_CharMap* pCharMap) const {
CPDF_Object* p = GetElement(key);
if (CPDF_Reference* pRef = ToReference(p))
p = pRef->GetDirect();
return p ? p->GetUnicodeText(pCharMap) : CFX_WideString();
}
-CFX_ByteString CPDF_Dictionary::GetString(const CFX_ByteStringC& key,
- const CFX_ByteStringC& def) const {
+CFX_ByteString CPDF_Dictionary::GetStringBy(const CFX_ByteStringC& key,
+ const CFX_ByteStringC& def) const {
CPDF_Object* p = GetElement(key);
if (p) {
return p->GetString();
}
return CFX_ByteString(def);
}
-CFX_ByteStringC CPDF_Dictionary::GetConstString(
+CFX_ByteStringC CPDF_Dictionary::GetConstStringBy(
const CFX_ByteStringC& key,
const CFX_ByteStringC& def) const {
CPDF_Object* p = GetElement(key);
@@ -594,35 +594,35 @@ CFX_ByteStringC CPDF_Dictionary::GetConstString(
}
return CFX_ByteStringC(def);
}
-int CPDF_Dictionary::GetInteger(const CFX_ByteStringC& key) const {
+int CPDF_Dictionary::GetIntegerBy(const CFX_ByteStringC& key) const {
CPDF_Object* p = GetElement(key);
if (p) {
return p->GetInteger();
}
return 0;
}
-int CPDF_Dictionary::GetInteger(const CFX_ByteStringC& key, int def) const {
+int CPDF_Dictionary::GetIntegerBy(const CFX_ByteStringC& key, int def) const {
CPDF_Object* p = GetElement(key);
if (p) {
return p->GetInteger();
}
return def;
}
-FX_FLOAT CPDF_Dictionary::GetNumber(const CFX_ByteStringC& key) const {
+FX_FLOAT CPDF_Dictionary::GetNumberBy(const CFX_ByteStringC& key) const {
CPDF_Object* p = GetElement(key);
if (p) {
return p->GetNumber();
}
return 0;
}
-FX_BOOL CPDF_Dictionary::GetBoolean(const CFX_ByteStringC& key,
- FX_BOOL bDefault) const {
+FX_BOOL CPDF_Dictionary::GetBooleanBy(const CFX_ByteStringC& key,
+ FX_BOOL bDefault) const {
CPDF_Object* p = GetElement(key);
if (ToBoolean(p))
return p->GetInteger();
return bDefault;
}
-CPDF_Dictionary* CPDF_Dictionary::GetDict(const CFX_ByteStringC& key) const {
+CPDF_Dictionary* CPDF_Dictionary::GetDictBy(const CFX_ByteStringC& key) const {
CPDF_Object* p = GetElementValue(key);
if (!p)
return nullptr;
@@ -632,22 +632,22 @@ CPDF_Dictionary* CPDF_Dictionary::GetDict(const CFX_ByteStringC& key) const {
return pStream->GetDict();
return nullptr;
}
-CPDF_Array* CPDF_Dictionary::GetArray(const CFX_ByteStringC& key) const {
+CPDF_Array* CPDF_Dictionary::GetArrayBy(const CFX_ByteStringC& key) const {
return ToArray(GetElementValue(key));
}
-CPDF_Stream* CPDF_Dictionary::GetStream(const CFX_ByteStringC& key) const {
+CPDF_Stream* CPDF_Dictionary::GetStreamBy(const CFX_ByteStringC& key) const {
return ToStream(GetElementValue(key));
}
-CFX_FloatRect CPDF_Dictionary::GetRect(const CFX_ByteStringC& key) const {
+CFX_FloatRect CPDF_Dictionary::GetRectBy(const CFX_ByteStringC& key) const {
CFX_FloatRect rect;
- CPDF_Array* pArray = GetArray(key);
+ CPDF_Array* pArray = GetArrayBy(key);
if (pArray)
rect = pArray->GetRect();
return rect;
}
-CFX_Matrix CPDF_Dictionary::GetMatrix(const CFX_ByteStringC& key) const {
+CFX_Matrix CPDF_Dictionary::GetMatrixBy(const CFX_ByteStringC& key) const {
CFX_Matrix matrix;
- CPDF_Array* pArray = GetArray(key);
+ CPDF_Array* pArray = GetArrayBy(key);
if (pArray)
matrix = pArray->GetMatrix();
return matrix;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index a62018d0cd..010554335d 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -70,11 +70,11 @@ FX_DWORD GetVarInt(const uint8_t* p, int32_t n) {
}
int32_t GetStreamNCount(CPDF_StreamAcc* pObjStream) {
- return pObjStream->GetDict()->GetInteger("N");
+ return pObjStream->GetDict()->GetIntegerBy("N");
}
int32_t GetStreamFirst(CPDF_StreamAcc* pObjStream) {
- return pObjStream->GetDict()->GetInteger("First");
+ return pObjStream->GetDict()->GetIntegerBy("First");
}
bool CanReadFromBitStream(const CFX_BitStream* hStream,
@@ -314,7 +314,7 @@ CPDF_Parser::Error CPDF_Parser::SetEncryptHandler() {
}
m_Syntax.SetEncrypt(pCryptoHandler.release());
} else if (m_pEncryptDict) {
- CFX_ByteString filter = m_pEncryptDict->GetString("Filter");
+ CFX_ByteString filter = m_pEncryptDict->GetStringBy("Filter");
std::unique_ptr<CPDF_SecurityHandler> pSecurityHandler;
Error err = HANDLER_ERROR;
if (filter == "Standard") {
@@ -396,7 +396,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) {
return FALSE;
xrefpos = GetDirectInteger(pDict.get(), "Prev");
- XRefStreamList.InsertAt(0, pDict->GetInteger("XRefStm"));
+ XRefStreamList.InsertAt(0, pDict->GetIntegerBy("XRefStm"));
m_Trailers.Add(pDict.release());
}
for (int32_t i = 0; i < CrossRefList.GetSize(); i++) {
@@ -439,7 +439,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos,
}
xrefpos = GetDirectInteger(pDict.get(), "Prev");
- XRefStreamList.InsertAt(0, pDict->GetInteger("XRefStm"));
+ XRefStreamList.InsertAt(0, pDict->GetIntegerBy("XRefStm"));
m_Trailers.Add(pDict.release());
}
for (int32_t i = 1; i < CrossRefList.GetSize(); i++)
@@ -790,7 +790,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
if (CPDF_Stream* pStream = ToStream(pObject)) {
if (CPDF_Dictionary* pDict = pStream->GetDict()) {
if ((pDict->KeyExist("Type")) &&
- (pDict->GetString("Type") == "XRef" &&
+ (pDict->GetStringBy("Type") == "XRef" &&
pDict->KeyExist("Size"))) {
CPDF_Object* pRoot = pDict->GetElement("Root");
if (pRoot && pRoot->GetDict() &&
@@ -1014,8 +1014,8 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
if (!pStream)
return FALSE;
- *pos = pStream->GetDict()->GetInteger("Prev");
- int32_t size = pStream->GetDict()->GetInteger("Size");
+ *pos = pStream->GetDict()->GetIntegerBy("Prev");
+ int32_t size = pStream->GetDict()->GetIntegerBy("Size");
if (size < 0) {
pStream->Release();
return FALSE;
@@ -1030,7 +1030,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
m_Trailers.Add(ToDictionary(pStream->GetDict()->Clone()));
}
std::vector<std::pair<int32_t, int32_t> > arrIndex;
- CPDF_Array* pArray = pStream->GetDict()->GetArray("Index");
+ CPDF_Array* pArray = pStream->GetDict()->GetArrayBy("Index");
if (pArray) {
FX_DWORD nPairSize = pArray->GetCount() / 2;
for (FX_DWORD i = 0; i < nPairSize; i++) {
@@ -1048,7 +1048,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 = pStream->GetDict()->GetArray("W");
+ pArray = pStream->GetDict()->GetArrayBy("W");
if (!pArray) {
pStream->Release();
return FALSE;
@@ -1056,7 +1056,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
CFX_DWordArray WidthArray;
FX_SAFE_DWORD dwAccWidth = 0;
for (FX_DWORD i = 0; i < pArray->GetCount(); i++) {
- WidthArray.Add(pArray->GetInteger(i));
+ WidthArray.Add(pArray->GetIntegerAt(i));
dwAccWidth += WidthArray[i];
}
if (!dwAccWidth.IsValid() || WidthArray.GetSize() < 3) {
@@ -1487,10 +1487,10 @@ FX_DWORD CPDF_Parser::GetPermissions(FX_BOOL bCheckRevision) {
return (FX_DWORD)-1;
}
FX_DWORD dwPermission = m_pSecurityHandler->GetPermissions();
- if (m_pEncryptDict && m_pEncryptDict->GetString("Filter") == "Standard") {
+ if (m_pEncryptDict && m_pEncryptDict->GetStringBy("Filter") == "Standard") {
dwPermission &= 0xFFFFFFFC;
dwPermission |= 0xFFFFF0C0;
- if (bCheckRevision && m_pEncryptDict->GetInteger("R") == 2) {
+ if (bCheckRevision && m_pEncryptDict->GetIntegerBy("R") == 2) {
dwPermission &= 0xFFFFF0FF;
}
}
@@ -2949,7 +2949,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(
pObj = pObj->GetDict();
case CPDF_Object::DICTIONARY: {
CPDF_Dictionary* pDict = pObj->GetDict();
- if (pDict && pDict->GetString("Type") == "Page" && !bParsePage) {
+ if (pDict && pDict->GetStringBy("Type") == "Page" && !bParsePage) {
continue;
}
for (const auto& it : *pDict) {
@@ -3300,7 +3300,7 @@ FX_BOOL CPDF_DataAvail::CheckPage(IFX_DownloadHints* pHints) {
pObj->Release();
continue;
}
- CFX_ByteString type = pObj->GetDict()->GetString("Type");
+ CFX_ByteString type = pObj->GetDict()->GetStringBy("Type");
if (type == "Pages") {
m_PagesArray.Add(pObj);
continue;
@@ -3501,7 +3501,7 @@ FX_BOOL CPDF_DataAvail::CheckHintTables(IFX_DownloadHints* pHints) {
m_docStatus = PDF_DATAAVAIL_DONE;
return TRUE;
}
- CPDF_Array* pHintStreamRange = pDict->GetArray("H");
+ CPDF_Array* pHintStreamRange = pDict->GetArrayBy("H");
FX_FILESIZE szHSStart =
pHintStreamRange->GetElementValue(0)
? pHintStreamRange->GetElementValue(0)->GetInteger()
@@ -3682,7 +3682,7 @@ int32_t CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints,
if (pName) {
if (pName->GetString() == "XRef") {
m_Pos += m_parser.m_Syntax.SavePos();
- xref_offset = pObj->GetDict()->GetInteger("Prev");
+ xref_offset = pObj->GetDict()->GetIntegerBy("Prev");
pObj->Release();
return 1;
}
@@ -4032,7 +4032,7 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo,
}
pPageNode->m_dwPageNo = dwPageNo;
CPDF_Dictionary* pDict = pPage->GetDict();
- CFX_ByteString type = pDict->GetString("Type");
+ CFX_ByteString type = pDict->GetStringBy("Type");
if (type == "Pages") {
pPageNode->m_type = PDF_PAGENODE_PAGES;
CPDF_Object* pKids = pDict->GetElement("Kids");
@@ -4159,7 +4159,7 @@ FX_BOOL CPDF_DataAvail::CheckPageCount(IFX_DownloadHints* pHints) {
pPages->Release();
return TRUE;
}
- int count = pPagesDict->GetInteger("Count");
+ int count = pPagesDict->GetIntegerBy("Count");
if (count > 0) {
pPages->Release();
return TRUE;
@@ -4875,7 +4875,7 @@ FX_BOOL CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) {
int CPDF_HintTables::ReadPrimaryHintStreamOffset() const {
if (!m_pLinearizedDict)
return -1;
- CPDF_Array* pRange = m_pLinearizedDict->GetArray("H");
+ CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H");
if (!pRange)
return -1;
CPDF_Object* pStreamOffset = pRange->GetElementValue(0);
@@ -4886,7 +4886,7 @@ int CPDF_HintTables::ReadPrimaryHintStreamOffset() const {
int CPDF_HintTables::ReadPrimaryHintStreamLength() const {
if (!m_pLinearizedDict)
return -1;
- CPDF_Array* pRange = m_pLinearizedDict->GetArray("H");
+ CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H");
if (!pRange)
return -1;
CPDF_Object* pStreamLen = pRange->GetElementValue(1);
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
index 141618030a..e6e2f2aabe 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
@@ -412,16 +412,16 @@ FX_FLOAT PDF_ClipFloat(FX_FLOAT f) {
return f;
}
static CPDF_Object* SearchNumberNode(CPDF_Dictionary* pNode, int num) {
- CPDF_Array* pLimits = pNode->GetArray("Limits");
+ CPDF_Array* pLimits = pNode->GetArrayBy("Limits");
if (pLimits &&
- (num < pLimits->GetInteger(0) || num > pLimits->GetInteger(1))) {
+ (num < pLimits->GetIntegerAt(0) || num > pLimits->GetIntegerAt(1))) {
return NULL;
}
- CPDF_Array* pNumbers = pNode->GetArray("Nums");
+ CPDF_Array* pNumbers = pNode->GetArrayBy("Nums");
if (pNumbers) {
FX_DWORD dwCount = pNumbers->GetCount() / 2;
for (FX_DWORD i = 0; i < dwCount; i++) {
- int index = pNumbers->GetInteger(i * 2);
+ int index = pNumbers->GetIntegerAt(i * 2);
if (num == index) {
return pNumbers->GetElementValue(i * 2 + 1);
}
@@ -431,12 +431,12 @@ static CPDF_Object* SearchNumberNode(CPDF_Dictionary* pNode, int num) {
}
return NULL;
}
- CPDF_Array* pKids = pNode->GetArray("Kids");
+ CPDF_Array* pKids = pNode->GetArrayBy("Kids");
if (!pKids) {
return NULL;
}
for (FX_DWORD i = 0; i < pKids->GetCount(); i++) {
- CPDF_Dictionary* pKid = pKids->GetDict(i);
+ CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid) {
continue;
}