summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-01-08 17:11:43 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-08 22:26:45 +0000
commit1f2211e9c3d0c2c3a448280b58c85d021cb3ee4b (patch)
treec448a67f22c99ba36d5e41aa3c0f4cdb4461702a
parent64204f591bc27976a7123ec5a88558542486bb3f (diff)
downloadpdfium-chromium/3316.tar.xz
Style fixes in FPDFDOC_GetAnnotAPchromium/3316
Change-Id: Iac18632ab1da7e30958278fd7769d5d7090e4242 Reviewed-on: https://pdfium-review.googlesource.com/22490 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r--core/fpdfdoc/cpdf_annot.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index 9f8ab7878f..d1baef5052 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -142,9 +142,9 @@ uint32_t CPDF_Annot::GetFlags() const {
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 @@ CPDF_Stream* FPDFDOC_GetAnnotAP(const CPDF_Dictionary* pAnnotDict,
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) {