Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: core/fpdfdoc/cpdf_annotlist.cpp

Issue 2395693002: Fix some nits in cpdf_annotlist.cpp. (Closed)
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/cpdf_annotlist.cpp
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp
index f73ace979154a3580c4b40d9edf2e84ac260c96d..b626115de19238d3d75dd9763d455dbe7bcf8757 100644
--- a/core/fpdfdoc/cpdf_annotlist.cpp
+++ b/core/fpdfdoc/cpdf_annotlist.cpp
@@ -6,6 +6,9 @@
#include "core/fpdfdoc/cpdf_annotlist.h"
+#include <memory>
+#include <utility>
+
#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<CPDF_Annot>(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);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698