summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-22 13:49:44 -0800
committerLei Zhang <thestig@chromium.org>2015-12-22 13:49:44 -0800
commitcd2bb30aba89a05c0bbd4d6973fa070205e3a1e8 (patch)
tree0eca7841e7be4b9392bbcd0ffb656a8495f64792 /core/src/fpdfdoc
parentbc75f1737f7eb8d45c5a2ebd3ad78203782c1642 (diff)
downloadpdfium-cd2bb30aba89a05c0bbd4d6973fa070205e3a1e8.tar.xz
Merge to XFA: Add ContainsKey() and ContainsValue() and use them where appropriate.
TBR=ochang@chromium.org Review URL: https://codereview.chromium.org/1540263003 . (cherry picked from commit 1fc92867ca53f0fba4272fbee3814d844f487495) Review URL: https://codereview.chromium.org/1542193002 .
Diffstat (limited to 'core/src/fpdfdoc')
-rw-r--r--core/src/fpdfdoc/doc_form.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index 1d10f68f71..8776337402 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -6,6 +6,7 @@
#include "core/include/fpdfdoc/fpdf_doc.h"
#include "doc_utils.h"
+#include "third_party/base/stl_util.h"
const int nMaxRecursion = 32;
@@ -846,8 +847,7 @@ bool CPDF_InterForm::ResetForm(const std::vector<CPDF_FormField*>& fields,
if (!pField)
continue;
- auto it = std::find(fields.begin(), fields.end(), pField);
- if (bIncludeOrExclude == (it != fields.end()))
+ if (bIncludeOrExclude == pdfium::ContainsValue(fields, pField))
pField->ResetField(bNotify);
}
if (bNotify && m_pFormNotify)
@@ -1019,10 +1019,8 @@ CPDF_FormField* CPDF_InterForm::CheckRequiredFields(
continue;
bool bFind = true;
- if (fields) {
- auto it = std::find(fields->begin(), fields->end(), pField);
- bFind = (it != fields->end());
- }
+ if (fields)
+ bFind = pdfium::ContainsValue(*fields, pField);
if (bIncludeOrExclude == bFind) {
CPDF_Dictionary* pFieldDict = pField->m_pDict;
if ((dwFlags & 0x02) != 0 && pFieldDict->GetString("V").IsEmpty()) {
@@ -1075,8 +1073,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(
if (dwFlags & 0x04)
continue;
- auto it = std::find(fields.begin(), fields.end(), pField);
- if (bIncludeOrExclude == (it != fields.end())) {
+ if (bIncludeOrExclude == pdfium::ContainsValue(fields, pField)) {
if ((dwFlags & 0x02) != 0 && pField->m_pDict->GetString("V").IsEmpty())
continue;