diff options
author | Wei Li <weili@chromium.org> | 2016-01-29 15:44:20 -0800 |
---|---|---|
committer | Wei Li <weili@chromium.org> | 2016-01-29 15:44:20 -0800 |
commit | 9b76113ae4567eb998618d049afde26d3f0175d5 (patch) | |
tree | ede02b9835770dafe91eaee727e328765e4ffd52 /core | |
parent | 47f7199eee69abdd48c5ab16a5b8f5aef433a003 (diff) | |
download | pdfium-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')
42 files changed, 792 insertions, 782 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h index ca4bb51fda..0478acc3e0 100644 --- a/core/include/fpdfapi/fpdf_objects.h +++ b/core/include/fpdfapi/fpdf_objects.h @@ -256,21 +256,21 @@ class CPDF_Array : public CPDF_Object { CFX_FloatRect GetRect(); - CFX_ByteString GetString(FX_DWORD index) const; + CFX_ByteString GetStringAt(FX_DWORD index) const; - CFX_ByteStringC GetConstString(FX_DWORD index) const; + CFX_ByteStringC GetConstStringAt(FX_DWORD index) const; - int GetInteger(FX_DWORD index) const; + int GetIntegerAt(FX_DWORD index) const; - FX_FLOAT GetNumber(FX_DWORD index) const; + FX_FLOAT GetNumberAt(FX_DWORD index) const; - CPDF_Dictionary* GetDict(FX_DWORD index) const; + CPDF_Dictionary* GetDictAt(FX_DWORD index) const; - CPDF_Stream* GetStream(FX_DWORD index) const; + CPDF_Stream* GetStreamAt(FX_DWORD index) const; - CPDF_Array* GetArray(FX_DWORD index) const; + CPDF_Array* GetArrayAt(FX_DWORD index) const; - FX_FLOAT GetFloat(FX_DWORD index) const { return GetNumber(index); } + FX_FLOAT GetFloatAt(FX_DWORD index) const { return GetNumberAt(index); } void SetAt(FX_DWORD index, CPDF_Object* pObj, @@ -298,7 +298,7 @@ class CPDF_Array : public CPDF_Object { AddReference(pDoc, obj->GetObjNum()); } - FX_FLOAT GetNumber16(FX_DWORD index) const { return GetNumber(index); } + FX_FLOAT GetNumber16(FX_DWORD index) const { return GetNumberAt(index); } void AddNumber16(FX_FLOAT value) { AddNumber(value); } @@ -328,39 +328,41 @@ class CPDF_Dictionary : public CPDF_Object { CPDF_Object* GetElementValue(const CFX_ByteStringC& key) const; - CFX_ByteString GetString(const CFX_ByteStringC& key) const; + CFX_ByteString GetStringBy(const CFX_ByteStringC& key) const; - CFX_ByteStringC GetConstString(const CFX_ByteStringC& key) const; + CFX_ByteStringC GetConstStringBy(const CFX_ByteStringC& key) const; - CFX_ByteString GetString(const CFX_ByteStringC& key, - const CFX_ByteStringC& default_str) const; + CFX_ByteString GetStringBy(const CFX_ByteStringC& key, + const CFX_ByteStringC& default_str) const; - CFX_ByteStringC GetConstString(const CFX_ByteStringC& key, - const CFX_ByteStringC& default_str) const; + CFX_ByteStringC GetConstStringBy(const CFX_ByteStringC& key, + const CFX_ByteStringC& default_str) const; - CFX_WideString GetUnicodeText(const CFX_ByteStringC& key, - CFX_CharMap* pCharMap = NULL) const; + CFX_WideString GetUnicodeTextBy(const CFX_ByteStringC& key, + CFX_CharMap* pCharMap = NULL) const; - int GetInteger(const CFX_ByteStringC& key) const; + int GetIntegerBy(const CFX_ByteStringC& key) const; - int GetInteger(const CFX_ByteStringC& key, int default_int) const; + int GetIntegerBy(const CFX_ByteStringC& key, int default_int) const; - FX_BOOL GetBoolean(const CFX_ByteStringC& key, - FX_BOOL bDefault = FALSE) const; + FX_BOOL GetBooleanBy(const CFX_ByteStringC& key, + FX_BOOL bDefault = FALSE) const; - FX_FLOAT GetNumber(const CFX_ByteStringC& key) const; + FX_FLOAT GetNumberBy(const CFX_ByteStringC& key) const; - CPDF_Dictionary* GetDict(const CFX_ByteStringC& key) const; + CPDF_Dictionary* GetDictBy(const CFX_ByteStringC& key) const; - CPDF_Stream* GetStream(const CFX_ByteStringC& key) const; + CPDF_Stream* GetStreamBy(const CFX_ByteStringC& key) const; - CPDF_Array* GetArray(const CFX_ByteStringC& key) const; + CPDF_Array* GetArrayBy(const CFX_ByteStringC& key) const; - CFX_FloatRect GetRect(const CFX_ByteStringC& key) const; + CFX_FloatRect GetRectBy(const CFX_ByteStringC& key) const; - CFX_Matrix GetMatrix(const CFX_ByteStringC& key) const; + CFX_Matrix GetMatrixBy(const CFX_ByteStringC& key) const; - FX_FLOAT GetFloat(const CFX_ByteStringC& key) const { return GetNumber(key); } + FX_FLOAT GetFloatBy(const CFX_ByteStringC& key) const { + return GetNumberBy(key); + } FX_BOOL KeyExist(const CFX_ByteStringC& key) const; diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h index 7a6dd4fcd4..97d7391cd0 100644 --- a/core/include/fpdfdoc/fpdf_doc.h +++ b/core/include/fpdfdoc/fpdf_doc.h @@ -218,7 +218,7 @@ class CPDF_Action { CPDF_Dictionary* GetDict() const { return m_pDict; } - CFX_ByteString GetTypeName() const { return m_pDict->GetString("S"); } + CFX_ByteString GetTypeName() const { return m_pDict->GetStringBy("S"); } ActionType GetType() const; @@ -226,19 +226,19 @@ class CPDF_Action { CFX_WideString GetFilePath() const; - FX_BOOL GetNewWindow() const { return m_pDict->GetBoolean("NewWindow"); } + FX_BOOL GetNewWindow() const { return m_pDict->GetBooleanBy("NewWindow"); } CFX_ByteString GetURI(CPDF_Document* pDoc) const; - FX_BOOL GetMouseMap() const { return m_pDict->GetBoolean("IsMap"); } + FX_BOOL GetMouseMap() const { return m_pDict->GetBooleanBy("IsMap"); } CPDF_ActionFields GetWidgets() const { return this; } - FX_BOOL GetHideStatus() const { return m_pDict->GetBoolean("H", TRUE); } + FX_BOOL GetHideStatus() const { return m_pDict->GetBooleanBy("H", TRUE); } - CFX_ByteString GetNamedAction() const { return m_pDict->GetString("N"); } + CFX_ByteString GetNamedAction() const { return m_pDict->GetStringBy("N"); } - FX_DWORD GetFlags() const { return m_pDict->GetInteger("Flags"); } + FX_DWORD GetFlags() const { return m_pDict->GetIntegerBy("Flags"); } CFX_WideString GetJavaScript() const; @@ -246,15 +246,15 @@ class CPDF_Action { int32_t GetOperationType() const; - CPDF_Stream* GetSoundStream() const { return m_pDict->GetStream("Sound"); } + CPDF_Stream* GetSoundStream() const { return m_pDict->GetStreamBy("Sound"); } - FX_FLOAT GetVolume() const { return m_pDict->GetNumber("Volume"); } + FX_FLOAT GetVolume() const { return m_pDict->GetNumberBy("Volume"); } - FX_BOOL IsSynchronous() const { return m_pDict->GetBoolean("Synchronous"); } + FX_BOOL IsSynchronous() const { return m_pDict->GetBooleanBy("Synchronous"); } - FX_BOOL IsRepeat() const { return m_pDict->GetBoolean("Repeat"); } + FX_BOOL IsRepeat() const { return m_pDict->GetBooleanBy("Repeat"); } - FX_BOOL IsMixPlay() const { return m_pDict->GetBoolean("Mix"); } + FX_BOOL IsMixPlay() const { return m_pDict->GetBooleanBy("Mix"); } FX_DWORD GetSubActionsCount() const; diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp index a7df332337..555de449fa 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp @@ -61,7 +61,7 @@ CFX_ByteString CPDF_PageContentGenerator::RealizeResource( int objnum = m_pDocument->AddIndirectObject(m_pPage->m_pResources); m_pPage->m_pFormDict->SetAtReference("Resources", m_pDocument, objnum); } - CPDF_Dictionary* pResList = m_pPage->m_pResources->GetDict(szType); + CPDF_Dictionary* pResList = m_pPage->m_pResources->GetDictBy(szType); if (!pResList) { pResList = new CPDF_Dictionary; m_pPage->m_pResources->SetAt(szType, pResList); diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index 8d0f6210d8..50644706b6 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -964,7 +964,7 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) { CPDF_Dictionary* pDict = pObj->GetDict(); if (pObj->IsStream()) { - if (pDict && pDict->GetString("Type") == "XRef") + if (pDict && pDict->GetStringBy("Type") == "XRef") return 0; return 1; } @@ -974,7 +974,7 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) { return 1; if (IsSignatureDict(pDict)) return 1; - if (pDict->GetString("Type") == "Page") + if (pDict->GetStringBy("Type") == "Page") return 1; } @@ -1039,7 +1039,7 @@ int32_t CPDF_Creator::WriteStream(const CPDF_Object* pStream, encoder.m_dwSize)) { return -1; } - if ((FX_DWORD)encoder.m_pDict->GetInteger("Length") != encryptor.m_dwSize) { + if ((FX_DWORD)encoder.m_pDict->GetIntegerBy("Length") != encryptor.m_dwSize) { encoder.CloneDict(); encoder.m_pDict->SetAtInteger("Length", encryptor.m_dwSize); } @@ -1155,7 +1155,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, CPDF_Encryptor encryptor; CPDF_CryptoHandler* pHandler = m_pCryptoHandler; encryptor.Initialize(pHandler, objnum, encoder.m_pData, encoder.m_dwSize); - if ((FX_DWORD)encoder.m_pDict->GetInteger("Length") != + if ((FX_DWORD)encoder.m_pDict->GetIntegerBy("Length") != encryptor.m_dwSize) { encoder.CloneDict(); encoder.m_pDict->SetAtInteger("Length", encryptor.m_dwSize); @@ -2015,7 +2015,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault) { } m_pIDArray->Add(m_pIDArray->GetElement(0)->Clone()); if (m_pEncryptDict && !pOldIDArray && m_pParser && bNewId) { - if (m_pEncryptDict->GetString("Filter") == "Standard") { + if (m_pEncryptDict->GetStringBy("Filter") == "Standard") { CPDF_StandardSecurityHandler handler; CFX_ByteString user_pass = m_pParser->GetPassword(); FX_DWORD flag = PDF_ENCRYPT_CONTENT; diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index 9fa196fd34..3595c99428 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -197,7 +197,7 @@ static void _InsertWidthArray(HDC hDC, break; } if (i == size) { - int first = pWidthArray->GetInteger(pWidthArray->GetCount() - 1); + int first = pWidthArray->GetIntegerAt(pWidthArray->GetCount() - 1); pWidthArray->AddInteger(first + size - 1); pWidthArray->AddInteger(*widths); } else { @@ -533,7 +533,7 @@ static void _InsertWidthArray(CTFontRef font, break; } if (i == size) { - int first = pWidthArray->GetInteger(pWidthArray->GetCount() - 1); + int first = pWidthArray->GetIntegerAt(pWidthArray->GetCount() - 1); pWidthArray->AddInteger(first + size - 1); pWidthArray->AddInteger(*widths); } else { @@ -811,7 +811,7 @@ static void _InsertWidthArray1(CFX_Font* pFont, break; } if (i == size) { - int first = pWidthArray->GetInteger(pWidthArray->GetCount() - 1); + int first = pWidthArray->GetIntegerAt(pWidthArray->GetCount() - 1); pWidthArray->AddInteger(first + size - 1); pWidthArray->AddInteger(*widths); } else { @@ -1018,14 +1018,14 @@ static int InsertDeletePDFPage(CPDF_Document* pDoc, CPDF_Dictionary* pPage, FX_BOOL bInsert, CFX_ArrayTemplate<CPDF_Dictionary*>& stackList) { - CPDF_Array* pKidList = pPages->GetArray("Kids"); + CPDF_Array* pKidList = pPages->GetArrayBy("Kids"); if (!pKidList) { return -1; } int nKids = pKidList->GetCount(); for (int i = 0; i < nKids; i++) { - CPDF_Dictionary* pKid = pKidList->GetDict(i); - if (pKid->GetString("Type") == "Page") { + CPDF_Dictionary* pKid = pKidList->GetDictAt(i); + if (pKid->GetStringBy("Type") == "Page") { if (nPagesToGo == 0) { if (bInsert) { pKidList->InsertAt(i, new CPDF_Reference(pDoc, pPage->GetObjNum())); @@ -1033,13 +1033,13 @@ static int InsertDeletePDFPage(CPDF_Document* pDoc, } else { pKidList->RemoveAt(i); } - pPages->SetAtInteger("Count", - pPages->GetInteger("Count") + (bInsert ? 1 : -1)); + pPages->SetAtInteger( + "Count", pPages->GetIntegerBy("Count") + (bInsert ? 1 : -1)); return 1; } nPagesToGo--; } else { - int nPages = pKid->GetInteger("Count"); + int nPages = pKid->GetIntegerBy("Count"); if (nPagesToGo < nPages) { int stackCount = stackList.GetSize(); for (int j = 0; j < stackCount; ++j) { @@ -1053,8 +1053,8 @@ static int InsertDeletePDFPage(CPDF_Document* pDoc, return -1; } stackList.RemoveAt(stackCount); - pPages->SetAtInteger("Count", - pPages->GetInteger("Count") + (bInsert ? 1 : -1)); + pPages->SetAtInteger( + "Count", pPages->GetIntegerBy("Count") + (bInsert ? 1 : -1)); return 1; } nPagesToGo -= nPages; @@ -1070,7 +1070,7 @@ static int InsertNewPage(CPDF_Document* pDoc, if (!pRoot) { return -1; } - CPDF_Dictionary* pPages = pRoot->GetDict("Pages"); + CPDF_Dictionary* pPages = pRoot->GetDictBy("Pages"); if (!pPages) { return -1; } @@ -1079,7 +1079,7 @@ static int InsertNewPage(CPDF_Document* pDoc, return -1; } if (iPage == nPages) { - CPDF_Array* pPagesList = pPages->GetArray("Kids"); + CPDF_Array* pPagesList = pPages->GetArrayBy("Kids"); if (!pPagesList) { pPagesList = new CPDF_Array; pPages->SetAt("Kids", pPagesList); @@ -1121,11 +1121,11 @@ void CPDF_Document::DeletePage(int iPage) { if (!pRoot) { return; } - CPDF_Dictionary* pPages = pRoot->GetDict("Pages"); + CPDF_Dictionary* pPages = pRoot->GetDictBy("Pages"); if (!pPages) { return; } - int nPages = pPages->GetInteger("Count"); + int nPages = pPages->GetIntegerBy("Count"); if (iPage < 0 || iPage >= nPages) { return; } diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp index b90d1147d6..e3d75076d7 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp @@ -194,11 +194,11 @@ CFX_ByteString CPDF_Font::EncodeString(const CFX_WideString& str) const { } void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) { - m_Flags = pFontDesc->GetInteger("Flags", PDFFONT_NONSYMBOLIC); + m_Flags = pFontDesc->GetIntegerBy("Flags", PDFFONT_NONSYMBOLIC); int ItalicAngle = 0; FX_BOOL bExistItalicAngle = FALSE; if (pFontDesc->KeyExist("ItalicAngle")) { - ItalicAngle = pFontDesc->GetInteger("ItalicAngle"); + ItalicAngle = pFontDesc->GetIntegerBy("ItalicAngle"); bExistItalicAngle = TRUE; } if (ItalicAngle < 0) { @@ -207,17 +207,17 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) { } FX_BOOL bExistStemV = FALSE; if (pFontDesc->KeyExist("StemV")) { - m_StemV = pFontDesc->GetInteger("StemV"); + m_StemV = pFontDesc->GetIntegerBy("StemV"); bExistStemV = TRUE; } FX_BOOL bExistAscent = FALSE; if (pFontDesc->KeyExist("Ascent")) { - m_Ascent = pFontDesc->GetInteger("Ascent"); + m_Ascent = pFontDesc->GetIntegerBy("Ascent"); bExistAscent = TRUE; } FX_BOOL bExistDescent = FALSE; if (pFontDesc->KeyExist("Descent")) { - m_Descent = pFontDesc->GetInteger("Descent"); + m_Descent = pFontDesc->GetIntegerBy("Descent"); bExistDescent = TRUE; } FX_BOOL bExistCapHeight = FALSE; @@ -231,19 +231,19 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) { if (m_Descent > 10) { m_Descent = -m_Descent; } - CPDF_Array* pBBox = pFontDesc->GetArray("FontBBox"); + CPDF_Array* pBBox = pFontDesc->GetArrayBy("FontBBox"); if (pBBox) { - m_FontBBox.left = pBBox->GetInteger(0); - m_FontBBox.bottom = pBBox->GetInteger(1); - m_FontBBox.right = pBBox->GetInteger(2); - m_FontBBox.top = pBBox->GetInteger(3); + m_FontBBox.left = pBBox->GetIntegerAt(0); + m_FontBBox.bottom = pBBox->GetIntegerAt(1); + m_FontBBox.right = pBBox->GetIntegerAt(2); + m_FontBBox.top = pBBox->GetIntegerAt(3); } - CPDF_Stream* pFontFile = pFontDesc->GetStream("FontFile"); + CPDF_Stream* pFontFile = pFontDesc->GetStreamBy("FontFile"); if (!pFontFile) - pFontFile = pFontDesc->GetStream("FontFile2"); + pFontFile = pFontDesc->GetStreamBy("FontFile2"); if (!pFontFile) - pFontFile = pFontDesc->GetStream("FontFile3"); + pFontFile = pFontDesc->GetStreamBy("FontFile3"); if (!pFontFile) return; @@ -324,7 +324,7 @@ void CPDF_Font::CheckFontMetrics() { } void CPDF_Font::LoadUnicodeMap() { m_bToUnicodeLoaded = TRUE; - CPDF_Stream* pStream = m_pFontDict->GetStream("ToUnicode"); + CPDF_Stream* pStream = m_pFontDict->GetStreamBy("ToUnicode"); if (!pStream) { return; } @@ -380,7 +380,7 @@ const uint8_t ChineseFontNames[][5] = {{0xCB, 0xCE, 0xCC, 0xE5, 0x00}, {0xD0, 0xC2, 0xCB, 0xCE, 0x00}}; CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary* pFontDict) { - CFX_ByteString type = pFontDict->GetString("Subtype"); + CFX_ByteString type = pFontDict->GetStringBy("Subtype"); CPDF_Font* pFont; if (type == "TrueType") { { @@ -388,7 +388,7 @@ CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc, _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ || \ _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ || \ _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ - CFX_ByteString basefont = pFontDict->GetString("BaseFont"); + CFX_ByteString basefont = pFontDict->GetStringBy("BaseFont"); CFX_ByteString tag = basefont.Left(4); int i; int count = sizeof(ChineseFontNames) / sizeof(ChineseFontNames[0]); @@ -398,7 +398,7 @@ CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc, } } if (i < count) { - CPDF_Dictionary* pFontDesc = pFontDict->GetDict("FontDescriptor"); + CPDF_Dictionary* pFontDesc = pFontDict->GetDictBy("FontDescriptor"); if (!pFontDesc || !pFontDesc->KeyExist("FontFile2")) { pFont = new CPDF_CIDFont; pFont->m_pFontDict = pFontDict; @@ -432,8 +432,8 @@ FX_BOOL CPDF_Font::Load() { if (!m_pFontDict) { return FALSE; } - CFX_ByteString type = m_pFontDict->GetString("Subtype"); - m_BaseFont = m_pFontDict->GetString("BaseFont"); + CFX_ByteString type = m_pFontDict->GetStringBy("Subtype"); + m_BaseFont = m_pFontDict->GetStringBy("BaseFont"); if (type == "MMType1") { type = "Type1"; } @@ -712,7 +712,7 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding, if (iBaseEncoding != PDFFONT_ENCODING_ADOBE_SYMBOL && iBaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS) { - CFX_ByteString bsEncoding = pDict->GetString("BaseEncoding"); + CFX_ByteString bsEncoding = pDict->GetStringBy("BaseEncoding"); if (bsEncoding.Compare("MacExpertEncoding") == 0 && bTrueType) { bsEncoding = "WinAnsiEncoding"; } @@ -721,7 +721,7 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding, if ((!bEmbedded || bTrueType) && iBaseEncoding == PDFFONT_ENCODING_BUILTIN) { iBaseEncoding = PDFFONT_ENCODING_STANDARD; } - CPDF_Array* pDiffs = pDict->GetArray("Differences"); + CPDF_Array* pDiffs = pDict->GetArrayBy("Differences"); if (!pDiffs) { return; } @@ -859,23 +859,23 @@ const FX_CHAR* GetAdobeCharName(int iBaseEncoding, return name && name[0] ? name : nullptr; } FX_BOOL CPDF_SimpleFont::LoadCommon() { - CPDF_Dictionary* pFontDesc = m_pFontDict->GetDict("FontDescriptor"); + CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictBy("FontDescriptor"); if (pFontDesc) { LoadFontDescriptor(pFontDesc); } - CPDF_Array* pWidthArray = m_pFontDict->GetArray("Widths"); + CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths"); int width_start = 0, width_end = -1; m_bUseFontWidth = TRUE; if (pWidthArray) { m_bUseFontWidth = FALSE; if (pFontDesc && pFontDesc->KeyExist("MissingWidth")) { - int MissingWidth = pFontDesc->GetInteger("MissingWidth"); + int MissingWidth = pFontDesc->GetIntegerBy("MissingWidth"); for (int i = 0; i < 256; i++) { m_CharWidth[i] = MissingWidth; } } - width_start = m_pFontDict->GetInteger("FirstChar", 0); - width_end = m_pFontDict->GetInteger("LastChar", 0); + width_start = m_pFontDict->GetIntegerBy("FirstChar", 0); + width_end = m_pFontDict->GetIntegerBy("LastChar", 0); if (width_start >= 0 && width_start <= 255) { if (width_end <= 0 || width_end >= width_start + (int)pWidthArray->GetCount()) { @@ -885,7 +885,7 @@ FX_BOOL CPDF_SimpleFont::LoadCommon() { width_end = 255; } for (int i = width_start; i <= width_end; i++) { - m_CharWidth[i] = pWidthArray->GetInteger(i - width_start); + m_CharWidth[i] = pWidthArray->GetIntegerAt(i - width_start); } } } @@ -960,9 +960,9 @@ CPDF_Type1Font::CPDF_Type1Font() : CPDF_SimpleFont(PDFFONT_TYPE1) { FX_BOOL CPDF_Type1Font::_Load() { m_Base14Font = PDF_GetStandardFontName(&m_BaseFont); if (m_Base14Font >= 0) { - CPDF_Dictionary* pFontDesc = m_pFontDict->GetDict("FontDescriptor"); + CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictBy("FontDescriptor"); if (pFontDesc && pFontDesc->KeyExist("Flags")) { - m_Flags = pFontDesc->GetInteger("Flags"); + m_Flags = pFontDesc->GetIntegerBy("Flags"); } else { m_Flags = m_Base14Font >= 12 ? PDFFONT_SYMBOLIC : PDFFONT_NONSYMBOLIC; } @@ -1429,7 +1429,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() { (m_Flags & PDFFONT_NONSYMBOLIC)) { if (!FXFT_Has_Glyph_Names(m_Font.GetFace()) && (!m_Font.GetFace()->num_charmaps || !m_Font.GetFace()->charmaps)) { - int nStartChar = m_pFontDict->GetInteger("FirstChar"); + int nStartChar = m_pFontDict->GetIntegerBy("FirstChar"); if (nStartChar < 0 || nStartChar > 255) return; @@ -1605,24 +1605,26 @@ CPDF_Type3Font::~CPDF_Type3Font() { } FX_BOOL CPDF_Type3Font::_Load() { - m_pFontResources = m_pFontDict->GetDict("Resources"); - CPDF_Array* pMatrix = m_pFontDict->GetArray("FontMatrix"); + m_pFontResources = m_pFontDict->GetDictBy("Resources"); + CPDF_Array* pMatrix = m_pFontDict->GetArrayBy("FontMatrix"); FX_FLOAT xscale = 1.0f, yscale = 1.0f; if (pMatrix) { m_FontMatrix = pMatrix->GetMatrix(); xscale = m_FontMatrix.a; yscale = m_FontMatrix.d; } - CPDF_Array* pBBox = m_pFontDict->GetArray("FontBBox"); + CPDF_Array* pBBox = m_pFontDict->GetArrayBy("FontBBox"); if (pBBox) { - m_FontBBox.left = (int32_t)(FXSYS_Mul(pBBox->GetNumber(0), xscale) * 1000); + m_FontBBox.left = + (int32_t)(FXSYS_Mul(pBBox->GetNumberAt(0), xscale) * 1000); m_FontBBox.bottom = - (int32_t)(FXSYS_Mul(pBBox->GetNumber(1), yscale) * 1000); - m_FontBBox.right = (int32_t)(FXSYS_Mul(pBBox->GetNumber(2), xscale) * 1000); - m_FontBBox.top = (int32_t)(FXSYS_Mul(pBBox->GetNumber(3), yscale) * 1000); + (int32_t)(FXSYS_Mul(pBBox->GetNumberAt(1), yscale) * 1000); + m_FontBBox.right = + (int32_t)(FXSYS_Mul(pBBox->GetNumberAt(2), xscale) * 1000); + m_FontBBox.top = (int32_t)(FXSYS_Mul(pBBox->GetNumberAt(3), yscale) * 1000); } - int StartChar = m_pFontDict->GetInteger("FirstChar"); - CPDF_Array* pWidthArray = m_pFontDict->GetArray("Widths"); + int StartChar = m_pFontDict->GetIntegerBy("FirstChar"); + CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths"); if (pWidthArray && (StartChar >= 0 && StartChar < 256)) { FX_DWORD count = pWidthArray->GetCount(); if (count > 256) { @@ -1633,10 +1635,10 @@ FX_BOOL CPDF_Type3Font::_Load() { } for (FX_DWORD i = 0; i < count; i++) { m_CharWidthL[StartChar + i] = - FXSYS_round(FXSYS_Mul(pWidthArray->GetNumber(i), xscale) * 1000); + FXSYS_round(FXSYS_Mul(pWidthArray->GetNumberAt(i), xscale) * 1000); } } - m_pCharProcs = m_pFontDict->GetDict("CharProcs"); + m_pCharProcs = m_pFontDict->GetDictBy("CharProcs"); CPDF_Object* pEncoding = m_pFontDict->GetElementValue("Encoding"); if (pEncoding) { LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, FALSE, FALSE); diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp index 6e7a051b34..37647c8ef0 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -1153,21 +1153,21 @@ FX_DWORD CPDF_CIDFont::_CharCodeFromUnicode(FX_WCHAR unicode) const { } FX_BOOL CPDF_CIDFont::_Load() { - if (m_pFontDict->GetString("Subtype") == "TrueType") { + if (m_pFontDict->GetStringBy("Subtype") == "TrueType") { return LoadGB2312(); } - CPDF_Array* pFonts = m_pFontDict->GetArray("DescendantFonts"); + CPDF_Array* pFonts = m_pFontDict->GetArrayBy("DescendantFonts"); if (!pFonts) { return FALSE; } if (pFonts->GetCount() != 1) { return FALSE; } - CPDF_Dictionary* pCIDFontDict = pFonts->GetDict(0); + CPDF_Dictionary* pCIDFontDict = pFonts->GetDictAt(0); if (!pCIDFontDict) { return FALSE; } - m_BaseFont = pCIDFontDict->GetString("BaseFont"); + m_BaseFont = pCIDFontDict->GetStringBy("BaseFont"); if ((m_BaseFont.Compare("CourierStd") == 0 || m_BaseFont.Compare("CourierStd-Bold") == 0 || m_BaseFont.Compare("CourierStd-BoldOblique") == 0 || @@ -1175,7 +1175,7 @@ FX_BOOL CPDF_CIDFont::_Load() { !IsEmbedded()) { m_bAdobeCourierStd = TRUE; } - CPDF_Dictionary* pFontDesc = pCIDFontDict->GetDict("FontDescriptor"); + CPDF_Dictionary* pFontDesc = pCIDFontDict->GetDictBy("FontDescriptor"); if (pFontDesc) { LoadFontDescriptor(pFontDesc); } @@ -1183,7 +1183,7 @@ FX_BOOL CPDF_CIDFont::_Load() { if (!pEncoding) { return FALSE; } - CFX_ByteString subtype = pCIDFontDict->GetString("Subtype"); + CFX_ByteString subtype = pCIDFontDict->GetStringBy("Subtype"); m_bType1 = (subtype == "CIDFontType0"); if (pEncoding->IsName()) { @@ -1206,9 +1206,9 @@ FX_BOOL CPDF_CIDFont::_Load() { } m_Charset = m_pCMap->m_Charset; if (m_Charset == CIDSET_UNKNOWN) { - CPDF_Dictionary* pCIDInfo = pCIDFontDict->GetDict("CIDSystemInfo"); + CPDF_Dictionary* pCIDInfo = pCIDFontDict->GetDictBy("CIDSystemInfo"); if (pCIDInfo) { - m_Charset = CharsetFromOrdering(pCIDInfo->GetString("Ordering")); + m_Charset = CharsetFromOrdering(pCIDInfo->GetStringBy("Ordering")); } } if (m_Charset != CIDSET_UNKNOWN) @@ -1227,8 +1227,8 @@ FX_BOOL CPDF_CIDFont::_Load() { FT_UseCIDCharmap(m_Font.GetFace(), m_pCMap->m_Coding); } } - m_DefaultWidth = pCIDFontDict->GetInteger("DW", 1000); - CPDF_Array* pWidthArray = pCIDFontDict->GetArray("W"); + m_DefaultWidth = pCIDFontDict->GetIntegerBy("DW", 1000); + CPDF_Array* pWidthArray = pCIDFontDict->GetArrayBy("W"); if (pWidthArray) { LoadMetricsArray(pWidthArray, m_WidthList, 1); } @@ -1256,14 +1256,14 @@ FX_BOOL CPDF_CIDFont::_Load() { } CheckFontMetrics(); if (IsVertWriting()) { - pWidthArray = pCIDFontDict->GetArray("W2"); + pWidthArray = pCIDFontDict->GetArrayBy("W2"); if (pWidthArray) { LoadMetricsArray(pWidthArray, m_VertMetrics, 3); } - CPDF_Array* pDefaultArray = pCIDFontDict->GetArray("DW2"); + CPDF_Array* pDefaultArray = pCIDFontDict->GetArrayBy("DW2"); if (pDefaultArray) { - m_DefaultVY = pDefaultArray->GetInteger(0); - m_DefaultW1 = pDefaultArray->GetInteger(1); + m_DefaultVY = pDefaultArray->GetIntegerAt(0); + m_DefaultW1 = pDefaultArray->GetIntegerAt(1); } else { m_DefaultVY = 880; m_DefaultW1 = -1000; @@ -1650,7 +1650,7 @@ void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray, result.Add(first_code); result.Add(first_code); for (int k = 0; k < nElements; k++) { - result.Add(pArray->GetInteger(j + k)); + result.Add(pArray->GetIntegerAt(j + k)); } first_code++; } @@ -1687,8 +1687,8 @@ FX_FLOAT CPDF_CIDFont::CIDTransformToFloat(uint8_t ch) { } FX_BOOL CPDF_CIDFont::LoadGB2312() { - m_BaseFont = m_pFontDict->GetString("BaseFont"); - CPDF_Dictionary* pFontDesc = m_pFontDict->GetDict("FontDescriptor"); + m_BaseFont = m_pFontDict->GetStringBy("BaseFont"); + CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictBy("FontDescriptor"); if (pFontDesc) { LoadFontDescriptor(pFontDesc); } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp index 5ec79000ac..c4a26e9921 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp @@ -756,18 +756,18 @@ void CPDF_PageObjectList::LoadTransInfo() { if (!m_pFormDict) { return; } - CPDF_Dictionary* pGroup = m_pFormDict->GetDict("Group"); + CPDF_Dictionary* pGroup = m_pFormDict->GetDictBy("Group"); if (!pGroup) { return; } - if (pGroup->GetString("S") != "Transparency") { + if (pGroup->GetStringBy("S") != "Transparency") { return; } m_Transparency |= PDFTRANS_GROUP; - if (pGroup->GetInteger("I")) { + if (pGroup->GetIntegerBy("I")) { m_Transparency |= PDFTRANS_ISOLATED; } - if (pGroup->GetInteger("K")) { + if (pGroup->GetIntegerBy("K")) { m_Transparency |= PDFTRANS_KNOCKOUT; } } @@ -869,7 +869,7 @@ CPDF_Object* FPDFAPI_GetPageAttr(CPDF_Dictionary* pPageDict, if (pObj) { return pObj; } - CPDF_Dictionary* pParent = pPageDict->GetDict("Parent"); + CPDF_Dictionary* pParent = pPageDict->GetDictBy("Parent"); if (!pParent || pParent == pPageDict) { return NULL; } @@ -890,7 +890,7 @@ CPDF_Form::CPDF_Form(CPDF_Document* pDoc, m_pDocument = pDoc; m_pFormStream = pFormStream; m_pFormDict = pFormStream ? pFormStream->GetDict() : NULL; - m_pResources = m_pFormDict->GetDict("Resources"); + m_pResources = m_pFormDict->GetDictBy("Resources"); m_pPageResources = pPageResources; if (!m_pResources) { m_pResources = pParentResources; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp index 87b9e025bc..9620415e55 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -333,20 +333,20 @@ class CPDF_CalGray : public CPDF_ColorSpace { }; FX_BOOL CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { - CPDF_Dictionary* pDict = pArray->GetDict(1); + CPDF_Dictionary* pDict = pArray->GetDictAt(1); if (!pDict) return FALSE; - CPDF_Array* pParam = pDict->GetArray("WhitePoint"); + CPDF_Array* pParam = pDict->GetArrayBy("WhitePoint"); int i; for (i = 0; i < 3; i++) { - m_WhitePoint[i] = pParam ? pParam->GetNumber(i) : 0; + m_WhitePoint[i] = pParam ? pParam->GetNumberAt(i) : 0; } - pParam = pDict->GetArray("BlackPoint"); + pParam = pDict->GetArrayBy("BlackPoint"); for (i = 0; i < 3; i++) { - m_BlackPoint[i] = pParam ? pParam->GetNumber(i) : 0; + m_BlackPoint[i] = pParam ? pParam->GetNumberAt(i) : 0; } - m_Gamma = pDict->GetNumber("Gamma"); + m_Gamma = pDict->GetNumberBy("Gamma"); if (m_Gamma == 0) { m_Gamma = 1.0f; } @@ -409,33 +409,33 @@ class CPDF_CalRGB : public CPDF_ColorSpace { FX_BOOL m_bMatrix; }; FX_BOOL CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { - CPDF_Dictionary* pDict = pArray->GetDict(1); + CPDF_Dictionary* pDict = pArray->GetDictAt(1); if (!pDict) return FALSE; - CPDF_Array* pParam = pDict->GetArray("WhitePoint"); + CPDF_Array* pParam = pDict->GetArrayBy("WhitePoint"); int i; for (i = 0; i < 3; i++) { - m_WhitePoint[i] = pParam ? pParam->GetNumber(i) : 0; + m_WhitePoint[i] = pParam ? pParam->GetNumberAt(i) : 0; } - pParam = pDict->GetArray("BlackPoint"); + pParam = pDict->GetArrayBy("BlackPoint"); for (i = 0; i < 3; i++) { - m_BlackPoint[i] = pParam ? pParam->GetNumber(i) : 0; + m_BlackPoint[i] = pParam ? pParam->GetNumberAt(i) : 0; } - pParam = pDict->GetArray("Gamma"); + pParam = pDict->GetArrayBy("Gamma"); if (pParam) { m_bGamma = TRUE; for (i = 0; i < 3; i++) { - m_Gamma[i] = pParam->GetNumber(i); + m_Gamma[i] = pParam->GetNumberAt(i); } } else { m_bGamma = FALSE; } - pParam = pDict->GetArray("Matrix"); + pParam = pDict->GetArrayBy("Matrix"); if (pParam) { m_bMatrix = TRUE; for (i = 0; i < 9; i++) { - m_Matrix[i] = pParam->GetNumber(i); + m_Matrix[i] = pParam->GetNumberAt(i); } } else { m_bMatrix = FALSE; @@ -529,24 +529,24 @@ class CPDF_LabCS : public CPDF_ColorSpace { FX_FLOAT m_Ranges[4]; }; FX_BOOL CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { - CPDF_Dictionary* pDict = pArray->GetDict(1); + CPDF_Dictionary* pDict = pArray->GetDictAt(1); if (!pDict) { return FALSE; } - CPDF_Array* pParam = pDict->GetArray("WhitePoint"); + CPDF_Array* pParam = pDict->GetArrayBy("WhitePoint"); int i; for (i = 0; i < 3; i++) { - m_WhitePoint[i] = pParam ? pParam->GetNumber(i) : 0; + m_WhitePoint[i] = pParam ? pParam->GetNumberAt(i) : 0; } - pParam = pDict->GetArray("BlackPoint"); + pParam = pDict->GetArrayBy("BlackPoint"); for (i = 0; i < 3; i++) { - m_BlackPoint[i] = pParam ? pParam->GetNumber(i) : 0; + m_BlackPoint[i] = pParam ? pParam->GetNumberAt(i) : 0; } - pParam = pDict->GetArray("Range"); + pParam = pDict->GetArrayBy("Range"); const FX_FLOAT def_ranges[4] = {-100 * 1.0f, 100 * 1.0f, -100 * 1.0f, 100 * 1.0f}; for (i = 0; i < 4; i++) { - m_Ranges[i] = pParam ? pParam->GetNumber(i) : def_ranges[i]; + m_Ranges[i] = pParam ? pParam->GetNumberAt(i) : def_ranges[i]; } return TRUE; } @@ -692,7 +692,7 @@ CPDF_ICCBasedCS::~CPDF_ICCBasedCS() { } FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { - CPDF_Stream* pStream = pArray->GetStream(1); + CPDF_Stream* pStream = pArray->GetStreamAt(1); if (!pStream) { return FALSE; } @@ -717,7 +717,7 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { m_bOwn = TRUE; } else { // No valid alternative colorspace pAlterCS->ReleaseCS(); - int32_t nDictComponents = pDict ? pDict->GetInteger("N") : 0; + int32_t nDictComponents = pDict ? pDict->GetIntegerBy("N") : 0; if (nDictComponents != 1 && nDictComponents != 3 && nDictComponents != 4) { return FALSE; @@ -745,11 +745,11 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { } } } - CPDF_Array* pRanges = pDict->GetArray("Range"); + CPDF_Array* pRanges = pDict->GetArrayBy("Range"); m_pRanges = FX_Alloc2D(FX_FLOAT, m_nComponents, 2); for (int i = 0; i < m_nComponents * 2; i++) { if (pRanges) { - m_pRanges[i] = pRanges->GetNumber(i); + m_pRanges[i] = pRanges->GetNumberAt(i); } else if (i % 2) { m_pRanges[i] = 1.0f; } else { @@ -914,7 +914,7 @@ FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { m_pCompMinMax[i * 2 + 1]); m_pCompMinMax[i * 2 + 1] -= m_pCompMinMax[i * 2]; } - m_MaxIndex = pArray->GetInteger(2); + m_MaxIndex = pArray->GetIntegerAt(2); CPDF_Object* pTableObj = pArray->GetElementValue(3); if (!pTableObj) @@ -1054,7 +1054,7 @@ void CPDF_SeparationCS::GetDefaultValue(int iComponent, max = 1.0f; } FX_BOOL CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { - CFX_ByteString name = pArray->GetString(1); + CFX_ByteString name = pArray->GetStringAt(1); if (name == "None") { m_Type = None; } else { diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp index 0199809a45..6ba7e4598b 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp @@ -317,7 +317,7 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace( CFX_ByteString name = pCSObj->GetConstString(); CPDF_ColorSpace* pCS = _CSFromName(name); if (!pCS && pResources) { - CPDF_Dictionary* pList = pResources->GetDict("ColorSpace"); + CPDF_Dictionary* pList = pResources->GetDictBy("ColorSpace"); if (pList) { pCSObj = pList->GetElementValue(name); return GetColorSpace(pCSObj, nullptr); @@ -326,7 +326,7 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace( if (!pCS || !pResources) return pCS; - CPDF_Dictionary* pColorSpaces = pResources->GetDict("ColorSpace"); + CPDF_Dictionary* pColorSpaces = pResources->GetDictBy("ColorSpace"); if (!pColorSpaces) return pCS; @@ -423,7 +423,7 @@ CPDF_Pattern* CPDF_DocPageData::GetPattern(CPDF_Object* pPatternObj, } else { CPDF_Dictionary* pDict = pPatternObj ? pPatternObj->GetDict() : nullptr; if (pDict) { - int type = pDict->GetInteger("PatternType"); + int type = pDict->GetIntegerBy("PatternType"); if (type == 1) { pPattern = new CPDF_TilingPattern(m_pPDFDoc, pPatternObj, matrix); } else if (type == 2) { @@ -553,9 +553,9 @@ CPDF_StreamAcc* CPDF_DocPageData::GetFontFileStreamAcc( return it->second->AddRef(); CPDF_Dictionary* pFontDict = pFontStream->GetDict(); - int32_t org_size = pFontDict->GetInteger("Length1") + - pFontDict->GetInteger("Length2") + - pFontDict->GetInteger("Length3"); + int32_t org_size = pFontDict->GetIntegerBy("Length1") + + pFontDict->GetIntegerBy("Length2") + + pFontDict->GetIntegerBy("Length3"); if (org_size < 0) org_size = 0; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp index 15222fc594..d1991adab2 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -500,10 +500,10 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) { return false; CPDF_Dictionary* pDict = pStream->GetDict(); - CPDF_Array* pSize = pDict->GetArray("Size"); - CPDF_Array* pEncode = pDict->GetArray("Encode"); - CPDF_Array* pDecode = pDict->GetArray("Decode"); - m_nBitsPerSample = pDict->GetInteger("BitsPerSample"); + CPDF_Array* pSize = pDict->GetArrayBy("Size"); + CPDF_Array* pEncode = pDict->GetArrayBy("Encode"); + CPDF_Array* pDecode = pDict->GetArrayBy("Decode"); + m_nBitsPerSample = pDict->GetIntegerBy("BitsPerSample"); if (m_nBitsPerSample > 32) { return FALSE; } @@ -513,14 +513,14 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) { m_pEncodeInfo = FX_Alloc(SampleEncodeInfo, m_nInputs); FX_SAFE_DWORD nTotalSampleBits = 1; for (int i = 0; i < m_nInputs; i++) { - m_pEncodeInfo[i].sizes = pSize ? pSize->GetInteger(i) : 0; + m_pEncodeInfo[i].sizes = pSize ? pSize->GetIntegerAt(i) : 0; if (!pSize && i == 0) { - m_pEncodeInfo[i].sizes = pDict->GetInteger("Size"); + m_pEncodeInfo[i].sizes = pDict->GetIntegerBy("Size"); } nTotalSampleBits *= m_pEncodeInfo[i].sizes; if (pEncode) { - m_pEncodeInfo[i].encode_min = pEncode->GetFloat(i * 2); - m_pEncodeInfo[i].encode_max = pEncode->GetFloat(i * 2 + 1); + m_pEncodeInfo[i].encode_min = pEncode->GetFloatAt(i * 2); + m_pEncodeInfo[i].encode_max = pEncode->GetFloatAt(i * 2 + 1); } else { m_pEncodeInfo[i].encode_min = 0; if (m_pEncodeInfo[i].sizes == 1) { @@ -542,8 +542,8 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) { m_pDecodeInfo = FX_Alloc(SampleDecodeInfo, m_nOutputs); for (int i = 0; i < m_nOutputs; i++) { if (pDecode) { - m_pDecodeInfo[i].decode_min = pDecode->GetFloat(2 * i); - m_pDecodeInfo[i].decode_max = pDecode->GetFloat(2 * i + 1); + m_pDecodeInfo[i].decode_min = pDecode->GetFloatAt(2 * i); + m_pDecodeInfo[i].decode_max = pDecode->GetFloatAt(2 * i + 1); } else { m_pDecodeInfo[i].decode_min = m_pRanges[i * 2]; m_pDecodeInfo[i].decode_max = m_pRanges[i * 2 + 1]; @@ -686,21 +686,21 @@ FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) { if (!pDict) { return FALSE; } - CPDF_Array* pArray0 = pDict->GetArray("C0"); + CPDF_Array* pArray0 = pDict->GetArrayBy("C0"); if (m_nOutputs == 0) { m_nOutputs = 1; if (pArray0) { m_nOutputs = pArray0->GetCount(); } } - CPDF_Array* pArray1 = pDict->GetArray("C1"); + CPDF_Array* pArray1 = pDict->GetArrayBy("C1"); m_pBeginValues = FX_Alloc2D(FX_FLOAT, m_nOutputs, 2); m_pEndValues = FX_Alloc2D(FX_FLOAT, m_nOutputs, 2); for (int i = 0; i < m_nOutputs; i++) { - m_pBeginValues[i] = pArray0 ? pArray0->GetFloat(i) : 0.0f; - m_pEndValues[i] = pArray1 ? pArray1->GetFloat(i) : 1.0f; + m_pBeginValues[i] = pArray0 ? pArray0->GetFloatAt(i) : 0.0f; + m_pEndValues[i] = pArray1 ? pArray1->GetFloatAt(i) : 1.0f; } - m_Exponent = pDict->GetFloat("N"); + m_Exponent = pDict->GetFloatBy("N"); m_nOrigOutputs = m_nOutputs; if (m_nOutputs && m_nInputs > INT_MAX / m_nOutputs) { return FALSE; @@ -754,7 +754,7 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) { if (m_nInputs != kRequiredNumInputs) { return FALSE; } - CPDF_Array* pArray = pDict->GetArray("Functions"); + CPDF_Array* pArray = pDict->GetArrayBy("Functions"); if (!pArray) { return FALSE; } @@ -788,21 +788,21 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) { } m_pBounds = FX_Alloc(FX_FLOAT, nSubs + 1); m_pBounds[0] = m_pDomains[0]; - pArray = pDict->GetArray("Bounds"); + pArray = pDict->GetArrayBy("Bounds"); if (!pArray) { return FALSE; } for (FX_DWORD i = 0; i < nSubs - 1; i++) { - m_pBounds[i + 1] = pArray->GetFloat(i); + m_pBounds[i + 1] = pArray->GetFloatAt(i); } m_pBounds[nSubs] = m_pDomains[1]; m_pEncode = FX_Alloc2D(FX_FLOAT, nSubs, 2); - pArray = pDict->GetArray("Encode"); + pArray = pDict->GetArrayBy("Encode"); if (!pArray) { return FALSE; } for (FX_DWORD i = 0; i < nSubs * 2; i++) { - m_pEncode[i] = pArray->GetFloat(i); + m_pEncode[i] = pArray->GetFloatAt(i); } return TRUE; } @@ -829,9 +829,9 @@ CPDF_Function* CPDF_Function::Load(CPDF_Object* pFuncObj) { CPDF_Function* pFunc = NULL; int type; if (CPDF_Stream* pStream = pFuncObj->AsStream()) { - type = pStream->GetDict()->GetInteger("FunctionType"); + type = pStream->GetDict()->GetIntegerBy("FunctionType"); } else if (CPDF_Dictionary* pDict = pFuncObj->AsDictionary()) { - type = pDict->GetInteger("FunctionType"); + type = pDict->GetIntegerBy("FunctionType"); } else { return NULL; } @@ -864,7 +864,7 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) { CPDF_Stream* pStream = pObj->AsStream(); CPDF_Dictionary* pDict = pStream ? pStream->GetDict() : pObj->AsDictionary(); - CPDF_Array* pDomains = pDict->GetArray("Domain"); + CPDF_Array* pDomains = pDict->GetArrayBy("Domain"); if (!pDomains) return FALSE; @@ -874,15 +874,15 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) { m_pDomains = FX_Alloc2D(FX_FLOAT, m_nInputs, 2); for (int i = 0; i < m_nInputs * 2; i++) { - m_pDomains[i] = pDomains->GetFloat(i); + m_pDomains[i] = pDomains->GetFloatAt(i); } - CPDF_Array* pRanges = pDict->GetArray("Range"); + CPDF_Array* pRanges = pDict->GetArrayBy("Range"); m_nOutputs = 0; if (pRanges) { m_nOutputs = pRanges->GetCount() / 2; m_pRanges = FX_Alloc2D(FX_FLOAT, m_nOutputs, 2); for (int i = 0; i < m_nOutputs * 2; i++) { - m_pRanges[i] = pRanges->GetFloat(i); + m_pRanges[i] = pRanges->GetFloatAt(i); } } FX_DWORD old_outputs = m_nOutputs; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp index e9f1747097..37e3c04e53 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp @@ -452,7 +452,7 @@ void CPDF_AllStates::SetLineDash(CPDF_Array* pArray, pData->m_DashPhase = FXSYS_Mul(phase, scale); pData->SetDashCount(pArray->GetCount()); for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { - pData->m_DashArray[i] = FXSYS_Mul(pArray->GetNumber(i), scale); + pData->m_DashArray[i] = FXSYS_Mul(pArray->GetNumberAt(i), scale); } } void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, @@ -486,11 +486,11 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, if (!pDash) break; - CPDF_Array* pArray = pDash->GetArray(0); + CPDF_Array* pArray = pDash->GetArrayAt(0); if (!pArray) break; - SetLineDash(pArray, pDash->GetNumber(1), 1.0f); + SetLineDash(pArray, pDash->GetNumberAt(1), 1.0f); break; } case FXBSTR_ID('R', 'I', 0, 0): @@ -501,8 +501,8 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, if (!pFont) break; - m_TextState.GetModify()->m_FontSize = pFont->GetNumber(1); - m_TextState.SetFont(pParser->FindFont(pFont->GetString(0))); + m_TextState.GetModify()->m_FontSize = pFont->GetNumberAt(1); + m_TextState.SetFont(pParser->FindFont(pFont->GetStringAt(0))); break; } case FXBSTR_ID('T', 'R', 0, 0): @@ -516,7 +516,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, case FXBSTR_ID('B', 'M', 0, 0): { CPDF_Array* pArray = pObject->AsArray(); CFX_ByteString mode = - pArray ? pArray->GetString(0) : pObject->GetString(); + pArray ? pArray->GetStringAt(0) : pObject->GetString(); pGeneralState->SetBlendMode(mode); if (pGeneralState->m_BlendType > FXDIB_BLEND_MULTIPLY) { @@ -625,7 +625,7 @@ int CPDF_ContentMarkData::GetMCID() const { CPDF_Dictionary* pDict = ToDictionary(static_cast<CPDF_Object*>(m_Marks[i].GetParam())); if (pDict->KeyExist("MCID")) { - return pDict->GetInteger("MCID"); + return pDict->GetIntegerBy("MCID"); } } } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp index d1e6687999..9296cd6158 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp @@ -86,10 +86,11 @@ FX_BOOL CPDF_Image::LoadImageF(CPDF_Stream* pStream, FX_BOOL bInline) { if (m_bInline) { m_pInlineDict = ToDictionary(pDict->Clone()); } - m_pOC = pDict->GetDict("OC"); - m_bIsMask = !pDict->KeyExist("ColorSpace") || pDict->GetInteger("ImageMask"); - m_bInterpolate = pDict->GetInteger("Interpolate"); - m_Height = pDict->GetInteger("Height"); - m_Width = pDict->GetInteger("Width"); + m_pOC = pDict->GetDictBy("OC"); + m_bIsMask = + !pDict->KeyExist("ColorSpace") || pDict->GetIntegerBy("ImageMask"); + m_bInterpolate = pDict->GetIntegerBy("Interpolate"); + m_Height = pDict->GetIntegerBy("Height"); + m_Width = pDict->GetIntegerBy("Width"); return TRUE; } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 30480ca348..7f242fdb0e 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -708,9 +708,9 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() { if (!m_pResources) return; - CPDF_Dictionary* pList = m_pResources->GetDict("XObject"); + CPDF_Dictionary* pList = m_pResources->GetDictBy("XObject"); if (!pList && m_pPageResources && m_pResources != m_pPageResources) - pList = m_pPageResources->GetDict("XObject"); + pList = m_pPageResources->GetDictBy("XObject"); if (!pList) return; CPDF_Reference* pRes = ToReference(pList->GetElement(name)); @@ -729,7 +729,7 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() { } CFX_ByteStringC type = pXObject->GetDict() - ? pXObject->GetDict()->GetConstString("Subtype") + ? pXObject->GetDict()->GetConstStringBy("Subtype") : CFX_ByteStringC(); if (type == "Image") { if (m_Options.m_bTextOnly) { @@ -749,14 +749,14 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() { void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) { if (!m_Options.m_bSeparateForm) { - CPDF_Dictionary* pResources = pStream->GetDict()->GetDict("Resources"); - CFX_Matrix form_matrix = pStream->GetDict()->GetMatrix("Matrix"); + CPDF_Dictionary* pResources = pStream->GetDict()->GetDictBy("Resources"); + CFX_Matrix form_matrix = pStream->GetDict()->GetMatrixBy("Matrix"); form_matrix.Concat(m_pCurStates->m_CTM); - CPDF_Array* pBBox = pStream->GetDict()->GetArray("BBox"); + CPDF_Array* pBBox = pStream->GetDict()->GetArrayBy("BBox"); CFX_FloatRect form_bbox; CPDF_Path ClipPath; if (pBBox) { - form_bbox = pStream->GetDict()->GetRect("BBox"); + form_bbox = pStream->GetDict()->GetRectBy("BBox"); ClipPath.New(); ClipPath.AppendRect(form_bbox.left, form_bbox.bottom, form_bbox.right, form_bbox.top); @@ -1249,19 +1249,19 @@ CPDF_Object* CPDF_StreamContentParser::FindResourceObj( return NULL; } if (m_pResources == m_pPageResources) { - CPDF_Dictionary* pList = m_pResources->GetDict(type); + CPDF_Dictionary* pList = m_pResources->GetDictBy(type); if (!pList) { return NULL; } CPDF_Object* pRes = pList->GetElementValue(name); return pRes; } - CPDF_Dictionary* pList = m_pResources->GetDict(type); + CPDF_Dictionary* pList = m_pResources->GetDictBy(type); if (!pList) { if (!m_pPageResources) { return NULL; } - CPDF_Dictionary* pList = m_pPageResources->GetDict(type); + CPDF_Dictionary* pList = m_pPageResources->GetDictBy(type); if (!pList) { return NULL; } @@ -1427,7 +1427,7 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() { if (nsegs == 0) { for (int i = 0; i < n; i++) { m_pCurStates->m_TextX -= - FXSYS_Mul(pArray->GetNumber(i), + FXSYS_Mul(pArray->GetNumberAt(i), m_pCurStates->m_TextState.GetFontSize()) / 1000; } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index 7b96c4f02c..022c170bf0 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -94,7 +94,7 @@ FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf, ICodec_ScanlineDecoder* pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder( src_buf, limit, width, height, 0, - pParam ? pParam->GetInteger("ColorTransform", 1) : 1); + pParam ? pParam->GetIntegerBy("ColorTransform", 1) : 1); return _DecodeAllScanlines(pDecoder, dest_buf, dest_size); } if (decoder == "RunLengthDecode" || decoder == "RL") { @@ -120,20 +120,20 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Object* pFilter = pDict->GetElementValue("Filter"); if (pFilter) { if (CPDF_Array* pArray = pFilter->AsArray()) { - Decoder = pArray->GetString(0); - CPDF_Array* pParams = pDict->GetArray("DecodeParms"); + Decoder = pArray->GetStringAt(0); + CPDF_Array* pParams = pDict->GetArrayBy("DecodeParms"); if (pParams) - pParam = pParams->GetDict(0); + pParam = pParams->GetDictAt(0); } else { Decoder = pFilter->GetString(); - pParam = pDict->GetDict("DecodeParms"); + pParam = pDict->GetDictBy("DecodeParms"); } } - FX_DWORD width = pDict->GetInteger("Width"); - FX_DWORD height = pDict->GetInteger("Height"); + FX_DWORD width = pDict->GetIntegerBy("Width"); + FX_DWORD height = pDict->GetIntegerBy("Height"); FX_DWORD OrigSize = 0; if (pCSObj) { - FX_DWORD bpc = pDict->GetInteger("BitsPerComponent"); + FX_DWORD bpc = pDict->GetIntegerBy("BitsPerComponent"); FX_DWORD nComponents = 1; CPDF_ColorSpace* pCS = pDoc->LoadColorSpace(pCSObj); if (!pCS) { @@ -191,7 +191,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, dwStreamSize = dwDestSize; if (CPDF_Array* pArray = pFilter->AsArray()) { pArray->RemoveAt(0); - CPDF_Array* pParams = pDict->GetArray("DecodeParms"); + CPDF_Array* pParams = pDict->GetArrayBy("DecodeParms"); if (pParams) pParams->RemoveAt(0); } else { @@ -722,11 +722,11 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, m_pType3Char = pType3Char; m_pObjects = pForm; m_bForm = TRUE; - CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrix("Matrix"); + CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrixBy("Matrix"); if (pGraphicStates) { form_matrix.Concat(pGraphicStates->m_CTM); } - CPDF_Array* pBBox = pForm->m_pFormDict->GetArray("BBox"); + CPDF_Array* pBBox = pForm->m_pFormDict->GetArrayBy("BBox"); CFX_FloatRect form_bbox; CPDF_Path ClipPath; if (pBBox) { @@ -743,7 +743,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, form_bbox.Transform(pParentMatrix); } } - CPDF_Dictionary* pResources = pForm->m_pFormDict->GetDict("Resources"); + CPDF_Dictionary* pResources = pForm->m_pFormDict->GetDictBy("Resources"); m_pParser.reset(new CPDF_StreamContentParser( pForm->m_pDocument, pForm->m_pPageResources, pForm->m_pResources, pParentMatrix, pForm, pResources, &form_bbox, pOptions, pGraphicStates, @@ -803,7 +803,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) { m_InternalStage = STAGE_PARSE; m_CurrentOffset = 0; } else { - CPDF_Array* pContent = m_pObjects->m_pFormDict->GetArray("Contents"); + CPDF_Array* pContent = m_pObjects->m_pFormDict->GetArrayBy("Contents"); m_StreamArray[m_CurrentOffset].reset(new CPDF_StreamAcc); CPDF_Stream* pStreamObj = ToStream( pContent ? pContent->GetElementValue(m_CurrentOffset) : nullptr); diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp index 1eae578b97..dae583e8b9 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp @@ -43,8 +43,8 @@ CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc, const CFX_Matrix* parentMatrix) : CPDF_Pattern(TILING, pDoc, pPatternObj, parentMatrix) { CPDF_Dictionary* pDict = m_pPatternObj->GetDict(); - m_Pattern2Form = pDict->GetMatrix("Matrix"); - m_bColored = pDict->GetInteger("PaintType") == 1; + m_Pattern2Form = pDict->GetMatrixBy("Matrix"); + m_bColored = pDict->GetIntegerBy("PaintType") == 1; if (parentMatrix) { m_Pattern2Form.Concat(*parentMatrix); } @@ -62,9 +62,9 @@ FX_BOOL CPDF_TilingPattern::Load() { if (!pDict) return FALSE; - m_bColored = pDict->GetInteger("PaintType") == 1; - m_XStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumber("XStep")); - m_YStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumber("YStep")); + m_bColored = pDict->GetIntegerBy("PaintType") == 1; + m_XStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumberBy("XStep")); + m_YStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumberBy("YStep")); CPDF_Stream* pStream = m_pPatternObj->AsStream(); if (!pStream) @@ -72,7 +72,7 @@ FX_BOOL CPDF_TilingPattern::Load() { m_pForm = new CPDF_Form(m_pDocument, NULL, pStream); m_pForm->ParseContent(NULL, &m_ParentMatrix, NULL, NULL); - m_BBox = pDict->GetRect("BBox"); + m_BBox = pDict->GetRectBy("BBox"); return TRUE; } CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc, @@ -91,7 +91,7 @@ CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc, m_nFuncs(0) { if (!bShading) { CPDF_Dictionary* pDict = m_pPatternObj->GetDict(); - m_Pattern2Form = pDict->GetMatrix("Matrix"); + m_Pattern2Form = pDict->GetMatrixBy("Matrix"); m_pShadingObj = pDict->GetElementValue("Shading"); if (parentMatrix) m_Pattern2Form.Concat(*parentMatrix); @@ -146,7 +146,7 @@ FX_BOOL CPDF_ShadingPattern::Load() { m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray()); } - m_ShadingType = ToShadingType(pShadingDict->GetInteger("ShadingType")); + m_ShadingType = ToShadingType(pShadingDict->GetIntegerBy("ShadingType")); // We expect to have a stream if our shading type is a mesh. if (IsMeshShading() && !ToStream(m_pShadingObj)) @@ -164,9 +164,9 @@ FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, m_nFuncs = nFuncs; m_pCS = pCS; CPDF_Dictionary* pDict = pShadingStream->GetDict(); - m_nCoordBits = pDict->GetInteger("BitsPerCoordinate"); - m_nCompBits = pDict->GetInteger("BitsPerComponent"); - m_nFlagBits = pDict->GetInteger("BitsPerFlag"); + m_nCoordBits = pDict->GetIntegerBy("BitsPerCoordinate"); + m_nCompBits = pDict->GetIntegerBy("BitsPerComponent"); + m_nFlagBits = pDict->GetIntegerBy("BitsPerFlag"); if (!m_nCoordBits || !m_nCompBits) { return FALSE; } @@ -180,17 +180,17 @@ FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, } m_CoordMax = m_nCoordBits == 32 ? -1 : (1 << m_nCoordBits) - 1; m_CompMax = (1 << m_nCompBits) - 1; - CPDF_Array* pDecode = pDict->GetArray("Decode"); + CPDF_Array* pDecode = pDict->GetArrayBy("Decode"); if (!pDecode || pDecode->GetCount() != 4 + m_nComps * 2) { return FALSE; } - m_xmin = pDecode->GetNumber(0); - m_xmax = pDecode->GetNumber(1); - m_ymin = pDecode->GetNumber(2); - m_ymax = pDecode->GetNumber(3); + m_xmin = pDecode->GetNumberAt(0); + m_xmax = pDecode->GetNumberAt(1); + m_ymin = pDecode->GetNumberAt(2); + m_ymax = pDecode->GetNumberAt(3); for (FX_DWORD i = 0; i < m_nComps; i++) { - m_ColorMin[i] = pDecode->GetNumber(i * 2 + 4); - m_ColorMax[i] = pDecode->GetNumber(i * 2 + 5); + m_ColorMin[i] = pDecode->GetNumberAt(i * 2 + 4); + m_ColorMax[i] = pDecode->GetNumberAt(i * 2 + 5); } return TRUE; } 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; } diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp index 28a5fe1eef..35d62ce0b3 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp @@ -446,7 +446,7 @@ void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj, if (pObj->m_Type == CPDF_PageObject::FORM) { CPDF_FormObject* pFormObj = (CPDF_FormObject*)pObj; if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { - pFormResource = pFormObj->m_pForm->m_pFormDict->GetDict("Resources"); + pFormResource = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources"); } } CPDF_RenderStatus status; @@ -458,7 +458,7 @@ void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj, } FX_BOOL CPDF_RenderStatus::ProcessForm(CPDF_FormObject* pFormObj, const CFX_Matrix* pObj2Device) { - CPDF_Dictionary* pOC = pFormObj->m_pForm->m_pFormDict->GetDict("OC"); + CPDF_Dictionary* pOC = pFormObj->m_pForm->m_pFormDict->GetDictBy("OC"); if (pOC && m_Options.m_pOCContext && !m_Options.m_pOCContext->CheckOCGVisible(pOC)) { return TRUE; @@ -467,7 +467,7 @@ FX_BOOL CPDF_RenderStatus::ProcessForm(CPDF_FormObject* pFormObj, matrix.Concat(*pObj2Device); CPDF_Dictionary* pResources = NULL; if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { - pResources = pFormObj->m_pForm->m_pFormDict->GetDict("Resources"); + pResources = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources"); } CPDF_RenderStatus status; status.Initialize(m_pContext, m_pDevice, NULL, m_pStopObj, this, pFormObj, @@ -746,7 +746,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, Transparency = pFormObj->m_pForm->m_Transparency; bGroupTransparent = !!(Transparency & PDFTRANS_ISOLATED); if (pFormObj->m_pForm->m_pFormDict) { - pFormResource = pFormObj->m_pForm->m_pFormDict->GetDict("Resources"); + pFormResource = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources"); } } FX_BOOL bTextClip = FALSE; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp index a0b3059e5b..d31e214ffd 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -406,7 +406,7 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { } } else if (CPDF_Array* pArray = pFilters->AsArray()) { for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { - CFX_ByteStringC bsDecodeType = pArray->GetConstString(i); + CFX_ByteStringC bsDecodeType = pArray->GetConstStringAt(i); if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode") { m_Flags |= FXRENDER_IMAGE_LOSSY; break; @@ -871,8 +871,8 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, int width = pClipRect->right - pClipRect->left; int height = pClipRect->bottom - pClipRect->top; FX_BOOL bLuminosity = FALSE; - bLuminosity = pSMaskDict->GetConstString("S") != "Alpha"; - CPDF_Stream* pGroup = pSMaskDict->GetStream("G"); + bLuminosity = pSMaskDict->GetConstStringBy("S") != "Alpha"; + CPDF_Stream* pGroup = pSMaskDict->GetStreamBy("G"); if (!pGroup) { return NULL; } @@ -902,12 +902,12 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, CPDF_Object* pCSObj = NULL; CPDF_ColorSpace* pCS = NULL; if (bLuminosity) { - CPDF_Array* pBC = pSMaskDict->GetArray("BC"); + CPDF_Array* pBC = pSMaskDict->GetArrayBy("BC"); FX_ARGB back_color = 0xff000000; if (pBC) { CPDF_Dictionary* pDict = pGroup->GetDict(); - if (pDict && pDict->GetDict("Group")) - pCSObj = pDict->GetDict("Group")->GetElementValue("CS"); + if (pDict && pDict->GetDictBy("Group")) + pCSObj = pDict->GetDictBy("Group")->GetElementValue("CS"); else pCSObj = NULL; pCS = m_pContext->GetDocument()->LoadColorSpace(pCSObj); @@ -927,7 +927,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, FXSYS_memset(pFloats, 0, num_floats.ValueOrDie()); int count = pBC->GetCount() > 8 ? 8 : pBC->GetCount(); for (int i = 0; i < count; i++) { - pFloats[i] = pBC->GetNumber(i); + pFloats[i] = pBC->GetNumberAt(i); } pCS->GetRGB(pFloats, R, G, B); back_color = 0xff000000 | ((int32_t)(R * 255) << 16) | @@ -941,7 +941,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, } CPDF_Dictionary* pFormResource = NULL; if (form.m_pFormDict) { - pFormResource = form.m_pFormDict->GetDict("Resources"); + pFormResource = form.m_pFormDict->GetDictBy("Resources"); } CPDF_RenderOptions options; options.m_ColorMode = bLuminosity ? RENDER_COLOR_NORMAL : RENDER_COLOR_ALPHA; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index f690c209a0..452103afca 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -222,8 +222,8 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, return FALSE; } m_pStream = pStream; - m_Width = m_pDict->GetInteger("Width"); - m_Height = m_pDict->GetInteger("Height"); + m_Width = m_pDict->GetIntegerBy("Width"); + m_Height = m_pDict->GetIntegerBy("Height"); if (m_Width <= 0 || m_Height <= 0 || m_Width > kMaxImageDimension || m_Height > kMaxImageDimension) { return FALSE; @@ -342,8 +342,8 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, m_pStream = pStream; m_bStdCS = bStdCS; m_bHasMask = bHasMask; - m_Width = m_pDict->GetInteger("Width"); - m_Height = m_pDict->GetInteger("Height"); + m_Width = m_pDict->GetIntegerBy("Width"); + m_Height = m_pDict->GetIntegerBy("Height"); if (m_Width <= 0 || m_Height <= 0 || m_Width > kMaxImageDimension || m_Height > kMaxImageDimension) { return 0; @@ -406,7 +406,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) { m_pJbig2Context = pJbig2Module->CreateJbig2Context(); if (m_pStreamAcc->GetImageParam()) { CPDF_Stream* pGlobals = - m_pStreamAcc->GetImageParam()->GetStream("JBIG2Globals"); + m_pStreamAcc->GetImageParam()->GetStreamBy("JBIG2Globals"); if (pGlobals) { m_pGlobalStream = new CPDF_StreamAcc; m_pGlobalStream->LoadAllData(pGlobals, FALSE); @@ -473,8 +473,8 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) { bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources, const CPDF_Dictionary* pPageResources) { - m_bpc_orig = m_pDict->GetInteger("BitsPerComponent"); - if (m_pDict->GetInteger("ImageMask")) + m_bpc_orig = m_pDict->GetIntegerBy("BitsPerComponent"); + if (m_pDict->GetIntegerBy("ImageMask")) m_bImageMask = TRUE; if (m_bImageMask || !m_pDict->KeyExist("ColorSpace")) { @@ -485,7 +485,7 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources, if (pFilter->IsName()) { filter = pFilter->GetString(); } else if (CPDF_Array* pArray = pFilter->AsArray()) { - filter = pArray->GetString(pArray->GetCount() - 1); + filter = pArray->GetStringAt(pArray->GetCount() - 1); } if (filter == "JPXDecode") { @@ -496,8 +496,8 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources, } m_bImageMask = TRUE; m_bpc = m_nComponents = 1; - CPDF_Array* pDecode = m_pDict->GetArray("Decode"); - m_bDefaultDecode = !pDecode || !pDecode->GetInteger(0); + CPDF_Array* pDecode = m_pDict->GetArrayBy("Decode"); + m_bDefaultDecode = !pDecode || !pDecode->GetIntegerAt(0); return true; } @@ -537,11 +537,11 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, } DIB_COMP_DATA* pCompData = FX_Alloc(DIB_COMP_DATA, m_nComponents); int max_data = (1 << m_bpc) - 1; - CPDF_Array* pDecode = m_pDict->GetArray("Decode"); + CPDF_Array* pDecode = m_pDict->GetArrayBy("Decode"); if (pDecode) { for (FX_DWORD i = 0; i < m_nComponents; i++) { - pCompData[i].m_DecodeMin = pDecode->GetNumber(i * 2); - FX_FLOAT max = pDecode->GetNumber(i * 2 + 1); + pCompData[i].m_DecodeMin = pDecode->GetNumberAt(i * 2); + FX_FLOAT max = pDecode->GetNumberAt(i * 2 + 1); pCompData[i].m_DecodeStep = (max - pCompData[i].m_DecodeMin) / max_data; FX_FLOAT def_value, def_min, def_max; m_pColorSpace->GetDefaultValue(i, def_value, def_min, def_max); @@ -572,8 +572,8 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, if (CPDF_Array* pArray = pMask->AsArray()) { if (pArray->GetCount() >= m_nComponents * 2) { for (FX_DWORD i = 0; i < m_nComponents; i++) { - int min_num = pArray->GetInteger(i * 2); - int max_num = pArray->GetInteger(i * 2 + 1); + int min_num = pArray->GetIntegerAt(i * 2); + int max_num = pArray->GetIntegerAt(i * 2 + 1); pCompData[i].m_ColorKeyMin = std::max(min_num, 0); pCompData[i].m_ColorKeyMax = std::min(max_num, max_data); } @@ -614,7 +614,7 @@ int CPDF_DIBSource::CreateDecoder() { } else if (decoder == "DCTDecode") { m_pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder( src_data, src_size, m_Width, m_Height, m_nComponents, - pParams ? pParams->GetInteger("ColorTransform", 1) : 1); + pParams ? pParams->GetIntegerBy("ColorTransform", 1) : 1); if (!m_pDecoder) { FX_BOOL bTransform = FALSE; int comps, bpc; @@ -759,14 +759,14 @@ void CPDF_DIBSource::LoadJpxBitmap() { } CPDF_DIBSource* CPDF_DIBSource::LoadMask(FX_DWORD& MatteColor) { MatteColor = 0xFFFFFFFF; - CPDF_Stream* pSoftMask = m_pDict->GetStream("SMask"); + CPDF_Stream* pSoftMask = m_pDict->GetStreamBy("SMask"); if (pSoftMask) { - CPDF_Array* pMatte = pSoftMask->GetDict()->GetArray("Matte"); + CPDF_Array* pMatte = pSoftMask->GetDict()->GetArrayBy("Matte"); if (pMatte && m_pColorSpace && (FX_DWORD)m_pColorSpace->CountComponents() <= m_nComponents) { FX_FLOAT* pColor = FX_Alloc(FX_FLOAT, m_nComponents); for (FX_DWORD i = 0; i < m_nComponents; i++) { - pColor[i] = pMatte->GetFloat(i); + pColor[i] = pMatte->GetFloatAt(i); } FX_FLOAT R, G, B; m_pColorSpace->GetRGB(pColor, R, G, B); @@ -784,15 +784,15 @@ CPDF_DIBSource* CPDF_DIBSource::LoadMask(FX_DWORD& MatteColor) { } int CPDF_DIBSource::StratLoadMask() { m_MatteColor = 0XFFFFFFFF; - m_pMaskStream = m_pDict->GetStream("SMask"); + m_pMaskStream = m_pDict->GetStreamBy("SMask"); if (m_pMaskStream) { - CPDF_Array* pMatte = m_pMaskStream->GetDict()->GetArray("Matte"); + CPDF_Array* pMatte = m_pMaskStream->GetDict()->GetArrayBy("Matte"); if (pMatte && m_pColorSpace && (FX_DWORD)m_pColorSpace->CountComponents() <= m_nComponents) { FX_FLOAT R, G, B; FX_FLOAT* pColor = FX_Alloc(FX_FLOAT, m_nComponents); for (FX_DWORD i = 0; i < m_nComponents; i++) { - pColor[i] = pMatte->GetFloat(i); + pColor[i] = pMatte->GetFloatAt(i); } m_pColorSpace->GetRGB(pColor, R, G, B); FX_Free(pColor); @@ -939,7 +939,7 @@ void CPDF_DIBSource::ValidateDictParam() { m_bpc = 8; } } else if (CPDF_Array* pArray = pFilter->AsArray()) { - CFX_ByteString filter = pArray->GetString(pArray->GetCount() - 1); + CFX_ByteString filter = pArray->GetStringAt(pArray->GetCount() - 1); if (filter == "CCITTFaxDecode" || filter == "JBIG2Decode") { m_bpc = 1; m_nComponents = 1; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index 6aeed548a3..ed44a04181 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -20,25 +20,25 @@ static void DrawAxialShading(CFX_DIBitmap* pBitmap, CPDF_ColorSpace* pCS, int alpha) { ASSERT(pBitmap->GetFormat() == FXDIB_Argb); - CPDF_Array* pCoords = pDict->GetArray("Coords"); + CPDF_Array* pCoords = pDict->GetArrayBy("Coords"); if (!pCoords) { return; } - FX_FLOAT start_x = pCoords->GetNumber(0); - FX_FLOAT start_y = pCoords->GetNumber(1); - FX_FLOAT end_x = pCoords->GetNumber(2); - FX_FLOAT end_y = pCoords->GetNumber(3); + FX_FLOAT start_x = pCoords->GetNumberAt(0); + FX_FLOAT start_y = pCoords->GetNumberAt(1); + FX_FLOAT end_x = pCoords->GetNumberAt(2); + FX_FLOAT end_y = pCoords->GetNumberAt(3); FX_FLOAT t_min = 0, t_max = 1.0f; - CPDF_Array* pArray = pDict->GetArray("Domain"); + CPDF_Array* pArray = pDict->GetArrayBy("Domain"); if (pArray) { - t_min = pArray->GetNumber(0); - t_max = pArray->GetNumber(1); + t_min = pArray->GetNumberAt(0); + t_max = pArray->GetNumberAt(1); } FX_BOOL bStartExtend = FALSE, bEndExtend = FALSE; - pArray = pDict->GetArray("Extend"); + pArray = pDict->GetArrayBy("Extend"); if (pArray) { - bStartExtend = pArray->GetInteger(0); - bEndExtend = pArray->GetInteger(1); + bStartExtend = pArray->GetIntegerAt(0); + bEndExtend = pArray->GetIntegerAt(1); } int width = pBitmap->GetWidth(); int height = pBitmap->GetHeight(); @@ -111,29 +111,29 @@ static void DrawRadialShading(CFX_DIBitmap* pBitmap, CPDF_ColorSpace* pCS, int alpha) { ASSERT(pBitmap->GetFormat() == FXDIB_Argb); - CPDF_Array* pCoords = pDict->GetArray("Coords"); + CPDF_Array* pCoords = pDict->GetArrayBy("Coords"); if (!pCoords) { return; } - FX_FLOAT start_x = pCoords->GetNumber(0); - FX_FLOAT start_y = pCoords->GetNumber(1); - FX_FLOAT start_r = pCoords->GetNumber(2); - FX_FLOAT end_x = pCoords->GetNumber(3); - FX_FLOAT end_y = pCoords->GetNumber(4); - FX_FLOAT end_r = pCoords->GetNumber(5); + FX_FLOAT start_x = pCoords->GetNumberAt(0); + FX_FLOAT start_y = pCoords->GetNumberAt(1); + FX_FLOAT start_r = pCoords->GetNumberAt(2); + FX_FLOAT end_x = pCoords->GetNumberAt(3); + FX_FLOAT end_y = pCoords->GetNumberAt(4); + FX_FLOAT end_r = pCoords->GetNumberAt(5); CFX_Matrix matrix; matrix.SetReverse(*pObject2Bitmap); FX_FLOAT t_min = 0, t_max = 1.0f; - CPDF_Array* pArray = pDict->GetArray("Domain"); + CPDF_Array* pArray = pDict->GetArrayBy("Domain"); if (pArray) { - t_min = pArray->GetNumber(0); - t_max = pArray->GetNumber(1); + t_min = pArray->GetNumberAt(0); + t_max = pArray->GetNumberAt(1); } FX_BOOL bStartExtend = FALSE, bEndExtend = FALSE; - pArray = pDict->GetArray("Extend"); + pArray = pDict->GetArrayBy("Extend"); if (pArray) { - bStartExtend = pArray->GetInteger(0); - bEndExtend = pArray->GetInteger(1); + bStartExtend = pArray->GetIntegerAt(0); + bEndExtend = pArray->GetIntegerAt(1); } int total_results = 0; for (int j = 0; j < nFuncs; j++) { @@ -249,15 +249,15 @@ static void DrawFuncShading(CFX_DIBitmap* pBitmap, CPDF_ColorSpace* pCS, int alpha) { ASSERT(pBitmap->GetFormat() == FXDIB_Argb); - CPDF_Array* pDomain = pDict->GetArray("Domain"); + CPDF_Array* pDomain = pDict->GetArrayBy("Domain"); FX_FLOAT xmin = 0, ymin = 0, xmax = 1.0f, ymax = 1.0f; if (pDomain) { - xmin = pDomain->GetNumber(0); - xmax = pDomain->GetNumber(1); - ymin = pDomain->GetNumber(2); - ymax = pDomain->GetNumber(3); + xmin = pDomain->GetNumberAt(0); + xmax = pDomain->GetNumberAt(1); + ymin = pDomain->GetNumberAt(2); + ymax = pDomain->GetNumberAt(3); } - CFX_Matrix mtDomain2Target = pDict->GetMatrix("Matrix"); + CFX_Matrix mtDomain2Target = pDict->GetMatrixBy("Matrix"); CFX_Matrix matrix, reverse_matrix; matrix.SetReverse(*pObject2Bitmap); reverse_matrix.SetReverse(mtDomain2Target); @@ -453,7 +453,7 @@ static void DrawLatticeGouraudShading(CFX_DIBitmap* pBitmap, int alpha) { ASSERT(pBitmap->GetFormat() == FXDIB_Argb); - int row_verts = pShadingStream->GetDict()->GetInteger("VerticesPerRow"); + int row_verts = pShadingStream->GetDict()->GetIntegerBy("VerticesPerRow"); if (row_verts < 2) return; @@ -841,12 +841,12 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, if (!pPattern->m_bShadingObj && pPattern->m_pShadingObj->GetDict()->KeyExist("Background")) { CPDF_Array* pBackColor = - pPattern->m_pShadingObj->GetDict()->GetArray("Background"); + pPattern->m_pShadingObj->GetDict()->GetArrayBy("Background"); if (pBackColor && pBackColor->GetCount() >= (FX_DWORD)pColorSpace->CountComponents()) { CFX_FixedBufGrow<FX_FLOAT, 16> comps(pColorSpace->CountComponents()); for (int i = 0; i < pColorSpace->CountComponents(); i++) { - comps[i] = pBackColor->GetNumber(i); + comps[i] = pBackColor->GetNumberAt(i); } FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; pColorSpace->GetRGB(comps, R, G, B); @@ -855,7 +855,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, } } if (pDict->KeyExist("BBox")) { - CFX_FloatRect rect = pDict->GetRect("BBox"); + CFX_FloatRect rect = pDict->GetRectBy("BBox"); rect.Transform(pMatrix); clip_rect.Intersect(rect.GetOutterRect()); } @@ -1063,7 +1063,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, } CPDF_Dictionary* pFormResource = NULL; if (pPattern->m_pForm->m_pFormDict) { - pFormResource = pPattern->m_pForm->m_pFormDict->GetDict("Resources"); + pFormResource = pPattern->m_pForm->m_pFormDict->GetDictBy("Resources"); } for (int col = min_col; col <= max_col; col++) for (int row = min_row; row <= max_row; row++) { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp index a40284a1f8..d0427f68fa 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -411,7 +411,8 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, Options.m_Flags &= ~RENDER_FORCE_DOWNSAMPLE; CPDF_Dictionary* pFormResource = NULL; if (pType3Char->m_pForm && pType3Char->m_pForm->m_pFormDict) { - pFormResource = pType3Char->m_pForm->m_pFormDict->GetDict("Resources"); + pFormResource = + pType3Char->m_pForm->m_pFormDict->GetDictBy("Resources"); } if (fill_alpha == 255) { CPDF_RenderStatus status; diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp index 28d17cd673..97ca046bb9 100644 --- a/core/src/fpdfdoc/doc_action.cpp +++ b/core/src/fpdfdoc/doc_action.cpp @@ -10,7 +10,7 @@ CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const { if (!m_pDict) { return CPDF_Dest(); } - CFX_ByteString type = m_pDict->GetString("S"); + CFX_ByteString type = m_pDict->GetStringBy("S"); if (type != "GoTo" && type != "GoToR") { return CPDF_Dest(); } @@ -35,7 +35,7 @@ const FX_CHAR* g_sATypes[] = { CPDF_Action::ActionType CPDF_Action::GetType() const { ActionType eType = Unknown; if (m_pDict) { - CFX_ByteString csType = m_pDict->GetString("S"); + CFX_ByteString csType = m_pDict->GetStringBy("S"); if (!csType.IsEmpty()) { int i = 0; while (g_sATypes[i][0] != '\0') { @@ -49,7 +49,7 @@ CPDF_Action::ActionType CPDF_Action::GetType() const { return eType; } CFX_WideString CPDF_Action::GetFilePath() const { - CFX_ByteString type = m_pDict->GetString("S"); + CFX_ByteString type = m_pDict->GetStringBy("S"); if (type != "GoToR" && type != "Launch" && type != "SubmitForm" && type != "ImportData") { return CFX_WideString(); @@ -58,9 +58,9 @@ CFX_WideString CPDF_Action::GetFilePath() const { CFX_WideString path; if (!pFile) { if (type == "Launch") { - CPDF_Dictionary* pWinDict = m_pDict->GetDict("Win"); + CPDF_Dictionary* pWinDict = m_pDict->GetDictBy("Win"); if (pWinDict) { - return CFX_WideString::FromLocal(pWinDict->GetString("F")); + return CFX_WideString::FromLocal(pWinDict->GetStringBy("F")); } } return path; @@ -74,15 +74,15 @@ CFX_ByteString CPDF_Action::GetURI(CPDF_Document* pDoc) const { if (!m_pDict) { return csURI; } - if (m_pDict->GetString("S") != "URI") { + if (m_pDict->GetStringBy("S") != "URI") { return csURI; } - csURI = m_pDict->GetString("URI"); + csURI = m_pDict->GetStringBy("URI"); CPDF_Dictionary* pRoot = pDoc->GetRoot(); - CPDF_Dictionary* pURI = pRoot->GetDict("URI"); + CPDF_Dictionary* pURI = pRoot->GetDictBy("URI"); if (pURI) { if (csURI.Find(":", 0) < 1) { - csURI = pURI->GetString("Base") + csURI; + csURI = pURI->GetStringBy("Base") + csURI; } } return csURI; @@ -95,12 +95,12 @@ FX_DWORD CPDF_ActionFields::GetFieldsCount() const { if (!pDict) { return 0; } - CFX_ByteString csType = pDict->GetString("S"); + CFX_ByteString csType = pDict->GetStringBy("S"); CPDF_Object* pFields = NULL; if (csType == "Hide") { pFields = pDict->GetElementValue("T"); } else { - pFields = pDict->GetArray("Fields"); + pFields = pDict->GetArrayBy("Fields"); } if (!pFields) return 0; @@ -122,12 +122,12 @@ std::vector<CPDF_Object*> CPDF_ActionFields::GetAllFields() const { if (!pDict) return fields; - CFX_ByteString csType = pDict->GetString("S"); + CFX_ByteString csType = pDict->GetStringBy("S"); CPDF_Object* pFields; if (csType == "Hide") pFields = pDict->GetElementValue("T"); else - pFields = pDict->GetArray("Fields"); + pFields = pDict->GetArrayBy("Fields"); if (!pFields) return fields; @@ -153,12 +153,12 @@ CPDF_Object* CPDF_ActionFields::GetField(FX_DWORD iIndex) const { if (!pDict) { return NULL; } - CFX_ByteString csType = pDict->GetString("S"); + CFX_ByteString csType = pDict->GetStringBy("S"); CPDF_Object* pFields = NULL; if (csType == "Hide") { pFields = pDict->GetElementValue("T"); } else { - pFields = pDict->GetArray("Fields"); + pFields = pDict->GetArrayBy("Fields"); } if (!pFields) { return NULL; @@ -185,12 +185,12 @@ CPDF_Dictionary* CPDF_Action::GetAnnot() const { if (!m_pDict) { return nullptr; } - CFX_ByteString csType = m_pDict->GetString("S"); + CFX_ByteString csType = m_pDict->GetStringBy("S"); if (csType == "Rendition") { - return m_pDict->GetDict("AN"); + return m_pDict->GetDictBy("AN"); } if (csType == "Movie") { - return m_pDict->GetDict("Annotation"); + return m_pDict->GetDictBy("Annotation"); } return nullptr; } @@ -198,12 +198,12 @@ int32_t CPDF_Action::GetOperationType() const { if (!m_pDict) { return 0; } - CFX_ByteString csType = m_pDict->GetString("S"); + CFX_ByteString csType = m_pDict->GetStringBy("S"); if (csType == "Rendition") { - return m_pDict->GetInteger("OP"); + return m_pDict->GetIntegerBy("OP"); } if (csType == "Movie") { - CFX_ByteString csOP = m_pDict->GetString("Operation"); + CFX_ByteString csOP = m_pDict->GetStringBy("Operation"); if (csOP == "Play") { return 0; } @@ -241,7 +241,7 @@ CPDF_Action CPDF_Action::GetSubAction(FX_DWORD iIndex) const { if (iIndex == 0) return CPDF_Action(pDict); } else if (CPDF_Array* pArray = ToArray(pNext)) { - return CPDF_Action(pArray->GetDict(iIndex)); + return CPDF_Action(pArray->GetDictAt(iIndex)); } return CPDF_Action(); } @@ -255,7 +255,7 @@ CPDF_Action CPDF_AAction::GetAction(AActionType eType) const { if (!m_pDict) { return CPDF_Action(); } - return CPDF_Action(m_pDict->GetDict(g_sAATypes[(int)eType])); + return CPDF_Action(m_pDict->GetDictBy(g_sAATypes[(int)eType])); } CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) : m_pDocument(pDoc) {} diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp index 5786349490..a73d24410c 100644 --- a/core/src/fpdfdoc/doc_annot.cpp +++ b/core/src/fpdfdoc/doc_annot.cpp @@ -12,13 +12,14 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) if (!pPage->m_pFormDict) return; - CPDF_Array* pAnnots = pPage->m_pFormDict->GetArray("Annots"); + CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayBy("Annots"); if (!pAnnots) return; CPDF_Dictionary* pRoot = m_pDocument->GetRoot(); - CPDF_Dictionary* pAcroForm = pRoot->GetDict("AcroForm"); - FX_BOOL bRegenerateAP = pAcroForm && pAcroForm->GetBoolean("NeedAppearances"); + CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); + FX_BOOL bRegenerateAP = + pAcroForm && pAcroForm->GetBooleanBy("NeedAppearances"); for (FX_DWORD i = 0; i < pAnnots->GetCount(); ++i) { CPDF_Dictionary* pDict = ToDictionary(pAnnots->GetElementValue(i)); if (!pDict) @@ -30,10 +31,10 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) CPDF_Reference* pAction = new CPDF_Reference(m_pDocument, dwObjNum); pAnnots->InsertAt(i, pAction); pAnnots->RemoveAt(i + 1); - pDict = pAnnots->GetDict(i); + pDict = pAnnots->GetDictAt(i); } m_AnnotList.push_back(new CPDF_Annot(pDict, this)); - if (bRegenerateAP && pDict->GetConstString("Subtype") == "Widget" && + if (bRegenerateAP && pDict->GetConstStringBy("Subtype") == "Widget" && CPDF_InterForm::UpdatingAPEnabled()) { FPDF_GenerateAP(m_pDocument, pDict); } @@ -72,7 +73,7 @@ void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage, IPDF_OCContext* pOCContext = pOptions->m_pOCContext; CPDF_Dictionary* pAnnotDict = pAnnot->GetAnnotDict(); if (pOCContext && pAnnotDict && - !pOCContext->CheckOCGVisible(pAnnotDict->GetDict("OC"))) { + !pOCContext->CheckOCGVisible(pAnnotDict->GetDictBy("OC"))) { continue; } } @@ -117,7 +118,7 @@ void CPDF_AnnotList::DisplayAnnots(CPDF_Page* pPage, CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList) : m_pAnnotDict(pDict), m_pList(pList), - m_sSubtype(m_pAnnotDict->GetConstString("Subtype")) {} + m_sSubtype(m_pAnnotDict->GetConstStringBy("Subtype")) {} CPDF_Annot::~CPDF_Annot() { ClearCachedAP(); } @@ -135,17 +136,17 @@ void CPDF_Annot::GetRect(CPDF_Rect& rect) const { if (!m_pAnnotDict) { return; } - rect = m_pAnnotDict->GetRect("Rect"); + rect = m_pAnnotDict->GetRectBy("Rect"); rect.Normalize(); } FX_DWORD CPDF_Annot::GetFlags() const { - return m_pAnnotDict->GetInteger("F"); + return m_pAnnotDict->GetIntegerBy("F"); } CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, CPDF_Annot::AppearanceMode mode) { - CPDF_Dictionary* pAP = pAnnotDict->GetDict("AP"); + CPDF_Dictionary* pAP = pAnnotDict->GetDictBy("AP"); if (!pAP) { return NULL; } @@ -164,19 +165,19 @@ CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, return pStream; if (CPDF_Dictionary* pDict = psub->AsDictionary()) { - CFX_ByteString as = pAnnotDict->GetString("AS"); + CFX_ByteString as = pAnnotDict->GetStringBy("AS"); if (as.IsEmpty()) { - CFX_ByteString value = pAnnotDict->GetString("V"); + CFX_ByteString value = pAnnotDict->GetStringBy("V"); if (value.IsEmpty()) { - CPDF_Dictionary* pDict = pAnnotDict->GetDict("Parent"); - value = pDict ? pDict->GetString("V") : CFX_ByteString(); + CPDF_Dictionary* pDict = pAnnotDict->GetDictBy("Parent"); + value = pDict ? pDict->GetStringBy("V") : CFX_ByteString(); } if (value.IsEmpty() || !pDict->KeyExist(value)) as = "Off"; else as = value; } - return pDict->GetStream(as); + return pDict->GetStreamBy(as); } return nullptr; } @@ -206,8 +207,8 @@ static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage, if (!pForm) { return NULL; } - CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRect("BBox"); - CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrix("Matrix"); + CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRectBy("BBox"); + CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrixBy("Matrix"); form_matrix.TransformRect(form_bbox); CPDF_Rect arect; pAnnot->GetRect(arect); @@ -262,17 +263,17 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, if (!bPrinting && (annot_flags & ANNOTFLAG_NOVIEW)) { return; } - CPDF_Dictionary* pBS = m_pAnnotDict->GetDict("BS"); + CPDF_Dictionary* pBS = m_pAnnotDict->GetDictBy("BS"); char style_char; FX_FLOAT width; CPDF_Array* pDashArray = NULL; if (!pBS) { - CPDF_Array* pBorderArray = m_pAnnotDict->GetArray("Border"); + CPDF_Array* pBorderArray = m_pAnnotDict->GetArrayBy("Border"); style_char = 'S'; if (pBorderArray) { - width = pBorderArray->GetNumber(2); + width = pBorderArray->GetNumberAt(2); if (pBorderArray->GetCount() == 4) { - pDashArray = pBorderArray->GetArray(3); + pDashArray = pBorderArray->GetArrayAt(3); if (!pDashArray) { return; } @@ -293,20 +294,20 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, width = 1; } } else { - CFX_ByteString style = pBS->GetString("S"); - pDashArray = pBS->GetArray("D"); + CFX_ByteString style = pBS->GetStringBy("S"); + pDashArray = pBS->GetArrayBy("D"); style_char = style[1]; - width = pBS->GetNumber("W"); + width = pBS->GetNumberBy("W"); } if (width <= 0) { return; } - CPDF_Array* pColor = m_pAnnotDict->GetArray("C"); + CPDF_Array* pColor = m_pAnnotDict->GetArrayBy("C"); FX_DWORD argb = 0xff000000; if (pColor) { - int R = (int32_t)(pColor->GetNumber(0) * 255); - int G = (int32_t)(pColor->GetNumber(1) * 255); - int B = (int32_t)(pColor->GetNumber(2) * 255); + int R = (int32_t)(pColor->GetNumberAt(0) * 255); + int G = (int32_t)(pColor->GetNumberAt(1) * 255); + int B = (int32_t)(pColor->GetNumberAt(2) * 255); argb = ArgbEncode(0xff, R, G, B); } CPDF_GraphStateData graph_state; @@ -321,7 +322,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, graph_state.m_DashCount = dash_count; FX_DWORD i; for (i = 0; i < pDashArray->GetCount(); ++i) { - graph_state.m_DashArray[i] = pDashArray->GetNumber(i); + graph_state.m_DashArray[i] = pDashArray->GetNumberAt(i); } if (i < dash_count) { graph_state.m_DashArray[i] = graph_state.m_DashArray[i - 1]; diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp index 15576965b1..c84a36d499 100644 --- a/core/src/fpdfdoc/doc_ap.cpp +++ b/core/src/fpdfdoc/doc_ap.cpp @@ -17,7 +17,7 @@ #define PBS_UNDERLINED 4 FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { - if (!pAnnotDict || pAnnotDict->GetConstString("Subtype") != "Widget") { + if (!pAnnotDict || pAnnotDict->GetConstStringBy("Subtype") != "Widget") { return FALSE; } CFX_ByteString field_type = FPDF_GetFieldAttr(pAnnotDict, "FT")->GetString(); @@ -35,9 +35,9 @@ FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { if (field_type == "Btn") { if (!(flags & (1 << 16))) { if (!pAnnotDict->KeyExist("AS")) { - if (CPDF_Dictionary* pParentDict = pAnnotDict->GetDict("Parent")) { + if (CPDF_Dictionary* pParentDict = pAnnotDict->GetDictBy("Parent")) { if (pParentDict->KeyExist("AS")) { - pAnnotDict->SetAtString("AS", pParentDict->GetString("AS")); + pAnnotDict->SetAtString("AS", pParentDict->GetStringBy("AS")); } } } @@ -89,10 +89,10 @@ void CPVT_FontMap::GetAnnotSysPDFFont(CPDF_Document* pDoc, CFX_ByteString& sSysFontAlias) { if (pDoc && pResDict) { CFX_ByteString sFontAlias; - CPDF_Dictionary* pFormDict = pDoc->GetRoot()->GetDict("AcroForm"); + CPDF_Dictionary* pFormDict = pDoc->GetRoot()->GetDictBy("AcroForm"); if (CPDF_Font* pPDFFont = AddNativeInterFormFont(pFormDict, pDoc, sSysFontAlias)) { - if (CPDF_Dictionary* pFontList = pResDict->GetDict("Font")) { + if (CPDF_Dictionary* pFontList = pResDict->GetDictBy("Font")) { if (!pFontList->KeyExist(sSysFontAlias)) { pFontList->SetAtReference(sSysFontAlias, pDoc, pPDFFont->GetFontDict()); @@ -253,15 +253,16 @@ static CPVT_Color ParseColor(const CPDF_Array& array) { CPVT_Color rt; switch (array.GetCount()) { case 1: - rt = CPVT_Color(CPVT_Color::kGray, array.GetFloat(0)); + rt = CPVT_Color(CPVT_Color::kGray, array.GetFloatAt(0)); break; case 3: - rt = CPVT_Color(CPVT_Color::kRGB, array.GetFloat(0), array.GetFloat(1), - array.GetFloat(2)); + rt = CPVT_Color(CPVT_Color::kRGB, array.GetFloatAt(0), + array.GetFloatAt(1), array.GetFloatAt(2)); break; case 4: - rt = CPVT_Color(CPVT_Color::kCMYK, array.GetFloat(0), array.GetFloat(1), - array.GetFloat(2), array.GetFloat(3)); + rt = CPVT_Color(CPVT_Color::kCMYK, array.GetFloatAt(0), + array.GetFloatAt(1), array.GetFloatAt(2), + array.GetFloatAt(3)); break; } return rt; @@ -271,7 +272,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, const int32_t& nWidgetType) { CPDF_Dictionary* pFormDict = NULL; if (CPDF_Dictionary* pRootDict = pDoc->GetRoot()) { - pFormDict = pRootDict->GetDict("AcroForm"); + pFormDict = pRootDict->GetDictBy("AcroForm"); } if (!pFormDict) { return FALSE; @@ -281,7 +282,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, DA = pDAObj->GetString(); } if (DA.IsEmpty()) { - DA = pFormDict->GetString("DA"); + DA = pFormDict->GetStringBy("DA"); } if (DA.IsEmpty()) { return FALSE; @@ -297,19 +298,19 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPVT_Color crText = ParseColor(DA); FX_BOOL bUseFormRes = FALSE; CPDF_Dictionary* pFontDict = NULL; - CPDF_Dictionary* pDRDict = pAnnotDict->GetDict("DR"); + CPDF_Dictionary* pDRDict = pAnnotDict->GetDictBy("DR"); if (!pDRDict) { - pDRDict = pFormDict->GetDict("DR"); + pDRDict = pFormDict->GetDictBy("DR"); bUseFormRes = TRUE; } CPDF_Dictionary* pDRFontDict = NULL; - if (pDRDict && (pDRFontDict = pDRDict->GetDict("Font"))) { - pFontDict = pDRFontDict->GetDict(sFontName.Mid(1)); + if (pDRDict && (pDRFontDict = pDRDict->GetDictBy("Font"))) { + pFontDict = pDRFontDict->GetDictBy(sFontName.Mid(1)); if (!pFontDict && !bUseFormRes) { - pDRDict = pFormDict->GetDict("DR"); - pDRFontDict = pDRDict->GetDict("Font"); + pDRDict = pFormDict->GetDictBy("DR"); + pDRFontDict = pDRDict->GetDictBy("Font"); if (pDRFontDict) { - pFontDict = pDRFontDict->GetDict(sFontName.Mid(1)); + pFontDict = pDRFontDict->GetDictBy(sFontName.Mid(1)); } } } @@ -329,10 +330,10 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, if (!pDefFont) { return FALSE; } - CPDF_Rect rcAnnot = pAnnotDict->GetRect("Rect"); + CPDF_Rect rcAnnot = pAnnotDict->GetRectBy("Rect"); int32_t nRotate = 0; - if (CPDF_Dictionary* pMKDict = pAnnotDict->GetDict("MK")) { - nRotate = pMKDict->GetInteger("R"); + if (CPDF_Dictionary* pMKDict = pAnnotDict->GetDictBy("MK")) { + nRotate = pMKDict->GetIntegerBy("R"); } CPDF_Rect rcBBox; CFX_Matrix matrix; @@ -362,15 +363,15 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, FX_FLOAT fBorderWidth = 1; CPVT_Dash dsBorder(3, 0, 0); CPVT_Color crLeftTop, crRightBottom; - if (CPDF_Dictionary* pBSDict = pAnnotDict->GetDict("BS")) { + if (CPDF_Dictionary* pBSDict = pAnnotDict->GetDictBy("BS")) { if (pBSDict->KeyExist("W")) { - fBorderWidth = pBSDict->GetNumber("W"); + fBorderWidth = pBSDict->GetNumberBy("W"); } - if (CPDF_Array* pArray = pBSDict->GetArray("D")) { - dsBorder = CPVT_Dash(pArray->GetInteger(0), pArray->GetInteger(1), - pArray->GetInteger(2)); + if (CPDF_Array* pArray = pBSDict->GetArrayBy("D")) { + dsBorder = CPVT_Dash(pArray->GetIntegerAt(0), pArray->GetIntegerAt(1), + pArray->GetIntegerAt(2)); } - switch (pBSDict->GetString("S").GetAt(0)) { + switch (pBSDict->GetStringBy("S").GetAt(0)) { case 'S': nBorderStyle = PBS_SOLID; break; @@ -395,11 +396,11 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, } } CPVT_Color crBorder, crBG; - if (CPDF_Dictionary* pMKDict = pAnnotDict->GetDict("MK")) { - if (CPDF_Array* pArray = pMKDict->GetArray("BC")) { + if (CPDF_Dictionary* pMKDict = pAnnotDict->GetDictBy("MK")) { + if (CPDF_Array* pArray = pMKDict->GetArrayBy("BC")) { crBorder = ParseColor(*pArray); } - if (CPDF_Array* pArray = pMKDict->GetArray("BG")) { + if (CPDF_Array* pArray = pMKDict->GetArrayBy("BG")) { crBG = ParseColor(*pArray); } } @@ -420,24 +421,24 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Rect(rcBBox.left + fBorderWidth, rcBBox.bottom + fBorderWidth, rcBBox.right - fBorderWidth, rcBBox.top - fBorderWidth); rcBody.Normalize(); - CPDF_Dictionary* pAPDict = pAnnotDict->GetDict("AP"); + CPDF_Dictionary* pAPDict = pAnnotDict->GetDictBy("AP"); if (!pAPDict) { pAPDict = new CPDF_Dictionary; pAnnotDict->SetAt("AP", pAPDict); } - CPDF_Stream* pNormalStream = pAPDict->GetStream("N"); + CPDF_Stream* pNormalStream = pAPDict->GetStreamBy("N"); if (!pNormalStream) { pNormalStream = new CPDF_Stream(nullptr, 0, nullptr); int32_t objnum = pDoc->AddIndirectObject(pNormalStream); - pAnnotDict->GetDict("AP")->SetAtReference("N", pDoc, objnum); + pAnnotDict->GetDictBy("AP")->SetAtReference("N", pDoc, objnum); } CPDF_Dictionary* pStreamDict = pNormalStream->GetDict(); if (pStreamDict) { pStreamDict->SetAtMatrix("Matrix", matrix); pStreamDict->SetAtRect("BBox", rcBBox); - CPDF_Dictionary* pStreamResList = pStreamDict->GetDict("Resources"); + CPDF_Dictionary* pStreamResList = pStreamDict->GetDictBy("Resources"); if (pStreamResList) { - CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDict("Font"); + CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictBy("Font"); if (!pStreamResFontList) { pStreamResFontList = new CPDF_Dictionary; pStreamResList->SetAt("Font", pStreamResFontList); @@ -446,8 +447,8 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, pStreamResFontList->SetAtReference(sFontName, pDoc, pFontDict); } } else { - pStreamDict->SetAt("Resources", pFormDict->GetDict("DR")->Clone()); - pStreamResList = pStreamDict->GetDict("Resources"); + pStreamDict->SetAt("Resources", pFormDict->GetDictBy("DR")->Clone()); + pStreamResList = pStreamDict->GetDictBy("Resources"); } } switch (nWidgetType) { @@ -467,7 +468,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, ? FPDF_GetFieldAttr(pAnnotDict, "MaxLen")->GetInteger() : 0; CPVT_FontMap map(pDoc, - pStreamDict ? pStreamDict->GetDict("Resources") : NULL, + pStreamDict ? pStreamDict->GetDictBy("Resources") : NULL, pDefFont, sFontName.Right(sFontName.GetLength() - 1)); CPVT_Provider prd(&map); CPDF_VariableText vt; @@ -526,7 +527,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, ? FPDF_GetFieldAttr(pAnnotDict, "V")->GetUnicodeText() : CFX_WideString(); CPVT_FontMap map(pDoc, - pStreamDict ? pStreamDict->GetDict("Resources") : NULL, + pStreamDict ? pStreamDict->GetDictBy("Resources") : NULL, pDefFont, sFontName.Right(sFontName.GetLength() - 1)); CPVT_Provider prd(&map); CPDF_VariableText vt; @@ -593,7 +594,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, } break; case 2: { CPVT_FontMap map(pDoc, - pStreamDict ? pStreamDict->GetDict("Resources") : NULL, + pStreamDict ? pStreamDict->GetDictBy("Resources") : NULL, pDefFont, sFontName.Right(sFontName.GetLength() - 1)); CPVT_Provider prd(&map); CPDF_Array* pOpts = FPDF_GetFieldAttr(pAnnotDict, "Opt") @@ -622,7 +623,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, FX_BOOL bSelected = FALSE; if (pSels) { for (FX_DWORD s = 0, ssz = pSels->GetCount(); s < ssz; s++) { - if (i == pSels->GetInteger(s)) { + if (i == pSels->GetIntegerAt(s)) { bSelected = TRUE; break; } @@ -683,9 +684,9 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, if (pStreamDict) { pStreamDict->SetAtMatrix("Matrix", matrix); pStreamDict->SetAtRect("BBox", rcBBox); - CPDF_Dictionary* pStreamResList = pStreamDict->GetDict("Resources"); + CPDF_Dictionary* pStreamResList = pStreamDict->GetDictBy("Resources"); if (pStreamResList) { - CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDict("Font"); + CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictBy("Font"); if (!pStreamResFontList) { pStreamResFontList = new CPDF_Dictionary; pStreamResList->SetAt("Font", pStreamResFontList); @@ -694,8 +695,8 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, pStreamResFontList->SetAtReference(sFontName, pDoc, pFontDict); } } else { - pStreamDict->SetAt("Resources", pFormDict->GetDict("DR")->Clone()); - pStreamResList = pStreamDict->GetDict("Resources"); + pStreamDict->SetAt("Resources", pFormDict->GetDictBy("DR")->Clone()); + pStreamResList = pStreamDict->GetDictBy("Resources"); } } } diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp index 3fb997878b..85a6c0f7c8 100644 --- a/core/src/fpdfdoc/doc_basic.cpp +++ b/core/src/fpdfdoc/doc_basic.cpp @@ -56,15 +56,15 @@ int CPDF_Dest::GetZoomMode() { } FX_FLOAT CPDF_Dest::GetParam(int index) { CPDF_Array* pArray = ToArray(m_pObj); - return pArray ? pArray->GetNumber(2 + index) : 0; + return pArray ? pArray->GetNumberAt(2 + index) : 0; } CFX_ByteString CPDF_Dest::GetRemoteName() { return m_pObj ? m_pObj->GetString() : CFX_ByteString(); } CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc, const CFX_ByteStringC& category) { - if (pDoc->GetRoot() && pDoc->GetRoot()->GetDict("Names")) - m_pRoot = pDoc->GetRoot()->GetDict("Names")->GetDict(category); + if (pDoc->GetRoot() && pDoc->GetRoot()->GetDictBy("Names")) + m_pRoot = pDoc->GetRoot()->GetDictBy("Names")->GetDictBy(category); else m_pRoot = NULL; } @@ -76,10 +76,10 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, if (nLevel > nMaxRecursion) { return NULL; } - CPDF_Array* pLimits = pNode->GetArray("Limits"); + CPDF_Array* pLimits = pNode->GetArrayBy("Limits"); if (pLimits) { - CFX_ByteString csLeft = pLimits->GetString(0); - CFX_ByteString csRight = pLimits->GetString(1); + CFX_ByteString csLeft = pLimits->GetStringAt(0); + CFX_ByteString csRight = pLimits->GetStringAt(1); if (csLeft.Compare(csRight) > 0) { CFX_ByteString csTmp = csRight; csRight = csLeft; @@ -89,11 +89,11 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, return NULL; } } - CPDF_Array* pNames = pNode->GetArray("Names"); + CPDF_Array* pNames = pNode->GetArrayBy("Names"); if (pNames) { FX_DWORD dwCount = pNames->GetCount() / 2; for (FX_DWORD i = 0; i < dwCount; i++) { - CFX_ByteString csValue = pNames->GetString(i * 2); + CFX_ByteString csValue = pNames->GetStringAt(i * 2); int32_t iCompare = csValue.Compare(csName); if (iCompare <= 0) { if (ppFind) { @@ -111,12 +111,12 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, nIndex += dwCount; 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; } @@ -137,7 +137,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, if (nLevel > nMaxRecursion) { return NULL; } - CPDF_Array* pNames = pNode->GetArray("Names"); + CPDF_Array* pNames = pNode->GetArrayBy("Names"); if (pNames) { int nCount = pNames->GetCount() / 2; if (nIndex >= nCurIndex + nCount) { @@ -147,15 +147,15 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, if (ppFind) { *ppFind = pNames; } - csName = pNames->GetString((nIndex - nCurIndex) * 2); + csName = pNames->GetStringAt((nIndex - nCurIndex) * 2); return pNames->GetElementValue((nIndex - nCurIndex) * 2 + 1); } - 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; } @@ -171,17 +171,17 @@ static int CountNames(CPDF_Dictionary* pNode, int nLevel = 0) { if (nLevel > nMaxRecursion) { return 0; } - CPDF_Array* pNames = pNode->GetArray("Names"); + CPDF_Array* pNames = pNode->GetArrayBy("Names"); if (pNames) { return pNames->GetCount() / 2; } - CPDF_Array* pKids = pNode->GetArray("Kids"); + CPDF_Array* pKids = pNode->GetArrayBy("Kids"); if (!pKids) { return 0; } int nCount = 0; for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { - CPDF_Dictionary* pKid = pKids->GetDict(i); + CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) { continue; } @@ -224,7 +224,7 @@ CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc, const CFX_ByteStringC& sName) { CPDF_Object* pValue = LookupValue(sName); if (!pValue) { - CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDict("Dests"); + CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDictBy("Dests"); if (!pDests) return nullptr; pValue = pDests->GetElementValue(sName); @@ -234,7 +234,7 @@ CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc, if (CPDF_Array* pArray = pValue->AsArray()) return pArray; if (CPDF_Dictionary* pDict = pValue->AsDictionary()) - return pDict->GetArray("D"); + return pDict->GetArrayBy("D"); return nullptr; } #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \ @@ -304,20 +304,20 @@ FX_BOOL CPDF_FileSpec::GetFileName(CFX_WideString& csFileName) const { return FALSE; } if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) { - csFileName = pDict->GetUnicodeText("UF"); + csFileName = pDict->GetUnicodeTextBy("UF"); if (csFileName.IsEmpty()) { - csFileName = CFX_WideString::FromLocal(pDict->GetString("F")); + csFileName = CFX_WideString::FromLocal(pDict->GetStringBy("F")); } - if (pDict->GetString("FS") == "URL") { + if (pDict->GetStringBy("FS") == "URL") { return TRUE; } if (csFileName.IsEmpty()) { if (pDict->KeyExist("DOS")) { - csFileName = CFX_WideString::FromLocal(pDict->GetString("DOS")); + csFileName = CFX_WideString::FromLocal(pDict->GetStringBy("DOS")); } else if (pDict->KeyExist("Mac")) { - csFileName = CFX_WideString::FromLocal(pDict->GetString("Mac")); + csFileName = CFX_WideString::FromLocal(pDict->GetStringBy("Mac")); } else if (pDict->KeyExist("Unix")) { - csFileName = CFX_WideString::FromLocal(pDict->GetString("Unix")); + csFileName = CFX_WideString::FromLocal(pDict->GetStringBy("Unix")); } else { return FALSE; } @@ -336,7 +336,7 @@ CPDF_FileSpec::CPDF_FileSpec() { } FX_BOOL CPDF_FileSpec::IsURL() const { if (CPDF_Dictionary* pDict = ToDictionary(m_pObj)) { - return pDict->GetString("FS") == "URL"; + return pDict->GetStringBy("FS") == "URL"; } return FALSE; } @@ -382,8 +382,8 @@ CPDF_Stream* CPDF_FileSpec::GetFileStream() const { return nullptr; if (CPDF_Stream* pStream = m_pObj->AsStream()) return pStream; - if (CPDF_Dictionary* pEF = m_pObj->AsDictionary()->GetDict("EF")) - return pEF->GetStream("F"); + if (CPDF_Dictionary* pEF = m_pObj->AsDictionary()->GetDictBy("EF")) + return pEF->GetStreamBy("F"); return nullptr; } static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj, @@ -475,7 +475,7 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const { if (!pPDFRoot) { return wsLabel; } - CPDF_Dictionary* pLabels = pPDFRoot->GetDict("PageLabels"); + CPDF_Dictionary* pLabels = pPDFRoot->GetDictBy("PageLabels"); CPDF_NumberTree numberTree(pLabels); CPDF_Object* pValue = NULL; int n = nPage; @@ -490,10 +490,10 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const { pValue = pValue->GetDirect(); if (CPDF_Dictionary* pLabel = pValue->AsDictionary()) { if (pLabel->KeyExist("P")) { - wsLabel += pLabel->GetUnicodeText("P"); + wsLabel += pLabel->GetUnicodeTextBy("P"); } - CFX_ByteString bsNumberingStyle = pLabel->GetString("S", NULL); - int nLabelNum = nPage - n + pLabel->GetInteger("St", 1); + CFX_ByteString bsNumberingStyle = pLabel->GetStringBy("S", NULL); + int nLabelNum = nPage - n + pLabel->GetIntegerBy("St", 1); CFX_WideString wsNumPortion = _GetLabelNumPortion(nLabelNum, bsNumberingStyle); wsLabel += wsNumPortion; diff --git a/core/src/fpdfdoc/doc_bookmark.cpp b/core/src/fpdfdoc/doc_bookmark.cpp index b435fc619c..53e90c0ae1 100644 --- a/core/src/fpdfdoc/doc_bookmark.cpp +++ b/core/src/fpdfdoc/doc_bookmark.cpp @@ -12,40 +12,40 @@ CPDF_Bookmark CPDF_BookmarkTree::GetFirstChild( const CPDF_Bookmark& parent) const { if (!parent.m_pDict) { - CPDF_Dictionary* pRoot = m_pDocument->GetRoot()->GetDict("Outlines"); + CPDF_Dictionary* pRoot = m_pDocument->GetRoot()->GetDictBy("Outlines"); if (!pRoot) { return CPDF_Bookmark(); } - return CPDF_Bookmark(pRoot->GetDict("First")); + return CPDF_Bookmark(pRoot->GetDictBy("First")); } - return CPDF_Bookmark(parent.m_pDict->GetDict("First")); + return CPDF_Bookmark(parent.m_pDict->GetDictBy("First")); } CPDF_Bookmark CPDF_BookmarkTree::GetNextSibling( const CPDF_Bookmark& bookmark) const { if (!bookmark.m_pDict) { return CPDF_Bookmark(); } - CPDF_Dictionary* pNext = bookmark.m_pDict->GetDict("Next"); + CPDF_Dictionary* pNext = bookmark.m_pDict->GetDictBy("Next"); return pNext == bookmark.m_pDict ? CPDF_Bookmark() : CPDF_Bookmark(pNext); } FX_DWORD CPDF_Bookmark::GetColorRef() const { if (!m_pDict) { return 0; } - CPDF_Array* pColor = m_pDict->GetArray("C"); + CPDF_Array* pColor = m_pDict->GetArrayBy("C"); if (!pColor) { return FXSYS_RGB(0, 0, 0); } - int r = FXSYS_round(pColor->GetNumber(0) * 255); - int g = FXSYS_round(pColor->GetNumber(1) * 255); - int b = FXSYS_round(pColor->GetNumber(2) * 255); + int r = FXSYS_round(pColor->GetNumberAt(0) * 255); + int g = FXSYS_round(pColor->GetNumberAt(1) * 255); + int b = FXSYS_round(pColor->GetNumberAt(2) * 255); return FXSYS_RGB(r, g, b); } FX_DWORD CPDF_Bookmark::GetFontStyle() const { if (!m_pDict) { return 0; } - return m_pDict->GetInteger("F"); + return m_pDict->GetIntegerBy("F"); } CFX_WideString CPDF_Bookmark::GetTitle() const { if (!m_pDict) { @@ -87,5 +87,5 @@ CPDF_Action CPDF_Bookmark::GetAction() const { if (!m_pDict) { return CPDF_Action(); } - return CPDF_Action(m_pDict->GetDict("A")); + return CPDF_Action(m_pDict->GetDictBy("A")); } diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp index 8776337402..b07fe45ed5 100644 --- a/core/src/fpdfdoc/doc_form.cpp +++ b/core/src/fpdfdoc/doc_form.cpp @@ -234,17 +234,17 @@ CPDF_InterForm::CPDF_InterForm(CPDF_Document* pDocument, FX_BOOL bGenerateAP) if (!pRoot) return; - m_pFormDict = pRoot->GetDict("AcroForm"); + m_pFormDict = pRoot->GetDictBy("AcroForm"); if (!m_pFormDict) return; - CPDF_Array* pFields = m_pFormDict->GetArray("Fields"); + CPDF_Array* pFields = m_pFormDict->GetArrayBy("Fields"); if (!pFields) return; int count = pFields->GetCount(); for (int i = 0; i < count; i++) { - LoadField(pFields->GetDict(i)); + LoadField(pFields->GetDictAt(i)); } } @@ -301,7 +301,7 @@ CFX_ByteString CPDF_InterForm::GenerateNewResourceName( if (!pResDict) { return csTmp; } - CPDF_Dictionary* pDict = pResDict->GetDict(csType); + CPDF_Dictionary* pDict = pResDict->GetDictBy(csType); if (!pDict) { return csTmp; } @@ -688,13 +688,13 @@ CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLOAT pdf_y, int* z_order) const { - CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArray("Annots"); + CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArrayBy("Annots"); if (!pAnnotList) return nullptr; for (FX_DWORD i = pAnnotList->GetCount(); i > 0; --i) { FX_DWORD annot_index = i - 1; - CPDF_Dictionary* pAnnot = pAnnotList->GetDict(annot_index); + CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(annot_index); if (!pAnnot) continue; @@ -721,7 +721,7 @@ CPDF_FormControl* CPDF_InterForm::GetControlByDict( } FX_BOOL CPDF_InterForm::NeedConstructAP() { - return m_pFormDict && m_pFormDict->GetBoolean("NeedAppearances"); + return m_pFormDict && m_pFormDict->GetBooleanBy("NeedAppearances"); } void CPDF_InterForm::NeedConstructAP(FX_BOOL bNeedAP) { if (!m_pFormDict) { @@ -734,14 +734,14 @@ int CPDF_InterForm::CountFieldsInCalculationOrder() { if (!m_pFormDict) { return 0; } - CPDF_Array* pArray = m_pFormDict->GetArray("CO"); + CPDF_Array* pArray = m_pFormDict->GetArrayBy("CO"); return pArray ? pArray->GetCount() : 0; } CPDF_FormField* CPDF_InterForm::GetFieldInCalculationOrder(int index) { if (!m_pFormDict || index < 0) { return NULL; } - CPDF_Array* pArray = m_pFormDict->GetArray("CO"); + CPDF_Array* pArray = m_pFormDict->GetArrayBy("CO"); if (!pArray) { return NULL; } @@ -755,7 +755,7 @@ int CPDF_InterForm::FindFieldInCalculationOrder(const CPDF_FormField* pField) { if (!m_pFormDict || !pField) { return -1; } - CPDF_Array* pArray = m_pFormDict->GetArray("CO"); + CPDF_Array* pArray = m_pFormDict->GetArrayBy("CO"); if (!pArray) { return -1; } @@ -825,14 +825,14 @@ CPDF_DefaultAppearance CPDF_InterForm::GetDefaultAppearance() { if (!m_pFormDict) { return csDA; } - csDA = m_pFormDict->GetString("DA"); + csDA = m_pFormDict->GetStringBy("DA"); return csDA; } CPDF_Font* CPDF_InterForm::GetDefaultFormFont() { return GetDefaultInterFormFont(m_pFormDict, m_pDocument); } int CPDF_InterForm::GetFormAlignment() { - return m_pFormDict ? m_pFormDict->GetInteger("Q", 0) : 0; + return m_pFormDict ? m_pFormDict->GetIntegerBy("Q", 0) : 0; } bool CPDF_InterForm::ResetForm(const std::vector<CPDF_FormField*>& fields, @@ -880,18 +880,18 @@ void CPDF_InterForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) { return; } FX_DWORD dwParentObjNum = pFieldDict->GetObjNum(); - CPDF_Array* pKids = pFieldDict->GetArray("Kids"); + CPDF_Array* pKids = pFieldDict->GetArrayBy("Kids"); if (!pKids) { AddTerminalField(pFieldDict); return; } - CPDF_Dictionary* pFirstKid = pKids->GetDict(0); + CPDF_Dictionary* pFirstKid = pKids->GetDictAt(0); if (!pFirstKid) { return; } if (pFirstKid->KeyExist("T") || pFirstKid->KeyExist("Kids")) { for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { - CPDF_Dictionary* pChildDict = pKids->GetDict(i); + CPDF_Dictionary* pChildDict = pKids->GetDictAt(i); if (pChildDict) { if (pChildDict->GetObjNum() != dwParentObjNum) { LoadField(pChildDict, nLevel + 1); @@ -903,21 +903,21 @@ void CPDF_InterForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) { } } FX_BOOL CPDF_InterForm::HasXFAForm() const { - return m_pFormDict && m_pFormDict->GetArray("XFA"); + return m_pFormDict && m_pFormDict->GetArrayBy("XFA"); } void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) { CPDF_Dictionary* pPageDict = pPage->m_pFormDict; if (!pPageDict) { return; } - CPDF_Array* pAnnots = pPageDict->GetArray("Annots"); + CPDF_Array* pAnnots = pPageDict->GetArrayBy("Annots"); if (!pAnnots) { return; } int iAnnotCount = pAnnots->GetCount(); for (int i = 0; i < iAnnotCount; i++) { - CPDF_Dictionary* pAnnot = pAnnots->GetDict(i); - if (pAnnot && pAnnot->GetString("Subtype") == "Widget") { + CPDF_Dictionary* pAnnot = pAnnots->GetDictAt(i); + if (pAnnot && pAnnot->GetStringBy("Subtype") == "Widget") { LoadField(pAnnot); } } @@ -936,8 +936,8 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) { if (!pField) { CPDF_Dictionary* pParent = pFieldDict; if (!pFieldDict->KeyExist("T") && - pFieldDict->GetString("Subtype") == "Widget") { - pParent = pFieldDict->GetDict("Parent"); + pFieldDict->GetStringBy("Subtype") == "Widget") { + pParent = pFieldDict->GetDictBy("Parent"); if (!pParent) { pParent = pFieldDict; } @@ -967,18 +967,18 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) { } m_pFieldTree->SetField(csWName, pField); } - CPDF_Array* pKids = pFieldDict->GetArray("Kids"); + CPDF_Array* pKids = pFieldDict->GetArrayBy("Kids"); if (!pKids) { - if (pFieldDict->GetString("Subtype") == "Widget") { + if (pFieldDict->GetStringBy("Subtype") == "Widget") { AddControl(pField, pFieldDict); } } else { for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { - CPDF_Dictionary* pKid = pKids->GetDict(i); + CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) { continue; } - if (pKid->GetString("Subtype") != "Widget") { + if (pKid->GetStringBy("Subtype") != "Widget") { continue; } AddControl(pField, pKid); @@ -1023,7 +1023,7 @@ CPDF_FormField* CPDF_InterForm::CheckRequiredFields( bFind = pdfium::ContainsValue(*fields, pField); if (bIncludeOrExclude == bFind) { CPDF_Dictionary* pFieldDict = pField->m_pDict; - if ((dwFlags & 0x02) != 0 && pFieldDict->GetString("V").IsEmpty()) { + if ((dwFlags & 0x02) != 0 && pFieldDict->GetStringBy("V").IsEmpty()) { return pField; } } @@ -1049,7 +1049,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF( if (!pDoc) { return NULL; } - CPDF_Dictionary* pMainDict = pDoc->GetRoot()->GetDict("FDF"); + CPDF_Dictionary* pMainDict = pDoc->GetRoot()->GetDictBy("FDF"); if (!pdf_path.IsEmpty()) { if (bSimpleFileSpec) { CFX_WideString wsFilePath = FILESPEC_EncodeFileName(pdf_path); @@ -1074,7 +1074,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF( continue; if (bIncludeOrExclude == pdfium::ContainsValue(fields, pField)) { - if ((dwFlags & 0x02) != 0 && pField->m_pDict->GetString("V").IsEmpty()) + if ((dwFlags & 0x02) != 0 && pField->m_pDict->GetStringBy("V").IsEmpty()) continue; CFX_WideString fullname = GetFullName(pField->GetFieldDict()); @@ -1111,7 +1111,7 @@ const struct _SupportFieldEncoding { static void FPDFDOC_FDF_GetFieldValue(CPDF_Dictionary* pFieldDict, CFX_WideString& csValue, CFX_ByteString& bsEncoding) { - CFX_ByteString csBValue = pFieldDict->GetString("V"); + CFX_ByteString csBValue = pFieldDict->GetStringBy("V"); int32_t iCount = sizeof(g_fieldEncoding) / sizeof(g_fieldEncoding[0]); int32_t i = 0; for (; i < iCount; ++i) @@ -1140,11 +1140,11 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict, if (!parent_name.IsEmpty()) { name = parent_name + L"."; } - name += pFieldDict->GetUnicodeText("T"); - CPDF_Array* pKids = pFieldDict->GetArray("Kids"); + name += pFieldDict->GetUnicodeTextBy("T"); + CPDF_Array* pKids = pFieldDict->GetArrayBy("Kids"); if (pKids) { for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { - CPDF_Dictionary* pKid = pKids->GetDict(i); + CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) { continue; } @@ -1204,15 +1204,15 @@ FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF, if (!pFDF) { return FALSE; } - CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDict("FDF"); + CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDictBy("FDF"); if (!pMainDict) { return FALSE; } - CPDF_Array* pFields = pMainDict->GetArray("Fields"); + CPDF_Array* pFields = pMainDict->GetArrayBy("Fields"); if (!pFields) { return FALSE; } - m_bsEncoding = pMainDict->GetString("Encoding"); + m_bsEncoding = pMainDict->GetStringBy("Encoding"); if (bNotify && m_pFormNotify) { int iRet = m_pFormNotify->BeforeFormImportData(this); if (iRet < 0) { @@ -1220,7 +1220,7 @@ FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF, } } for (FX_DWORD i = 0; i < pFields->GetCount(); i++) { - CPDF_Dictionary* pField = pFields->GetDict(i); + CPDF_Dictionary* pField = pFields->GetDictAt(i); if (!pField) { continue; } diff --git a/core/src/fpdfdoc/doc_formcontrol.cpp b/core/src/fpdfdoc/doc_formcontrol.cpp index 1ec98bb986..feaff38f16 100644 --- a/core/src/fpdfdoc/doc_formcontrol.cpp +++ b/core/src/fpdfdoc/doc_formcontrol.cpp @@ -15,17 +15,17 @@ CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField, m_pForm = m_pField->m_pForm; } CFX_FloatRect CPDF_FormControl::GetRect() const { - return m_pWidgetDict->GetRect("Rect"); + return m_pWidgetDict->GetRectBy("Rect"); } CFX_ByteString CPDF_FormControl::GetOnStateName() { ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton); CFX_ByteString csOn; - CPDF_Dictionary* pAP = m_pWidgetDict->GetDict("AP"); + CPDF_Dictionary* pAP = m_pWidgetDict->GetDictBy("AP"); if (!pAP) { return csOn; } - CPDF_Dictionary* pN = pAP->GetDict("N"); + CPDF_Dictionary* pN = pAP->GetDictBy("N"); if (!pN) { return csOn; } @@ -46,11 +46,11 @@ void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) { if (csValue == "Off") { csValue = "Yes"; } - CFX_ByteString csAS = m_pWidgetDict->GetString("AS", "Off"); + CFX_ByteString csAS = m_pWidgetDict->GetStringBy("AS", "Off"); if (csAS != "Off") { m_pWidgetDict->SetAtName("AS", csValue); } - CPDF_Dictionary* pAP = m_pWidgetDict->GetDict("AP"); + CPDF_Dictionary* pAP = m_pWidgetDict->GetDictBy("AP"); if (!pAP) { return; } @@ -103,7 +103,7 @@ CFX_WideString CPDF_FormControl::GetExportValue() { if (CPDF_Array* pArray = ToArray(FPDF_GetFieldAttr(m_pField->m_pDict, "Opt"))) { int iIndex = m_pField->GetControlIndex(this); - csOn = pArray->GetString(iIndex); + csOn = pArray->GetStringAt(iIndex); } } if (csOn.IsEmpty()) { @@ -116,7 +116,7 @@ FX_BOOL CPDF_FormControl::IsChecked() { ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton); CFX_ByteString csOn = GetOnStateName(); - CFX_ByteString csAS = m_pWidgetDict->GetString("AS"); + CFX_ByteString csAS = m_pWidgetDict->GetStringBy("AS"); return csAS == csOn; } FX_BOOL CPDF_FormControl::IsDefaultChecked() { @@ -134,7 +134,7 @@ void CPDF_FormControl::CheckControl(FX_BOOL bChecked) { ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton); CFX_ByteString csOn = GetOnStateName(); - CFX_ByteString csOldAS = m_pWidgetDict->GetString("AS", "Off"); + CFX_ByteString csOldAS = m_pWidgetDict->GetStringBy("AS", "Off"); CFX_ByteString csAS = "Off"; if (bChecked) { csAS = csOn; @@ -152,22 +152,22 @@ void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice, CPDF_Page* pPage, CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions) { - if (m_pWidgetDict->GetInteger("F") & ANNOTFLAG_HIDDEN) { + if (m_pWidgetDict->GetIntegerBy("F") & ANNOTFLAG_HIDDEN) { return; } CPDF_Stream* pStream = FPDFDOC_GetAnnotAP(m_pWidgetDict, mode); if (!pStream) { return; } - CFX_FloatRect form_bbox = pStream->GetDict()->GetRect("BBox"); - CFX_Matrix form_matrix = pStream->GetDict()->GetMatrix("Matrix"); + CFX_FloatRect form_bbox = pStream->GetDict()->GetRectBy("BBox"); + CFX_Matrix form_matrix = pStream->GetDict()->GetMatrixBy("Matrix"); form_matrix.TransformRect(form_bbox); - CFX_FloatRect arect = m_pWidgetDict->GetRect("Rect"); + CFX_FloatRect arect = m_pWidgetDict->GetRectBy("Rect"); CFX_Matrix matrix; matrix.MatchRect(arect, form_bbox); matrix.Concat(*pMatrix); CPDF_Form form(m_pField->m_pForm->m_pDocument, - m_pField->m_pForm->m_pFormDict->GetDict("DR"), pStream); + m_pField->m_pForm->m_pFormDict->GetDictBy("DR"), pStream); form.ParseContent(NULL, NULL, NULL, NULL); CPDF_RenderContext context(pPage); context.AppendLayer(&form, &matrix); @@ -180,7 +180,7 @@ CPDF_FormControl::HighlightingMode CPDF_FormControl::GetHighlightingMode() { if (!m_pWidgetDict) { return Invert; } - CFX_ByteString csH = m_pWidgetDict->GetString("H", "I"); + CFX_ByteString csH = m_pWidgetDict->GetStringBy("H", "I"); for (int i = 0; g_sHighlightingMode[i]; ++i) { if (csH.Equal(g_sHighlightingMode[i])) return static_cast<HighlightingMode>(i); @@ -189,7 +189,7 @@ CPDF_FormControl::HighlightingMode CPDF_FormControl::GetHighlightingMode() { } CPDF_ApSettings CPDF_FormControl::GetMK() const { - return CPDF_ApSettings(m_pWidgetDict ? m_pWidgetDict->GetDict("MK") + return CPDF_ApSettings(m_pWidgetDict ? m_pWidgetDict->GetDictBy("MK") : nullptr); } @@ -235,7 +235,7 @@ CPDF_Action CPDF_FormControl::GetAction() { return CPDF_Action(); } if (m_pWidgetDict->KeyExist("A")) { - return CPDF_Action(m_pWidgetDict->GetDict("A")); + return CPDF_Action(m_pWidgetDict->GetDictBy("A")); } CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "A"); if (!pObj) { @@ -248,7 +248,7 @@ CPDF_AAction CPDF_FormControl::GetAdditionalAction() { return nullptr; } if (m_pWidgetDict->KeyExist("AA")) { - return m_pWidgetDict->GetDict("AA"); + return m_pWidgetDict->GetDictBy("AA"); } return m_pField->GetAdditionalAction(); } @@ -257,7 +257,7 @@ CPDF_DefaultAppearance CPDF_FormControl::GetDefaultAppearance() { return CFX_ByteString(); } if (m_pWidgetDict->KeyExist("DA")) { - return m_pWidgetDict->GetString("DA"); + return m_pWidgetDict->GetStringBy("DA"); } CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "DA"); if (!pObj) { @@ -276,9 +276,9 @@ CPDF_Font* CPDF_FormControl::GetDefaultControlFont() { CPDF_Object* pObj = FPDF_GetFieldAttr(m_pWidgetDict, "DR"); if (CPDF_Dictionary* pDict = ToDictionary(pObj)) { - CPDF_Dictionary* pFonts = pDict->GetDict("Font"); + CPDF_Dictionary* pFonts = pDict->GetDictBy("Font"); if (pFonts) { - CPDF_Dictionary* pElement = pFonts->GetDict(csFontNameTag); + CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag); if (pElement) { CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement); if (pFont) { @@ -290,12 +290,12 @@ CPDF_Font* CPDF_FormControl::GetDefaultControlFont() { if (CPDF_Font* pFormFont = m_pField->m_pForm->GetFormFont(csFontNameTag)) return pFormFont; - CPDF_Dictionary* pPageDict = m_pWidgetDict->GetDict("P"); + CPDF_Dictionary* pPageDict = m_pWidgetDict->GetDictBy("P"); pObj = FPDF_GetFieldAttr(pPageDict, "Resources"); if (CPDF_Dictionary* pDict = ToDictionary(pObj)) { - CPDF_Dictionary* pFonts = pDict->GetDict("Font"); + CPDF_Dictionary* pFonts = pDict->GetDictBy("Font"); if (pFonts) { - CPDF_Dictionary* pElement = pFonts->GetDict(csFontNameTag); + CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag); if (pElement) { CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement); if (pFont) { @@ -312,7 +312,7 @@ int CPDF_FormControl::GetControlAlignment() { return 0; } if (m_pWidgetDict->KeyExist("Q")) { - return m_pWidgetDict->GetInteger("Q", 0); + return m_pWidgetDict->GetIntegerBy("Q", 0); } CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "Q"); if (pObj) @@ -327,7 +327,7 @@ bool CPDF_ApSettings::HasMKEntry(const CFX_ByteStringC& csEntry) const { } int CPDF_ApSettings::GetRotation() const { - return m_pDict ? m_pDict->GetInteger("R") : 0; + return m_pDict ? m_pDict->GetIntegerBy("R") : 0; } FX_ARGB CPDF_ApSettings::GetColor(int& iColorType, @@ -336,7 +336,7 @@ FX_ARGB CPDF_ApSettings::GetColor(int& iColorType, if (!m_pDict) return 0; - CPDF_Array* pEntry = m_pDict->GetArray(csEntry); + CPDF_Array* pEntry = m_pDict->GetArrayBy(csEntry); if (!pEntry) return 0; @@ -344,20 +344,20 @@ FX_ARGB CPDF_ApSettings::GetColor(int& iColorType, FX_DWORD dwCount = pEntry->GetCount(); if (dwCount == 1) { iColorType = COLORTYPE_GRAY; - FX_FLOAT g = pEntry->GetNumber(0) * 255; + FX_FLOAT g = pEntry->GetNumberAt(0) * 255; color = ArgbEncode(255, (int)g, (int)g, (int)g); } else if (dwCount == 3) { iColorType = COLORTYPE_RGB; - FX_FLOAT r = pEntry->GetNumber(0) * 255; - FX_FLOAT g = pEntry->GetNumber(1) * 255; - FX_FLOAT b = pEntry->GetNumber(2) * 255; + FX_FLOAT r = pEntry->GetNumberAt(0) * 255; + FX_FLOAT g = pEntry->GetNumberAt(1) * 255; + FX_FLOAT b = pEntry->GetNumberAt(2) * 255; color = ArgbEncode(255, (int)r, (int)g, (int)b); } else if (dwCount == 4) { iColorType = COLORTYPE_CMYK; - FX_FLOAT c = pEntry->GetNumber(0); - FX_FLOAT m = pEntry->GetNumber(1); - FX_FLOAT y = pEntry->GetNumber(2); - FX_FLOAT k = pEntry->GetNumber(3); + FX_FLOAT c = pEntry->GetNumberAt(0); + FX_FLOAT m = pEntry->GetNumberAt(1); + FX_FLOAT y = pEntry->GetNumberAt(2); + FX_FLOAT k = pEntry->GetNumberAt(3); FX_FLOAT r = 1.0f - std::min(1.0f, c + k); FX_FLOAT g = 1.0f - std::min(1.0f, m + k); FX_FLOAT b = 1.0f - std::min(1.0f, y + k); @@ -372,8 +372,8 @@ FX_FLOAT CPDF_ApSettings::GetOriginalColor( if (!m_pDict) return 0; - CPDF_Array* pEntry = m_pDict->GetArray(csEntry); - return pEntry ? pEntry->GetNumber(index) : 0; + CPDF_Array* pEntry = m_pDict->GetArrayBy(csEntry); + return pEntry ? pEntry->GetNumberAt(index) : 0; } void CPDF_ApSettings::GetOriginalColor(int& iColorType, @@ -386,41 +386,42 @@ void CPDF_ApSettings::GetOriginalColor(int& iColorType, if (!m_pDict) { return; } - CPDF_Array* pEntry = m_pDict->GetArray(csEntry); + CPDF_Array* pEntry = m_pDict->GetArrayBy(csEntry); if (!pEntry) { return; } FX_DWORD dwCount = pEntry->GetCount(); if (dwCount == 1) { iColorType = COLORTYPE_GRAY; - fc[0] = pEntry->GetNumber(0); + fc[0] = pEntry->GetNumberAt(0); } else if (dwCount == 3) { iColorType = COLORTYPE_RGB; - fc[0] = pEntry->GetNumber(0); - fc[1] = pEntry->GetNumber(1); - fc[2] = pEntry->GetNumber(2); + fc[0] = pEntry->GetNumberAt(0); + fc[1] = pEntry->GetNumberAt(1); + fc[2] = pEntry->GetNumberAt(2); } else if (dwCount == 4) { iColorType = COLORTYPE_CMYK; - fc[0] = pEntry->GetNumber(0); - fc[1] = pEntry->GetNumber(1); - fc[2] = pEntry->GetNumber(2); - fc[3] = pEntry->GetNumber(3); + fc[0] = pEntry->GetNumberAt(0); + fc[1] = pEntry->GetNumberAt(1); + fc[2] = pEntry->GetNumberAt(2); + fc[3] = pEntry->GetNumberAt(3); } } CFX_WideString CPDF_ApSettings::GetCaption( const CFX_ByteStringC& csEntry) const { - return m_pDict ? m_pDict->GetUnicodeText(csEntry) : CFX_WideString(); + return m_pDict ? m_pDict->GetUnicodeTextBy(csEntry) : CFX_WideString(); } CPDF_Stream* CPDF_ApSettings::GetIcon(const CFX_ByteStringC& csEntry) const { - return m_pDict ? m_pDict->GetStream(csEntry) : nullptr; + return m_pDict ? m_pDict->GetStreamBy(csEntry) : nullptr; } CPDF_IconFit CPDF_ApSettings::GetIconFit() const { - return m_pDict ? m_pDict->GetDict("IF") : nullptr; + return m_pDict ? m_pDict->GetDictBy("IF") : nullptr; } int CPDF_ApSettings::GetTextPosition() const { - return m_pDict ? m_pDict->GetInteger("TP", TEXTPOS_CAPTION) : TEXTPOS_CAPTION; + return m_pDict ? m_pDict->GetIntegerBy("TP", TEXTPOS_CAPTION) + : TEXTPOS_CAPTION; } diff --git a/core/src/fpdfdoc/doc_formfield.cpp b/core/src/fpdfdoc/doc_formfield.cpp index 617acd4e99..39af0c94c7 100644 --- a/core/src/fpdfdoc/doc_formfield.cpp +++ b/core/src/fpdfdoc/doc_formfield.cpp @@ -408,7 +408,7 @@ int CPDF_FormField::GetMaxLen() { CPDF_Dictionary* pWidgetDict = pControl->m_pWidgetDict; if (pWidgetDict->KeyExist("MaxLen")) - return pWidgetDict->GetInteger("MaxLen"); + return pWidgetDict->GetIntegerBy("MaxLen"); } return 0; } @@ -948,7 +948,7 @@ int CPDF_FormField::GetSelectedOptionIndex(int index) { } int iCount = (int)pArray->GetCount(); if (iCount > 0 && index < iCount) { - return pArray->GetInteger(index); + return pArray->GetIntegerAt(index); } return -1; } @@ -963,7 +963,7 @@ FX_BOOL CPDF_FormField::IsOptionSelected(int iOptIndex) { } int iCount = (int)pArray->GetCount(); for (int i = 0; i < iCount; i++) { - if (pArray->GetInteger(i) == iOptIndex) { + if (pArray->GetIntegerAt(i) == iOptIndex) { return TRUE; } } @@ -972,7 +972,7 @@ FX_BOOL CPDF_FormField::IsOptionSelected(int iOptIndex) { FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, FX_BOOL bSelected, FX_BOOL bNotify) { - CPDF_Array* pArray = m_pDict->GetArray("I"); + CPDF_Array* pArray = m_pDict->GetArrayBy("I"); if (!pArray) { if (!bSelected) { return TRUE; @@ -982,7 +982,7 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, } FX_BOOL bReturn = FALSE; for (int i = 0; i < (int)pArray->GetCount(); i++) { - int iFind = pArray->GetInteger(i); + int iFind = pArray->GetIntegerAt(i); if (iFind == iOptIndex) { if (bSelected) { return TRUE; @@ -1081,7 +1081,7 @@ void CPDF_FormField::LoadDA() { DA = pObj_t->GetString(); } if (DA.IsEmpty() && m_pForm->m_pFormDict) { - DA = m_pForm->m_pFormDict->GetString("DA"); + DA = m_pForm->m_pFormDict->GetStringBy("DA"); } if (DA.IsEmpty()) { return; @@ -1090,10 +1090,11 @@ void CPDF_FormField::LoadDA() { syntax.FindTagParam("Tf", 2); CFX_ByteString font_name = syntax.GetWord(); CPDF_Dictionary* pFontDict = NULL; - if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDict("DR") && - m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")) - pFontDict = m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")->GetDict( - font_name); + if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDictBy("DR") && + m_pForm->m_pFormDict->GetDictBy("DR")->GetDictBy("Font")) + pFontDict = m_pForm->m_pFormDict->GetDictBy("DR") + ->GetDictBy("Font") + ->GetDictBy(font_name); if (!pFontDict) { return; diff --git a/core/src/fpdfdoc/doc_link.cpp b/core/src/fpdfdoc/doc_link.cpp index b7ddb7e61c..6617e85cd4 100644 --- a/core/src/fpdfdoc/doc_link.cpp +++ b/core/src/fpdfdoc/doc_link.cpp @@ -56,20 +56,20 @@ CPDF_Link CPDF_LinkList::GetLinkAtPoint(CPDF_Page* pPage, void CPDF_LinkList::LoadPageLinks(CPDF_Page* pPage, std::vector<CPDF_Dictionary*>* pList) { - CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArray("Annots"); + CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArrayBy("Annots"); if (!pAnnotList) return; for (FX_DWORD i = 0; i < pAnnotList->GetCount(); ++i) { - CPDF_Dictionary* pAnnot = pAnnotList->GetDict(i); - bool add_link = (pAnnot && pAnnot->GetString("Subtype") == "Link"); + CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(i); + bool add_link = (pAnnot && pAnnot->GetStringBy("Subtype") == "Link"); // Add non-links as nullptrs to preserve z-order. pList->push_back(add_link ? pAnnot : nullptr); } } CPDF_Rect CPDF_Link::GetRect() { - return m_pDict->GetRect("Rect"); + return m_pDict->GetRectBy("Rect"); } CPDF_Dest CPDF_Link::GetDest(CPDF_Document* pDoc) { CPDF_Object* pDest = m_pDict->GetElementValue("Dest"); @@ -86,5 +86,5 @@ CPDF_Dest CPDF_Link::GetDest(CPDF_Document* pDoc) { return CPDF_Dest(); } CPDF_Action CPDF_Link::GetAction() { - return CPDF_Action(m_pDict->GetDict("A")); + return CPDF_Action(m_pDict->GetDictBy("A")); } diff --git a/core/src/fpdfdoc/doc_metadata.cpp b/core/src/fpdfdoc/doc_metadata.cpp index f25007351b..593cffbebb 100644 --- a/core/src/fpdfdoc/doc_metadata.cpp +++ b/core/src/fpdfdoc/doc_metadata.cpp @@ -12,7 +12,7 @@ CPDF_Metadata::CPDF_Metadata(CPDF_Document* pDoc) { if (!pRoot) return; - CPDF_Stream* pStream = pRoot->GetStream("Metadata"); + CPDF_Stream* pStream = pRoot->GetStreamBy("Metadata"); if (!pStream) return; diff --git a/core/src/fpdfdoc/doc_ocg.cpp b/core/src/fpdfdoc/doc_ocg.cpp index 539c038b41..a18924c1dc 100644 --- a/core/src/fpdfdoc/doc_ocg.cpp +++ b/core/src/fpdfdoc/doc_ocg.cpp @@ -14,7 +14,7 @@ static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object* pObject, if (const CPDF_Array* pArray = pObject->AsArray()) { FX_DWORD dwCount = pArray->GetCount(); for (FX_DWORD i = 0; i < dwCount; i++) { - if (pArray->GetDict(i) == pGroupDict) + if (pArray->GetDictAt(i) == pGroupDict) return i; } return -1; @@ -32,7 +32,7 @@ static FX_BOOL FPDFDOC_OCG_HasIntent(const CPDF_Dictionary* pDict, if (CPDF_Array* pArray = pIntent->AsArray()) { FX_DWORD dwCount = pArray->GetCount(); for (FX_DWORD i = 0; i < dwCount; i++) { - bsIntent = pArray->GetString(i); + bsIntent = pArray->GetStringAt(i); if (bsIntent == "All" || bsIntent == csElement) return TRUE; } @@ -45,24 +45,24 @@ static CPDF_Dictionary* FPDFDOC_OCG_GetConfig(CPDF_Document* pDoc, const CPDF_Dictionary* pOCGDict, const CFX_ByteStringC& bsState) { FXSYS_assert(pDoc && pOCGDict); - CPDF_Dictionary* pOCProperties = pDoc->GetRoot()->GetDict("OCProperties"); + CPDF_Dictionary* pOCProperties = pDoc->GetRoot()->GetDictBy("OCProperties"); if (!pOCProperties) { return NULL; } - CPDF_Array* pOCGs = pOCProperties->GetArray("OCGs"); + CPDF_Array* pOCGs = pOCProperties->GetArrayBy("OCGs"); if (!pOCGs) { return NULL; } if (FPDFDOC_OCG_FindGroup(pOCGs, pOCGDict) < 0) { return NULL; } - CPDF_Dictionary* pConfig = pOCProperties->GetDict("D"); - CPDF_Array* pConfigs = pOCProperties->GetArray("Configs"); + CPDF_Dictionary* pConfig = pOCProperties->GetDictBy("D"); + CPDF_Array* pConfigs = pOCProperties->GetArrayBy("Configs"); if (pConfigs) { CPDF_Dictionary* pFind; int32_t iCount = pConfigs->GetCount(); for (int32_t i = 0; i < iCount; i++) { - pFind = pConfigs->GetDict(i); + pFind = pConfigs->GetDictAt(i); if (!pFind) { continue; } @@ -104,43 +104,43 @@ FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig, return TRUE; } bValidConfig = TRUE; - FX_BOOL bState = pConfig->GetString("BaseState", "ON") != "OFF"; - CPDF_Array* pArray = pConfig->GetArray("ON"); + FX_BOOL bState = pConfig->GetStringBy("BaseState", "ON") != "OFF"; + CPDF_Array* pArray = pConfig->GetArrayBy("ON"); if (pArray) { if (FPDFDOC_OCG_FindGroup(pArray, pOCGDict) >= 0) { bState = TRUE; } } - pArray = pConfig->GetArray("OFF"); + pArray = pConfig->GetArrayBy("OFF"); if (pArray) { if (FPDFDOC_OCG_FindGroup(pArray, pOCGDict) >= 0) { bState = FALSE; } } - pArray = pConfig->GetArray("AS"); + pArray = pConfig->GetArrayBy("AS"); if (pArray) { CFX_ByteString csFind = csConfig + "State"; int32_t iCount = pArray->GetCount(); for (int32_t i = 0; i < iCount; i++) { - CPDF_Dictionary* pUsage = pArray->GetDict(i); + CPDF_Dictionary* pUsage = pArray->GetDictAt(i); if (!pUsage) { continue; } - if (pUsage->GetString("Event", "View") != csConfig) { + if (pUsage->GetStringBy("Event", "View") != csConfig) { continue; } - CPDF_Array* pOCGs = pUsage->GetArray("OCGs"); + CPDF_Array* pOCGs = pUsage->GetArrayBy("OCGs"); if (!pOCGs) { continue; } if (FPDFDOC_OCG_FindGroup(pOCGs, pOCGDict) < 0) { continue; } - CPDF_Dictionary* pState = pUsage->GetDict(csConfig); + CPDF_Dictionary* pState = pUsage->GetDictBy(csConfig); if (!pState) { continue; } - bState = pState->GetString(csFind) != "OFF"; + bState = pState->GetStringBy(csFind) != "OFF"; } } return bState; @@ -150,19 +150,19 @@ FX_BOOL CPDF_OCContext::LoadOCGState(const CPDF_Dictionary* pOCGDict) const { return TRUE; } CFX_ByteString csState = FPDFDOC_OCG_GetUsageTypeString(m_eUsageType); - CPDF_Dictionary* pUsage = pOCGDict->GetDict("Usage"); + CPDF_Dictionary* pUsage = pOCGDict->GetDictBy("Usage"); if (pUsage) { - CPDF_Dictionary* pState = pUsage->GetDict(csState); + CPDF_Dictionary* pState = pUsage->GetDictBy(csState); if (pState) { CFX_ByteString csFind = csState + "State"; if (pState->KeyExist(csFind)) { - return pState->GetString(csFind) != "OFF"; + return pState->GetStringBy(csFind) != "OFF"; } } if (csState != "View") { - pState = pUsage->GetDict("View"); + pState = pUsage->GetDictBy("View"); if (pState && pState->KeyExist("ViewState")) { - return pState->GetString("ViewState") != "OFF"; + return pState->GetStringBy("ViewState") != "OFF"; } } } @@ -194,7 +194,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression, } int32_t iCount = pExpression->GetCount(); CPDF_Object* pOCGObj; - CFX_ByteString csOperator = pExpression->GetString(0); + CFX_ByteString csOperator = pExpression->GetStringAt(0); if (csOperator == "Not") { pOCGObj = pExpression->GetElementValue(1); if (!pOCGObj) @@ -234,11 +234,11 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression, } FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict, FX_BOOL bFromConfig) { - CPDF_Array* pVE = pOCMDDict->GetArray("VE"); + CPDF_Array* pVE = pOCMDDict->GetArrayBy("VE"); if (pVE) { return GetOCGVE(pVE, bFromConfig); } - CFX_ByteString csP = pOCMDDict->GetString("P", "AnyOn"); + CFX_ByteString csP = pOCMDDict->GetStringBy("P", "AnyOn"); CPDF_Object* pOCGObj = pOCMDDict->GetElementValue("OCGs"); if (!pOCGObj) return TRUE; @@ -256,7 +256,7 @@ FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict, int32_t iCount = pArray->GetCount(); for (int32_t i = 0; i < iCount; i++) { FX_BOOL bItem = TRUE; - CPDF_Dictionary* pItemDict = pArray->GetDict(i); + CPDF_Dictionary* pItemDict = pArray->GetDictAt(i); if (pItemDict) bItem = bFromConfig ? LoadOCGState(pItemDict) : GetOCGVisible(pItemDict); @@ -271,7 +271,7 @@ FX_BOOL CPDF_OCContext::CheckOCGVisible(const CPDF_Dictionary* pOCGDict) { if (!pOCGDict) { return TRUE; } - CFX_ByteString csType = pOCGDict->GetString("Type", "OCG"); + CFX_ByteString csType = pOCGDict->GetStringBy("Type", "OCG"); if (csType == "OCG") { return GetOCGVisible(pOCGDict); } diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp index 3510eb6c8e..bf623eb703 100644 --- a/core/src/fpdfdoc/doc_tagged.cpp +++ b/core/src/fpdfdoc/doc_tagged.cpp @@ -12,8 +12,8 @@ const int nMaxRecursion = 32; static FX_BOOL IsTagged(const CPDF_Document* pDoc) { CPDF_Dictionary* pCatalog = pDoc->GetRoot(); - CPDF_Dictionary* pMarkInfo = pCatalog->GetDict("MarkInfo"); - return pMarkInfo != NULL && pMarkInfo->GetInteger("Marked"); + CPDF_Dictionary* pMarkInfo = pCatalog->GetDictBy("MarkInfo"); + return pMarkInfo != NULL && pMarkInfo->GetIntegerBy("Marked"); } CPDF_StructTree* CPDF_StructTree::LoadPage(const CPDF_Document* pDoc, const CPDF_Dictionary* pPageDict) { @@ -34,11 +34,11 @@ CPDF_StructTree* CPDF_StructTree::LoadDoc(const CPDF_Document* pDoc) { } CPDF_StructTreeImpl::CPDF_StructTreeImpl(const CPDF_Document* pDoc) { CPDF_Dictionary* pCatalog = pDoc->GetRoot(); - m_pTreeRoot = pCatalog->GetDict("StructTreeRoot"); + m_pTreeRoot = pCatalog->GetDictBy("StructTreeRoot"); if (!m_pTreeRoot) { return; } - m_pRoleMap = m_pTreeRoot->GetDict("RoleMap"); + m_pRoleMap = m_pTreeRoot->GetDictBy("RoleMap"); } CPDF_StructTreeImpl::~CPDF_StructTreeImpl() { for (int i = 0; i < m_Kids.GetSize(); i++) @@ -65,7 +65,7 @@ void CPDF_StructTreeImpl::LoadDocTree() { return; for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { - CPDF_Dictionary* pKid = pArray->GetDict(i); + CPDF_Dictionary* pKid = pArray->GetDictAt(i); CPDF_StructElementImpl* pStructElementImpl = new CPDF_StructElementImpl(this, nullptr, pKid); m_Kids.Add(pStructElementImpl); @@ -94,19 +94,19 @@ void CPDF_StructTreeImpl::LoadPageTree(const CPDF_Dictionary* pPageDict) { m_Kids[i] = NULL; } std::map<CPDF_Dictionary*, CPDF_StructElementImpl*> element_map; - CPDF_Dictionary* pParentTree = m_pTreeRoot->GetDict("ParentTree"); + CPDF_Dictionary* pParentTree = m_pTreeRoot->GetDictBy("ParentTree"); if (!pParentTree) { return; } CPDF_NumberTree parent_tree(pParentTree); - int parents_id = pPageDict->GetInteger("StructParents", -1); + int parents_id = pPageDict->GetIntegerBy("StructParents", -1); if (parents_id >= 0) { CPDF_Array* pParentArray = ToArray(parent_tree.LookupValue(parents_id)); if (!pParentArray) return; for (i = 0; i < pParentArray->GetCount(); i++) { - CPDF_Dictionary* pParent = pParentArray->GetDict(i); + CPDF_Dictionary* pParent = pParentArray->GetDictAt(i); if (!pParent) { continue; } @@ -128,8 +128,8 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode( CPDF_StructElementImpl* pElement = new CPDF_StructElementImpl(this, NULL, pDict); map[pDict] = pElement; - CPDF_Dictionary* pParent = pDict->GetDict("P"); - if (!pParent || pParent->GetString("Type") == "StructTreeRoot") { + CPDF_Dictionary* pParent = pDict->GetDictBy("P"); + if (!pParent || pParent->GetStringBy("Type") == "StructTreeRoot") { if (!AddTopLevelNode(pDict, pElement)) { pElement->Release(); map.erase(pDict); @@ -197,9 +197,9 @@ CPDF_StructElementImpl::CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree, : m_RefCount(0) { m_pTree = pTree; m_pDict = pDict; - m_Type = pDict->GetString("S"); + m_Type = pDict->GetStringBy("S"); if (pTree->m_pRoleMap) { - CFX_ByteString mapped = pTree->m_pRoleMap->GetString(m_Type); + CFX_ByteString mapped = pTree->m_pRoleMap->GetStringBy(m_Type); if (!mapped.IsEmpty()) { m_Type = mapped; } @@ -269,7 +269,7 @@ void CPDF_StructElementImpl::LoadKid(FX_DWORD PageObjNum, if (CPDF_Reference* pRef = ToReference(pKidDict->GetElement("Pg"))) PageObjNum = pRef->GetRefObjNum(); - CFX_ByteString type = pKidDict->GetString("Type"); + CFX_ByteString type = pKidDict->GetStringBy("Type"); if (type == "MCR") { if (m_pTree->m_pPage && m_pTree->m_pPage->GetObjNum() != PageObjNum) { return; @@ -281,7 +281,7 @@ void CPDF_StructElementImpl::LoadKid(FX_DWORD PageObjNum, pKid->m_StreamContent.m_RefObjNum = 0; } pKid->m_StreamContent.m_PageObjNum = PageObjNum; - pKid->m_StreamContent.m_ContentId = pKidDict->GetInteger("MCID"); + pKid->m_StreamContent.m_ContentId = pKidDict->GetIntegerBy("MCID"); } else if (type == "OBJR") { if (m_pTree->m_pPage && m_pTree->m_pPage->GetObjNum() != PageObjNum) { return; @@ -325,7 +325,7 @@ static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs, return pDict; } } - if (pDict && pDict->GetString("O") == owner) + if (pDict && pDict->GetStringBy("O") == owner) return pDict; return nullptr; } @@ -360,22 +360,22 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, if (!pC) return nullptr; - CPDF_Dictionary* pClassMap = m_pTree->m_pTreeRoot->GetDict("ClassMap"); + CPDF_Dictionary* pClassMap = m_pTree->m_pTreeRoot->GetDictBy("ClassMap"); if (!pClassMap) return nullptr; if (CPDF_Array* pArray = pC->AsArray()) { for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { - CFX_ByteString class_name = pArray->GetString(i); - CPDF_Dictionary* pClassDict = pClassMap->GetDict(class_name); - if (pClassDict && pClassDict->GetString("O") == owner) + CFX_ByteString class_name = pArray->GetStringAt(i); + CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name); + if (pClassDict && pClassDict->GetStringBy("O") == owner) return pClassDict->GetElementValue(name); } return nullptr; } CFX_ByteString class_name = pC->GetString(); - CPDF_Dictionary* pClassDict = pClassMap->GetDict(class_name); - if (pClassDict && pClassDict->GetString("O") == owner) + CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name); + if (pClassDict && pClassDict->GetStringBy("O") == owner) return pClassDict->GetElementValue(name); return nullptr; } @@ -412,9 +412,9 @@ FX_ARGB CPDF_StructElementImpl::GetColor(const CFX_ByteStringC& owner, CPDF_Array* pArray = ToArray(GetAttr(owner, name, bInheritable, subindex)); if (!pArray) return default_value; - return 0xff000000 | ((int)(pArray->GetNumber(0) * 255) << 16) | - ((int)(pArray->GetNumber(1) * 255) << 8) | - (int)(pArray->GetNumber(2) * 255); + return 0xff000000 | ((int)(pArray->GetNumberAt(0) * 255) << 16) | + ((int)(pArray->GetNumberAt(1) * 255) << 8) | + (int)(pArray->GetNumberAt(2) * 255); } FX_FLOAT CPDF_StructElementImpl::GetNumber(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, diff --git a/core/src/fpdfdoc/doc_utils.cpp b/core/src/fpdfdoc/doc_utils.cpp index 4856cb51e5..7db2887834 100644 --- a/core/src/fpdfdoc/doc_utils.cpp +++ b/core/src/fpdfdoc/doc_utils.cpp @@ -15,7 +15,7 @@ CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict) { CFX_WideString full_name; CPDF_Dictionary* pLevel = pFieldDict; while (pLevel) { - CFX_WideString short_name = pLevel->GetUnicodeText("T"); + CFX_WideString short_name = pLevel->GetUnicodeTextBy("T"); if (short_name != L"") { if (full_name == L"") { full_name = short_name; @@ -23,7 +23,7 @@ CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict) { full_name = short_name + L"." + full_name; } } - pLevel = pLevel->GetDict("Parent"); + pLevel = pLevel->GetDictBy("Parent"); } return full_name; } @@ -272,11 +272,11 @@ FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict) { if (!pFormDict) { return 0; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { return 0; } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { return 0; } @@ -287,7 +287,7 @@ FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict) { continue; } if (CPDF_Dictionary* pDirect = ToDictionary(pObj->GetDirect())) { - if (pDirect->GetString("Type") == "Font") { + if (pDirect->GetStringBy("Type") == "Font") { dwCount++; } } @@ -301,11 +301,11 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, if (!pFormDict) { return NULL; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { return NULL; } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { return NULL; } @@ -319,7 +319,7 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); if (!pElement) continue; - if (pElement->GetString("Type") != "Font") + if (pElement->GetStringBy("Type") != "Font") continue; if (dwCount == index) { csNameTag = csKey; @@ -336,19 +336,19 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, if (!pFormDict || csAlias.IsEmpty()) { return NULL; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { return NULL; } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { return NULL; } - CPDF_Dictionary* pElement = pFonts->GetDict(csAlias); + CPDF_Dictionary* pElement = pFonts->GetDictBy(csAlias); if (!pElement) { return NULL; } - if (pElement->GetString("Type") == "Font") { + if (pElement->GetStringBy("Type") == "Font") { return pDocument->LoadFont(pElement); } return NULL; @@ -360,11 +360,11 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, if (!pFormDict || csFontName.IsEmpty()) { return NULL; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { return NULL; } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { return NULL; } @@ -377,7 +377,7 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); if (!pElement) continue; - if (pElement->GetString("Type") != "Font") + if (pElement->GetStringBy("Type") != "Font") continue; CPDF_Font* pFind = pDocument->LoadFont(pElement); @@ -401,11 +401,11 @@ CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, if (!pFormDict) { return NULL; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { return NULL; } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { return NULL; } @@ -418,7 +418,7 @@ CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); if (!pElement) continue; - if (pElement->GetString("Type") != "Font") + if (pElement->GetStringBy("Type") != "Font") continue; CPDF_Font* pFind = pDocument->LoadFont(pElement); if (!pFind) { @@ -457,11 +457,11 @@ FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, if (!pFormDict || !pFont) { return FALSE; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { return FALSE; } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { return FALSE; } @@ -474,7 +474,7 @@ FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); if (!pElement) continue; - if (pElement->GetString("Type") != "Font") { + if (pElement->GetStringBy("Type") != "Font") { continue; } if (pFont->GetFontDict() == pElement) { @@ -492,11 +492,11 @@ FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, if (!pFormDict) { return FALSE; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { return FALSE; } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { return FALSE; } @@ -512,7 +512,7 @@ FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); if (!pElement) continue; - if (pElement->GetString("Type") != "Font") { + if (pElement->GetStringBy("Type") != "Font") { continue; } pFont = pDocument->LoadFont(pElement); @@ -547,12 +547,12 @@ void AddInterFormFont(CPDF_Dictionary*& pFormDict, if (!pFormDict) { InitInterFormDict(pFormDict, pDocument); } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { pDR = new CPDF_Dictionary; pFormDict->SetAt("DR", pDR); } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { pFonts = new CPDF_Dictionary; pDR->SetAt("Font", pFonts); @@ -605,19 +605,19 @@ void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont) { if (!FindInterFormFont(pFormDict, pFont, csTag)) { return; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); pFonts->RemoveAt(csTag); } void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag) { if (!pFormDict || csNameTag.IsEmpty()) { return; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { return; } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { return; } @@ -628,7 +628,7 @@ CPDF_Font* GetDefaultInterFormFont(CPDF_Dictionary* pFormDict, if (!pFormDict) { return NULL; } - CPDF_DefaultAppearance cDA = pFormDict->GetString("DA"); + CPDF_DefaultAppearance cDA = pFormDict->GetStringBy("DA"); CFX_ByteString csFontNameTag; FX_FLOAT fFontSize; cDA.GetFont(csFontNameTag, fFontSize); @@ -638,7 +638,7 @@ CPDF_IconFit::ScaleMethod CPDF_IconFit::GetScaleMethod() { if (!m_pDict) { return Always; } - CFX_ByteString csSW = m_pDict->GetString("SW", "A"); + CFX_ByteString csSW = m_pDict->GetStringBy("SW", "A"); if (csSW == "B") { return Bigger; } @@ -654,21 +654,21 @@ FX_BOOL CPDF_IconFit::IsProportionalScale() { if (!m_pDict) { return TRUE; } - return m_pDict->GetString("S", "P") != "A"; + return m_pDict->GetStringBy("S", "P") != "A"; } void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { fLeft = fBottom = 0.5; if (!m_pDict) { return; } - CPDF_Array* pA = m_pDict->GetArray("A"); + CPDF_Array* pA = m_pDict->GetArrayBy("A"); if (pA) { FX_DWORD dwCount = pA->GetCount(); if (dwCount > 0) { - fLeft = pA->GetNumber(0); + fLeft = pA->GetNumberAt(0); } if (dwCount > 1) { - fBottom = pA->GetNumber(1); + fBottom = pA->GetNumberAt(1); } } } @@ -676,7 +676,7 @@ FX_BOOL CPDF_IconFit::GetFittingBounds() { if (!m_pDict) { return FALSE; } - return m_pDict->GetBoolean("FB"); + return m_pDict->GetBooleanBy("FB"); } void SaveCheckedFieldStatus(CPDF_FormField* pField, CFX_ByteArray& statusArray) { @@ -702,7 +702,7 @@ CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, if (pAttr) { return pAttr; } - CPDF_Dictionary* pParent = pFieldDict->GetDict("Parent"); + CPDF_Dictionary* pParent = pFieldDict->GetDictBy("Parent"); if (!pParent) { return NULL; } diff --git a/core/src/fpdfdoc/doc_viewerPreferences.cpp b/core/src/fpdfdoc/doc_viewerPreferences.cpp index 05f50c03d0..6ef09255c6 100644 --- a/core/src/fpdfdoc/doc_viewerPreferences.cpp +++ b/core/src/fpdfdoc/doc_viewerPreferences.cpp @@ -11,43 +11,43 @@ CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document* pDoc) CPDF_ViewerPreferences::~CPDF_ViewerPreferences() {} FX_BOOL CPDF_ViewerPreferences::IsDirectionR2L() const { CPDF_Dictionary* pDict = m_pDoc->GetRoot(); - pDict = pDict->GetDict("ViewerPreferences"); + pDict = pDict->GetDictBy("ViewerPreferences"); if (!pDict) { return FALSE; } - return "R2L" == pDict->GetString("Direction"); + return "R2L" == pDict->GetStringBy("Direction"); } FX_BOOL CPDF_ViewerPreferences::PrintScaling() const { CPDF_Dictionary* pDict = m_pDoc->GetRoot(); - pDict = pDict->GetDict("ViewerPreferences"); + pDict = pDict->GetDictBy("ViewerPreferences"); if (!pDict) { return TRUE; } - return "None" != pDict->GetString("PrintScaling"); + return "None" != pDict->GetStringBy("PrintScaling"); } int32_t CPDF_ViewerPreferences::NumCopies() const { CPDF_Dictionary* pDict = m_pDoc->GetRoot(); - pDict = pDict->GetDict("ViewerPreferences"); + pDict = pDict->GetDictBy("ViewerPreferences"); if (!pDict) { return 1; } - return pDict->GetInteger("NumCopies"); + return pDict->GetIntegerBy("NumCopies"); } CPDF_Array* CPDF_ViewerPreferences::PrintPageRange() const { CPDF_Dictionary* pDict = m_pDoc->GetRoot(); CPDF_Array* pRange = NULL; - pDict = pDict->GetDict("ViewerPreferences"); + pDict = pDict->GetDictBy("ViewerPreferences"); if (!pDict) { return pRange; } - pRange = pDict->GetArray("PrintPageRange"); + pRange = pDict->GetArrayBy("PrintPageRange"); return pRange; } CFX_ByteString CPDF_ViewerPreferences::Duplex() const { CPDF_Dictionary* pDict = m_pDoc->GetRoot(); - pDict = pDict->GetDict("ViewerPreferences"); + pDict = pDict->GetDictBy("ViewerPreferences"); if (!pDict) { return "None"; } - return pDict->GetString("Duplex"); + return pDict->GetStringBy("Duplex"); } |