From 96660d6f382204339d6b1aadc3913303d436e252 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 14 Dec 2015 18:27:25 -0800 Subject: Merge to XFA: Get rid of most instance of 'foo != NULL' TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1512763013 . (cherry picked from commit e3c7c2b54348da4a6939f6672f6c6bff126815a7) Review URL: https://codereview.chromium.org/1529553003 . --- fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp | 2 - fpdfsdk/src/formfiller/FFL_CheckBox.cpp | 18 +-- fpdfsdk/src/formfiller/FFL_ComboBox.cpp | 18 +-- fpdfsdk/src/formfiller/FFL_FormFiller.cpp | 22 ++-- fpdfsdk/src/formfiller/FFL_IFormFiller.cpp | 95 +++------------ fpdfsdk/src/formfiller/FFL_ListBox.cpp | 8 +- fpdfsdk/src/formfiller/FFL_RadioButton.cpp | 11 +- fpdfsdk/src/formfiller/FFL_TextField.cpp | 26 +--- fpdfsdk/src/fpdfformfill.cpp | 1 - fpdfsdk/src/fsdk_actionhandler.cpp | 62 +--------- fpdfsdk/src/fsdk_annothandler.cpp | 50 ++------ fpdfsdk/src/fsdk_baseannot.cpp | 14 --- fpdfsdk/src/fsdk_baseform.cpp | 150 +++-------------------- fpdfsdk/src/fsdk_mgr.cpp | 2 - fpdfsdk/src/fxedit/fxet_ap.cpp | 3 - fpdfsdk/src/fxedit/fxet_edit.cpp | 20 +--- fpdfsdk/src/fxedit/fxet_list.cpp | 2 - fpdfsdk/src/fxedit/fxet_module.cpp | 5 +- fpdfsdk/src/javascript/Document.cpp | 39 ------ fpdfsdk/src/javascript/Field.cpp | 183 ++++++----------------------- fpdfsdk/src/javascript/JS_Context.cpp | 2 - fpdfsdk/src/javascript/JS_EventHandler.cpp | 10 -- fpdfsdk/src/javascript/JS_GlobalData.cpp | 26 ++-- fpdfsdk/src/javascript/JS_Object.cpp | 2 - fpdfsdk/src/javascript/PublicMethods.cpp | 24 +--- fpdfsdk/src/javascript/app.cpp | 9 +- fpdfsdk/src/javascript/event.cpp | 35 ------ fpdfsdk/src/javascript/global.cpp | 8 -- fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp | 2 +- fpdfsdk/src/pdfwindow/PWL_FontMap.cpp | 2 +- fpdfsdk/src/pdfwindow/PWL_Icon.cpp | 2 +- fpdfsdk/src/pdfwindow/PWL_Label.cpp | 3 +- fpdfsdk/src/pdfwindow/PWL_ListBox.cpp | 4 +- fpdfsdk/src/pdfwindow/PWL_Note.cpp | 38 +----- fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp | 37 +----- fpdfsdk/src/pdfwindow/PWL_Utils.cpp | 3 - fpdfsdk/src/pdfwindow/PWL_Wnd.cpp | 4 +- 37 files changed, 135 insertions(+), 807 deletions(-) (limited to 'fpdfsdk/src') 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 84992ae5c5..8d801c8352 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(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(GetPDFWindow(pPageView, TRUE))) { @@ -268,9 +262,7 @@ FX_BOOL CFFL_ComboBox::IsFieldFull(CPDFSDK_PageView* pPageView) { #endif // PDF_ENABLE_XFA 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; @@ -290,11 +282,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 8b030a51a2..0e74d91fab 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""; } @@ -643,7 +641,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, @@ -681,7 +679,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; } @@ -691,7 +689,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 352097d2ff..b8893e872f 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); @@ -291,7 +278,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)) { @@ -299,9 +286,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); @@ -331,7 +316,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)) { @@ -345,7 +329,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 @@ -361,7 +344,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)) { @@ -375,7 +357,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)) { @@ -389,7 +370,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)) { @@ -402,7 +382,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)) { @@ -441,7 +420,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); @@ -484,7 +463,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); @@ -506,10 +485,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; } @@ -589,8 +565,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); @@ -598,7 +572,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; @@ -665,12 +638,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); @@ -680,8 +652,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); @@ -689,9 +659,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; } } @@ -703,14 +670,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); @@ -719,8 +683,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); @@ -728,9 +690,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; } } @@ -741,22 +700,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; } } @@ -766,24 +715,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; @@ -998,12 +938,10 @@ 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); #ifdef PDF_ENABLE_XFA if (pFormFiller->IsFieldFull(pData->pPageView)) { @@ -1024,7 +962,6 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(void* pPrivateData, 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 3490338a4d..cc2d31827f 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()); @@ -279,10 +268,7 @@ FX_BOOL CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) { #endif // PDF_ENABLE_XFA 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 0a6cdee9f2..1f12f5dd3f 100644 --- a/fpdfsdk/src/fpdfformfill.cpp +++ b/fpdfsdk/src/fpdfformfill.cpp @@ -707,7 +707,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 ae6b5f2fc8..ff591c1620 100644 --- a/fpdfsdk/src/fsdk_annothandler.cpp +++ b/fpdfsdk/src/fsdk_annothandler.cpp @@ -59,8 +59,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())) { @@ -86,8 +85,6 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(IXFA_Widget* pAnnot, #endif // PDF_ENABLE_XFA void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { - ASSERT(pAnnot != NULL); - pAnnot->GetPDFPage(); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { @@ -99,8 +96,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; @@ -113,7 +108,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); @@ -122,8 +117,6 @@ 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()); @@ -164,7 +157,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); @@ -175,7 +168,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); @@ -187,7 +180,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); @@ -198,7 +191,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); @@ -210,7 +203,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, @@ -223,7 +216,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); @@ -234,7 +227,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); @@ -245,7 +238,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); @@ -256,7 +249,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); @@ -304,7 +297,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)) { @@ -449,15 +442,13 @@ CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(IXFA_Widget* hWidget, #endif // PDF_ENABLE_XFA 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); @@ -484,7 +475,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) { @@ -496,7 +486,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) { @@ -509,7 +498,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) { @@ -525,7 +513,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) { @@ -541,7 +528,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) { @@ -557,7 +543,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) { @@ -574,7 +559,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) { @@ -591,7 +575,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) { @@ -606,7 +589,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) { @@ -621,7 +603,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) { @@ -636,7 +617,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) { @@ -654,7 +634,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) { @@ -696,7 +675,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) { @@ -709,7 +687,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) { @@ -723,7 +700,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 82bbeb11ac..0f2aaf42cd 100644 --- a/fpdfsdk/src/fsdk_baseannot.cpp +++ b/fpdfsdk/src/fsdk_baseannot.cpp @@ -532,8 +532,6 @@ void CPDFSDK_Annot::SetTabOrder(int iTabOrder) { } CPDF_Dictionary* CPDFSDK_BAAnnot::GetAnnotDict() const { - ASSERT(m_pAnnot != NULL); - return m_pAnnot->GetAnnotDict(); } @@ -545,17 +543,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(); } @@ -567,9 +560,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); } @@ -603,12 +593,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(); } @@ -948,8 +936,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 be20ab47ed..b76cb75199 100644 --- a/fpdfsdk/src/fsdk_baseform.cpp +++ b/fpdfsdk/src/fsdk_baseform.cpp @@ -493,10 +493,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() { @@ -512,8 +509,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(); @@ -540,7 +535,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); } @@ -558,8 +553,6 @@ CFX_WideString CPDFSDK_Widget::GetName() 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)); @@ -568,8 +561,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)); @@ -578,8 +569,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; @@ -595,8 +584,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; @@ -641,22 +628,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(); } @@ -699,15 +680,11 @@ 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(); } @@ -820,22 +797,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); } @@ -868,16 +841,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(); @@ -907,12 +876,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; @@ -1047,7 +1012,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()); @@ -1129,10 +1093,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]; @@ -1258,10 +1219,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]; @@ -1424,10 +1382,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(); @@ -1439,7 +1394,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(); @@ -1503,19 +1457,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()); @@ -1597,17 +1546,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()); @@ -1834,8 +1779,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; @@ -1863,8 +1806,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; @@ -1880,8 +1821,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); @@ -1895,8 +1834,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); @@ -1908,20 +1845,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()) { @@ -2036,8 +1965,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(); } @@ -2197,8 +2124,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)) { @@ -2326,7 +2252,6 @@ CPDF_Stream* CPDFSDK_InterForm::LoadImageFromFile(const CFX_WideString& sFile) { #endif // _WIN32 void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { - ASSERT(m_pDocument != NULL); CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); ASSERT(pEnv); if (!pEnv->IsJSInitiated()) @@ -2339,8 +2264,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(); @@ -2356,8 +2279,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; @@ -2386,9 +2307,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); @@ -2398,8 +2316,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) { @@ -2421,8 +2337,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; @@ -2443,13 +2357,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); } @@ -2458,7 +2368,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(); @@ -2476,19 +2386,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); @@ -2504,19 +2407,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); @@ -2529,8 +2425,6 @@ void CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, } } -/* ----------------------------- action ----------------------------- */ - FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { ASSERT(action); @@ -2565,7 +2459,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; @@ -2699,15 +2592,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; @@ -2737,9 +2626,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; @@ -2783,9 +2669,6 @@ std::vector CPDFSDK_InterForm::GetFieldFromObjects( return fields; } -/* ----------------------------- CPDF_FormNotify ----------------------------- - */ - int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, CFX_WideString& csValue) { CPDF_FormField* pFormField = (CPDF_FormField*)pField; @@ -2926,12 +2809,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") { @@ -2994,8 +2872,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 a59d3393a7..5e847b78e5 100644 --- a/fpdfsdk/src/fsdk_mgr.cpp +++ b/fpdfsdk/src/fsdk_mgr.cpp @@ -603,12 +603,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& 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& 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 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& 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& 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& 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& 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& 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(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 d3531a4aa3..89725ffb7f 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); } } @@ -296,8 +282,6 @@ CPDFSDK_Widget* Field::GetWidget(CPDFSDK_Document* pDocument, 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; @@ -317,13 +301,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) @@ -379,7 +360,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) @@ -439,7 +420,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; @@ -491,7 +472,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) @@ -540,7 +521,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) @@ -589,7 +570,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) @@ -634,7 +615,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) @@ -677,7 +658,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) @@ -725,7 +706,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) @@ -784,7 +765,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) @@ -811,11 +792,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); } @@ -832,7 +809,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) @@ -870,7 +847,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) @@ -912,7 +889,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) @@ -1019,7 +996,7 @@ void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_DWordArray& array) { - ASSERT(pDocument != NULL); + ASSERT(pDocument); std::vector FieldArray = GetFormFields(pDocument, swFieldName); @@ -1059,7 +1036,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) @@ -1100,7 +1077,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) @@ -1142,7 +1119,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) @@ -1199,8 +1176,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; @@ -1251,11 +1226,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 FieldArray = GetFormFields(pDocument, swFieldName); for (CPDF_FormField* pFormField : FieldArray) { @@ -1263,7 +1234,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(); @@ -1353,7 +1324,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; @@ -1426,8 +1396,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 FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -1524,8 +1492,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; @@ -1567,11 +1533,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 FieldArray = GetFormFields(pDocument, swFieldName); for (CPDF_FormField* pFormField : FieldArray) { @@ -1634,7 +1596,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) @@ -1695,8 +1657,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; @@ -1723,8 +1683,6 @@ FX_BOOL Field::lineWidth(IJS_Context* cc, CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - if (!pFormField->CountControls()) return FALSE; @@ -1742,10 +1700,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 FieldArray = GetFormFields(pDocument, swFieldName); @@ -1754,7 +1709,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()) { @@ -1784,7 +1739,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) @@ -1826,7 +1781,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) @@ -1941,7 +1896,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) @@ -1983,12 +1938,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 FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -2062,8 +2013,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 FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -2092,8 +2041,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 FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -2183,10 +2130,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 FieldArray = GetFormFields(pDocument, swFieldName); @@ -2195,7 +2139,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; @@ -2225,11 +2169,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()) { @@ -2249,8 +2188,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 FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -2279,7 +2216,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) @@ -2333,7 +2270,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) @@ -2443,7 +2380,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) @@ -2578,7 +2515,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) @@ -2634,7 +2571,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) @@ -2682,8 +2619,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; @@ -2728,7 +2663,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) @@ -2881,7 +2816,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; @@ -2940,8 +2875,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; @@ -2981,15 +2914,10 @@ FX_BOOL Field::valueAsString(IJS_Context* cc, return TRUE; } -/* --------------------------------- methods --------------------------------- - */ - FX_BOOL Field::browseForFileToSubmit(IJS_Context* cc, const std::vector& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - std::vector FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -3012,8 +2940,6 @@ FX_BOOL Field::buttonGetCaption(IJS_Context* cc, const std::vector& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - int nface = 0; int iSize = params.size(); if (iSize >= 1) @@ -3047,8 +2973,6 @@ FX_BOOL Field::buttonGetIcon(IJS_Context* cc, const std::vector& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - int nface = 0; int iSize = params.size(); if (iSize >= 1) @@ -3116,7 +3040,7 @@ FX_BOOL Field::checkThisBox(IJS_Context* cc, const std::vector& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (!m_bCanSet) return FALSE; @@ -3161,8 +3085,6 @@ FX_BOOL Field::defaultIsChecked(IJS_Context* cc, const std::vector& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!m_bCanSet) return FALSE; @@ -3195,9 +3117,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); } @@ -3205,8 +3124,6 @@ FX_BOOL Field::getArray(IJS_Context* cc, const std::vector& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - std::vector FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -3247,7 +3164,6 @@ FX_BOOL Field::getItemAt(IJS_Context* cc, const std::vector& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); int iSize = params.size(); int nIdx = -1; @@ -3301,8 +3217,6 @@ FX_BOOL Field::isBoxChecked(IJS_Context* cc, const std::vector& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - int nIndex = -1; if (params.size() >= 1) nIndex = params[0].ToInt(); @@ -3334,8 +3248,6 @@ FX_BOOL Field::isDefaultChecked(IJS_Context* cc, const std::vector& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - int nIndex = -1; if (params.size() >= 1) nIndex = params[0].ToInt(); @@ -3373,8 +3285,6 @@ FX_BOOL Field::setFocus(IJS_Context* cc, const std::vector& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - std::vector FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -3386,8 +3296,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)); @@ -3483,12 +3391,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; @@ -3499,8 +3402,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; @@ -3512,8 +3413,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; @@ -3525,8 +3424,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; @@ -3537,8 +3434,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; @@ -3549,8 +3444,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; @@ -3562,8 +3455,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; @@ -3577,8 +3468,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; @@ -3590,8 +3479,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: @@ -3731,9 +3619,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 d520c86942..9dbf5ed50a 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 cb1cc9b592..34b51310ce 100644 --- a/fpdfsdk/src/javascript/app.cpp +++ b/fpdfsdk/src/javascript/app.cpp @@ -129,7 +129,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)); } @@ -450,9 +450,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()) { @@ -561,8 +559,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()) { @@ -804,10 +800,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 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 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& 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() { -- cgit v1.2.3