Simplify CheckForUnsupportedAnnot() internals.
In this case, there is no need to call CPDF_Dictionary::KeyExists()
before calling GetStringFor().
Change-Id: I69187e16759b3993ea864ea4295d5ea2ae01a923
Reviewed-on: https://pdfium-review.googlesource.com/c/51231
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_helpers.cpp b/fpdfsdk/cpdfsdk_helpers.cpp
index fcedc1f..2a64f5f 100644
--- a/fpdfsdk/cpdfsdk_helpers.cpp
+++ b/fpdfsdk/cpdfsdk_helpers.cpp
@@ -377,10 +377,8 @@
break;
case CPDF_Annot::Subtype::SCREEN: {
const CPDF_Dictionary* pAnnotDict = pAnnot->GetAnnotDict();
- ByteString cbString;
- if (pAnnotDict->KeyExist("IT"))
- cbString = pAnnotDict->GetStringFor("IT");
- if (cbString.Compare("Img") != 0)
+ ByteString cbString = pAnnotDict->GetStringFor("IT");
+ if (cbString != "Img")
RaiseUnSupportError(FPDF_UNSP_ANNOT_SCREEN_MEDIA);
break;
}
@@ -392,10 +390,8 @@
break;
case CPDF_Annot::Subtype::WIDGET: {
const CPDF_Dictionary* pAnnotDict = pAnnot->GetAnnotDict();
- ByteString cbString;
- if (pAnnotDict->KeyExist("FT"))
- cbString = pAnnotDict->GetStringFor("FT");
- if (cbString.Compare("Sig") == 0)
+ ByteString cbString = pAnnotDict->GetStringFor("FT");
+ if (cbString == "Sig")
RaiseUnSupportError(FPDF_UNSP_ANNOT_SIG);
break;
}