summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_interform.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-09-14 20:58:36 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-14 20:58:36 +0000
commit65be34f5356ac43b973d41839da9c84f82b9ca17 (patch)
tree39cc52931d8b08e07d518c2099ae57d181886636 /fpdfsdk/cpdfsdk_interform.cpp
parent59d2a590a5fc061663fec0a1543b608e8af9eec9 (diff)
downloadpdfium-65be34f5356ac43b973d41839da9c84f82b9ca17.tar.xz
Change two memcpys to iterator form of vector constructor.
Because bytestring supports standard iterators. Change-Id: Iaa33d79dbbf07d660eee1dd95d9f5f15547fb57c Reviewed-on: https://pdfium-review.googlesource.com/42511 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_interform.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_interform.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index 0e44268b39..d8f999ec72 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -500,12 +500,10 @@ bool CPDFSDK_InterForm::SubmitFields(const WideString& csDestination,
bool bIncludeOrExclude,
bool bUrlEncoded) {
ByteString textBuf = ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude);
- size_t nBufSize = textBuf.GetLength();
- if (nBufSize == 0)
+ if (textBuf.IsEmpty())
return false;
- std::vector<uint8_t> buffer(nBufSize);
- memcpy(buffer.data(), textBuf.c_str(), nBufSize);
+ std::vector<uint8_t> buffer(textBuf.begin(), textBuf.end());
if (bUrlEncoded && !FDFToURLEncodedData(&buffer))
return false;
@@ -539,8 +537,7 @@ bool CPDFSDK_InterForm::SubmitForm(const WideString& sDestination,
if (fdfBuffer.IsEmpty())
return false;
- std::vector<uint8_t> buffer(fdfBuffer.GetLength());
- memcpy(buffer.data(), fdfBuffer.c_str(), fdfBuffer.GetLength());
+ std::vector<uint8_t> buffer(fdfBuffer.begin(), fdfBuffer.end());
if (bUrlEncoded && !FDFToURLEncodedData(&buffer))
return false;