summaryrefslogtreecommitdiff
path: root/samples/pdfium_test.cc
diff options
context:
space:
mode:
authorArtem Strygin <art-snake@yandex-team.ru>2017-07-27 14:01:32 +0300
committerChromium commit bot <commit-bot@chromium.org>2017-07-28 00:03:54 +0000
commit834ebece214f06c6e9fda803ab321e8453b3a54b (patch)
tree259c4aead897943a48c99016d17cd63a04de5d12 /samples/pdfium_test.cc
parent672a1721620c3f4e62fe6adfaceb929d423ae31f (diff)
downloadpdfium-834ebece214f06c6e9fda803ab321e8453b3a54b.tar.xz
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 <art-snake@yandex-team.ru> Reviewed-by: (OOO Jul 28 - Aug 8) dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'samples/pdfium_test.cc')
-rw-r--r--samples/pdfium_test.cc5
1 files changed, 3 insertions, 2 deletions
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<void, FPDFAvailDeleter> pdf_avail;
// The document must outlive |form_callbacks.loaded_pages|.
std::unique_ptr<void, FPDFDocumentDeleter> 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<void, FPDFAvailDeleter> 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));