Remove always-"Off" argument from SetAppState() Then simplify and rename as appropriate. Change-Id: I67bef96ac31ae18a6fe85cd49eea68f8d3344700 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/79514 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_appstream.cpp b/fpdfsdk/cpdfsdk_appstream.cpp index 2945f41..1284439 100644 --- a/fpdfsdk/cpdfsdk_appstream.cpp +++ b/fpdfsdk/cpdfsdk_appstream.cpp
@@ -1422,7 +1422,7 @@ ByteString csAS = widget_->GetAppState(); if (csAS.IsEmpty()) - widget_->SetAppState("Off"); + widget_->SetAppStateOff(); } void CPDFSDK_AppStream::SetAsRadioButton() { @@ -1554,7 +1554,7 @@ ByteString csAS = widget_->GetAppState(); if (csAS.IsEmpty()) - widget_->SetAppState("Off"); + widget_->SetAppStateOff(); } void CPDFSDK_AppStream::SetAsComboBox(Optional<WideString> sValue) {
diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp index 72551ee..dc3f891 100644 --- a/fpdfsdk/cpdfsdk_baannot.cpp +++ b/fpdfsdk/cpdfsdk_baannot.cpp
@@ -97,12 +97,9 @@ return GetAnnotDict()->GetIntegerFor(pdfium::annotation::kF); } -void CPDFSDK_BAAnnot::SetAppState(const ByteString& str) { +void CPDFSDK_BAAnnot::SetAppStateOff() { CPDF_Dictionary* pDict = GetAnnotDict(); - if (str.IsEmpty()) - pDict->RemoveFor(pdfium::annotation::kAS); - else - pDict->SetNewFor<CPDF_String>(pdfium::annotation::kAS, str, false); + pDict->SetNewFor<CPDF_String>(pdfium::annotation::kAS, "Off", false); } ByteString CPDFSDK_BAAnnot::GetAppState() const {
diff --git a/fpdfsdk/cpdfsdk_baannot.h b/fpdfsdk/cpdfsdk_baannot.h index df6f5f8..20eb2e6 100644 --- a/fpdfsdk/cpdfsdk_baannot.h +++ b/fpdfsdk/cpdfsdk_baannot.h
@@ -50,7 +50,7 @@ void SetFlags(uint32_t nFlags); uint32_t GetFlags() const; - void SetAppState(const ByteString& str); + void SetAppStateOff(); ByteString GetAppState() const; void SetBorderWidth(int nWidth);