From 35939f83e45b67de4ccc8c3e70e5e00be40326b6 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 17 Apr 2018 21:23:58 +0000 Subject: Avoid some string -> ptr -> string duplicate allocations in FF Environment Change-Id: I4bd89b64cd77a4e2fe0ffc2dcc415cc8fe34667a Reviewed-on: https://pdfium-review.googlesource.com/30871 Reviewed-by: dsinclair Commit-Queue: Tom Sepez --- fpdfsdk/fpdfxfa/cpdfxfa_context.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'fpdfsdk/fpdfxfa') diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp index e1721a3f86..949d886e01 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp @@ -258,8 +258,9 @@ int32_t CPDFXFA_Context::MsgBox(const WideString& wsMessage, iButtonType |= 3; break; } - int32_t iRet = m_pFormFillEnv->JS_appAlert(wsMessage.c_str(), wsTitle.c_str(), - iButtonType, iconType); + int32_t iRet = + m_pFormFillEnv->JS_appAlert(wsMessage, wsTitle, iButtonType, iconType); + switch (iRet) { case 1: return XFA_IDOK; @@ -282,9 +283,9 @@ WideString CPDFXFA_Context::Response(const WideString& wsQuestion, int nLength = 2048; std::vector pBuff(nLength); - nLength = m_pFormFillEnv->JS_appResponse(wsQuestion.c_str(), wsTitle.c_str(), - wsDefaultAnswer.c_str(), nullptr, - bMark, pBuff.data(), nLength); + nLength = m_pFormFillEnv->JS_appResponse(wsQuestion, wsTitle, wsDefaultAnswer, + WideString(), bMark, pBuff.data(), + nLength); if (nLength <= 0) return WideString(); @@ -297,8 +298,7 @@ WideString CPDFXFA_Context::Response(const WideString& wsQuestion, RetainPtr CPDFXFA_Context::DownloadURL( const WideString& wsURL) { - return m_pFormFillEnv ? m_pFormFillEnv->DownloadFromURL(wsURL.c_str()) - : nullptr; + return m_pFormFillEnv ? m_pFormFillEnv->DownloadFromURL(wsURL) : nullptr; } bool CPDFXFA_Context::PostRequestURL(const WideString& wsURL, @@ -310,9 +310,8 @@ bool CPDFXFA_Context::PostRequestURL(const WideString& wsURL, if (!m_pFormFillEnv) return false; - wsResponse = m_pFormFillEnv->PostRequestURL( - wsURL.c_str(), wsData.c_str(), wsContentType.c_str(), wsEncode.c_str(), - wsHeader.c_str()); + wsResponse = m_pFormFillEnv->PostRequestURL(wsURL, wsData, wsContentType, + wsEncode, wsHeader); return true; } @@ -320,8 +319,7 @@ bool CPDFXFA_Context::PutRequestURL(const WideString& wsURL, const WideString& wsData, const WideString& wsEncode) { return m_pFormFillEnv && - m_pFormFillEnv->PutRequestURL(wsURL.c_str(), wsData.c_str(), - wsEncode.c_str()); + m_pFormFillEnv->PutRequestURL(wsURL, wsData, wsEncode); } IFWL_AdapterTimerMgr* CPDFXFA_Context::GetTimerMgr() { -- cgit v1.2.3