diff options
author | Artem Strygin <art-snake@yandex-team.ru> | 2017-11-02 21:31:30 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-02 21:31:30 +0000 |
commit | d7999f6a794207842544214d015af6f06322157c (patch) | |
tree | 300fbd43be94ea1b10268610296fd99cdf7c115d /fpdfsdk/fpdf_dataavail.cpp | |
parent | 0c9c70bdf9bcda1df54f1bc74016ce49dffb58b6 (diff) | |
download | pdfium-d7999f6a794207842544214d015af6f06322157c.tar.xz |
Move parsing logic from FPDF_DataAvail into CPDF_DataAvail.
Change-Id: Iacae9723e88eeae52154276b2478e4fd8c309c2d
Reviewed-on: https://pdfium-review.googlesource.com/15512
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_dataavail.cpp')
-rw-r--r-- | fpdfsdk/fpdf_dataavail.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/fpdfsdk/fpdf_dataavail.cpp b/fpdfsdk/fpdf_dataavail.cpp index 0a74c9c245..b1a134d914 100644 --- a/fpdfsdk/fpdf_dataavail.cpp +++ b/fpdfsdk/fpdf_dataavail.cpp @@ -147,20 +147,15 @@ FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) { auto* pDataAvail = FPDFAvailContextFromFPDFAvail(avail); if (!pDataAvail) return nullptr; - - auto pParser = pdfium::MakeUnique<CPDF_Parser>(); - pParser->SetPassword(password); - - auto pDocument = pdfium::MakeUnique<CPDF_Document>(std::move(pParser)); - CPDF_Parser::Error error = pDocument->GetParser()->StartLinearizedParse( - pDataAvail->m_pDataAvail->GetFileRead(), pDocument.get()); + CPDF_Parser::Error error; + std::unique_ptr<CPDF_Document> document; + std::tie(error, document) = pDataAvail->m_pDataAvail->ParseDocument(password); if (error != CPDF_Parser::SUCCESS) { ProcessParseError(error); return nullptr; } - pDataAvail->m_pDataAvail->SetDocument(pDocument.get()); - CheckUnSupportError(pDocument.get(), FPDF_ERR_SUCCESS); - return FPDFDocumentFromCPDFDocument(pDocument.release()); + CheckUnSupportError(document.get(), FPDF_ERR_SUCCESS); + return FPDFDocumentFromCPDFDocument(document.release()); } FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc) { |