diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-08-05 10:39:02 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-08-05 10:39:02 -0700 |
commit | 2b9178181eb82a3611bee5c9435ea5956def24be (patch) | |
tree | fe7909a1b5338a328f9e53ec1501e72c675da1e7 /fpdfsdk/src/fpdfview.cpp | |
parent | 5cd398545141226f082b2f757f23c73303058a83 (diff) | |
download | pdfium-2b9178181eb82a3611bee5c9435ea5956def24be.tar.xz |
CPDF_Parser shouldnt be in the business of opening files
Move that operation closer to the embedder's call.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1269073003 .
Diffstat (limited to 'fpdfsdk/src/fpdfview.cpp')
-rw-r--r-- | fpdfsdk/src/fpdfview.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index a419749e8e..8895dce076 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -155,12 +155,20 @@ DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, return FSDK_SetSandBoxPolicy(policy, enable); } + DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, FPDF_BYTESTRING password) { + // NOTE: the creation of the file needs to be by the embedder on the + // other side of this API. + IFX_FileRead* pFileAccess = FX_CreateFileRead((const FX_CHAR*)file_path); + if (!pFileAccess) { + return nullptr; + } + CPDF_Parser* pParser = new CPDF_Parser; pParser->SetPassword(password); - FX_DWORD err_code = pParser->StartParse((const FX_CHAR*)file_path); + FX_DWORD err_code = pParser->StartParse(pFileAccess); if (err_code) { delete pParser; ProcessParseError(err_code); |