Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Unified Diff: core/src/fpdfdoc/doc_form.cpp

Issue 1540263003: Add ContainsKey() and ContainsValue() and use them where appropriate. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp ('k') | core/src/fxge/ge/fx_ge_fontmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfdoc/doc_form.cpp
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index 9f949cc96589b70dc1c3503e96608eb6c8bd0942..c49f042b32486e6f679d37ab9c422e1be0550572 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;
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp ('k') | core/src/fxge/ge/fx_ge_fontmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698