diff options
Diffstat (limited to 'core/src/fpdfapi')
26 files changed, 408 insertions, 404 deletions
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; |