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 | |
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')
37 files changed, 138 insertions, 826 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp index 97b061f56a..743c90e817 100644 --- a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp +++ b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp @@ -14,8 +14,6 @@ CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot, m_pAnnotDict(NULL), m_pDefaultFont(NULL), m_sAPType("N") { - ASSERT(pAnnot != NULL); - CPDF_Page* pPage = pAnnot->GetPDFPage(); m_pDocument = pPage->m_pDocument; diff --git a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp index b0fc906f98..0129707340 100644 --- a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp @@ -20,10 +20,7 @@ CPWL_Wnd* CFFL_CheckBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView) { CPWL_CheckBox* pWnd = new CPWL_CheckBox(); pWnd->Create(cp); - - ASSERT(m_pWidget != NULL); pWnd->SetCheck(m_pWidget->IsChecked()); - return pWnd; } @@ -45,10 +42,10 @@ FX_BOOL CFFL_CheckBox::OnChar(CPDFSDK_Annot* pAnnot, case FWL_VKEY_Return: case FWL_VKEY_Space: { CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); - ASSERT(pIFormFiller != NULL); + ASSERT(pIFormFiller); CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); FX_BOOL bReset = FALSE; FX_BOOL bExit = FALSE; @@ -94,18 +91,11 @@ FX_BOOL CFFL_CheckBox::OnLButtonUp(CPDFSDK_PageView* pPageView, } FX_BOOL CFFL_CheckBox::IsDataChanged(CPDFSDK_PageView* pPageView) { - ASSERT(m_pWidget != NULL); - - if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE)) { - return pWnd->IsChecked() != m_pWidget->IsChecked(); - } - - return FALSE; + CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE); + return pWnd && pWnd->IsChecked() != m_pWidget->IsChecked(); } void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) { - ASSERT(m_pWidget != NULL); - if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE)) { FX_BOOL bNewChecked = pWnd->IsChecked(); diff --git a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp index 858cc6285a..9458a14764 100644 --- a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp @@ -27,10 +27,7 @@ CFFL_ComboBox::~CFFL_ComboBox() { PWL_CREATEPARAM CFFL_ComboBox::GetCreateParam() { PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam(); - ASSERT(m_pWidget != NULL); - int nFlags = m_pWidget->GetFieldFlags(); - if (nFlags & FIELDFLAG_EDIT) { cp.dwFlags |= PCBS_ALLOWCUSTOMTEXT; } @@ -93,8 +90,6 @@ FX_BOOL CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) { } void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) { - ASSERT(m_pWidget != NULL); - if (CPWL_ComboBox* pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) { CFX_WideString swText = pWnd->GetText(); int32_t nCurSel = pWnd->GetSelect(); @@ -165,7 +160,6 @@ void CFFL_ComboBox::GetActionData(CPDFSDK_PageView* pPageView, break; case CPDF_AAction::LoseFocus: case CPDF_AAction::GetFocus: - ASSERT(m_pWidget != NULL); fa.sValue = m_pWidget->GetValue(); break; default: @@ -207,7 +201,7 @@ FX_BOOL CFFL_ComboBox::IsActionDataChanged(CPDF_AAction::AActionType type, } void CFFL_ComboBox::SaveState(CPDFSDK_PageView* pPageView) { - ASSERT(pPageView != NULL); + ASSERT(pPageView); if (CPWL_ComboBox* pComboBox = static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, FALSE))) { @@ -221,7 +215,7 @@ void CFFL_ComboBox::SaveState(CPDFSDK_PageView* pPageView) { } void CFFL_ComboBox::RestoreState(CPDFSDK_PageView* pPageView) { - ASSERT(pPageView != NULL); + ASSERT(pPageView); if (CPWL_ComboBox* pComboBox = static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, TRUE))) { @@ -257,9 +251,7 @@ CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, } void CFFL_ComboBox::OnSetFocus(CPWL_Wnd* pWnd) { - ASSERT(m_pApp != NULL); - - ASSERT(pWnd != NULL); + ASSERT(m_pApp); if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) { CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; @@ -279,11 +271,11 @@ void CFFL_ComboBox::OnSetFocus(CPWL_Wnd* pWnd) { } void CFFL_ComboBox::OnKillFocus(CPWL_Wnd* pWnd) { - ASSERT(m_pApp != NULL); + ASSERT(m_pApp); } void CFFL_ComboBox::OnAddUndo(CPWL_Edit* pEdit) { - ASSERT(pEdit != NULL); + ASSERT(pEdit); } CFX_WideString CFFL_ComboBox::GetSelectExportText() { diff --git a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp index e5b0f2968f..2e0451c0f6 100644 --- a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp @@ -49,8 +49,8 @@ CPDF_Rect CFFL_FormFiller::GetWindowRect(CPDFSDK_PageView* pPageView) { FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) { - ASSERT(pPageView != NULL); - ASSERT(pAnnot != NULL); + ASSERT(pPageView); + ASSERT(pAnnot); CPDF_Rect rcAnnot = m_pWidget->GetRect(); @@ -109,7 +109,7 @@ void CFFL_FormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, void CFFL_FormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) { EndTimer(); - ASSERT(m_pWidget != NULL); + ASSERT(m_pWidget); } FX_BOOL CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, @@ -216,7 +216,7 @@ FX_BOOL CFFL_FormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nFlags) { if (IsValid()) { CPDFSDK_PageView* pPageView = GetCurPageView(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { return pWnd->OnKeyDown(nKeyCode, nFlags); @@ -231,7 +231,7 @@ FX_BOOL CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nFlags) { if (IsValid()) { CPDFSDK_PageView* pPageView = GetCurPageView(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { return pWnd->OnChar(nChar, nFlags); @@ -284,7 +284,7 @@ FX_BOOL CFFL_FormFiller::IsValid() const { } PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() { - ASSERT(m_pApp != NULL); + ASSERT(m_pApp); PWL_CREATEPARAM cp; cp.pParentWnd = NULL; @@ -415,8 +415,6 @@ CFX_Matrix CFFL_FormFiller::GetWindowMatrix(void* pAttachedData) { CFX_Matrix CFFL_FormFiller::GetCurMatrix() { CFX_Matrix mt; - ASSERT(m_pWidget != NULL); - CPDF_Rect rcDA; m_pWidget->GetPDFAnnot()->GetRect(rcDA); @@ -443,7 +441,7 @@ CFX_Matrix CFFL_FormFiller::GetCurMatrix() { } CFX_WideString CFFL_FormFiller::LoadPopupMenuString(int nIndex) { - ASSERT(m_pApp != NULL); + ASSERT(m_pApp); return L""; } @@ -637,7 +635,7 @@ void CFFL_Button::OnMouseExit(CPDFSDK_PageView* pPageView, FX_RECT rect = GetViewBBox(pPageView, pAnnot); InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); EndTimer(); - ASSERT(m_pWidget != NULL); + ASSERT(m_pWidget); } FX_BOOL CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView, @@ -675,7 +673,7 @@ FX_BOOL CFFL_Button::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { - ASSERT(m_pApp != NULL); + ASSERT(m_pApp); return TRUE; } @@ -685,7 +683,7 @@ void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView, CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, FX_DWORD dwFlags) { - ASSERT(pPageView != NULL); + ASSERT(pPageView); CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; CPDF_FormControl* pCtrl = pWidget->GetFormControl(); CPDF_FormControl::HighlightingMode eHM = pCtrl->GetHighlightingMode(); diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp index a939942a55..6d8c3a9d4b 100644 --- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp @@ -15,12 +15,6 @@ #define FFL_MAXLISTBOXHEIGHT 140.0f -// HHOOK CFFL_IFormFiller::m_hookSheet = NULL; -// MSG CFFL_IFormFiller::g_Msg; - -/* ----------------------------- CFFL_IFormFiller ----------------------------- - */ - CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp) : m_pApp(pApp), m_bNotifying(FALSE) {} @@ -44,7 +38,7 @@ FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) return pFormFiller->GetViewBBox(pPageView, pAnnot); - ASSERT(pPageView != NULL); + ASSERT(pPageView); CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); CPDF_Rect rcAnnot; @@ -55,11 +49,11 @@ FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, } void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, - /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, + CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - /*const CRect& rcWindow,*/ FX_DWORD dwFlags) { - ASSERT(pPageView != NULL); + FX_DWORD dwFlags) { + ASSERT(pPageView); CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; if (IsVisible(pWidget)) { @@ -127,7 +121,6 @@ void CFFL_IFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) { void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); if (!m_bNotifying) { @@ -139,7 +132,7 @@ void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, pWidget->ClearAppModified(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -147,8 +140,6 @@ void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView); m_bNotifying = FALSE; - // if ( !IsValidAnnot(pPageView, pAnnot) ) return; - if (pWidget->IsAppModified()) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { pFormFiller->ResetPDFWindow(pPageView, @@ -166,7 +157,6 @@ void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); if (!m_bNotifying) { @@ -177,7 +167,7 @@ void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, int nValueAge = pWidget->GetValueAge(); pWidget->ClearAppModified(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -186,8 +176,6 @@ void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); m_bNotifying = FALSE; - // if (!IsValidAnnot(pPageView, pAnnot)) return; - if (pWidget->IsAppModified()) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { pFormFiller->ResetPDFWindow(pPageView, @@ -206,7 +194,6 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); if (!m_bNotifying) { @@ -218,7 +205,7 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, int nValueAge = pWidget->GetValueAge(); pWidget->ClearAppModified(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); @@ -286,7 +273,7 @@ void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag) { - ASSERT(pWidget != NULL); + ASSERT(pWidget); if (!m_bNotifying) { if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) { @@ -294,9 +281,7 @@ void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, int nAge = pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); - ASSERT(pPageView != NULL); - // CReader_DocView* pDocView = pPageView->GetDocView(); - // ASSERT(pDocView != NULL); + ASSERT(pPageView); PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -326,7 +311,6 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { @@ -340,7 +324,6 @@ FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); // change cursor @@ -356,7 +339,6 @@ FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, FX_UINT nFlags, short zDelta, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { @@ -370,7 +352,6 @@ FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { @@ -384,7 +365,6 @@ FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { @@ -397,7 +377,6 @@ FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { @@ -436,7 +415,7 @@ FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { pWidget->ClearAppModified(); CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -479,7 +458,7 @@ FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { pWidget->ClearAppModified(); CPDFSDK_PageView* pPageView = pWidget->GetPageView(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -501,10 +480,7 @@ FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) { } FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { - ASSERT(pWidget != NULL); - int nFieldFlags = pWidget->GetFieldFlags(); - return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; } @@ -584,8 +560,6 @@ void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMax, int32_t& nRet, FX_FLOAT& fPopupRet) { - ASSERT(pPrivateData != NULL); - CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; CPDF_Rect rcPageView(0, 0, 0, 0); @@ -593,7 +567,6 @@ void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight(); rcPageView.Normalize(); - ASSERT(pData->pWidget != NULL); CPDF_Rect rcAnnot = pData->pWidget->GetRect(); FX_FLOAT fTop = 0.0f; @@ -660,12 +633,11 @@ void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, FX_BOOL& bExit, FX_DWORD nFlag) { if (!m_bNotifying) { - ASSERT(pWidget != NULL); if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) { m_bNotifying = TRUE; pWidget->ClearAppModified(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -675,8 +647,6 @@ void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, fa.bRC = TRUE; CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); - ASSERT(pFormFiller != NULL); - pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); pFormFiller->SaveState(pPageView); @@ -684,9 +654,6 @@ void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); bRC = fa.bRC; - // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, - // pWidget); - m_bNotifying = FALSE; } } @@ -698,14 +665,11 @@ void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, FX_BOOL& bExit, FX_DWORD nFlag) { if (!m_bNotifying) { - ASSERT(pWidget != NULL); if (pWidget->GetAAction(CPDF_AAction::Validate)) { m_bNotifying = TRUE; pWidget->ClearAppModified(); - ASSERT(pPageView != NULL); - // CReader_DocView* pDocView = pPageView->GetDocView(); - // ASSERT(pDocView != NULL); + ASSERT(pPageView); PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -714,8 +678,6 @@ void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, fa.bRC = TRUE; CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); - ASSERT(pFormFiller != NULL); - pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); pFormFiller->SaveState(pPageView); @@ -723,9 +685,6 @@ void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); bRC = fa.bRC; - // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, - // pWidget); - m_bNotifying = FALSE; } } @@ -736,22 +695,12 @@ void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, FX_BOOL& bExit, FX_DWORD nFlag) { if (!m_bNotifying) { - ASSERT(pWidget != NULL); - ASSERT(pPageView != NULL); - // CReader_DocView* pDocView = pPageView->GetDocView(); - // ASSERT(pDocView != NULL); + ASSERT(pWidget); CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - pInterForm->OnCalculate(pWidget->GetFormField()); - // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, - // pWidget); - m_bNotifying = FALSE; } } @@ -761,24 +710,15 @@ void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, FX_BOOL& bExit, FX_DWORD nFlag) { if (!m_bNotifying) { - ASSERT(pWidget != NULL); - ASSERT(pPageView != NULL); - // CReader_DocView* pDocView = pPageView->GetDocView(); - // ASSERT(pDocView != NULL); + ASSERT(pWidget); CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); FX_BOOL bFormated = FALSE; CFX_WideString sValue = pInterForm->OnFormat(pWidget->GetFormField(), bFormated); - // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, - // pWidget); - if (bExit) return; @@ -809,20 +749,16 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(void* pPrivateData, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) { - ASSERT(pPrivateData != NULL); CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; - ASSERT(pData->pWidget != NULL); + ASSERT(pData->pWidget); CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); - ASSERT(pFormFiller != NULL); - if (!m_bNotifying) { if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) { m_bNotifying = TRUE; int nAge = pData->pWidget->GetAppearanceAge(); int nValueAge = pData->pWidget->GetValueAge(); - ASSERT(pData->pPageView != NULL); CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); PDFSDK_FieldAction fa; diff --git a/fpdfsdk/src/formfiller/FFL_ListBox.cpp b/fpdfsdk/src/formfiller/FFL_ListBox.cpp index 53a7570716..d00bfb12ff 100644 --- a/fpdfsdk/src/formfiller/FFL_ListBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ListBox.cpp @@ -25,7 +25,6 @@ CFFL_ListBox::~CFFL_ListBox() { PWL_CREATEPARAM CFFL_ListBox::GetCreateParam() { PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam(); - ASSERT(m_pWidget != NULL); FX_DWORD dwFieldFlag = m_pWidget->GetFieldFlags(); if (dwFieldFlag & FIELDFLAG_MULTISELECT) { @@ -52,7 +51,6 @@ CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, pWnd->AttachFFLData(this); pWnd->Create(cp); - ASSERT(m_pApp != NULL); CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); pWnd->SetFillerNotify(pIFormFiller); @@ -115,7 +113,7 @@ FX_BOOL CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView) { } void CFFL_ListBox::SaveData(CPDFSDK_PageView* pPageView) { - ASSERT(m_pWidget != NULL); + ASSERT(m_pWidget); if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) { CFX_IntArray aOldSelect, aNewSelect; @@ -161,7 +159,6 @@ void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView, } else { if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) { - ASSERT(m_pWidget != NULL); int32_t nCurSel = pListBox->GetCurSel(); if (nCurSel >= 0) fa.sValue = m_pWidget->GetOptionLabel(nCurSel); @@ -173,7 +170,6 @@ void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView, if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) { fa.sValue = L""; } else { - ASSERT(m_pWidget != NULL); int32_t nCurSel = m_pWidget->GetSelectedIndex(0); if (nCurSel >= 0) fa.sValue = m_pWidget->GetOptionLabel(nCurSel); @@ -189,7 +185,7 @@ void CFFL_ListBox::SetActionData(CPDFSDK_PageView* pPageView, const PDFSDK_FieldAction& fa) {} void CFFL_ListBox::SaveState(CPDFSDK_PageView* pPageView) { - ASSERT(pPageView != NULL); + ASSERT(pPageView); if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) { for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; i++) { diff --git a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp b/fpdfsdk/src/formfiller/FFL_RadioButton.cpp index 572cfeb29a..609e043024 100644 --- a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp +++ b/fpdfsdk/src/formfiller/FFL_RadioButton.cpp @@ -22,7 +22,6 @@ CPWL_Wnd* CFFL_RadioButton::NewPDFWindow(const PWL_CREATEPARAM& cp, CPWL_RadioButton* pWnd = new CPWL_RadioButton(); pWnd->Create(cp); - ASSERT(m_pWidget != NULL); pWnd->SetCheck(m_pWidget->IsChecked()); return pWnd; @@ -47,10 +46,8 @@ FX_BOOL CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot, case FWL_VKEY_Return: case FWL_VKEY_Space: { CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); - ASSERT(pIFormFiller != NULL); - CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); FX_BOOL bReset = FALSE; FX_BOOL bExit = FALSE; @@ -94,8 +91,6 @@ FX_BOOL CFFL_RadioButton::OnLButtonUp(CPDFSDK_PageView* pPageView, } FX_BOOL CFFL_RadioButton::IsDataChanged(CPDFSDK_PageView* pPageView) { - ASSERT(m_pWidget != NULL); - if (CPWL_RadioButton* pWnd = (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) { return pWnd->IsChecked() != m_pWidget->IsChecked(); @@ -105,16 +100,12 @@ FX_BOOL CFFL_RadioButton::IsDataChanged(CPDFSDK_PageView* pPageView) { } void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) { - ASSERT(m_pWidget != NULL); - if (CPWL_RadioButton* pWnd = (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) { FX_BOOL bNewChecked = pWnd->IsChecked(); if (bNewChecked) { CPDF_FormField* pField = m_pWidget->GetFormField(); - ASSERT(pField != NULL); - for (int32_t i = 0, sz = pField->CountControls(); i < sz; i++) { if (CPDF_FormControl* pCtrl = pField->GetControl(i)) { if (pCtrl->IsChecked()) { diff --git a/fpdfsdk/src/formfiller/FFL_TextField.cpp b/fpdfsdk/src/formfiller/FFL_TextField.cpp index 2dc82a892e..2e67ebf0f3 100644 --- a/fpdfsdk/src/formfiller/FFL_TextField.cpp +++ b/fpdfsdk/src/formfiller/FFL_TextField.cpp @@ -11,10 +11,7 @@ * ------------------------------- */ CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot) - : CFFL_FormFiller(pApp, pAnnot), - m_pFontMap(NULL) //, -// m_pSpellCheck(NULL) -{ + : CFFL_FormFiller(pApp, pAnnot), m_pFontMap(NULL) { m_State.nStart = m_State.nEnd = 0; } @@ -25,7 +22,6 @@ CFFL_TextField::~CFFL_TextField() { PWL_CREATEPARAM CFFL_TextField::GetCreateParam() { PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam(); - ASSERT(m_pWidget != NULL); int nFlags = m_pWidget->GetFieldFlags(); if (nFlags & FIELDFLAG_PASSWORD) { @@ -88,11 +84,9 @@ CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp, pWnd->AttachFFLData(this); pWnd->Create(cp); - ASSERT(m_pApp != NULL); CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); pWnd->SetFillerNotify(pIFormFiller); - ASSERT(m_pWidget != NULL); int32_t nMaxLen = m_pWidget->GetMaxLen(); CFX_WideString swValue = m_pWidget->GetValue(); @@ -116,7 +110,7 @@ FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, case FWL_VKEY_Return: if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE)) { CPDFSDK_PageView* pPageView = GetCurPageView(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); m_bValid = !m_bValid; CPDF_Rect rcAnnot = pAnnot->GetRect(); m_pApp->FFI_Invalidate(pAnnot->GetUnderlyingPage(), rcAnnot.left, @@ -136,7 +130,7 @@ FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, break; case FWL_VKEY_Escape: { CPDFSDK_PageView* pPageView = GetCurPageView(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); EscapeFiller(pPageView, TRUE); return TRUE; } @@ -146,8 +140,6 @@ FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, } FX_BOOL CFFL_TextField::IsDataChanged(CPDFSDK_PageView* pPageView) { - ASSERT(m_pWidget != NULL); - if (CPWL_Edit* pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) return pEdit->GetText() != m_pWidget->GetValue(); @@ -155,8 +147,6 @@ FX_BOOL CFFL_TextField::IsDataChanged(CPDFSDK_PageView* pPageView) { } void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView) { - ASSERT(m_pWidget != NULL); - if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { CFX_WideString sOldValue = m_pWidget->GetValue(); CFX_WideString sNewValue = pWnd->GetText(); @@ -191,7 +181,6 @@ void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView, break; case CPDF_AAction::LoseFocus: case CPDF_AAction::GetFocus: - ASSERT(m_pWidget != NULL); fa.sValue = m_pWidget->GetValue(); break; default: @@ -231,7 +220,7 @@ FX_BOOL CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, } void CFFL_TextField::SaveState(CPDFSDK_PageView* pPageView) { - ASSERT(pPageView != NULL); + ASSERT(pPageView); if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { pWnd->GetSel(m_State.nStart, m_State.nEnd); @@ -240,7 +229,7 @@ void CFFL_TextField::SaveState(CPDFSDK_PageView* pPageView) { } void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView) { - ASSERT(pPageView != NULL); + ASSERT(pPageView); if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, TRUE)) { pWnd->SetText(m_State.sValue.c_str()); @@ -269,10 +258,7 @@ CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, } void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) { - ASSERT(m_pApp != NULL); - - ASSERT(pWnd != NULL); - + ASSERT(m_pApp); if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) { CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; pEdit->SetCharSet(134); diff --git a/fpdfsdk/src/fpdfformfill.cpp b/fpdfsdk/src/fpdfformfill.cpp index c8b90303a6..93cfab8bdf 100644 --- a/fpdfsdk/src/fpdfformfill.cpp +++ b/fpdfsdk/src/fpdfformfill.cpp @@ -316,7 +316,6 @@ DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, CPDF_Action action = aa.GetAction((CPDF_AAction::AActionType)aaType); CPDFSDK_ActionHandler* pActionHandler = ((CPDFDoc_Environment*)hHandle)->GetActionHander(); - ASSERT(pActionHandler != NULL); pActionHandler->DoAction_Document(action, (CPDF_AAction::AActionType)aaType, pSDKDoc); } diff --git a/fpdfsdk/src/fsdk_actionhandler.cpp b/fpdfsdk/src/fsdk_actionhandler.cpp index 0043bc7787..9524b2a1a5 100644 --- a/fpdfsdk/src/fsdk_actionhandler.cpp +++ b/fpdfsdk/src/fsdk_actionhandler.cpp @@ -134,8 +134,6 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentOpenAction( FX_BOOL CPDFSDK_ActionHandler::ExecuteLinkAction(const CPDF_Action& action, CPDFSDK_Document* pDocument, CFX_PtrList& list) { - ASSERT(pDocument != NULL); - CPDF_Dictionary* pDict = action.GetDict(); if (list.Find(pDict)) return FALSE; @@ -181,8 +179,6 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentPageAction( CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CFX_PtrList& list) { - ASSERT(pDocument != NULL); - CPDF_Dictionary* pDict = action.GetDict(); if (list.Find(pDict)) return FALSE; @@ -216,15 +212,10 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentPageAction( FX_BOOL CPDFSDK_ActionHandler::IsValidField(CPDFSDK_Document* pDocument, CPDF_Dictionary* pFieldDict) { - ASSERT(pDocument != NULL); - ASSERT(pFieldDict != NULL); + ASSERT(pFieldDict); CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); - ASSERT(pPDFInterForm != NULL); - return pPDFInterForm->GetFieldByDict(pFieldDict) != NULL; } @@ -235,8 +226,6 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteFieldAction( CPDF_FormField* pFormField, PDFSDK_FieldAction& data, CFX_PtrList& list) { - ASSERT(pDocument != NULL); - CPDF_Dictionary* pDict = action.GetDict(); if (list.Find(pDict)) return FALSE; @@ -273,8 +262,6 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteScreenAction( CPDFSDK_Document* pDocument, CPDFSDK_Annot* pScreen, CFX_PtrList& list) { - ASSERT(pDocument != NULL); - CPDF_Dictionary* pDict = action.GetDict(); if (list.Find(pDict)) return FALSE; @@ -317,8 +304,6 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteBookMark(const CPDF_Action& action, CPDFSDK_Document* pDocument, CPDF_Bookmark* pBookmark, CFX_PtrList& list) { - ASSERT(pDocument != NULL); - CPDF_Dictionary* pDict = action.GetDict(); if (list.Find(pDict)) return FALSE; @@ -361,7 +346,7 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteBookMark(const CPDF_Action& action, void CPDFSDK_ActionHandler::DoAction_NoJs(const CPDF_Action& action, CPDFSDK_Document* pDocument) { - ASSERT(pDocument != NULL); + ASSERT(pDocument); switch (action.GetType()) { case CPDF_Action::GoTo: @@ -467,8 +452,6 @@ void CPDFSDK_ActionHandler::DoAction_URI(CPDFSDK_Document* pDocument, ASSERT(action); CPDFDoc_Environment* pApp = pDocument->GetEnv(); - ASSERT(pApp != NULL); - CFX_ByteString sURI = action.GetURI(pDocument->GetPDFDocument()); pApp->FFI_DoURIAction(sURI.c_str()); } @@ -492,16 +475,10 @@ void CPDFSDK_ActionHandler::RunFieldJavaScript(CPDFSDK_Document* pDocument, ASSERT(type != CPDF_AAction::Calculate); ASSERT(type != CPDF_AAction::Format); - ASSERT(pDocument != NULL); - IJS_Runtime* pRuntime = pDocument->GetJsRuntime(); - ASSERT(pRuntime != NULL); - pRuntime->SetReaderDocument(pDocument); IJS_Context* pContext = pRuntime->NewContext(); - ASSERT(pContext != NULL); - switch (type) { case CPDF_AAction::CursorEnter: pContext->OnField_MouseEnter(data.bModifier, data.bShift, pFormField); @@ -552,16 +529,9 @@ void CPDFSDK_ActionHandler::RunDocumentOpenJavaScript( CPDFSDK_Document* pDocument, const CFX_WideString& sScriptName, const CFX_WideString& script) { - ASSERT(pDocument != NULL); - IJS_Runtime* pRuntime = pDocument->GetJsRuntime(); - ASSERT(pRuntime != NULL); - pRuntime->SetReaderDocument(pDocument); - IJS_Context* pContext = pRuntime->NewContext(); - ASSERT(pContext != NULL); - pContext->OnDoc_Open(pDocument, sScriptName); CFX_WideString csInfo; @@ -577,16 +547,10 @@ void CPDFSDK_ActionHandler::RunDocumentPageJavaScript( CPDFSDK_Document* pDocument, CPDF_AAction::AActionType type, const CFX_WideString& script) { - ASSERT(pDocument != NULL); - IJS_Runtime* pRuntime = pDocument->GetJsRuntime(); - ASSERT(pRuntime != NULL); - pRuntime->SetReaderDocument(pDocument); IJS_Context* pContext = pRuntime->NewContext(); - ASSERT(pContext != NULL); - switch (type) { case CPDF_AAction::OpenPage: pContext->OnPage_Open(pDocument); @@ -631,11 +595,7 @@ void CPDFSDK_ActionHandler::RunDocumentPageJavaScript( FX_BOOL CPDFSDK_FormActionHandler::DoAction_Hide(const CPDF_Action& action, CPDFSDK_Document* pDocument) { - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - if (pInterForm->DoAction_Hide(action)) { pDocument->SetChangeMark(); return TRUE; @@ -647,37 +607,21 @@ FX_BOOL CPDFSDK_FormActionHandler::DoAction_Hide(const CPDF_Action& action, FX_BOOL CPDFSDK_FormActionHandler::DoAction_SubmitForm( const CPDF_Action& action, CPDFSDK_Document* pDocument) { - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - return pInterForm->DoAction_SubmitForm(action); } FX_BOOL CPDFSDK_FormActionHandler::DoAction_ResetForm( const CPDF_Action& action, CPDFSDK_Document* pDocument) { - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - - if (pInterForm->DoAction_ResetForm(action)) { - return TRUE; - } - - return FALSE; + return pInterForm->DoAction_ResetForm(action); } FX_BOOL CPDFSDK_FormActionHandler::DoAction_ImportData( const CPDF_Action& action, CPDFSDK_Document* pDocument) { - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - if (pInterForm->DoAction_ImportData(action)) { pDocument->SetChangeMark(); return TRUE; 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) { diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp index 11718cd56c..734b9828ec 100644 --- a/fpdfsdk/src/fsdk_baseannot.cpp +++ b/fpdfsdk/src/fsdk_baseannot.cpp @@ -528,8 +528,6 @@ void CPDFSDK_Annot::SetTabOrder(int iTabOrder) { } CPDF_Dictionary* CPDFSDK_BAAnnot::GetAnnotDict() const { - ASSERT(m_pAnnot != NULL); - return m_pAnnot->GetAnnotDict(); } @@ -541,17 +539,12 @@ void CPDFSDK_BAAnnot::SetRect(const CPDF_Rect& rect) { } CPDF_Rect CPDFSDK_BAAnnot::GetRect() const { - ASSERT(m_pAnnot != NULL); - CPDF_Rect rect; m_pAnnot->GetRect(rect); - return rect; } CFX_ByteString CPDFSDK_BAAnnot::GetType() const { - ASSERT(m_pAnnot != NULL); - return m_pAnnot->GetSubType(); } @@ -563,9 +556,6 @@ void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice, const CFX_Matrix* pUser2Device, CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions) { - ASSERT(m_pPageView != NULL); - ASSERT(m_pAnnot != NULL); - m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, mode, pOptions); } @@ -599,12 +589,10 @@ FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { void CPDFSDK_BAAnnot::DrawBorder(CFX_RenderDevice* pDevice, const CFX_Matrix* pUser2Device, const CPDF_RenderOptions* pOptions) { - ASSERT(m_pAnnot != NULL); m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions); } void CPDFSDK_BAAnnot::ClearCachedAP() { - ASSERT(m_pAnnot != NULL); m_pAnnot->ClearCachedAP(); } @@ -944,8 +932,6 @@ CPDF_AAction CPDFSDK_BAAnnot::GetAAction() const { } void CPDFSDK_BAAnnot::SetAAction(const CPDF_AAction& aa) { - ASSERT(aa != NULL); - if ((CPDF_AAction&)aa != m_pAnnot->GetAnnotDict()->GetDict("AA")) m_pAnnot->GetAnnotDict()->SetAt("AA", (CPDF_AAction&)aa); } diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp index 80f8c8fcad..3b35d99026 100644 --- a/fpdfsdk/src/fsdk_baseform.cpp +++ b/fpdfsdk/src/fsdk_baseform.cpp @@ -25,7 +25,7 @@ CPDFSDK_Widget::CPDFSDK_Widget(CPDF_Annot* pAnnot, m_pInterForm(pInterForm), m_nAppAge(0), m_nValueAge(0) { - ASSERT(m_pInterForm != NULL); + ASSERT(m_pInterForm); } CPDFSDK_Widget::~CPDFSDK_Widget() {} @@ -69,10 +69,7 @@ FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid( } int CPDFSDK_Widget::GetFieldType() const { - CPDF_FormField* pField = GetFormField(); - ASSERT(pField != NULL); - - return pField->GetFieldType(); + return GetFormField()->GetFieldType(); } FX_BOOL CPDFSDK_Widget::IsAppearanceValid() { @@ -81,8 +78,6 @@ FX_BOOL CPDFSDK_Widget::IsAppearanceValid() { int CPDFSDK_Widget::GetFieldFlags() const { CPDF_InterForm* pPDFInterForm = m_pInterForm->GetInterForm(); - ASSERT(pPDFInterForm != NULL); - CPDF_FormControl* pFormControl = pPDFInterForm->GetControlByDict(m_pAnnot->GetAnnotDict()); CPDF_FormField* pFormField = pFormControl->GetField(); @@ -109,7 +104,7 @@ CPDF_FormControl* CPDFSDK_Widget::GetFormControl() const { CPDF_FormControl* CPDFSDK_Widget::GetFormControl( CPDF_InterForm* pInterForm, const CPDF_Dictionary* pAnnotDict) { - ASSERT(pAnnotDict != NULL); + ASSERT(pAnnotDict); return pInterForm->GetControlByDict(pAnnotDict); } @@ -120,8 +115,6 @@ int CPDFSDK_Widget::GetRotate() const { FX_BOOL CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const { CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - int iColorType = 0; color = FX_ARGBTOCOLORREF(pFormCtrl->GetBackgroundColor(iColorType)); @@ -130,8 +123,6 @@ FX_BOOL CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const { FX_BOOL CPDFSDK_Widget::GetBorderColor(FX_COLORREF& color) const { CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - int iColorType = 0; color = FX_ARGBTOCOLORREF(pFormCtrl->GetBorderColor(iColorType)); @@ -140,8 +131,6 @@ FX_BOOL CPDFSDK_Widget::GetBorderColor(FX_COLORREF& color) const { FX_BOOL CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const { CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance(); if (da.HasColor()) { FX_ARGB argb; @@ -157,8 +146,6 @@ FX_BOOL CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const { FX_FLOAT CPDFSDK_Widget::GetFontSize() const { CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance(); CFX_ByteString csFont = ""; FX_FLOAT fFontSize = 0.0f; @@ -179,22 +166,16 @@ CFX_WideString CPDFSDK_Widget::GetValue() const { CFX_WideString CPDFSDK_Widget::GetDefaultValue() const { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - return pFormField->GetDefaultValue(); } CFX_WideString CPDFSDK_Widget::GetOptionLabel(int nIndex) const { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - return pFormField->GetOptionLabel(nIndex); } int CPDFSDK_Widget::CountOptions() const { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - return pFormField->CountOptions(); } @@ -215,33 +196,23 @@ FX_BOOL CPDFSDK_Widget::IsChecked() const { int CPDFSDK_Widget::GetAlignment() const { CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - return pFormCtrl->GetControlAlignment(); } int CPDFSDK_Widget::GetMaxLen() const { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - return pFormField->GetMaxLen(); } void CPDFSDK_Widget::SetCheck(FX_BOOL bChecked, FX_BOOL bNotify) { CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - CPDF_FormField* pFormField = pFormCtrl->GetField(); - ASSERT(pFormField != NULL); - pFormField->CheckControl(pFormField->GetControlIndex(pFormCtrl), bChecked, bNotify); } void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, FX_BOOL bNotify) { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - pFormField->SetValue(sValue, bNotify); } @@ -250,15 +221,11 @@ void CPDFSDK_Widget::SetOptionSelection(int index, FX_BOOL bSelected, FX_BOOL bNotify) { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - pFormField->SetItemSelection(index, bSelected, bNotify); } void CPDFSDK_Widget::ClearSelection(FX_BOOL bNotify) { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - pFormField->ClearSelection(bNotify); } @@ -309,22 +276,18 @@ void CPDFSDK_Widget::ResetAppearance(const FX_WCHAR* sValue, break; } - ASSERT(m_pAnnot != NULL); m_pAnnot->ClearCachedAP(); } CFX_WideString CPDFSDK_Widget::OnFormat(FX_BOOL& bFormated) { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); + ASSERT(pFormField); return m_pInterForm->OnFormat(pFormField, bFormated); } void CPDFSDK_Widget::ResetFieldAppearance(FX_BOOL bValueChanged) { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - - ASSERT(m_pInterForm != NULL); - + ASSERT(pFormField); m_pInterForm->ResetFieldAppearance(pFormField, NULL, bValueChanged); } @@ -357,16 +320,12 @@ void CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice, void CPDFSDK_Widget::UpdateField() { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - - ASSERT(m_pInterForm != NULL); + ASSERT(pFormField); m_pInterForm->UpdateField(pFormField); } void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPageView) { - ASSERT(m_pInterForm != NULL); - int nFieldType = GetFieldType(); if (m_pInterForm->IsNeedHighLight(nFieldType)) { CPDF_Rect rc = GetRect(); @@ -396,12 +355,8 @@ void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice, void CPDFSDK_Widget::ResetAppearance_PushButton() { CPDF_FormControl* pControl = GetFormControl(); - ASSERT(pControl != NULL); - CPDF_Rect rcWindow = GetRotatedRect(); - int32_t nLayout = 0; - switch (pControl->GetTextPosition()) { case TEXTPOS_ICON: nLayout = PPBL_ICON; @@ -536,7 +491,6 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() { CPDF_IconFit iconFit = pControl->GetIconFit(); CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); - ASSERT(pDoc != NULL); CPDFDoc_Environment* pEnv = pDoc->GetEnv(); CBA_FontMap FontMap(this, pEnv->GetSysHandler()); @@ -618,10 +572,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() { void CPDFSDK_Widget::ResetAppearance_CheckBox() { CPDF_FormControl* pControl = GetFormControl(); - ASSERT(pControl != NULL); - CPWL_Color crBackground, crBorder, crText; - int iColorType; FX_FLOAT fc[4]; @@ -747,10 +698,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() { void CPDFSDK_Widget::ResetAppearance_RadioButton() { CPDF_FormControl* pControl = GetFormControl(); - ASSERT(pControl != NULL); - CPWL_Color crBackground, crBorder, crText; - int iColorType; FX_FLOAT fc[4]; @@ -913,10 +861,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() { void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) { CPDF_FormControl* pControl = GetFormControl(); - ASSERT(pControl != NULL); CPDF_FormField* pField = pControl->GetField(); - ASSERT(pField != NULL); - CFX_ByteTextBuf sBody, sLines; CPDF_Rect rcClient = GetClientRect(); @@ -928,7 +873,6 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) { pEdit->EnableRefresh(FALSE); CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); - ASSERT(pDoc != NULL); CPDFDoc_Environment* pEnv = pDoc->GetEnv(); CBA_FontMap FontMap(this, pEnv->GetSysHandler()); FontMap.Initial(); @@ -992,19 +936,14 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) { void CPDFSDK_Widget::ResetAppearance_ListBox() { CPDF_FormControl* pControl = GetFormControl(); - ASSERT(pControl != NULL); CPDF_FormField* pField = pControl->GetField(); - ASSERT(pField != NULL); - CPDF_Rect rcClient = GetClientRect(); - CFX_ByteTextBuf sBody, sLines; if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) { pEdit->EnableRefresh(FALSE); CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); - ASSERT(pDoc != NULL); CPDFDoc_Environment* pEnv = pDoc->GetEnv(); CBA_FontMap FontMap(this, pEnv->GetSysHandler()); @@ -1086,17 +1025,13 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() { void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) { CPDF_FormControl* pControl = GetFormControl(); - ASSERT(pControl != NULL); CPDF_FormField* pField = pControl->GetField(); - ASSERT(pField != NULL); - CFX_ByteTextBuf sBody, sLines; if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) { pEdit->EnableRefresh(FALSE); CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); - ASSERT(pDoc != NULL); CPDFDoc_Environment* pEnv = pDoc->GetEnv(); CBA_FontMap FontMap(this, pEnv->GetSysHandler()); @@ -1315,8 +1250,6 @@ CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const { CFX_Matrix CPDFSDK_Widget::GetMatrix() const { CFX_Matrix mt; CPDF_FormControl* pControl = GetFormControl(); - ASSERT(pControl != NULL); - CPDF_Rect rcAnnot = GetRect(); FX_FLOAT fWidth = rcAnnot.right - rcAnnot.left; FX_FLOAT fHeight = rcAnnot.top - rcAnnot.bottom; @@ -1344,8 +1277,6 @@ CPWL_Color CPDFSDK_Widget::GetTextPWLColor() const { CPWL_Color crText = CPWL_Color(COLORTYPE_GRAY, 0); CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance(); if (da.HasColor()) { int32_t iColorType; @@ -1361,8 +1292,6 @@ CPWL_Color CPDFSDK_Widget::GetBorderPWLColor() const { CPWL_Color crBorder; CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - int32_t iColorType; FX_FLOAT fc[4]; pFormCtrl->GetOriginalBorderColor(iColorType, fc); @@ -1376,8 +1305,6 @@ CPWL_Color CPDFSDK_Widget::GetFillPWLColor() const { CPWL_Color crFill; CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - int32_t iColorType; FX_FLOAT fc[4]; pFormCtrl->GetOriginalBackgroundColor(iColorType, fc); @@ -1389,20 +1316,12 @@ CPWL_Color CPDFSDK_Widget::GetFillPWLColor() const { void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_Stream* pImage) { - ASSERT(pImage != NULL); - CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); - ASSERT(pDoc != NULL); + ASSERT(pDoc); CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP"); - ASSERT(pAPDict != NULL); - CPDF_Stream* pStream = pAPDict->GetStream(sAPType); - ASSERT(pStream != NULL); - CPDF_Dictionary* pStreamDict = pStream->GetDict(); - ASSERT(pStreamDict != NULL); - CFX_ByteString sImageAlias = "IMG"; if (CPDF_Dictionary* pImageDict = pImage->GetDict()) { @@ -1477,8 +1396,6 @@ CPDF_Action CPDFSDK_Widget::GetAAction(CPDF_AAction::AActionType eAAT) { CFX_WideString CPDFSDK_Widget::GetAlternateName() const { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - return pFormField->GetAlternateName(); } @@ -1601,8 +1518,7 @@ void CPDFSDK_InterForm::GetWidgets( int CPDFSDK_InterForm::GetPageIndexByAnnotDict( CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict) const { - ASSERT(pDocument != NULL); - ASSERT(pAnnotDict != NULL); + ASSERT(pAnnotDict); for (int i = 0, sz = pDocument->GetPageCount(); i < sz; i++) { if (CPDF_Dictionary* pPageDict = pDocument->GetPage(i)) { @@ -1698,7 +1614,6 @@ CPDF_Stream* CPDFSDK_InterForm::LoadImageFromFile(const CFX_WideString& sFile) { #endif void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { - ASSERT(m_pDocument != NULL); CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); ASSERT(pEnv); if (!pEnv->IsJSInitiated()) @@ -1711,8 +1626,6 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { if (IsCalculateEnabled()) { IJS_Runtime* pRuntime = m_pDocument->GetJsRuntime(); - ASSERT(pRuntime != NULL); - pRuntime->SetReaderDocument(m_pDocument); int nSize = m_pInterForm->CountFieldsInCalculationOrder(); @@ -1728,8 +1641,6 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { CFX_WideString csJS = action.GetJavaScript(); if (!csJS.IsEmpty()) { IJS_Context* pContext = pRuntime->NewContext(); - ASSERT(pContext != NULL); - CFX_WideString sOldValue = pField->GetValue(); CFX_WideString sValue = sOldValue; FX_BOOL bRC = TRUE; @@ -1758,9 +1669,6 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, FX_BOOL& bFormated) { - ASSERT(m_pDocument != NULL); - ASSERT(pFormField != NULL); - CFX_WideString sValue = pFormField->GetValue(); CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); ASSERT(pEnv); @@ -1770,8 +1678,6 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, } IJS_Runtime* pRuntime = m_pDocument->GetJsRuntime(); - ASSERT(pRuntime != NULL); - pRuntime->SetReaderDocument(m_pDocument); if (pFormField->GetFieldType() == FIELDTYPE_COMBOBOX) { @@ -1793,8 +1699,6 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, CFX_WideString Value = sValue; IJS_Context* pContext = pRuntime->NewContext(); - ASSERT(pContext != NULL); - pContext->OnField_Format(pFormField, Value, TRUE); CFX_WideString sInfo; @@ -1815,13 +1719,9 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField, const FX_WCHAR* sValue, FX_BOOL bValueChanged) { - ASSERT(pFormField != NULL); - for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) { CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); - ASSERT(pFormCtrl != NULL); - - ASSERT(m_pInterForm != NULL); + ASSERT(pFormCtrl); if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) pWidget->ResetAppearance(sValue, bValueChanged); } @@ -1830,7 +1730,7 @@ void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField, void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) { for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) { CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); - ASSERT(pFormCtrl != NULL); + ASSERT(pFormCtrl); if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) { CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); @@ -1848,19 +1748,12 @@ void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) { void CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, CFX_WideString& csValue, FX_BOOL& bRC) { - ASSERT(pFormField != NULL); - CPDF_AAction aAction = pFormField->GetAdditionalAction(); if (aAction && aAction.ActionExist(CPDF_AAction::KeyStroke)) { CPDF_Action action = aAction.GetAction(CPDF_AAction::KeyStroke); if (action) { - ASSERT(m_pDocument != NULL); CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); - ASSERT(pEnv != NULL); - CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); - ASSERT(pActionHandler != NULL); - PDFSDK_FieldAction fa; fa.bModifier = pEnv->FFI_IsCTRLKeyDown(0); fa.bShift = pEnv->FFI_IsSHIFTKeyDown(0); @@ -1876,19 +1769,12 @@ void CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, void CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, CFX_WideString& csValue, FX_BOOL& bRC) { - ASSERT(pFormField != NULL); - CPDF_AAction aAction = pFormField->GetAdditionalAction(); if (aAction && aAction.ActionExist(CPDF_AAction::Validate)) { CPDF_Action action = aAction.GetAction(CPDF_AAction::Validate); if (action) { - ASSERT(m_pDocument != NULL); CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); - ASSERT(pEnv != NULL); - CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); - ASSERT(pActionHandler != NULL); - PDFSDK_FieldAction fa; fa.bModifier = pEnv->FFI_IsCTRLKeyDown(0); fa.bShift = pEnv->FFI_IsSHIFTKeyDown(0); @@ -1901,8 +1787,6 @@ void CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, } } -/* ----------------------------- action ----------------------------- */ - FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { ASSERT(action); @@ -1937,7 +1821,6 @@ FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { } FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) { - ASSERT(m_pInterForm != NULL); CFX_WideString sDestination = action.GetFilePath(); if (sDestination.IsEmpty()) return FALSE; @@ -2050,15 +1933,11 @@ FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, if (sDestination.IsEmpty()) return FALSE; - CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); - ASSERT(pEnv != NULL); - - if (!m_pDocument) + if (!m_pDocument || !m_pInterForm) return FALSE; - CFX_WideString wsPDFFilePath = m_pDocument->GetPath(); - if (!m_pInterForm) - return FALSE; + CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); + CFX_WideString wsPDFFilePath = m_pDocument->GetPath(); CFDF_Document* pFDFDoc = m_pInterForm->ExportToFDF(wsPDFFilePath); if (!pFDFDoc) return FALSE; @@ -2088,9 +1967,6 @@ FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, } FX_BOOL CPDFSDK_InterForm::ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf) { - ASSERT(m_pInterForm != NULL); - ASSERT(m_pDocument != NULL); - CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath()); if (!pFDF) return FALSE; @@ -2134,9 +2010,6 @@ std::vector<CPDF_FormField*> CPDFSDK_InterForm::GetFieldFromObjects( return fields; } -/* ----------------------------- CPDF_FormNotify ----------------------------- - */ - int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, CFX_WideString& csValue) { CPDF_FormField* pFormField = (CPDF_FormField*)pField; @@ -2274,12 +2147,7 @@ CBA_AnnotIterator::CBA_AnnotIterator(CPDFSDK_PageView* pPageView, m_sType(sType), m_sSubType(sSubType), m_nTabs(BAI_STRUCTURE) { - ASSERT(m_pPageView != NULL); - CPDF_Page* pPDFPage = m_pPageView->GetPDFPage(); - ASSERT(pPDFPage != NULL); - ASSERT(pPDFPage->m_pFormDict != NULL); - CFX_ByteString sTabs = pPDFPage->m_pFormDict->GetString("Tabs"); if (sTabs == "R") { @@ -2342,8 +2210,8 @@ int CBA_AnnotIterator::CompareByLeft(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) { } int CBA_AnnotIterator::CompareByTop(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) { - ASSERT(p1 != NULL); - ASSERT(p2 != NULL); + ASSERT(p1); + ASSERT(p2); CPDF_Rect rcAnnot1 = GetAnnotRect(p1); CPDF_Rect rcAnnot2 = GetAnnotRect(p2); diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp index 8a73970e49..e01fe89610 100644 --- a/fpdfsdk/src/fsdk_mgr.cpp +++ b/fpdfsdk/src/fsdk_mgr.cpp @@ -578,12 +578,10 @@ FX_BOOL CPDFSDK_Document::GetPermissions(int nFlag) { } IJS_Runtime* CPDFSDK_Document::GetJsRuntime() { - ASSERT(m_pEnv != NULL); return m_pEnv->GetJSRuntime(); } CFX_WideString CPDFSDK_Document::GetPath() { - ASSERT(m_pEnv != NULL); return m_pEnv->JS_docGetFilePath(); } diff --git a/fpdfsdk/src/fxedit/fxet_ap.cpp b/fpdfsdk/src/fxedit/fxet_ap.cpp index bdce7c05db..4f879c0022 100644 --- a/fpdfsdk/src/fxedit/fxet_ap.cpp +++ b/fpdfsdk/src/fxedit/fxet_ap.cpp @@ -12,10 +12,7 @@ CFX_ByteString GetPDFWordString(IFX_Edit_FontMap* pFontMap, int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord) { - ASSERT(pFontMap != NULL); - CFX_ByteString sWord; - if (CPDF_Font* pPDFFont = pFontMap->GetPDFFont(nFontIndex)) { if (SubWord > 0) { Word = SubWord; diff --git a/fpdfsdk/src/fxedit/fxet_edit.cpp b/fpdfsdk/src/fxedit/fxet_edit.cpp index cca0319eb5..573a5723bd 100644 --- a/fpdfsdk/src/fxedit/fxet_edit.cpp +++ b/fpdfsdk/src/fxedit/fxet_edit.cpp @@ -93,7 +93,7 @@ IFX_Edit* CFX_Edit_Iterator::GetEdit() const { CFX_Edit_Provider::CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap) : m_pFontMap(pFontMap) { - ASSERT(m_pFontMap != NULL); + ASSERT(m_pFontMap); } CFX_Edit_Provider::~CFX_Edit_Provider() {} @@ -286,8 +286,6 @@ void CFX_Edit_Undo::Undo() { if (m_nCurUndoPos > 0) { IFX_Edit_UndoItem* pItem = m_UndoItemStack.GetAt(m_nCurUndoPos - 1); - ASSERT(pItem != NULL); - pItem->Undo(); m_nCurUndoPos--; @@ -308,8 +306,6 @@ void CFX_Edit_Undo::Redo() { if (m_nCurUndoPos < nStackSize) { IFX_Edit_UndoItem* pItem = m_UndoItemStack.GetAt(m_nCurUndoPos); - ASSERT(pItem != NULL); - pItem->Redo(); m_nCurUndoPos++; @@ -325,7 +321,7 @@ FX_BOOL CFX_Edit_Undo::IsWorking() const { void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) { ASSERT(!m_bWorking); - ASSERT(pItem != NULL); + ASSERT(pItem); ASSERT(m_nBufSize > 1); if (m_nCurUndoPos < m_UndoItemStack.GetSize()) @@ -390,8 +386,6 @@ CFX_Edit_GroupUndoItem::~CFX_Edit_GroupUndoItem() { } void CFX_Edit_GroupUndoItem::AddUndoItem(CFX_Edit_UndoItem* pUndoItem) { - ASSERT(pUndoItem != NULL); - pUndoItem->SetFirst(FALSE); pUndoItem->SetLast(FALSE); @@ -404,11 +398,9 @@ void CFX_Edit_GroupUndoItem::AddUndoItem(CFX_Edit_UndoItem* pUndoItem) { void CFX_Edit_GroupUndoItem::UpdateItems() { if (m_Items.GetSize() > 0) { CFX_Edit_UndoItem* pFirstItem = m_Items[0]; - ASSERT(pFirstItem != NULL); pFirstItem->SetFirst(TRUE); CFX_Edit_UndoItem* pLastItem = m_Items[m_Items.GetSize() - 1]; - ASSERT(pLastItem != NULL); pLastItem->SetLast(TRUE); } } @@ -416,8 +408,6 @@ void CFX_Edit_GroupUndoItem::UpdateItems() { void CFX_Edit_GroupUndoItem::Undo() { for (int i = m_Items.GetSize() - 1; i >= 0; i--) { CFX_Edit_UndoItem* pUndoItem = m_Items[i]; - ASSERT(pUndoItem != NULL); - pUndoItem->Undo(); } } @@ -425,8 +415,6 @@ void CFX_Edit_GroupUndoItem::Undo() { void CFX_Edit_GroupUndoItem::Redo() { for (int i = 0, sz = m_Items.GetSize(); i < sz; i++) { CFX_Edit_UndoItem* pUndoItem = m_Items[i]; - ASSERT(pUndoItem != NULL); - pUndoItem->Redo(); } } @@ -818,7 +806,7 @@ CFX_Edit::CFX_Edit(IPDF_VariableText* pVT) m_bNotify(TRUE), m_bOprNotify(FALSE), m_pGroupUndoItem(NULL) { - ASSERT(pVT != NULL); + ASSERT(pVT); } CFX_Edit::~CFX_Edit() { @@ -3107,8 +3095,6 @@ void CFX_Edit::BeginGroupUndo(const CFX_WideString& sTitle) { } void CFX_Edit::EndGroupUndo() { - ASSERT(m_pGroupUndoItem != NULL); - m_pGroupUndoItem->UpdateItems(); m_Undo.AddItem(m_pGroupUndoItem); if (m_bOprNotify && m_pOprNotify) diff --git a/fpdfsdk/src/fxedit/fxet_list.cpp b/fpdfsdk/src/fxedit/fxet_list.cpp index 19d41ccf41..1ece0ef11a 100644 --- a/fpdfsdk/src/fxedit/fxet_list.cpp +++ b/fpdfsdk/src/fxedit/fxet_list.cpp @@ -17,8 +17,6 @@ CFX_ListItem::CFX_ListItem() m_bCaret(FALSE), m_rcListItem(0.0f, 0.0f, 0.0f, 0.0f) { m_pEdit = IFX_Edit::NewEdit(); - ASSERT(m_pEdit != NULL); - m_pEdit->SetAlignmentV(1); m_pEdit->Initialize(); } diff --git a/fpdfsdk/src/fxedit/fxet_module.cpp b/fpdfsdk/src/fxedit/fxet_module.cpp index 12f2c86e03..553cf3a62f 100644 --- a/fpdfsdk/src/fxedit/fxet_module.cpp +++ b/fpdfsdk/src/fxedit/fxet_module.cpp @@ -19,8 +19,6 @@ IFX_Edit* IFX_Edit::NewEdit() { } void IFX_Edit::DelEdit(IFX_Edit* pEdit) { - ASSERT(pEdit != NULL); - IPDF_VariableText::DelVariableText(pEdit->GetVariableText()); delete (CFX_Edit*)pEdit; @@ -33,7 +31,6 @@ IFX_List* IFX_List::NewList() { } void IFX_List::DelList(IFX_List* pList) { - ASSERT(pList != NULL); - + ASSERT(pList); delete (CFX_ListCtrl*)pList; } diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp index 1fa88f9b12..b0ca69b5ba 100644 --- a/fpdfsdk/src/javascript/Document.cpp +++ b/fpdfsdk/src/javascript/Document.cpp @@ -22,11 +22,7 @@ static v8::Isolate* GetIsolate(IJS_Context* cc) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); - CJS_Runtime* pRuntime = pContext->GetJSRuntime(); - ASSERT(pRuntime != NULL); - return pRuntime->GetIsolate(); } @@ -194,8 +190,6 @@ FX_BOOL Document::numFields(IJS_Context* cc, FX_BOOL Document::dirty(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (vp.IsGetting()) { if (m_pDocument->GetChangeMark()) vp << true; @@ -218,8 +212,6 @@ FX_BOOL Document::dirty(IJS_Context* cc, FX_BOOL Document::ADBE(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (vp.IsGetting()) { vp.SetNull(); } else { @@ -231,8 +223,6 @@ FX_BOOL Document::ADBE(IJS_Context* cc, FX_BOOL Document::pageNum(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (vp.IsGetting()) { if (CPDFSDK_PageView* pPageView = m_pDocument->GetCurrentView()) { vp << pPageView->GetPageIndex(); @@ -394,8 +384,6 @@ FX_BOOL Document::mailForm(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; @@ -410,18 +398,13 @@ FX_BOOL Document::mailForm(IJS_Context* cc, CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - CFX_ByteTextBuf textBuf; if (!pInterForm->ExportFormToFDFTextBuf(textBuf)) return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CPDFDoc_Environment* pEnv = pContext->GetReaderApp(); - ASSERT(pEnv != NULL); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); - ASSERT(pRuntime != NULL); pRuntime->BeginBlock(); pEnv->JS_docmailForm(textBuf.GetBuffer(), textBuf.GetLength(), bUI, @@ -485,8 +468,6 @@ FX_BOOL Document::print(IJS_Context* cc, bAnnotations = params[7].ToBool(); } - ASSERT(m_pDocument != NULL); - if (CPDFDoc_Environment* pEnv = m_pDocument->GetEnv()) { pEnv->JS_docprint(bUI, nStart, nEnd, bSilent, bShrinkToFit, bPrintAsImage, bReverse, bAnnotations); @@ -503,8 +484,6 @@ FX_BOOL Document::removeField(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM))) return FALSE; @@ -518,7 +497,6 @@ FX_BOOL Document::removeField(IJS_Context* cc, CFX_WideString sFieldName = params[0].ToCFXWideString(); CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); std::vector<CPDFSDK_Widget*> widgets; pInterForm->GetWidgets(sFieldName, &widgets); @@ -1100,11 +1078,8 @@ FX_BOOL Document::baseURL(IJS_Context* cc, FX_BOOL Document::calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); if (vp.IsGetting()) { if (pInterForm->IsCalculateEnabled()) @@ -1220,7 +1195,6 @@ FX_BOOL Document::closeDoc(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); return TRUE; } @@ -1479,8 +1453,6 @@ FX_BOOL Document::calculateNow(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || m_pDocument->GetPermissions(FPDFPERM_FILL_FORM))) @@ -1488,7 +1460,6 @@ FX_BOOL Document::calculateNow(IJS_Context* cc, CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); pInterForm->OnCalculate(); return TRUE; } @@ -1503,8 +1474,6 @@ FX_BOOL Document::getPageNthWord(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; @@ -1565,8 +1534,6 @@ FX_BOOL Document::getPageNthWordQuads(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; @@ -1577,16 +1544,12 @@ FX_BOOL Document::getPageNumWords(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; int nPageNo = params.size() > 0 ? params[0].ToInt() : 0; CPDF_Document* pDocument = m_pDocument->GetPDFDocument(); - ASSERT(pDocument != NULL); - CJS_Context* pContext = static_cast<CJS_Context*>(cc); if (nPageNo < 0 || nPageNo >= pDocument->GetPageCount()) { sError = JSGetStringFromID(pContext, IDS_STRING_JSVALUEERROR); @@ -1673,8 +1636,6 @@ int Document::CountWords(CPDF_TextObject* pTextObj) { CFX_WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex) { - ASSERT(pTextObj != NULL); - CFX_WideString swRet; CPDF_Font* pFont = pTextObj->GetFont(); diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp index 39e15e9868..288ab5e747 100644 --- a/fpdfsdk/src/javascript/Field.cpp +++ b/fpdfsdk/src/javascript/Field.cpp @@ -19,8 +19,6 @@ #include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment. #include "fpdfsdk/include/javascript/IJavaScript.h" -/* ---------------------- Field ---------------------- */ - BEGIN_JS_STATIC_CONST(CJS_Field) END_JS_STATIC_CONST() @@ -156,22 +154,14 @@ void Field::ParseFieldName(const std::wstring& strFieldNameParsed, FX_BOOL Field::AttachField(Document* pDocument, const CFX_WideString& csFieldName) { - ASSERT(pDocument != NULL); m_pJSDoc = pDocument; - m_pDocument = pDocument->GetReaderDoc(); - ASSERT(m_pDocument != NULL); - m_bCanSet = m_pDocument->GetPermissions(FPDFPERM_FILL_FORM) || m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || m_pDocument->GetPermissions(FPDFPERM_MODIFY); CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm(); - ASSERT(pRDInterForm != NULL); - CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); - ASSERT(pInterForm != NULL); - CFX_WideString swFieldNameTemp = csFieldName; swFieldNameTemp.Replace(L"..", L"."); @@ -251,12 +241,9 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument, FX_BOOL bChangeMark, FX_BOOL bResetAP, FX_BOOL bRefresh) { - ASSERT(pDocument != NULL); - ASSERT(pFormControl != NULL); + ASSERT(pFormControl); CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl); if (pWidget) { @@ -278,7 +265,6 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument, if (bRefresh) { CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); CPDFSDK_Document* pDoc = pInterForm->GetDocument(); - ASSERT(pDoc != NULL); pDoc->UpdateAllViews(NULL, pWidget); } } @@ -289,19 +275,14 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument, CPDFSDK_Widget* Field::GetWidget(CPDFSDK_Document* pDocument, CPDF_FormControl* pFormControl) { - ASSERT(pDocument != NULL); - ASSERT(pFormControl != NULL); + ASSERT(pFormControl); CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - return pInterForm->GetWidget(pFormControl); } FX_BOOL Field::ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel) { - ASSERT(pFormField != NULL); - for (int i = 0, sz = pFormField->CountOptions(); i < sz; i++) { if (csOptLabel.Compare(pFormField->GetOptionLabel(i)) == 0) return TRUE; @@ -321,13 +302,10 @@ CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField) { return pFormField->GetControl(m_nFormControlIndex); } -/* ---------------------------------------- property - * ---------------------------------------- */ - FX_BOOL Field::alignment(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -383,7 +361,7 @@ void Field::SetAlignment(CPDFSDK_Document* pDocument, FX_BOOL Field::borderStyle(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -443,7 +421,7 @@ void Field::SetBorderStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string) { - ASSERT(pDocument != NULL); + ASSERT(pDocument); int nBorderStyle = 0; @@ -495,7 +473,7 @@ void Field::SetBorderStyle(CPDFSDK_Document* pDocument, FX_BOOL Field::buttonAlignX(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -544,7 +522,7 @@ void Field::SetButtonAlignX(CPDFSDK_Document* pDocument, FX_BOOL Field::buttonAlignY(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -593,7 +571,7 @@ void Field::SetButtonAlignY(CPDFSDK_Document* pDocument, FX_BOOL Field::buttonFitBounds(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -638,7 +616,7 @@ void Field::SetButtonFitBounds(CPDFSDK_Document* pDocument, FX_BOOL Field::buttonPosition(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -681,7 +659,7 @@ void Field::SetButtonPosition(CPDFSDK_Document* pDocument, FX_BOOL Field::buttonScaleHow(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -729,7 +707,7 @@ void Field::SetButtonScaleHow(CPDFSDK_Document* pDocument, FX_BOOL Field::buttonScaleWhen(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -788,7 +766,7 @@ void Field::SetButtonScaleWhen(CPDFSDK_Document* pDocument, FX_BOOL Field::calcOrderIndex(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -815,11 +793,7 @@ FX_BOOL Field::calcOrderIndex(IJS_Context* cc, } CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm(); - ASSERT(pRDInterForm != NULL); - CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); - ASSERT(pInterForm != NULL); - vp << (int32_t)pInterForm->FindFieldInCalculationOrder(pFormField); } @@ -836,7 +810,7 @@ void Field::SetCalcOrderIndex(CPDFSDK_Document* pDocument, FX_BOOL Field::charLimit(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -874,7 +848,7 @@ void Field::SetCharLimit(CPDFSDK_Document* pDocument, FX_BOOL Field::comb(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -916,7 +890,7 @@ void Field::SetComb(CPDFSDK_Document* pDocument, FX_BOOL Field::commitOnSelChange(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -1023,7 +997,7 @@ void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_DWordArray& array) { - ASSERT(pDocument != NULL); + ASSERT(pDocument); std::vector<CPDF_FormField*> FieldArray = GetFormFields(pDocument, swFieldName); @@ -1063,7 +1037,7 @@ void Field::SetDefaultStyle(CPDFSDK_Document* pDocument, FX_BOOL Field::defaultValue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -1104,7 +1078,7 @@ void Field::SetDefaultValue(CPDFSDK_Document* pDocument, FX_BOOL Field::doNotScroll(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -1146,7 +1120,7 @@ void Field::SetDoNotScroll(CPDFSDK_Document* pDocument, FX_BOOL Field::doNotSpellCheck(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -1203,8 +1177,6 @@ FX_BOOL Field::delay(IJS_Context* cc, FX_BOOL Field::display(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (vp.IsSetting()) { if (!m_bCanSet) return FALSE; @@ -1255,11 +1227,7 @@ void Field::SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number) { - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(pDocument, swFieldName); for (CPDF_FormField* pFormField : FieldArray) { @@ -1267,7 +1235,7 @@ void Field::SetDisplay(CPDFSDK_Document* pDocument, FX_BOOL bSet = FALSE; for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { CPDF_FormControl* pFormControl = pFormField->GetControl(i); - ASSERT(pFormControl != NULL); + ASSERT(pFormControl); if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { FX_DWORD dwFlag = pWidget->GetFlags(); @@ -1357,7 +1325,6 @@ FX_BOOL Field::doc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { FX_BOOL Field::editable(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); if (vp.IsSetting()) { if (!m_bCanSet) return FALSE; @@ -1430,8 +1397,6 @@ FX_BOOL Field::exportValues(IJS_Context* cc, FX_BOOL Field::fileSelect(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -1528,8 +1493,6 @@ void Field::SetFillColor(CPDFSDK_Document* pDocument, FX_BOOL Field::hidden(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (vp.IsSetting()) { if (!m_bCanSet) return FALSE; @@ -1571,11 +1534,7 @@ void Field::SetHidden(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b) { - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(pDocument, swFieldName); for (CPDF_FormField* pFormField : FieldArray) { @@ -1638,7 +1597,7 @@ void Field::SetHidden(CPDFSDK_Document* pDocument, FX_BOOL Field::highlight(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -1699,8 +1658,6 @@ void Field::SetHighlight(CPDFSDK_Document* pDocument, FX_BOOL Field::lineWidth(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (vp.IsSetting()) { if (!m_bCanSet) return FALSE; @@ -1727,8 +1684,6 @@ FX_BOOL Field::lineWidth(IJS_Context* cc, CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - if (!pFormField->CountControls()) return FALSE; @@ -1746,10 +1701,7 @@ void Field::SetLineWidth(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number) { - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); std::vector<CPDF_FormField*> FieldArray = GetFormFields(pDocument, swFieldName); @@ -1758,7 +1710,7 @@ void Field::SetLineWidth(CPDFSDK_Document* pDocument, FX_BOOL bSet = FALSE; for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { CPDF_FormControl* pFormControl = pFormField->GetControl(i); - ASSERT(pFormControl != NULL); + ASSERT(pFormControl); if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { if (number != pWidget->GetBorderWidth()) { @@ -1788,7 +1740,7 @@ void Field::SetLineWidth(CPDFSDK_Document* pDocument, FX_BOOL Field::multiline(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -1830,7 +1782,7 @@ void Field::SetMultiline(CPDFSDK_Document* pDocument, FX_BOOL Field::multipleSelection(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -1945,7 +1897,7 @@ FX_BOOL Field::page(IJS_Context* cc, FX_BOOL Field::password(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -1987,12 +1939,8 @@ void Field::SetPassword(CPDFSDK_Document* pDocument, FX_BOOL Field::print(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -2066,8 +2014,6 @@ FX_BOOL Field::print(IJS_Context* cc, FX_BOOL Field::radiosInUnison(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -2096,8 +2042,6 @@ FX_BOOL Field::radiosInUnison(IJS_Context* cc, FX_BOOL Field::readonly(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -2187,10 +2131,7 @@ void Field::SetRect(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPDF_Rect& rect) { - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); std::vector<CPDF_FormField*> FieldArray = GetFormFields(pDocument, swFieldName); @@ -2199,7 +2140,7 @@ void Field::SetRect(CPDFSDK_Document* pDocument, FX_BOOL bSet = FALSE; for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { CPDF_FormControl* pFormControl = pFormField->GetControl(i); - ASSERT(pFormControl != NULL); + ASSERT(pFormControl); if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { CPDF_Rect crRect = rect; @@ -2229,11 +2170,6 @@ void Field::SetRect(CPDFSDK_Document* pDocument, CPDF_Rect crRect = rect; CPDF_Page* pPDFPage = pWidget->GetPDFPage(); - ASSERT(pPDFPage != NULL); - - // CPDF_Page* pPDFPage = pPage->GetPage(); - // ASSERT(pPDFPage != NULL); - crRect.Intersect(pPDFPage->GetPageBBox()); if (!crRect.IsEmpty()) { @@ -2253,8 +2189,6 @@ void Field::SetRect(CPDFSDK_Document* pDocument, FX_BOOL Field::required(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -2283,7 +2217,7 @@ FX_BOOL Field::required(IJS_Context* cc, FX_BOOL Field::richText(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -2337,7 +2271,7 @@ void Field::SetRichValue(CPDFSDK_Document* pDocument, FX_BOOL Field::rotation(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -2447,7 +2381,7 @@ void Field::SetStrokeColor(CPDFSDK_Document* pDocument, FX_BOOL Field::style(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -2582,7 +2516,7 @@ void Field::SetTextColor(CPDFSDK_Document* pDocument, FX_BOOL Field::textFont(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -2638,7 +2572,7 @@ void Field::SetTextFont(CPDFSDK_Document* pDocument, FX_BOOL Field::textSize(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -2686,8 +2620,6 @@ void Field::SetTextSize(CPDFSDK_Document* pDocument, FX_BOOL Field::type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!vp.IsGetting()) return FALSE; @@ -2732,7 +2664,7 @@ FX_BOOL Field::type(IJS_Context* cc, FX_BOOL Field::userName(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -2885,7 +2817,7 @@ void Field::SetValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CJS_WideStringArray& strArray) { - ASSERT(pDocument != NULL); + ASSERT(pDocument); if (strArray.GetSize() < 1) return; @@ -2944,8 +2876,6 @@ void Field::SetValue(CPDFSDK_Document* pDocument, FX_BOOL Field::valueAsString(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!vp.IsGetting()) return FALSE; @@ -2985,15 +2915,10 @@ FX_BOOL Field::valueAsString(IJS_Context* cc, return TRUE; } -/* --------------------------------- methods --------------------------------- - */ - FX_BOOL Field::browseForFileToSubmit(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -3016,8 +2941,6 @@ FX_BOOL Field::buttonGetCaption(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - int nface = 0; int iSize = params.size(); if (iSize >= 1) @@ -3051,8 +2974,6 @@ FX_BOOL Field::buttonGetIcon(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - int nface = 0; int iSize = params.size(); if (iSize >= 1) @@ -3120,7 +3041,7 @@ FX_BOOL Field::checkThisBox(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (!m_bCanSet) return FALSE; @@ -3165,8 +3086,6 @@ FX_BOOL Field::defaultIsChecked(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!m_bCanSet) return FALSE; @@ -3199,9 +3118,6 @@ FX_BOOL Field::deleteItemAt(IJS_Context* cc, } int JS_COMPARESTRING(CFX_WideString* ps1, CFX_WideString* ps2) { - ASSERT(ps1 != NULL); - ASSERT(ps2 != NULL); - return ps1->Compare(*ps2); } @@ -3209,8 +3125,6 @@ FX_BOOL Field::getArray(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -3251,7 +3165,6 @@ FX_BOOL Field::getItemAt(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); int iSize = params.size(); int nIdx = -1; @@ -3305,8 +3218,6 @@ FX_BOOL Field::isBoxChecked(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - int nIndex = -1; if (params.size() >= 1) nIndex = params[0].ToInt(); @@ -3338,8 +3249,6 @@ FX_BOOL Field::isDefaultChecked(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - int nIndex = -1; if (params.size() >= 1) nIndex = params[0].ToInt(); @@ -3377,8 +3286,6 @@ FX_BOOL Field::setFocus(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -3390,8 +3297,6 @@ FX_BOOL Field::setFocus(IJS_Context* cc, CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - CPDFSDK_Widget* pWidget = NULL; if (nCount == 1) { pWidget = pInterForm->GetWidget(pFormField->GetControl(0)); @@ -3487,12 +3392,7 @@ FX_BOOL Field::source(IJS_Context* cc, return TRUE; } -/////////////////////////////////////////// delay -//////////////////////////////////////////////// - void Field::AddDelay_Int(enum FIELD_PROP prop, int32_t n) { - ASSERT(m_pJSDoc != NULL); - CJS_DelayData* pNewData = new CJS_DelayData; pNewData->sFieldName = m_FieldName; pNewData->nControlIndex = m_nFormControlIndex; @@ -3503,8 +3403,6 @@ void Field::AddDelay_Int(enum FIELD_PROP prop, int32_t n) { } void Field::AddDelay_Bool(enum FIELD_PROP prop, bool b) { - ASSERT(m_pJSDoc != NULL); - CJS_DelayData* pNewData = new CJS_DelayData; pNewData->sFieldName = m_FieldName; pNewData->nControlIndex = m_nFormControlIndex; @@ -3516,8 +3414,6 @@ void Field::AddDelay_Bool(enum FIELD_PROP prop, bool b) { void Field::AddDelay_String(enum FIELD_PROP prop, const CFX_ByteString& string) { - ASSERT(m_pJSDoc != NULL); - CJS_DelayData* pNewData = new CJS_DelayData; pNewData->sFieldName = m_FieldName; pNewData->nControlIndex = m_nFormControlIndex; @@ -3529,8 +3425,6 @@ void Field::AddDelay_String(enum FIELD_PROP prop, void Field::AddDelay_WideString(enum FIELD_PROP prop, const CFX_WideString& string) { - ASSERT(m_pJSDoc != NULL); - CJS_DelayData* pNewData = new CJS_DelayData; pNewData->sFieldName = m_FieldName; pNewData->nControlIndex = m_nFormControlIndex; @@ -3541,8 +3435,6 @@ void Field::AddDelay_WideString(enum FIELD_PROP prop, } void Field::AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect) { - ASSERT(m_pJSDoc != NULL); - CJS_DelayData* pNewData = new CJS_DelayData; pNewData->sFieldName = m_FieldName; pNewData->nControlIndex = m_nFormControlIndex; @@ -3553,8 +3445,6 @@ void Field::AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect) { } void Field::AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color) { - ASSERT(m_pJSDoc != NULL); - CJS_DelayData* pNewData = new CJS_DelayData; pNewData->sFieldName = m_FieldName; pNewData->nControlIndex = m_nFormControlIndex; @@ -3566,8 +3456,6 @@ void Field::AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color) { void Field::AddDelay_WordArray(enum FIELD_PROP prop, const CFX_DWordArray& array) { - ASSERT(m_pJSDoc != NULL); - CJS_DelayData* pNewData = new CJS_DelayData; pNewData->sFieldName = m_FieldName; pNewData->nControlIndex = m_nFormControlIndex; @@ -3581,8 +3469,6 @@ void Field::AddDelay_WordArray(enum FIELD_PROP prop, void Field::AddDelay_WideStringArray(enum FIELD_PROP prop, const CJS_WideStringArray& array) { - ASSERT(m_pJSDoc != NULL); - CJS_DelayData* pNewData = new CJS_DelayData; pNewData->sFieldName = m_FieldName; pNewData->nControlIndex = m_nFormControlIndex; @@ -3594,8 +3480,7 @@ void Field::AddDelay_WideStringArray(enum FIELD_PROP prop, } void Field::DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData) { - ASSERT(pDocument != NULL); - ASSERT(pData != NULL); + ASSERT(pDocument); switch (pData->eProp) { case FP_ALIGNMENT: @@ -3735,9 +3620,6 @@ void Field::DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData) { } } -#define JS_FIELD_MINWIDTH 1 -#define JS_FIELD_MINHEIGHT 1 - void Field::AddField(CPDFSDK_Document* pDocument, int nPageIndex, int nFieldType, diff --git a/fpdfsdk/src/javascript/JS_Context.cpp b/fpdfsdk/src/javascript/JS_Context.cpp index 8d54cddc41..b9a10e1bc2 100644 --- a/fpdfsdk/src/javascript/JS_Context.cpp +++ b/fpdfsdk/src/javascript/JS_Context.cpp @@ -27,8 +27,6 @@ CPDFSDK_Document* CJS_Context::GetReaderDocument() { } CPDFDoc_Environment* CJS_Context::GetReaderApp() { - ASSERT(m_pRuntime != NULL); - return m_pRuntime->GetReaderApp(); } diff --git a/fpdfsdk/src/javascript/JS_EventHandler.cpp b/fpdfsdk/src/javascript/JS_EventHandler.cpp index df7f9791c2..e413166328 100644 --- a/fpdfsdk/src/javascript/JS_EventHandler.cpp +++ b/fpdfsdk/src/javascript/JS_EventHandler.cpp @@ -115,7 +115,6 @@ void CJS_EventHandler::OnField_MouseEnter(FX_BOOL bModifier, m_bModifier = bModifier; m_bShift = bShift; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); } @@ -126,7 +125,6 @@ void CJS_EventHandler::OnField_MouseExit(FX_BOOL bModifier, m_bModifier = bModifier; m_bShift = bShift; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); } @@ -138,7 +136,6 @@ void CJS_EventHandler::OnField_MouseDown(FX_BOOL bModifier, m_bModifier = bModifier; m_bShift = bShift; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); } @@ -149,7 +146,6 @@ void CJS_EventHandler::OnField_MouseUp(FX_BOOL bModifier, m_bModifier = bModifier; m_bShift = bShift; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); } @@ -161,7 +157,6 @@ void CJS_EventHandler::OnField_Focus(FX_BOOL bModifier, m_bModifier = bModifier; m_bShift = bShift; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); m_pValue = (CFX_WideString*)&Value; } @@ -174,7 +169,6 @@ void CJS_EventHandler::OnField_Blur(FX_BOOL bModifier, m_bModifier = bModifier; m_bShift = bShift; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); m_pValue = (CFX_WideString*)&Value; } @@ -201,7 +195,6 @@ void CJS_EventHandler::OnField_Keystroke(CFX_WideString& strChange, m_pISelEnd = &nSelEnd; m_pISelStart = &nSelStart; m_bShift = bShift; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); m_pValue = &Value; m_bWillCommit = bWillCommit; @@ -224,7 +217,6 @@ void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange, m_bKeyDown = bKeyDown; m_bModifier = bModifier; m_bShift = bShift; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); m_pValue = &Value; m_pbRc = &bRc; @@ -238,7 +230,6 @@ void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource, if (pSource) m_strSourceName = pSource->GetFullName(); - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); m_pValue = &Value; m_pbRc = &bRc; @@ -250,7 +241,6 @@ void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget, Initial(JET_FIELD_FORMAT); m_nCommitKey = 0; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); m_pValue = &Value; m_bWillCommit = bWillCommit; diff --git a/fpdfsdk/src/javascript/JS_GlobalData.cpp b/fpdfsdk/src/javascript/JS_GlobalData.cpp index d9a07a8507..474886c484 100644 --- a/fpdfsdk/src/javascript/JS_GlobalData.cpp +++ b/fpdfsdk/src/javascript/JS_GlobalData.cpp @@ -23,8 +23,6 @@ void CJS_GlobalVariableArray::Copy(const CJS_GlobalVariableArray& array) { Empty(); for (int i = 0, sz = array.Count(); i < sz; i++) { CJS_KeyValue* pOldObjData = array.GetAt(i); - ASSERT(pOldObjData != NULL); - switch (pOldObjData->nType) { case JS_GLOBALDATA_TYPE_NUMBER: { CJS_KeyValue* pNewObjData = new CJS_KeyValue; @@ -141,19 +139,15 @@ int CJS_GlobalData::FindGlobalVariable(const FX_CHAR* propname) { CJS_GlobalData_Element* CJS_GlobalData::GetGlobalVariable( const FX_CHAR* propname) { - ASSERT(propname != NULL); + ASSERT(propname); int nFind = FindGlobalVariable(propname); - if (nFind >= 0) - return m_arrayGlobalData.GetAt(nFind); - - return NULL; + return nFind >= 0 ? m_arrayGlobalData.GetAt(nFind) : nullptr; } void CJS_GlobalData::SetGlobalVariableNumber(const FX_CHAR* propname, double dData) { - ASSERT(propname != NULL); - + ASSERT(propname); CFX_ByteString sPropName = propname; sPropName.TrimLeft(); sPropName.TrimRight(); @@ -174,7 +168,7 @@ void CJS_GlobalData::SetGlobalVariableNumber(const FX_CHAR* propname, void CJS_GlobalData::SetGlobalVariableBoolean(const FX_CHAR* propname, bool bData) { - ASSERT(propname != NULL); + ASSERT(propname); CFX_ByteString sPropName = propname; sPropName.TrimLeft(); @@ -198,7 +192,7 @@ void CJS_GlobalData::SetGlobalVariableBoolean(const FX_CHAR* propname, void CJS_GlobalData::SetGlobalVariableString(const FX_CHAR* propname, const CFX_ByteString& sData) { - ASSERT(propname != NULL); + ASSERT(propname); CFX_ByteString sPropName = propname; sPropName.TrimLeft(); @@ -223,7 +217,7 @@ void CJS_GlobalData::SetGlobalVariableString(const FX_CHAR* propname, void CJS_GlobalData::SetGlobalVariableObject( const FX_CHAR* propname, const CJS_GlobalVariableArray& array) { - ASSERT(propname != NULL); + ASSERT(propname); CFX_ByteString sPropName = propname; sPropName.TrimLeft(); @@ -246,7 +240,7 @@ void CJS_GlobalData::SetGlobalVariableObject( } void CJS_GlobalData::SetGlobalVariableNull(const FX_CHAR* propname) { - ASSERT(propname != NULL); + ASSERT(propname); CFX_ByteString sPropName = propname; sPropName.TrimLeft(); @@ -268,7 +262,7 @@ void CJS_GlobalData::SetGlobalVariableNull(const FX_CHAR* propname) { FX_BOOL CJS_GlobalData::SetGlobalVariablePersistent(const FX_CHAR* propname, FX_BOOL bPersistent) { - ASSERT(propname != NULL); + ASSERT(propname); CFX_ByteString sPropName = propname; sPropName.TrimLeft(); @@ -286,7 +280,7 @@ FX_BOOL CJS_GlobalData::SetGlobalVariablePersistent(const FX_CHAR* propname, } FX_BOOL CJS_GlobalData::DeleteGlobalVariable(const FX_CHAR* propname) { - ASSERT(propname != NULL); + ASSERT(propname); CFX_ByteString sPropName = propname; sPropName.TrimLeft(); @@ -409,8 +403,6 @@ void CJS_GlobalData::SaveGlobalPersisitentVariables() { for (int i = 0, sz = m_arrayGlobalData.GetSize(); i < sz; i++) { CJS_GlobalData_Element* pElement = m_arrayGlobalData.GetAt(i); - ASSERT(pElement != NULL); - if (pElement->bPersistent) { CFX_BinaryBuf sElement; MakeByteString(pElement->data.sKey, &pElement->data, sElement); diff --git a/fpdfsdk/src/javascript/JS_Object.cpp b/fpdfsdk/src/javascript/JS_Object.cpp index 529b540237..058ec02925 100644 --- a/fpdfsdk/src/javascript/JS_Object.cpp +++ b/fpdfsdk/src/javascript/JS_Object.cpp @@ -86,8 +86,6 @@ int CJS_Object::MsgBox(CPDFDoc_Environment* pApp, } void CJS_Object::Alert(CJS_Context* pContext, const FX_WCHAR* swMsg) { - ASSERT(pContext != NULL); - if (pContext->IsMsgBoxEnabled()) { CPDFDoc_Environment* pApp = pContext->GetReaderApp(); if (pApp) diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp index 094f3e7dd7..c2e15fb116 100644 --- a/fpdfsdk/src/javascript/PublicMethods.cpp +++ b/fpdfsdk/src/javascript/PublicMethods.cpp @@ -1096,9 +1096,7 @@ FX_BOOL CJS_PublicMethods::AFNumber_Keystroke( CJS_Value& vRet, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (params.size() < 2) return FALSE; @@ -1217,9 +1215,7 @@ FX_BOOL CJS_PublicMethods::AFPercent_Format( CFX_WideString& sError) { #if _FX_OS_ != _FX_ANDROID_ CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (params.size() != 2) { sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); @@ -1319,9 +1315,7 @@ FX_BOOL CJS_PublicMethods::AFDate_FormatEx(IJS_Context* cc, CJS_Value& vRet, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (params.size() != 1) { sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); @@ -1436,9 +1430,7 @@ FX_BOOL CJS_PublicMethods::AFDate_KeystrokeEx( CJS_Value& vRet, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (params.size() != 1) { sError = L"AFDate_KeystrokeEx's parameters' size r not correct"; @@ -1609,7 +1601,6 @@ FX_BOOL CJS_PublicMethods::AFSpecial_Format( CJS_Value& vRet, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); if (params.size() != 1) { sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); @@ -1620,8 +1611,6 @@ FX_BOOL CJS_PublicMethods::AFSpecial_Format( int iIndex = params[0].ToInt(); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); - if (!pEvent->m_pValue) return FALSE; CFX_WideString& Value = pEvent->Value(); @@ -1661,11 +1650,8 @@ FX_BOOL CJS_PublicMethods::AFSpecial_KeystrokeEx( CJS_Value& vRet, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); - if (params.size() < 1) { sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); return FALSE; @@ -1805,9 +1791,7 @@ FX_BOOL CJS_PublicMethods::AFMergeChange(IJS_Context* cc, CJS_Value& vRet, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEventHandler = pContext->GetEventHandler(); - ASSERT(pEventHandler != NULL); if (params.size() != 1) { sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); @@ -1847,7 +1831,7 @@ FX_BOOL CJS_PublicMethods::AFParseDateEx(IJS_Context* cc, CJS_Value& vRet, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); + ASSERT(pContext); if (params.size() != 2) { sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); @@ -1878,7 +1862,7 @@ FX_BOOL CJS_PublicMethods::AFSimple(IJS_Context* cc, CFX_WideString& sError) { if (params.size() != 3) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); + ASSERT(pContext); sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); return FALSE; @@ -1895,7 +1879,7 @@ FX_BOOL CJS_PublicMethods::AFMakeNumber(IJS_Context* cc, CFX_WideString& sError) { if (params.size() != 1) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); + ASSERT(pContext); sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); return FALSE; @@ -2011,9 +1995,7 @@ FX_BOOL CJS_PublicMethods::AFRange_Validate( CJS_Value& vRet, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (params.size() != 4) { sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp index 70ce771090..0ed280740d 100644 --- a/fpdfsdk/src/javascript/app.cpp +++ b/fpdfsdk/src/javascript/app.cpp @@ -126,7 +126,7 @@ FX_BOOL app::activeDocs(IJS_Context* cc, pRuntime->GetIsolate(), pRuntime, CJS_Document::g_nObjDefnID); pJSDocument = (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); - ASSERT(pJSDocument != NULL); + ASSERT(pJSDocument); } aDocs.SetElement(0, CJS_Value(pRuntime, pJSDocument)); } @@ -416,9 +416,7 @@ FX_BOOL app::setTimeOut(IJS_Context* cc, } CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); - ASSERT(pRuntime != NULL); CFX_WideString script = params.size() > 0 ? params[0].ToCFXWideString() : L""; if (script.IsEmpty()) { @@ -527,8 +525,6 @@ FX_BOOL app::execMenuItem(IJS_Context* cc, } void app::TimerProc(CJS_Timer* pTimer) { - ASSERT(pTimer != NULL); - CJS_Runtime* pRuntime = pTimer->GetRuntime(); switch (pTimer->GetType()) { @@ -770,10 +766,7 @@ FX_BOOL app::response(IJS_Context* cc, } CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); - CPDFDoc_Environment* pApp = pContext->GetReaderApp(); - ASSERT(pApp != NULL); const int MAX_INPUT_BYTES = 2048; nonstd::unique_ptr<char[]> pBuff(new char[MAX_INPUT_BYTES + 2]); diff --git a/fpdfsdk/src/javascript/event.cpp b/fpdfsdk/src/javascript/event.cpp index 5ad1ca513f..2362c01287 100644 --- a/fpdfsdk/src/javascript/event.cpp +++ b/fpdfsdk/src/javascript/event.cpp @@ -56,10 +56,7 @@ FX_BOOL event::change(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); - CFX_WideString& wChange = pEvent->Change(); if (vp.IsSetting()) { if (vp.GetType() == CJS_Value::VT_string) @@ -77,9 +74,7 @@ FX_BOOL event::changeEx(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); vp << pEvent->ChangeEx(); return TRUE; @@ -92,9 +87,7 @@ FX_BOOL event::commitKey(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); vp << pEvent->CommitKey(); return TRUE; @@ -104,9 +97,7 @@ FX_BOOL event::fieldFull(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (!vp.IsGetting() && wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) @@ -126,9 +117,7 @@ FX_BOOL event::keyDown(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (pEvent->KeyDown()) vp << TRUE; @@ -144,9 +133,7 @@ FX_BOOL event::modifier(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (pEvent->Modifier()) vp << TRUE; @@ -162,9 +149,7 @@ FX_BOOL event::name(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); vp << pEvent->Name(); return TRUE; @@ -172,9 +157,7 @@ FX_BOOL event::name(IJS_Context* cc, FX_BOOL event::rc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); FX_BOOL& bRc = pEvent->Rc(); if (vp.IsSetting()) { @@ -222,9 +205,7 @@ FX_BOOL event::selEnd(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) { return TRUE; @@ -243,9 +224,7 @@ FX_BOOL event::selStart(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) { return TRUE; @@ -266,9 +245,7 @@ FX_BOOL event::shift(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (pEvent->Shift()) vp << TRUE; @@ -284,9 +261,7 @@ FX_BOOL event::source(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); vp << pEvent->Source()->GetJSObject(); return TRUE; @@ -299,9 +274,7 @@ FX_BOOL event::target(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); vp << pEvent->Target_Field()->GetJSObject(); return TRUE; @@ -314,9 +287,7 @@ FX_BOOL event::targetName(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); vp << pEvent->TargetName(); return TRUE; @@ -329,9 +300,7 @@ FX_BOOL event::type(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); vp << pEvent->Type(); return TRUE; @@ -341,9 +310,7 @@ FX_BOOL event::value(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (wcscmp((const wchar_t*)pEvent->Type(), L"Field") != 0) return FALSE; @@ -365,9 +332,7 @@ FX_BOOL event::willCommit(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (pEvent->WillCommit()) vp << TRUE; diff --git a/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp index 2d9799dd4e..7a43b677e9 100644 --- a/fpdfsdk/src/javascript/global.cpp +++ b/fpdfsdk/src/javascript/global.cpp @@ -227,12 +227,8 @@ FX_BOOL JSGlobalAlternate::setPersistent(IJS_Context* cc, } void JSGlobalAlternate::UpdateGlobalPersistentVariables() { - ASSERT(m_pGlobalData != NULL); - for (int i = 0, sz = m_pGlobalData->GetSize(); i < sz; i++) { CJS_GlobalData_Element* pData = m_pGlobalData->GetAt(i); - ASSERT(pData != NULL); - switch (pData->data.nType) { case JS_GLOBALDATA_TYPE_NUMBER: SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NUMBER, @@ -380,12 +376,8 @@ void JSGlobalAlternate::ObjectToArray(IJS_Context* cc, void JSGlobalAlternate::PutObjectProperty(v8::Local<v8::Object> pObj, CJS_KeyValue* pData) { - ASSERT(pData != NULL); - for (int i = 0, sz = pData->objData.Count(); i < sz; i++) { CJS_KeyValue* pObjData = pData->objData.GetAt(i); - ASSERT(pObjData != NULL); - switch (pObjData->nType) { case JS_GLOBALDATA_TYPE_NUMBER: FXJS_PutObjectNumber(NULL, pObj, pObjData->sKey.UTF8Decode().c_str(), diff --git a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp index 1c69f18b9f..8d54ae0a13 100644 --- a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp @@ -27,7 +27,7 @@ CPWL_EditCtrl::CPWL_EditCtrl() m_nCharSet(DEFAULT_CHARSET), m_nCodePage(0) { m_pEdit = IFX_Edit::NewEdit(); - ASSERT(m_pEdit != NULL); + ASSERT(m_pEdit); } CPWL_EditCtrl::~CPWL_EditCtrl() { diff --git a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp index cd65c383ff..d5ca376882 100644 --- a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp @@ -14,7 +14,7 @@ CPWL_FontMap::CPWL_FontMap(IFX_SystemHandler* pSystemHandler) : m_pPDFDoc(NULL), m_pSystemHandler(pSystemHandler) { - ASSERT(m_pSystemHandler != NULL); + ASSERT(m_pSystemHandler); } CPWL_FontMap::~CPWL_FontMap() { diff --git a/fpdfsdk/src/pdfwindow/PWL_Icon.cpp b/fpdfsdk/src/pdfwindow/PWL_Icon.cpp index 61ad1f6913..db5355c59e 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Icon.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Icon.cpp @@ -137,7 +137,7 @@ void CPWL_Icon::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { fBottom = 0.0f; CPDF_Array* pA = m_pIconFit->m_pDict ? m_pIconFit->m_pDict->GetArray("A") : NULL; - if (pA != NULL) { + if (pA) { FX_DWORD dwCount = pA->GetCount(); if (dwCount > 0) fLeft = pA->GetNumber(0); diff --git a/fpdfsdk/src/pdfwindow/PWL_Label.cpp b/fpdfsdk/src/pdfwindow/PWL_Label.cpp index 23be536766..8ff7235701 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Label.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Label.cpp @@ -13,8 +13,7 @@ CPWL_Label::CPWL_Label() : m_pEdit(NULL) { m_pEdit = IFX_Edit::NewEdit(); - - ASSERT(m_pEdit != NULL); + ASSERT(m_pEdit); } CPWL_Label::~CPWL_Label() { diff --git a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp index 9b62c471d7..685da4fd34 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp @@ -20,7 +20,7 @@ /* ------------------------ CPWL_List_Notify ----------------------- */ CPWL_List_Notify::CPWL_List_Notify(CPWL_ListBox* pList) : m_pList(pList) { - ASSERT(m_pList != NULL); + ASSERT(m_pList); } CPWL_List_Notify::~CPWL_List_Notify() {} @@ -74,8 +74,6 @@ CPWL_ListBox::CPWL_ListBox() m_bHoverSel(FALSE), m_pFillerNotify(NULL) { m_pList = IFX_List::NewList(); - - ASSERT(m_pList != NULL); } CPWL_ListBox::~CPWL_ListBox() { diff --git a/fpdfsdk/src/pdfwindow/PWL_Note.cpp b/fpdfsdk/src/pdfwindow/PWL_Note.cpp index f15004dcd6..d87c3df916 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Note.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Note.cpp @@ -47,8 +47,6 @@ void CPWL_Note_Options::SetTextColor(const CPWL_Color& color) { void CPWL_Note_Options::RePosChildWnd() { if (IsValid()) { - ASSERT(m_pText != NULL); - CPDF_Rect rcClient = GetClientRect(); if (rcClient.Width() > 15.0f) { @@ -103,8 +101,6 @@ void CPWL_Note_Options::DrawThisAppearance(CFX_RenderDevice* pDevice, } CPDF_Rect CPWL_Note_Options::GetContentRect() const { - ASSERT(m_pText != NULL); - CPDF_Rect rcText = m_pText->GetContentRect(); rcText.right += 15.0f; return rcText; @@ -661,10 +657,6 @@ void CPWL_NoteItem::CreateChildWnd(const PWL_CREATEPARAM& cp) { void CPWL_NoteItem::RePosChildWnd() { if (IsValid()) { - ASSERT(m_pSubject != NULL); - ASSERT(m_pDateTime != NULL); - ASSERT(m_pContents != NULL); - CPDF_Rect rcClient = GetClientRect(); CPDF_Rect rcSubject = rcClient; @@ -759,8 +751,6 @@ void CPWL_NoteItem::ResetSubjectName(int32_t nItemIndex) { } const CPWL_Note* pNote = GetNote(); - ASSERT(pNote != NULL); - CFX_WideString sSubject; sSubject.Format(pNote->GetReplyString().c_str(), nItemIndex); @@ -925,10 +915,6 @@ FX_FLOAT CPWL_NoteItem::GetItemHeight(FX_FLOAT fLimitWidth) { m_bSizeChanged = FALSE; - ASSERT(m_pSubject != NULL); - ASSERT(m_pDateTime != NULL); - ASSERT(m_pContents != NULL); - FX_FLOAT fRet = m_pDateTime->GetContentRect().Height(); FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); if (fLimitWidth > fBorderWidth * 2) @@ -1156,17 +1142,6 @@ void CPWL_Note::RePosNoteChildren() { m_bResizing = TRUE; if (IsValid()) { - ASSERT(m_pSubject != NULL); - ASSERT(m_pDateTime != NULL); - ASSERT(m_pContents != NULL); - ASSERT(m_pAuthor != NULL); - ASSERT(m_pCloseBox != NULL); - ASSERT(m_pIcon != NULL); - ASSERT(m_pLBBox != NULL); - ASSERT(m_pRBBox != NULL); - ASSERT(m_pContentsBar != NULL); - ASSERT(m_pOptions != NULL); - CPDF_Rect rcClient = GetClientRect(); CPDF_Rect rcIcon = rcClient; @@ -1267,21 +1242,10 @@ void CPWL_Note::RePosNoteChildren() { m_bResizing = FALSE; } +// TODO(thestig): Make this return an enum. // 0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close / // 5-options int32_t CPWL_Note::NoteHitTest(const CPDF_Point& point) const { - ASSERT(m_pSubject != NULL); - ASSERT(m_pDateTime != NULL); - ASSERT(m_pContents != NULL); - ASSERT(m_pAuthor != NULL); - ASSERT(m_pIcon != NULL); - ASSERT(m_pContentsBar != NULL); - - ASSERT(m_pCloseBox != NULL); - ASSERT(m_pLBBox != NULL); - ASSERT(m_pRBBox != NULL); - ASSERT(m_pOptions != NULL); - GetClientRect(); if (m_pSubject->WndHitTest(m_pSubject->ParentToChild(point))) diff --git a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp index f4d4baf6e9..b6a1bb3e6e 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp @@ -14,9 +14,6 @@ #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) -/* ------------------------------- PWL_FLOATRANGE - * ------------------------------- */ - PWL_FLOATRANGE::PWL_FLOATRANGE() { Default(); } @@ -49,9 +46,6 @@ FX_FLOAT PWL_FLOATRANGE::GetWidth() const { return fMax - fMin; } -/* ------------------------------- PWL_SCROLL_PRIVATEDATA - * ------------------------------- */ - PWL_SCROLL_PRIVATEDATA::PWL_SCROLL_PRIVATEDATA() { Default(); } @@ -113,9 +107,6 @@ void PWL_SCROLL_PRIVATEDATA::SubBig() { SetPos(ScrollRange.fMin); } -/* ------------------------------- CPWL_SBButton ------------------------------- - */ - CPWL_SBButton::CPWL_SBButton(PWL_SCROLLBAR_TYPE eScrollBarType, PWL_SBBUTTON_TYPE eButtonType) { m_eScrollBarType = eScrollBarType; @@ -405,8 +396,6 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, } } break; case PSBT_POS: { - // CPWL_Wnd::DrawThisAppearance(pDevice,pUser2Device); - // draw border CPDF_Rect rcDraw = rectWnd; CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, @@ -532,14 +521,6 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, crStroke, 1.0f); - - /* - ptLeft.y += 1.5f; - ptRight.y += 1.5f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, - ArgbEncode(nTransparancy,150,150,150),1.0f); - */ } } break; default: @@ -580,24 +561,11 @@ FX_BOOL CPWL_SBButton::OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag) { if (CPWL_Wnd* pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_MOUSEMOVE, 0, (intptr_t)&point); - - /* - if (m_bMouseDown && (m_eSBButtonType == PSBT_MIN || m_eSBButtonType == - PSBT_MAX)) - { - if - (!pParent->OnNotify(this,PNM_LBUTTONDOWN,nFlags,(intptr_t)&point)) - return FALSE; - } - */ } return TRUE; } -/* ------------------------------- CPWL_ScrollBar - * ---------------------------------- */ - CPWL_ScrollBar::CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType) : m_sbType(sbType), m_pMinButton(NULL), @@ -923,9 +891,8 @@ void CPWL_ScrollBar::SetScrollStep(FX_FLOAT fBigStep, FX_FLOAT fSmallStep) { } void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) { - ASSERT(m_pPosButton != NULL); - ASSERT(m_pMinButton != NULL); - ASSERT(m_pMaxButton != NULL); + ASSERT(m_pMinButton); + ASSERT(m_pMaxButton); if (m_pPosButton->IsVisible()) { CPDF_Rect rcClient; diff --git a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp index 85593e11d4..71a9d474b7 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp @@ -528,9 +528,6 @@ CFX_ByteString CPWL_Utils::GetSpellCheckAppStream( IPWL_SpellCheck* pSpellCheck, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange) { - ASSERT(pEdit != NULL); - ASSERT(pSpellCheck != NULL); - CFX_ByteTextBuf sRet; if (pRange && pRange->IsExist()) { diff --git a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp index 002fc051af..baa24cb8bf 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp @@ -22,8 +22,8 @@ static std::map<int32_t, CPWL_Timer*>& GetPWLTimeMap() { CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler) : m_nTimerID(0), m_pAttached(pAttached), m_pSystemHandler(pSystemHandler) { - ASSERT(m_pAttached != NULL); - ASSERT(m_pSystemHandler != NULL); + ASSERT(m_pAttached); + ASSERT(m_pSystemHandler); } CPWL_Timer::~CPWL_Timer() { |