summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorArtem Strygin <art-snake@yandex-team.ru>2017-09-29 16:36:50 +0300
committerChromium commit bot <commit-bot@chromium.org>2017-10-02 16:15:29 +0000
commit73784e81928a664169f0ae013707fdfb0e82e70d (patch)
tree5ab0f7b9db0de50ebf4c03da3e614e35b7fbd667 /fpdfsdk
parent522e100534c78b026d170d5625c1e72046a6953c (diff)
downloadpdfium-73784e81928a664169f0ae013707fdfb0e82e70d.tar.xz
Allow to use null FX_DOWNLOADHINTS to check data availability
This is allow us check document/pages/form availability using FPDFAvail_IsXXAvail without download requests. Change-Id: Ie4525147d8b8e98573d53b2e5b456b632a8a1951 Reviewed-on: https://pdfium-review.googlesource.com/13030 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdf_dataavail.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/fpdfsdk/fpdf_dataavail.cpp b/fpdfsdk/fpdf_dataavail.cpp
index f781a3d59f..3e1f713477 100644
--- a/fpdfsdk/fpdf_dataavail.cpp
+++ b/fpdfsdk/fpdf_dataavail.cpp
@@ -92,7 +92,8 @@ class FPDF_DownloadHintsContext : public CPDF_DataAvail::DownloadHints {
public:
// IFX_DownloadHints
void AddSegment(FX_FILESIZE offset, uint32_t size) override {
- m_pDownloadHints->AddSegment(m_pDownloadHints, offset, size);
+ if (m_pDownloadHints)
+ m_pDownloadHints->AddSegment(m_pDownloadHints, offset, size);
}
private:
@@ -134,7 +135,7 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFAvail_Destroy(FPDF_AVAIL avail) {
FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsDocAvail(FPDF_AVAIL avail,
FX_DOWNLOADHINTS* hints) {
- if (!avail || !hints)
+ if (!avail)
return PDF_DATA_ERROR;
FPDF_DownloadHintsContext hints_context(hints);
return FPDFAvailContextFromFPDFAvail(avail)->m_pDataAvail->IsDocAvail(
@@ -170,7 +171,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc) {
FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsPageAvail(FPDF_AVAIL avail,
int page_index,
FX_DOWNLOADHINTS* hints) {
- if (!avail || !hints)
+ if (!avail)
return PDF_DATA_ERROR;
if (page_index < 0)
return PDF_DATA_NOTAVAIL;
@@ -181,7 +182,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsPageAvail(FPDF_AVAIL avail,
FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsFormAvail(FPDF_AVAIL avail,
FX_DOWNLOADHINTS* hints) {
- if (!avail || !hints)
+ if (!avail)
return PDF_FORM_ERROR;
FPDF_DownloadHintsContext hints_context(hints);
return FPDFAvailContextFromFPDFAvail(avail)->m_pDataAvail->IsFormAvail(