summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorArtem Strygin <art-snake@yandex-team.ru>2017-11-02 21:31:30 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-02 21:31:30 +0000
commitd7999f6a794207842544214d015af6f06322157c (patch)
tree300fbd43be94ea1b10268610296fd99cdf7c115d /fpdfsdk
parent0c9c70bdf9bcda1df54f1bc74016ce49dffb58b6 (diff)
downloadpdfium-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')
-rw-r--r--fpdfsdk/fpdf_dataavail.cpp15
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) {