summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/app.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-02 15:10:58 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-02 23:22:07 +0000
commitd7188f7f91a98906743c48f6aa92ad041d4b51b2 (patch)
tree060a870bbfd7ecd2220c665c3a1441c81247a240 /fpdfsdk/javascript/app.cpp
parenta290470880669630dba46ebe0c94b44f36f34f00 (diff)
downloadpdfium-d7188f7f91a98906743c48f6aa92ad041d4b51b2.tar.xz
Remove some more |new|s, part 11chromium/3088
Using vector<uint8_t> as a buffer. Change-Id: I38a8a05e7ec1355980d17533a2c8336e733aa6f6 Reviewed-on: https://pdfium-review.googlesource.com/4791 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/app.cpp')
-rw-r--r--fpdfsdk/javascript/app.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp
index 6d31d7e2e4..c9d7c3fd50 100644
--- a/fpdfsdk/javascript/app.cpp
+++ b/fpdfsdk/javascript/app.cpp
@@ -748,12 +748,10 @@ bool app::response(CJS_Runtime* pRuntime,
swLabel = newParams[4].ToCFXWideString(pRuntime);
const int MAX_INPUT_BYTES = 2048;
- std::unique_ptr<char[]> pBuff(new char[MAX_INPUT_BYTES + 2]);
- memset(pBuff.get(), 0, MAX_INPUT_BYTES + 2);
-
+ std::vector<uint8_t> pBuff(MAX_INPUT_BYTES + 2);
int nLengthBytes = pRuntime->GetFormFillEnv()->JS_appResponse(
swQuestion.c_str(), swTitle.c_str(), swDefault.c_str(), swLabel.c_str(),
- bPassword, pBuff.get(), MAX_INPUT_BYTES);
+ bPassword, pBuff.data(), MAX_INPUT_BYTES);
if (nLengthBytes < 0 || nLengthBytes > MAX_INPUT_BYTES) {
sError = JSGetStringFromID(IDS_STRING_JSPARAM_TOOLONG);
@@ -761,7 +759,7 @@ bool app::response(CJS_Runtime* pRuntime,
}
vRet = CJS_Value(pRuntime, CFX_WideString::FromUTF16LE(
- reinterpret_cast<uint16_t*>(pBuff.get()),
+ reinterpret_cast<uint16_t*>(pBuff.data()),
nLengthBytes / sizeof(uint16_t))
.c_str());