diff options
Diffstat (limited to 'fpdfsdk/fpdfxfa')
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_context.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_context.h | 3 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp | 29 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h | 6 |
4 files changed, 22 insertions, 18 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp index 7945786070..1995882388 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp @@ -328,7 +328,7 @@ CFX_WideString CPDFXFA_Context::Response(const CFX_WideString& wsQuestion, return wsAnswer; } -IFX_SeekableReadStream* CPDFXFA_Context::DownloadURL( +CFX_RetainPtr<IFX_SeekableReadStream> CPDFXFA_Context::DownloadURL( const CFX_WideString& wsURL) { return m_pFormFillEnv ? m_pFormFillEnv->DownloadFromURL(wsURL.c_str()) : nullptr; diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.h b/fpdfsdk/fpdfxfa/cpdfxfa_context.h index 2cd2b439d3..8b9daea26f 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_context.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.h @@ -67,7 +67,8 @@ class CPDFXFA_Context : public IXFA_AppProvider { const CFX_WideString& wsTitle, const CFX_WideString& wsDefaultAnswer, bool bMark) override; - IFX_SeekableReadStream* DownloadURL(const CFX_WideString& wsURL) override; + CFX_RetainPtr<IFX_SeekableReadStream> DownloadURL( + const CFX_WideString& wsURL) override; bool PostRequestURL(const CFX_WideString& wsURL, const CFX_WideString& wsData, const CFX_WideString& wsContentType, diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp index 6e199e2ff1..2b3368bc60 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp @@ -11,6 +11,7 @@ #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_stream_acc.h" #include "core/fpdfapi/parser/cpdf_string.h" +#include "core/fxcrt/cfx_retain_ptr.h" #include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "fpdfsdk/cpdfsdk_pageview.h" @@ -437,15 +438,15 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, if (!pFileHandler) return; - std::unique_ptr<IFX_SeekableStream, ReleaseDeleter<IFX_SeekableStream>> - fileWrite(MakeSeekableStream(pFileHandler)); + CFX_RetainPtr<IFX_SeekableStream> fileWrite = + MakeSeekableStream(pFileHandler); CFX_ByteString content; if (fileType == FXFA_SAVEAS_XML) { content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; fileWrite->WriteBlock(content.c_str(), fileWrite->GetSize(), content.GetLength()); - m_pContext->GetXFADocView()->GetDoc()->SavePackage( - XFA_HASHCODE_Data, fileWrite.get(), nullptr); + m_pContext->GetXFADocView()->GetDoc()->SavePackage(XFA_HASHCODE_Data, + fileWrite, nullptr); } else if (fileType == FXFA_SAVEAS_XDP) { if (!m_pContext->GetPDFDoc()) return; @@ -475,13 +476,13 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, if (!pStream) continue; if (pPrePDFObj->GetString() == "form") { - m_pContext->GetXFADocView()->GetDoc()->SavePackage( - XFA_HASHCODE_Form, fileWrite.get(), nullptr); + m_pContext->GetXFADocView()->GetDoc()->SavePackage(XFA_HASHCODE_Form, + fileWrite, nullptr); continue; } if (pPrePDFObj->GetString() == "datasets") { m_pContext->GetXFADocView()->GetDoc()->SavePackage( - XFA_HASHCODE_Datasets, fileWrite.get(), nullptr); + XFA_HASHCODE_Datasets, fileWrite, nullptr); continue; } if (i == size - 1) { @@ -699,7 +700,7 @@ bool CPDFXFA_DocEnvironment::SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) { return ret; } -IFX_SeekableReadStream* CPDFXFA_DocEnvironment::OpenLinkedFile( +CFX_RetainPtr<IFX_SeekableReadStream> CPDFXFA_DocEnvironment::OpenLinkedFile( CXFA_FFDoc* hDoc, const CFX_WideString& wsLink) { CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); @@ -729,13 +730,13 @@ bool CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, if (!pFormFillEnv) return false; - std::unique_ptr<IFX_SeekableStream, ReleaseDeleter<IFX_SeekableStream>> - fileStream(MakeSeekableStream(pFileHandler)); + CFX_RetainPtr<IFX_SeekableStream> fileStream = + MakeSeekableStream(pFileHandler); if (fileType == FXFA_SAVEAS_XML) { const char kContent[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; fileStream->WriteBlock(kContent, 0, strlen(kContent)); - m_pContext->GetXFADoc()->SavePackage(XFA_HASHCODE_Data, fileStream.get(), + m_pContext->GetXFADoc()->SavePackage(XFA_HASHCODE_Data, fileStream, nullptr); return true; } @@ -797,11 +798,11 @@ bool CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, if (pPrePDFObj->GetString() == "form" && !(flag & FXFA_FORM)) continue; if (pPrePDFObj->GetString() == "form") { - m_pContext->GetXFADoc()->SavePackage(XFA_HASHCODE_Form, fileStream.get(), + m_pContext->GetXFADoc()->SavePackage(XFA_HASHCODE_Form, fileStream, nullptr); } else if (pPrePDFObj->GetString() == "datasets") { - m_pContext->GetXFADoc()->SavePackage(XFA_HASHCODE_Datasets, - fileStream.get(), nullptr); + m_pContext->GetXFADoc()->SavePackage(XFA_HASHCODE_Datasets, fileStream, + nullptr); } else { // PDF,creator. } diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h index a7d41a88c8..d7cb169616 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h @@ -7,6 +7,7 @@ #ifndef FPDFSDK_FPDFXFA_CPDFXFA_DOCENVIRONMENT_H_ #define FPDFSDK_FPDFXFA_CPDFXFA_DOCENVIRONMENT_H_ +#include "core/fxcrt/cfx_retain_ptr.h" #include "public/fpdfview.h" #include "xfa/fxfa/fxfa.h" @@ -85,8 +86,9 @@ class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment { const CFX_ByteStringC& szPropName, CFXJSE_Value* pValue) override; - IFX_SeekableReadStream* OpenLinkedFile(CXFA_FFDoc* hDoc, - const CFX_WideString& wsLink) override; + CFX_RetainPtr<IFX_SeekableReadStream> OpenLinkedFile( + CXFA_FFDoc* hDoc, + const CFX_WideString& wsLink) override; private: bool OnBeforeNotifySubmit(); |