From ebe865db548f768038186054fc0f1eb024565c43 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 21 Nov 2017 22:05:40 +0000 Subject: Cleanup CXFA_SubmitData This CL cleans up the CXFA_SubmitData methods by using returns instead of out-params, sets the correct return types and makes the methods const. Change-Id: I41fe8f59e450ca444b64c291ac4a0a199c7ad0cf Reviewed-on: https://pdfium-review.googlesource.com/19111 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp | 8 ++++---- xfa/fxfa/parser/cxfa_submitdata.cpp | 12 ++++++------ xfa/fxfa/parser/cxfa_submitdata.h | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp index 2c13b92d4e..000e1a904e 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp @@ -900,8 +900,7 @@ bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc, if (!pFormFillEnv) return false; - WideString csURL; - submitData.GetSubmitTarget(csURL); + WideString csURL = submitData.GetSubmitTarget(); if (csURL.IsEmpty()) { WideString ws; ws.FromLocal("Submit cancelled."); @@ -917,9 +916,9 @@ bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc, int fileFlag = -1; switch (submitData.GetSubmitFormat()) { case XFA_ATTRIBUTEENUM_Xdp: { - WideString csContent; - submitData.GetSubmitXDPContent(csContent); + WideString csContent = submitData.GetSubmitXDPContent(); csContent.Trim(); + WideString space; space.FromLocal(" "); csContent = space + csContent + space; @@ -950,6 +949,7 @@ bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc, } if (!pFileHandler) return false; + if (csURL.Left(7).CompareNoCase(L"mailto:") == 0) { WideString csToAddress; WideString csCCAddress; diff --git a/xfa/fxfa/parser/cxfa_submitdata.cpp b/xfa/fxfa/parser/cxfa_submitdata.cpp index c461ed2a09..e10dec62f0 100644 --- a/xfa/fxfa/parser/cxfa_submitdata.cpp +++ b/xfa/fxfa/parser/cxfa_submitdata.cpp @@ -10,18 +10,18 @@ CXFA_SubmitData::CXFA_SubmitData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} -bool CXFA_SubmitData::IsSubmitEmbedPDF() { +bool CXFA_SubmitData::IsSubmitEmbedPDF() const { return m_pNode->JSNode()->GetBoolean(XFA_Attribute::EmbedPDF); } -int32_t CXFA_SubmitData::GetSubmitFormat() { +XFA_ATTRIBUTEENUM CXFA_SubmitData::GetSubmitFormat() const { return m_pNode->JSNode()->GetEnum(XFA_Attribute::Format); } -void CXFA_SubmitData::GetSubmitTarget(WideString& wsTarget) { - wsTarget = m_pNode->JSNode()->GetCData(XFA_Attribute::Target); +WideString CXFA_SubmitData::GetSubmitTarget() const { + return m_pNode->JSNode()->GetCData(XFA_Attribute::Target); } -void CXFA_SubmitData::GetSubmitXDPContent(WideString& wsContent) { - wsContent = m_pNode->JSNode()->GetCData(XFA_Attribute::XdpContent); +WideString CXFA_SubmitData::GetSubmitXDPContent() const { + return m_pNode->JSNode()->GetCData(XFA_Attribute::XdpContent); } diff --git a/xfa/fxfa/parser/cxfa_submitdata.h b/xfa/fxfa/parser/cxfa_submitdata.h index e90848d9f1..039c327b97 100644 --- a/xfa/fxfa/parser/cxfa_submitdata.h +++ b/xfa/fxfa/parser/cxfa_submitdata.h @@ -17,10 +17,10 @@ class CXFA_SubmitData : public CXFA_DataData { public: explicit CXFA_SubmitData(CXFA_Node* pNode); - bool IsSubmitEmbedPDF(); - int32_t GetSubmitFormat(); - void GetSubmitTarget(WideString& wsTarget); - void GetSubmitXDPContent(WideString& wsContent); + bool IsSubmitEmbedPDF() const; + XFA_ATTRIBUTEENUM GetSubmitFormat() const; + WideString GetSubmitTarget() const; + WideString GetSubmitXDPContent() const; }; #endif // XFA_FXFA_PARSER_CXFA_SUBMITDATA_H_ -- cgit v1.2.3