summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/fpdf_dataavail.cpp9
-rw-r--r--public/fpdf_dataavail.h5
2 files changed, 10 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(
diff --git a/public/fpdf_dataavail.h b/public/fpdf_dataavail.h
index 12a77146d7..3ce92110ac 100644
--- a/public/fpdf_dataavail.h
+++ b/public/fpdf_dataavail.h
@@ -103,6 +103,7 @@ typedef struct _FX_DOWNLOADHINTS {
// Applications should call this function whenever new data arrives, and process
// all the generated download hints, if any, until the function returns
// |PDF_DATA_ERROR| or |PDF_DATA_AVAIL|.
+// if hints is nullptr, the function just check current document availability.
//
// Once all data is available, call |FPDFAvail_GetDocument| to get a document
// handle.
@@ -150,6 +151,8 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc);
// all the generated download |hints|, if any, until this function returns
// |PDF_DATA_ERROR| or |PDF_DATA_AVAIL|. Applications can then perform page
// loading.
+// if hints is nullptr, the function just check current availability of
+// specified page.
FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsPageAvail(FPDF_AVAIL avail,
int page_index,
FX_DOWNLOADHINTS* hints);
@@ -171,6 +174,8 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsPageAvail(FPDF_AVAIL avail,
// The application should call this function whenever new data arrives and
// process all the generated download |hints|, if any, until the function
// |PDF_FORM_ERROR|, |PDF_FORM_AVAIL| or |PDF_FORM_NOTEXIST|.
+// if hints is nullptr, the function just check current form availability.
+//
// Applications can then perform page loading. It is recommend to call
// |FPDFDOC_InitFormFillEnvironment| when |PDF_FORM_AVAIL| is returned.
FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsFormAvail(FPDF_AVAIL avail,