summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/Document.cpp
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2017-08-04 12:28:52 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-04 16:48:53 +0000
commit5c09f4ca825652f910d3ff406fcbf64d25f56e23 (patch)
tree9af51506fcc914244bc682878801b8d362f6cfdd /fpdfsdk/javascript/Document.cpp
parenta2da7c5612f1fa26dde508da2a527a4bab381de0 (diff)
downloadpdfium-5c09f4ca825652f910d3ff406fcbf64d25f56e23.tar.xz
Remove CFX_ByteTextBuf from cpdfsdk_interform.cpp and others.chromium/3177
New version of the CL that include fpdf_parser_utility.cpp where there is an overload for CFX_ByteTextBuf << CPDF_Object* used by CFDF_Document. Bug: pdfium:731 Change-Id: I54f4e9ee7e10e94388f6f6584f3999f43689e84c Reviewed-on: https://pdfium-review.googlesource.com/10170 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/Document.cpp')
-rw-r--r--fpdfsdk/javascript/Document.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index ba4b2ae622..77878a53ed 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -7,6 +7,7 @@
#include "fpdfsdk/javascript/Document.h"
#include <algorithm>
+#include <sstream>
#include <utility>
#include <vector>
@@ -382,16 +383,21 @@ bool Document::mailForm(CJS_Runtime* pRuntime,
iLength > 4 ? params[4].ToCFXWideString(pRuntime) : L"";
CFX_WideString cMsg = iLength > 5 ? params[5].ToCFXWideString(pRuntime) : L"";
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
- CFX_ByteTextBuf textBuf;
- if (!pInterForm->ExportFormToFDFTextBuf(textBuf))
+ CFX_ByteString sTextBuf = pInterForm->ExportFormToFDFTextBuf();
+ if (sTextBuf.GetLength() == 0)
return false;
+ FX_STRSIZE nBufSize = sTextBuf.GetLength();
+ char* pMutableBuf = FX_Alloc(char, nBufSize);
+ memcpy(pMutableBuf, sTextBuf.c_str(), nBufSize);
+
pRuntime->BeginBlock();
CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv();
- pFormFillEnv->JS_docmailForm(textBuf.GetBuffer(), textBuf.GetLength(), bUI,
- cTo.c_str(), cSubject.c_str(), cCc.c_str(),
- cBcc.c_str(), cMsg.c_str());
+ pFormFillEnv->JS_docmailForm(pMutableBuf, nBufSize, bUI, cTo.c_str(),
+ cSubject.c_str(), cCc.c_str(), cBcc.c_str(),
+ cMsg.c_str());
pRuntime->EndBlock();
+ FX_Free(pMutableBuf);
return true;
}