diff options
author | Artem Strygin <art-snake@yandex-team.ru> | 2017-09-08 17:09:27 +0300 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-09-18 21:28:35 +0000 |
commit | 21f4afbff95cf184917eac23a5659061654760a1 (patch) | |
tree | 65a063bc056e1e1a15a8dd70cb22d2aeffbec743 /core/fpdfapi/parser | |
parent | 5278cebc468e6975f217d0c016501a554d10fd97 (diff) | |
download | pdfium-21f4afbff95cf184917eac23a5659061654760a1.tar.xz |
Use CPDF_ReadValidator to request linearized data.
Change-Id: I5c0fccc74a9f103d91c95fd72dc6683d991eadec
Reviewed-on: https://pdfium-review.googlesource.com/13570
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 | 15 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_data_avail.h | 2 |
2 files changed, 8 insertions, 9 deletions
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp index 994d082712..b95c9daf8d 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/parser/cpdf_data_avail.cpp @@ -1204,8 +1204,7 @@ bool CPDF_DataAvail::LoadPages() { return false; } -CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::CheckLinearizedData( - DownloadHints* pHints) { +CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::CheckLinearizedData() { if (m_bLinearedDataOK) return DataAvailable; ASSERT(m_pLinearized); @@ -1218,10 +1217,10 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::CheckLinearizedData( if (!data_size.IsValid()) return DataError; - if (!m_pFileAvail->IsDataAvail(m_pLinearized->GetLastXRefOffset(), - data_size.ValueOrDie())) { - pHints->AddSegment(m_pLinearized->GetLastXRefOffset(), - data_size.ValueOrDie()); + if (!GetValidator()->IsDataRangeAvailable( + m_pLinearized->GetLastXRefOffset(), data_size.ValueOrDie())) { + GetValidator()->ScheduleDataDownload(m_pLinearized->GetLastXRefOffset(), + data_size.ValueOrDie()); return DataNotAvailable; } @@ -1312,7 +1311,7 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail( return nRet; } - DocAvailStatus nResult = CheckLinearizedData(pHints); + DocAvailStatus nResult = CheckLinearizedData(); if (nResult != DataAvailable) return nResult; @@ -1479,7 +1478,7 @@ CPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail( const HintsScope hints_scope(GetValidator().Get(), pHints); if (m_pLinearized) { - DocAvailStatus nDocStatus = CheckLinearizedData(pHints); + DocAvailStatus nDocStatus = CheckLinearizedData(); if (nDocStatus == DataError) return FormError; if (nDocStatus == DataNotAvailable) diff --git a/core/fpdfapi/parser/cpdf_data_avail.h b/core/fpdfapi/parser/cpdf_data_avail.h index 850ceeaae2..ab54b08404 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.h +++ b/core/fpdfapi/parser/cpdf_data_avail.h @@ -158,7 +158,7 @@ class CPDF_DataAvail final { bool LoadPages(); bool LoadAllXref(DownloadHints* pHints); bool LoadAllFile(); - DocAvailStatus CheckLinearizedData(DownloadHints* pHints); + DocAvailStatus CheckLinearizedData(); bool CheckPageAnnots(uint32_t dwPage); DocAvailStatus CheckLinearizedFirstPage(uint32_t dwPage); |