Make CPDF_FormField::SetItemSelection() and friends return void
Return value is never used, also the same for CheckControl()
and ResetField().
Change-Id: Ie5bd9f51cfddc3054e0d7084b0fc84b0a855217c
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/129551
Reviewed-by: Thomas Sepez <tsepez@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index 1e7886d..6694661 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -167,7 +167,7 @@
return pdfium::WrapRetain(GetFieldDictInternal());
}
-bool CPDF_FormField::ResetField() {
+void CPDF_FormField::ResetField() {
switch (m_Type) {
case kCheckBox:
case kRadioButton: {
@@ -189,7 +189,7 @@
if (iIndex >= 0)
csValue = GetOptionLabel(iIndex);
if (!NotifyListOrComboBoxBeforeChange(csValue)) {
- return false;
+ return;
}
SetItemSelection(iIndex, NotificationOption::kDoNotNotify);
NotifyListOrComboBoxAfterChange();
@@ -215,10 +215,10 @@
bool bHasRV = !!GetFieldAttrInternal(pdfium::form_fields::kRV);
if (!bHasRV && (csDValue == csValue))
- return false;
+ return;
if (!m_pForm->NotifyBeforeValueChange(this, csDValue))
- return false;
+ return;
{
// Limit scope of |pDV| because it may get invalidated during
@@ -227,7 +227,7 @@
if (pDV) {
RetainPtr<CPDF_Object> pClone = pDV->Clone();
if (!pClone)
- return false;
+ return;
m_pDict->SetFor(pdfium::form_fields::kV, std::move(pClone));
if (bHasRV) {
@@ -242,7 +242,6 @@
break;
}
}
- return true;
}
int CPDF_FormField::CountControls() const {
@@ -518,15 +517,15 @@
: IsSelectedOption(GetOptionValue(index));
}
-bool CPDF_FormField::SetItemSelection(int index, NotificationOption notify) {
+void CPDF_FormField::SetItemSelection(int index, NotificationOption notify) {
CHECK(IsComboOrListField(GetType()));
if (index < 0 || index >= CountOptions()) {
- return false;
+ return;
}
WideString opt_value = GetOptionValue(index);
if (notify == NotificationOption::kNotify &&
!NotifyListOrComboBoxBeforeChange(opt_value)) {
- return false;
+ return;
}
SetItemSelectionSelected(index, opt_value);
@@ -538,7 +537,6 @@
if (notify == NotificationOption::kNotify)
NotifyListOrComboBoxAfterChange();
- return true;
}
void CPDF_FormField::SetItemSelectionSelected(int index,
@@ -635,16 +633,17 @@
return -1;
}
-bool CPDF_FormField::CheckControl(int iControlIndex,
+void CPDF_FormField::CheckControl(int iControlIndex,
bool bChecked,
NotificationOption notify) {
DCHECK(GetType() == kCheckBox || GetType() == kRadioButton);
CPDF_FormControl* pControl = GetControl(iControlIndex);
- if (!pControl)
- return false;
- if (!bChecked && pControl->IsChecked() == bChecked)
- return false;
-
+ if (!pControl) {
+ return;
+ }
+ if (!bChecked && pControl->IsChecked() == bChecked) {
+ return;
+ }
const WideString csWExport = pControl->GetExportValue();
int iCount = CountControls();
for (int i = 0; i < iCount; i++) {
@@ -686,7 +685,6 @@
}
if (notify == NotificationOption::kNotify)
m_pForm->NotifyAfterCheckedStatusChange(this);
- return true;
}
WideString CPDF_FormField::GetCheckValue(bool bDefault) const {
diff --git a/core/fpdfdoc/cpdf_formfield.h b/core/fpdfdoc/cpdf_formfield.h
index c43f89e..4c8cbaa 100644
--- a/core/fpdfdoc/cpdf_formfield.h
+++ b/core/fpdfdoc/cpdf_formfield.h
@@ -86,7 +86,7 @@
RetainPtr<const CPDF_Object> GetFieldAttr(const ByteString& name) const;
RetainPtr<const CPDF_Dictionary> GetFieldDict() const;
- bool ResetField();
+ void ResetField();
int CountControls() const;
CPDF_FormControl* GetControl(int index) const;
@@ -114,7 +114,7 @@
bool ClearSelection(NotificationOption notify);
bool IsItemSelected(int index) const;
- bool SetItemSelection(int index, NotificationOption notify);
+ void SetItemSelection(int index, NotificationOption notify);
int GetDefaultSelectedItem() const;
@@ -126,7 +126,7 @@
WideString GetOptionValue(int index) const;
int FindOption(const WideString& csOptValue) const;
- bool CheckControl(int iControlIndex,
+ void CheckControl(int iControlIndex,
bool bChecked,
NotificationOption notify);