diff options
Diffstat (limited to 'fxjs/cjs_document.cpp')
-rw-r--r-- | fxjs/cjs_document.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp index b22d31b0b4..35e3e53437 100644 --- a/fxjs/cjs_document.cpp +++ b/fxjs/cjs_document.cpp @@ -326,15 +326,12 @@ CJS_Return CJS_Document::mailForm( WideString cBcc = nLength > 3 ? pRuntime->ToWideString(params[3]) : L""; WideString cSubject = nLength > 4 ? pRuntime->ToWideString(params[4]) : L""; WideString cMsg = nLength > 5 ? pRuntime->ToWideString(params[5]) : L""; - - size_t nBufSize = sTextBuf.GetLength(); - std::unique_ptr<char, FxFreeDeleter> pMutableBuf(FX_Alloc(char, nBufSize)); - memcpy(pMutableBuf.get(), sTextBuf.c_str(), nBufSize); + std::vector<char> mutable_buf(sTextBuf.begin(), sTextBuf.end()); pRuntime->BeginBlock(); CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv(); - pFormFillEnv->JS_docmailForm(pMutableBuf.get(), nBufSize, bUI, cTo, cSubject, - cCc, cBcc, cMsg); + pFormFillEnv->JS_docmailForm(mutable_buf.data(), mutable_buf.size(), bUI, cTo, + cSubject, cCc, cBcc, cMsg); pRuntime->EndBlock(); return CJS_Return(); } |