summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.cpp110
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.h7
2 files changed, 0 insertions, 117 deletions
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index 549ed75425..93dd39b87b 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -118,78 +118,6 @@ void CPDF_DataAvail::SetDocument(CPDF_Document* pDoc) {
m_pDocument = pDoc;
}
-bool CPDF_DataAvail::AreObjectsAvailable(std::vector<CPDF_Object*>& obj_array,
- bool bParsePage,
- std::vector<CPDF_Object*>& ret_array) {
- if (obj_array.empty())
- return true;
-
- uint32_t count = 0;
- std::vector<CPDF_Object*> new_obj_array;
- for (CPDF_Object* pObj : obj_array) {
- if (!pObj)
- continue;
-
- int32_t type = pObj->GetType();
- switch (type) {
- case CPDF_Object::ARRAY: {
- CPDF_Array* pArray = pObj->AsArray();
- for (size_t k = 0; k < pArray->GetCount(); ++k)
- new_obj_array.push_back(pArray->GetObjectAt(k));
- break;
- }
- case CPDF_Object::STREAM:
- pObj = pObj->GetDict();
- case CPDF_Object::DICTIONARY: {
- CPDF_Dictionary* pDict = pObj->GetDict();
- if (pDict && pDict->GetStringFor("Type") == "Page" && !bParsePage)
- continue;
-
- for (const auto& it : *pDict) {
- if (it.first != "Parent")
- new_obj_array.push_back(it.second.get());
- }
- break;
- }
- case CPDF_Object::REFERENCE: {
- const CPDF_ReadValidator::Session read_session(GetValidator().Get());
-
- CPDF_Reference* pRef = pObj->AsReference();
- const uint32_t dwNum = pRef->GetRefObjNum();
-
- if (pdfium::ContainsKey(m_ObjectSet, dwNum))
- break;
-
- CPDF_Object* pReferred = m_pDocument->GetOrParseIndirectObject(dwNum);
- if (GetValidator()->has_read_problems()) {
- ASSERT(!pReferred);
- ret_array.push_back(pObj);
- ++count;
- break;
- }
- m_ObjectSet.insert(dwNum);
- if (pReferred)
- new_obj_array.push_back(pReferred);
-
- break;
- }
- }
- }
-
- if (count > 0) {
- for (CPDF_Object* pObj : new_obj_array) {
- CPDF_Reference* pRef = pObj->AsReference();
- if (pRef && pdfium::ContainsKey(m_ObjectSet, pRef->GetRefObjNum()))
- continue;
- ret_array.push_back(pObj);
- }
- return false;
- }
-
- obj_array = new_obj_array;
- return AreObjectsAvailable(obj_array, false, ret_array);
-}
-
CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsDocAvail(
DownloadHints* pHints) {
if (!m_dwFileLen)
@@ -1137,44 +1065,6 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::CheckLinearizedData() {
return m_bLinearedDataOK ? DataAvailable : DataNotAvailable;
}
-bool CPDF_DataAvail::CheckPageAnnots(uint32_t dwPage) {
- if (m_objs_array.empty()) {
- m_ObjectSet.clear();
-
- FX_SAFE_INT32 safePage = pdfium::base::checked_cast<int32_t>(dwPage);
- CPDF_Dictionary* pPageDict = m_pDocument->GetPage(safePage.ValueOrDie());
- if (!pPageDict)
- return true;
-
- CPDF_Object* pAnnots = pPageDict->GetObjectFor("Annots");
- if (!pAnnots)
- return true;
-
- std::vector<CPDF_Object*> obj_array;
- obj_array.push_back(pAnnots);
- if (!AreObjectsAvailable(obj_array, false, m_objs_array))
- return false;
-
- m_objs_array.clear();
- return true;
- }
-
- std::vector<CPDF_Object*> new_objs_array;
- if (!AreObjectsAvailable(m_objs_array, false, new_objs_array)) {
- m_objs_array = new_objs_array;
- return false;
- }
- m_objs_array.clear();
- return true;
-}
-
-CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::CheckLinearizedFirstPage(
- uint32_t dwPage) {
- if (!ValidatePage(dwPage))
- return DataError;
- return DataAvailable;
-}
-
CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail(
uint32_t dwPage,
DownloadHints* pHints) {
diff --git a/core/fpdfapi/parser/cpdf_data_avail.h b/core/fpdfapi/parser/cpdf_data_avail.h
index a887d94901..2d46be1152 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.h
+++ b/core/fpdfapi/parser/cpdf_data_avail.h
@@ -124,9 +124,6 @@ class CPDF_DataAvail final {
static const int kMaxPageRecursionDepth = 1024;
- bool AreObjectsAvailable(std::vector<CPDF_Object*>& obj_array,
- bool bParsePage,
- std::vector<CPDF_Object*>& ret_array);
bool CheckDocStatus();
bool CheckHeader();
bool CheckFirstPage();
@@ -159,9 +156,7 @@ class CPDF_DataAvail final {
bool LoadAllXref();
bool LoadAllFile();
DocAvailStatus CheckLinearizedData();
- bool CheckPageAnnots(uint32_t dwPage);
- DocAvailStatus CheckLinearizedFirstPage(uint32_t dwPage);
bool CheckPage(uint32_t dwPage);
bool LoadDocPages();
bool LoadDocPage(uint32_t dwPage);
@@ -194,8 +189,6 @@ class CPDF_DataAvail final {
PDF_DATAAVAIL_STATUS m_docStatus;
FX_FILESIZE m_dwFileLen;
CPDF_Document* m_pDocument;
- std::set<uint32_t> m_ObjectSet;
- std::vector<CPDF_Object*> m_objs_array;
FX_FILESIZE m_Pos;
FX_FILESIZE m_bufferOffset;
uint32_t m_bufferSize;