From bfe042a4c4f0bd739c568754ebee6d993e134ad3 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 4 Nov 2015 14:04:13 -0500 Subject: Merge to XFA: Cleanup after syncing CPDFSDK_BAAnnot This cleans up various things after syncing BAAnnot to master. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1418043007 . (cherry picked from commit 110650e68e519e8cf14fe1119b77cf3309ed2d0b) Review URL: https://codereview.chromium.org/1415933007 . --- fpdfsdk/src/fsdk_baseannot.cpp | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'fpdfsdk/src/fsdk_baseannot.cpp') diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp index 1c96936f03..45f359a9d2 100644 --- a/fpdfsdk/src/fsdk_baseannot.cpp +++ b/fpdfsdk/src/fsdk_baseannot.cpp @@ -9,9 +9,6 @@ #include "../include/fsdk_mgr.h" #include "../include/fsdk_baseannot.h" -//--------------------------------------------------------------------------- -// CPDFSDK_DateTime -//--------------------------------------------------------------------------- int _gAfxGetTimeZoneInSeconds(FX_CHAR tzhour, uint8_t tzminute) { return (int)tzhour * 3600 + (int)tzminute * (tzhour >= 0 ? 60 : -60); } @@ -503,19 +500,13 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::AddSeconds(int seconds) { return *this; } -//--------------------------------------------------------------------------- -// CPDFSDK_Annot -//--------------------------------------------------------------------------- CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView) - : m_pPageView(pPageView), m_bSelected(FALSE), m_nTabOrder(-1) {} + : m_pPageView(pPageView), m_bSelected(FALSE), m_nTabOrder(-1) { +} -// CPDFSDK_BAAnnot CPDFSDK_BAAnnot::CPDFSDK_BAAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView) - : CPDFSDK_Annot(pPageView), m_pAnnot(pAnnot) {} - -CPDFSDK_BAAnnot::~CPDFSDK_BAAnnot() { - m_pAnnot = NULL; + : CPDFSDK_Annot(pPageView), m_pAnnot(pAnnot) { } CPDF_Annot* CPDFSDK_BAAnnot::GetPDFAnnot() const { @@ -867,8 +858,8 @@ void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType, m_pAnnot->GetAnnotDict()->SetAt("AP", pAPDict); } - CPDF_Stream* pStream = NULL; - CPDF_Dictionary* pParentDict = NULL; + CPDF_Stream* pStream = nullptr; + CPDF_Dictionary* pParentDict = nullptr; if (sAPState.IsEmpty()) { pParentDict = pAPDict; @@ -885,11 +876,9 @@ void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType, } if (!pStream) { - ASSERT(m_pPageView != NULL); - CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); - ASSERT(pDoc != NULL); + pStream = new CPDF_Stream(nullptr, 0, nullptr); - pStream = new CPDF_Stream(NULL, 0, NULL); + CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); int32_t objnum = pDoc->AddIndirectObject(pStream); // pAPDict->SetAtReference(sAPType, pDoc, objnum); ASSERT(pParentDict != NULL); @@ -897,13 +886,12 @@ void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType, } CPDF_Dictionary* pStreamDict = pStream->GetDict(); - if (!pStreamDict) { pStreamDict = new CPDF_Dictionary; pStreamDict->SetAtName("Type", "XObject"); pStreamDict->SetAtName("Subtype", "Form"); pStreamDict->SetAtInteger("FormType", 1); - pStream->InitStream(NULL, 0, pStreamDict); + pStream->InitStream(nullptr, 0, pStreamDict); } if (pStreamDict) { -- cgit v1.2.3