Fix CPDF_InterForm::CheckRequiredFields and its callers.
The method is used twice in fpdfsdk/cpdfsdk_interform.cpp and twice in
fpdfsdk/javascript/Document.cpp, but not in a compatible way. Changed
the method so that it now returns true when checks pass, which is the
more natural thing to do, considering the name of the method.
BUG=pdfium:659
Change-Id: Iacf3049f328df1d4db3fbfc995acf184230ebf48
Reviewed-on: https://pdfium-review.googlesource.com/2297
Commit-Queue: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index 7b77180..b22ccb1 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -427,13 +427,13 @@
std::vector<CPDF_FormField*> fields = GetFieldFromObjects(fieldObjects);
if (!fields.empty()) {
bool bIncludeOrExclude = !(dwFlags & 0x01);
- if (m_pInterForm->CheckRequiredFields(&fields, bIncludeOrExclude))
+ if (!m_pInterForm->CheckRequiredFields(&fields, bIncludeOrExclude))
return false;
return SubmitFields(sDestination, fields, bIncludeOrExclude, false);
}
}
- if (m_pInterForm->CheckRequiredFields(nullptr, true))
+ if (!m_pInterForm->CheckRequiredFields(nullptr, true))
return false;
return SubmitForm(sDestination, false);