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

Unified Diff: fpdfsdk/src/fsdk_annothandler.cpp

Issue 1512763013: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits Created 5 years 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 | « fpdfsdk/src/fsdk_actionhandler.cpp ('k') | fpdfsdk/src/fsdk_baseannot.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fsdk_annothandler.cpp
diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp
index 39dabe72bd08f524860af22d262794354cc9c70b..feaee744283487454029c70864fa85b374cf95ad 100644
--- a/fpdfsdk/src/fsdk_annothandler.cpp
+++ b/fpdfsdk/src/fsdk_annothandler.cpp
@@ -49,8 +49,7 @@ void CPDFSDK_AnnotHandlerMgr::UnRegisterAnnotHandler(
CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot,
CPDFSDK_PageView* pPageView) {
- ASSERT(pAnnot != NULL);
- ASSERT(pPageView != NULL);
+ ASSERT(pPageView);
if (IPDFSDK_AnnotHandler* pAnnotHandler =
GetAnnotHandler(pAnnot->GetSubType())) {
@@ -61,8 +60,6 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot,
}
void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
- ASSERT(pAnnot != NULL);
-
pAnnot->GetPDFPage();
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
@@ -74,8 +71,6 @@ void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
}
void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) {
- ASSERT(pAnnot != NULL);
-
CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
CPDFSDK_DateTime curTime;
@@ -88,7 +83,7 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) {
}
void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) {
- ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
pAnnotHandler->OnLoad(pAnnot);
@@ -97,12 +92,8 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) {
IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(
CPDFSDK_Annot* pAnnot) const {
- ASSERT(pAnnot != NULL);
-
CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
- if (pPDFAnnot)
- return GetAnnotHandler(pPDFAnnot->GetSubType());
- return nullptr;
+ return pPDFAnnot ? GetAnnotHandler(pPDFAnnot->GetSubType()) : nullptr;
}
IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(
@@ -131,7 +122,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown(
CPDFSDK_Annot* pAnnot,
FX_DWORD nFlags,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
return pAnnotHandler->OnLButtonDown(pPageView, pAnnot, nFlags, point);
@@ -142,7 +133,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_DWORD nFlags,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
return pAnnotHandler->OnLButtonUp(pPageView, pAnnot, nFlags, point);
@@ -154,7 +145,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk(
CPDFSDK_Annot* pAnnot,
FX_DWORD nFlags,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
return pAnnotHandler->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
@@ -165,7 +156,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_DWORD nFlags,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
return pAnnotHandler->OnMouseMove(pPageView, pAnnot, nFlags, point);
@@ -177,7 +168,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(CPDFSDK_PageView* pPageView,
FX_DWORD nFlags,
short zDelta,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
return pAnnotHandler->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta,
@@ -190,7 +181,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown(
CPDFSDK_Annot* pAnnot,
FX_DWORD nFlags,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
return pAnnotHandler->OnRButtonDown(pPageView, pAnnot, nFlags, point);
@@ -201,7 +192,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_DWORD nFlags,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
return pAnnotHandler->OnRButtonUp(pPageView, pAnnot, nFlags, point);
@@ -212,7 +203,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView* pPageView,
void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_DWORD nFlag) {
- ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
pAnnotHandler->OnMouseEnter(pPageView, pAnnot, nFlag);
@@ -223,7 +214,7 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView* pPageView,
void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_DWORD nFlag) {
- ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
pAnnotHandler->OnMouseExit(pPageView, pAnnot, nFlag);
@@ -271,7 +262,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot,
FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(CPDFSDK_Annot* pAnnot,
FX_DWORD nFlag) {
- ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
if (pAnnotHandler->OnSetFocus(pAnnot, nFlag)) {
@@ -361,15 +352,13 @@ CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot,
}
void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
- ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot);
if (m_pFormFiller)
m_pFormFiller->OnDelete(pAnnot);
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm();
- ASSERT(pInterForm != NULL);
-
CPDF_FormControl* pCtrol = pWidget->GetFormControl();
pInterForm->RemoveMap(pCtrol);
@@ -396,7 +385,6 @@ void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView,
void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_DWORD nFlag) {
- ASSERT(pAnnot != NULL);
CFX_ByteString sSubType = pAnnot->GetSubType();
if (sSubType == BFFT_SIGNATURE) {
@@ -408,7 +396,6 @@ void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
void CPDFSDK_BFAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_DWORD nFlag) {
- ASSERT(pAnnot != NULL);
CFX_ByteString sSubType = pAnnot->GetSubType();
if (sSubType == BFFT_SIGNATURE) {
@@ -421,7 +408,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_DWORD nFlags,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
CFX_ByteString sSubType = pAnnot->GetSubType();
if (sSubType == BFFT_SIGNATURE) {
@@ -437,7 +423,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_DWORD nFlags,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
CFX_ByteString sSubType = pAnnot->GetSubType();
if (sSubType == BFFT_SIGNATURE) {
@@ -453,7 +438,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_DWORD nFlags,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
CFX_ByteString sSubType = pAnnot->GetSubType();
if (sSubType == BFFT_SIGNATURE) {
@@ -469,7 +453,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_DWORD nFlags,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
CFX_ByteString sSubType = pAnnot->GetSubType();
if (sSubType == BFFT_SIGNATURE) {
@@ -486,7 +469,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView,
FX_DWORD nFlags,
short zDelta,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
CFX_ByteString sSubType = pAnnot->GetSubType();
if (sSubType == BFFT_SIGNATURE) {
@@ -503,7 +485,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_DWORD nFlags,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
CFX_ByteString sSubType = pAnnot->GetSubType();
if (sSubType == BFFT_SIGNATURE) {
@@ -518,7 +499,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_DWORD nFlags,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
CFX_ByteString sSubType = pAnnot->GetSubType();
if (sSubType == BFFT_SIGNATURE) {
@@ -533,7 +513,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView,
FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot,
FX_DWORD nChar,
FX_DWORD nFlags) {
- ASSERT(pAnnot != NULL);
CFX_ByteString sSubType = pAnnot->GetSubType();
if (sSubType == BFFT_SIGNATURE) {
@@ -548,7 +527,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot,
FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot,
int nKeyCode,
int nFlag) {
- ASSERT(pAnnot != NULL);
CFX_ByteString sSubType = pAnnot->GetSubType();
if (sSubType == BFFT_SIGNATURE) {
@@ -566,7 +544,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot,
return FALSE;
}
void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) {
- ASSERT(pAnnot != NULL);
CFX_ByteString sSubType = pAnnot->GetSubType();
if (sSubType == BFFT_SIGNATURE) {
@@ -599,7 +576,6 @@ void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) {
FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot,
FX_DWORD nFlag) {
- ASSERT(pAnnot != NULL);
CFX_ByteString sSubType = pAnnot->GetSubType();
if (sSubType == BFFT_SIGNATURE) {
@@ -612,7 +588,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot,
}
FX_BOOL CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot,
FX_DWORD nFlag) {
- ASSERT(pAnnot != NULL);
CFX_ByteString sSubType = pAnnot->GetSubType();
if (sSubType == BFFT_SIGNATURE) {
@@ -626,7 +601,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot,
CPDF_Rect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) {
- ASSERT(pAnnot != NULL);
CFX_ByteString sSubType = pAnnot->GetSubType();
if (sSubType == BFFT_SIGNATURE) {
« no previous file with comments | « fpdfsdk/src/fsdk_actionhandler.cpp ('k') | fpdfsdk/src/fsdk_baseannot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698