diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-09-14 20:58:36 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-09-14 20:58:36 +0000 |
commit | 65be34f5356ac43b973d41839da9c84f82b9ca17 (patch) | |
tree | 39cc52931d8b08e07d518c2099ae57d181886636 /fpdfsdk/cpdfsdk_interform.cpp | |
parent | 59d2a590a5fc061663fec0a1543b608e8af9eec9 (diff) | |
download | pdfium-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.cpp | 9 |
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; |