diff options
author | Lei Zhang <thestig@chromium.org> | 2015-12-14 18:10:25 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-12-14 18:10:25 -0800 |
commit | e3c7c2b54348da4a6939f6672f6c6bff126815a7 (patch) | |
tree | 68cc9bebdd5f4f055bfa7de116862091709b4054 /fpdfsdk/src/fsdk_annothandler.cpp | |
parent | ba41a35553573ab718026e8508e1e32107db6595 (diff) | |
download | pdfium-e3c7c2b54348da4a6939f6672f6c6bff126815a7.tar.xz |
Get rid of most instance of 'foo != NULL'
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1512763013 .
Diffstat (limited to 'fpdfsdk/src/fsdk_annothandler.cpp')
-rw-r--r-- | fpdfsdk/src/fsdk_annothandler.cpp | 54 |
1 files changed, 14 insertions, 40 deletions
diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp index 39dabe72bd..feaee74428 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) { |