summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.cpp12
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.h2
2 files changed, 7 insertions, 7 deletions
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index e3aea09934..4fa419c22a 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -266,7 +266,7 @@ bool CPDF_DataAvail::CheckDocStatus(DownloadHints* pHints) {
case PDF_DATAAVAIL_HEADER:
return CheckHeader();
case PDF_DATAAVAIL_FIRSTPAGE:
- return CheckFirstPage(pHints);
+ return CheckFirstPage();
case PDF_DATAAVAIL_HINTTABLE:
return CheckHintTables(pHints);
case PDF_DATAAVAIL_END:
@@ -577,7 +577,7 @@ bool CPDF_DataAvail::CheckHeader() {
return true;
}
-bool CPDF_DataAvail::CheckFirstPage(DownloadHints* pHints) {
+bool CPDF_DataAvail::CheckFirstPage() {
if (!m_pLinearized->GetFirstPageEndOffset() ||
!m_pLinearized->GetFileSize() || !m_pLinearized->GetLastXRefOffset()) {
m_docStatus = PDF_DATAAVAIL_ERROR;
@@ -589,10 +589,10 @@ bool CPDF_DataAvail::CheckFirstPage(DownloadHints* pHints) {
if ((FX_FILESIZE)dwEnd > m_dwFileLen)
dwEnd = (uint32_t)m_dwFileLen;
- int32_t iStartPos = (int32_t)(m_dwFileLen > 1024 ? 1024 : m_dwFileLen);
- int32_t iSize = dwEnd > 1024 ? dwEnd - 1024 : 0;
- if (!m_pFileAvail->IsDataAvail(iStartPos, iSize)) {
- pHints->AddSegment(iStartPos, iSize);
+ const FX_FILESIZE start_pos = m_dwFileLen > 1024 ? 1024 : m_dwFileLen;
+ const uint32_t data_size = dwEnd > 1024 ? dwEnd - 1024 : 0;
+ if (!GetValidator()->IsDataRangeAvailable(start_pos, data_size)) {
+ GetValidator()->ScheduleDataDownload(start_pos, data_size);
return false;
}
diff --git a/core/fpdfapi/parser/cpdf_data_avail.h b/core/fpdfapi/parser/cpdf_data_avail.h
index 9cd4aa986d..8a93424d36 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.h
+++ b/core/fpdfapi/parser/cpdf_data_avail.h
@@ -128,7 +128,7 @@ class CPDF_DataAvail final {
std::vector<CPDF_Object*>& ret_array);
bool CheckDocStatus(DownloadHints* pHints);
bool CheckHeader();
- bool CheckFirstPage(DownloadHints* pHints);
+ bool CheckFirstPage();
bool CheckHintTables(DownloadHints* pHints);
bool CheckEnd();
bool CheckCrossRef();