summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/fsdk_annothandler.cpp11
-rw-r--r--fpdfsdk/src/fsdk_baseannot.cpp24
2 files changed, 10 insertions, 25 deletions
diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp
index d6a2c00bd6..d3d6567ccd 100644
--- a/fpdfsdk/src/fsdk_annothandler.cpp
+++ b/fpdfsdk/src/fsdk_annothandler.cpp
@@ -116,13 +116,13 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView,
CFX_RenderDevice* pDevice,
CPDF_Matrix* pUser2Device,
FX_DWORD dwFlags) {
- ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
pAnnotHandler->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
} else {
- ((CPDFSDK_BAAnnot*)pAnnot)
- ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ static_cast<CPDFSDK_BAAnnot*>(pAnnot)
+ ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
}
}
@@ -381,12 +381,11 @@ void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView,
CFX_RenderDevice* pDevice,
CPDF_Matrix* pUser2Device,
FX_DWORD dwFlags) {
- ASSERT(pAnnot != NULL);
CFX_ByteString sSubType = pAnnot->GetSubType();
if (sSubType == BFFT_SIGNATURE) {
- ((CPDFSDK_BAAnnot*)pAnnot)
- ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ static_cast<CPDFSDK_BAAnnot*>(pAnnot)
+ ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
} else {
if (m_pFormFiller) {
m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp
index e9ef0fb2b6..52f34fae8e 100644
--- a/fpdfsdk/src/fsdk_baseannot.cpp
+++ b/fpdfsdk/src/fsdk_baseannot.cpp
@@ -8,9 +8,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);
}
@@ -502,23 +499,15 @@ 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) {
}
-// 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;
-}
-
CPDF_Annot* CPDFSDK_BAAnnot::GetPDFAnnot() const {
return m_pAnnot;
}
@@ -868,8 +857,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;
@@ -886,23 +875,20 @@ 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);
pParentDict->SetAtReference(sAPType, pDoc, objnum);
}
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) {