Style fixes in FPDFDOC_GetAnnotAP
Change-Id: Iac18632ab1da7e30958278fd7769d5d7090e4242
Reviewed-on: https://pdfium-review.googlesource.com/22490
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index 9f8ab78..d1baef5 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -142,9 +142,9 @@
CPDF_Stream* FPDFDOC_GetAnnotAP(const CPDF_Dictionary* pAnnotDict,
CPDF_Annot::AppearanceMode mode) {
CPDF_Dictionary* pAP = pAnnotDict->GetDictFor("AP");
- if (!pAP) {
+ if (!pAP)
return nullptr;
- }
+
const char* ap_entry = "N";
if (mode == CPDF_Annot::Down)
ap_entry = "D";
@@ -159,22 +159,20 @@
if (CPDF_Stream* pStream = psub->AsStream())
return pStream;
- if (CPDF_Dictionary* pDict = psub->AsDictionary()) {
- ByteString as = pAnnotDict->GetStringFor("AS");
- if (as.IsEmpty()) {
- ByteString value = pAnnotDict->GetStringFor("V");
- if (value.IsEmpty()) {
- CPDF_Dictionary* pParentDict = pAnnotDict->GetDictFor("Parent");
- value = pParentDict ? pParentDict->GetStringFor("V") : ByteString();
- }
- if (value.IsEmpty() || !pDict->KeyExist(value))
- as = "Off";
- else
- as = value;
+ CPDF_Dictionary* pDict = psub->AsDictionary();
+ if (!pDict)
+ return nullptr;
+
+ ByteString as = pAnnotDict->GetStringFor("AS");
+ if (as.IsEmpty()) {
+ ByteString value = pAnnotDict->GetStringFor("V");
+ if (value.IsEmpty()) {
+ CPDF_Dictionary* pParentDict = pAnnotDict->GetDictFor("Parent");
+ value = pParentDict ? pParentDict->GetStringFor("V") : ByteString();
}
- return pDict->GetStreamFor(as);
+ as = (!value.IsEmpty() && pDict->KeyExist(value)) ? value : "Off";
}
- return nullptr;
+ return pDict->GetStreamFor(as);
}
CPDF_Form* CPDF_Annot::GetAPForm(const CPDF_Page* pPage, AppearanceMode mode) {