From 834ebece214f06c6e9fda803ab321e8453b3a54b Mon Sep 17 00:00:00 2001 From: Artem Strygin Date: Thu, 27 Jul 2017 14:01:32 +0300 Subject: Implement read validator. The wrapper for IFX_SeekableReadStream. Which allow us to check data availability on read request and request downloading of non available data on fly. Change-Id: I27c66cd58f43f8432f73104cc3f4c980515a9b56 Reviewed-on: https://pdfium-review.googlesource.com/9050 Commit-Queue: Art Snake Reviewed-by: (OOO Jul 28 - Aug 8) dsinclair --- samples/pdfium_test.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'samples') diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc index bb969b1c8d..ee95e2f3c1 100644 --- a/samples/pdfium_test.cc +++ b/samples/pdfium_test.cc @@ -1256,6 +1256,8 @@ void RenderPdf(const std::string& name, platform_callbacks.Doc_gotoPage = ExampleDocGotoPage; platform_callbacks.Doc_mail = ExampleDocMail; + // The pdf_avail must outlive doc. + std::unique_ptr pdf_avail; // The document must outlive |form_callbacks.loaded_pages|. std::unique_ptr doc; FPDF_FORMFILLINFO_PDFiumTest form_callbacks = {}; @@ -1283,8 +1285,7 @@ void RenderPdf(const std::string& name, int nRet = PDF_DATA_NOTAVAIL; bool bIsLinearized = false; - std::unique_ptr pdf_avail( - FPDFAvail_Create(&file_avail, &file_access)); + pdf_avail.reset(FPDFAvail_Create(&file_avail, &file_access)); if (FPDFAvail_IsLinearized(pdf_avail.get()) == PDF_LINEARIZED) { doc.reset(FPDFAvail_GetDocument(pdf_avail.get(), nullptr)); -- cgit v1.2.3