From 4dc112664e9d87c0d450ee3349a5091c624a3363 Mon Sep 17 00:00:00 2001 From: thestig Date: Sat, 15 Oct 2016 18:31:04 -0700 Subject: Fix some nits in cpdf_annotlist.cpp. Review-Url: https://codereview.chromium.org/2395693002 --- core/fpdfdoc/cpdf_annotlist.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp index f73ace9791..b626115de1 100644 --- a/core/fpdfdoc/cpdf_annotlist.cpp +++ b/core/fpdfdoc/cpdf_annotlist.cpp @@ -6,6 +6,9 @@ #include "core/fpdfdoc/cpdf_annotlist.h" +#include +#include + #include "core/fpdfapi/page/cpdf_page.h" #include "core/fpdfapi/parser/cpdf_document.h" #include "core/fpdfapi/parser/cpdf_reference.h" @@ -64,11 +67,13 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) CPDF_Dictionary* pRoot = m_pDocument->GetRoot(); CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm"); - FX_BOOL bRegenerateAP = - pAcroForm && pAcroForm->GetBooleanFor("NeedAppearances"); + bool bRegenerateAP = pAcroForm && pAcroForm->GetBooleanFor("NeedAppearances"); for (size_t i = 0; i < pAnnots->GetCount(); ++i) { CPDF_Dictionary* pDict = ToDictionary(pAnnots->GetDirectObjectAt(i)); - if (!pDict || pDict->GetStringFor("Subtype") == "Popup") { + if (!pDict) + continue; + const CFX_ByteString subtype = pDict->GetStringFor("Subtype"); + if (subtype == "Popup") { // Skip creating Popup annotations in the PDF document since PDFium // provides its own Popup annotations. continue; @@ -76,7 +81,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) pAnnots->ConvertToIndirectObjectAt(i, m_pDocument); m_AnnotList.push_back( std::unique_ptr(new CPDF_Annot(pDict, m_pDocument, false))); - if (bRegenerateAP && pDict->GetStringFor("Subtype") == "Widget" && + if (bRegenerateAP && subtype == "Widget" && CPDF_InterForm::IsUpdateAPEnabled()) { FPDF_GenerateAP(m_pDocument, pDict); } -- cgit v1.2.3