diff options
author | tsepez <tsepez@chromium.org> | 2016-11-30 15:10:55 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-30 15:10:55 -0800 |
commit | 345d489b70a8e057587512524e69bd5692e2e14b (patch) | |
tree | 01a34c53a991ef069b503bed1b8d1845510cfe04 /fpdfsdk | |
parent | 47718fbaf24000877aff58d9512b9b1dea0af818 (diff) | |
download | pdfium-345d489b70a8e057587512524e69bd5692e2e14b.tar.xz |
Convert loose FX_Create* functions into static methods
Also remove a bool that is always false.
Review-Url: https://codereview.chromium.org/2539203002
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/fpdfsave.cpp | 6 | ||||
-rw-r--r-- | fpdfsdk/fpdfview.cpp | 10 |
2 files changed, 7 insertions, 9 deletions
diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp index cb01ab697b..c65ff88f3d 100644 --- a/fpdfsdk/fpdfsave.cpp +++ b/fpdfsdk/fpdfsave.cpp @@ -136,7 +136,7 @@ bool SaveXFADocumentData(CPDFXFA_Context* pContext, streamAcc.LoadAllData(pTemplateStream); uint8_t* pData = (uint8_t*)streamAcc.GetData(); uint32_t dwSize2 = streamAcc.GetSize(); - ScopedFileStream pTemplate(FX_CreateMemoryStream(pData, dwSize2)); + ScopedFileStream pTemplate(IFX_MemoryStream::Create(pData, dwSize2)); pChecksum->UpdateChecksum(pTemplate.get()); } CPDF_Stream* pFormStream = nullptr; @@ -169,7 +169,7 @@ bool SaveXFADocumentData(CPDFXFA_Context* pContext, } // L"datasets" { - ScopedFileStream pDsfileWrite(FX_CreateMemoryStream()); + ScopedFileStream pDsfileWrite(IFX_MemoryStream::Create()); if (pXFADocView->GetDoc()->SavePackage(XFA_HASHCODE_Datasets, pDsfileWrite.get(), nullptr) && pDsfileWrite->GetSize() > 0) { @@ -196,7 +196,7 @@ bool SaveXFADocumentData(CPDFXFA_Context* pContext, } // L"form" { - ScopedFileStream pfileWrite(FX_CreateMemoryStream()); + ScopedFileStream pfileWrite(IFX_MemoryStream::Create()); if (pXFADocView->GetDoc()->SavePackage(XFA_HASHCODE_Form, pfileWrite.get(), pChecksum.get()) && pfileWrite->GetSize() > 0) { diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index c7cc1242fe..1c27b6c69b 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -393,16 +393,14 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, // NOTE: the creation of the file needs to be by the embedder on the // other side of this API. IFX_SeekableReadStream* pFileAccess = - FX_CreateFileRead((const FX_CHAR*)file_path); - if (!pFileAccess) { + IFX_SeekableReadStream::CreateFromFilename((const FX_CHAR*)file_path); + if (!pFileAccess) return nullptr; - } - std::unique_ptr<CPDF_Parser> pParser(new CPDF_Parser); + auto pParser = pdfium::MakeUnique<CPDF_Parser>(); pParser->SetPassword(password); - std::unique_ptr<CPDF_Document> pDocument( - new CPDF_Document(std::move(pParser))); + auto pDocument = pdfium::MakeUnique<CPDF_Document>(std::move(pParser)); CPDF_Parser::Error error = pDocument->GetParser()->StartParse(pFileAccess, pDocument.get()); if (error != CPDF_Parser::SUCCESS) { |