diff options
author | Lei Zhang <thestig@chromium.org> | 2015-12-22 13:48:10 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-12-22 13:48:10 -0800 |
commit | 1fc92867ca53f0fba4272fbee3814d844f487495 (patch) | |
tree | 8c81760b66d1e8da186bddc52d38f350f4e85bf1 /core/src/fpdfdoc | |
parent | f6dafc90ec1a0df8d618efc68c0223f0cdd80ffb (diff) | |
download | pdfium-1fc92867ca53f0fba4272fbee3814d844f487495.tar.xz |
Add ContainsKey() and ContainsValue() and use them where appropriate.
R=ochang@chromium.org
Review URL: https://codereview.chromium.org/1540263003 .
Diffstat (limited to 'core/src/fpdfdoc')
-rw-r--r-- | core/src/fpdfdoc/doc_form.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp index 9f949cc965..c49f042b32 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; @@ -831,8 +832,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) @@ -1004,10 +1004,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()) { @@ -1060,8 +1058,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; |