diff options
author | Artem Strygin <art-snake@yandex-team.ru> | 2017-09-08 17:32:55 +0300 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-09-18 22:34:05 +0000 |
commit | 59aa827d6b41443ecfb2afe1d4ab9f0029b9e536 (patch) | |
tree | 525e36d107341d8b3ead56e7f7592f60bba8df35 /core/fpdfapi/parser | |
parent | 29b7891d920fd2b668d24076f530dfc7822c1032 (diff) | |
download | pdfium-59aa827d6b41443ecfb2afe1d4ab9f0029b9e536.tar.xz |
Use CPDF_ReadValidator to request linearized first page.
Change-Id: I416e636d90c63679e2dd0b109c6594fc02663c89
Reviewed-on: https://pdfium-review.googlesource.com/13572
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r-- | core/fpdfapi/parser/cpdf_data_avail.cpp | 12 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_data_avail.h | 2 |
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(); |