From 85d1f2c2f9f1e746bedb1b6f03576613f54fbc27 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 23 Jun 2016 12:40:16 -0700 Subject: Remove NULL in xfa/ This CL converts all NULL's to nullptr. All instances of comparison to nullptr have been removed. Review-Url: https://codereview.chromium.org/2095653002 --- xfa/fwl/lightwidget/cfwl_barcode.h | 2 +- xfa/fwl/lightwidget/cfwl_checkbox.h | 2 +- xfa/fwl/lightwidget/cfwl_combobox.cpp | 12 +++--------- xfa/fwl/lightwidget/cfwl_combobox.h | 2 +- xfa/fwl/lightwidget/cfwl_datetimepicker.h | 2 +- xfa/fwl/lightwidget/cfwl_edit.h | 2 +- xfa/fwl/lightwidget/cfwl_listbox.cpp | 22 +++++++++------------- xfa/fwl/lightwidget/cfwl_listbox.h | 2 +- xfa/fwl/lightwidget/cfwl_picturebox.h | 2 +- xfa/fwl/lightwidget/cfwl_pushbutton.h | 4 ++-- xfa/fwl/lightwidget/cfwl_widget.h | 8 ++++---- 11 files changed, 25 insertions(+), 35 deletions(-) (limited to 'xfa/fwl/lightwidget') diff --git a/xfa/fwl/lightwidget/cfwl_barcode.h b/xfa/fwl/lightwidget/cfwl_barcode.h index 1a22064a97..466ff6ed09 100644 --- a/xfa/fwl/lightwidget/cfwl_barcode.h +++ b/xfa/fwl/lightwidget/cfwl_barcode.h @@ -17,7 +17,7 @@ class CFWL_WidgetProperties; class CFWL_Barcode : public CFWL_Edit { public: static CFWL_Barcode* Create(); - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); void SetType(BC_TYPE type); FX_BOOL IsProtectedType(); diff --git a/xfa/fwl/lightwidget/cfwl_checkbox.h b/xfa/fwl/lightwidget/cfwl_checkbox.h index 7fcd43a6eb..eb23536e25 100644 --- a/xfa/fwl/lightwidget/cfwl_checkbox.h +++ b/xfa/fwl/lightwidget/cfwl_checkbox.h @@ -17,7 +17,7 @@ class CFWL_CheckBox : public CFWL_Widget { static CFWL_CheckBox* Create(); - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); FWL_Error SetCaption(const CFX_WideStringC& wsCaption); FWL_Error SetBoxSize(FX_FLOAT fHeight); int32_t GetCheckState(); diff --git a/xfa/fwl/lightwidget/cfwl_combobox.cpp b/xfa/fwl/lightwidget/cfwl_combobox.cpp index 9d20c97824..01b64dcd07 100644 --- a/xfa/fwl/lightwidget/cfwl_combobox.cpp +++ b/xfa/fwl/lightwidget/cfwl_combobox.cpp @@ -169,9 +169,7 @@ FWL_Error CFWL_ComboBox::SetItemData(int32_t iIndex, void* pData) { void* CFWL_ComboBox::GetItemData(int32_t iIndex) { CFWL_ComboBoxItem* pItem = static_cast(m_comboBoxData.GetItem(m_pIface, iIndex)); - if (!pItem) - return NULL; - return pItem->m_pData; + return pItem ? pItem->m_pData : nullptr; } FWL_Error CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) { @@ -357,9 +355,7 @@ FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemRect(IFWL_Widget* pWidget, void* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) { - if (!pItem) - return NULL; - return static_cast(pItem)->m_pData; + return pItem ? static_cast(pItem)->m_pData : nullptr; } FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemStyles(IFWL_Widget* pWidget, @@ -396,9 +392,7 @@ FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetItemHeight(IFWL_Widget* pWidget) { CFX_DIBitmap* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIcon( IFWL_Widget* pWidget, IFWL_ListItem* pItem) { - if (!pItem) - return NULL; - return static_cast(pItem)->m_pDIB; + return pItem ? static_cast(pItem)->m_pDIB : nullptr; } FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckRect(IFWL_Widget* pWidget, diff --git a/xfa/fwl/lightwidget/cfwl_combobox.h b/xfa/fwl/lightwidget/cfwl_combobox.h index ba5db16f87..ab703fe372 100644 --- a/xfa/fwl/lightwidget/cfwl_combobox.h +++ b/xfa/fwl/lightwidget/cfwl_combobox.h @@ -24,7 +24,7 @@ class CFWL_ComboBox : public CFWL_Widget { ~CFWL_ComboBox() override; static CFWL_ComboBox* Create(); - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); int32_t AddString(const CFX_WideStringC& wsText); int32_t AddString(const CFX_WideStringC& wsText, CFX_DIBitmap* pIcon); bool RemoveAt(int32_t iIndex); // Returns false iff |iIndex| out of range. diff --git a/xfa/fwl/lightwidget/cfwl_datetimepicker.h b/xfa/fwl/lightwidget/cfwl_datetimepicker.h index 2fa385fede..4348b6cd38 100644 --- a/xfa/fwl/lightwidget/cfwl_datetimepicker.h +++ b/xfa/fwl/lightwidget/cfwl_datetimepicker.h @@ -14,7 +14,7 @@ class CFWL_DateTimePicker : public CFWL_Widget { public: static CFWL_DateTimePicker* Create(); - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); FWL_Error SetToday(int32_t iYear, int32_t iMonth, int32_t iDay); FWL_Error GetEditText(CFX_WideString& wsText); FWL_Error SetEditText(const CFX_WideString& wsText); diff --git a/xfa/fwl/lightwidget/cfwl_edit.h b/xfa/fwl/lightwidget/cfwl_edit.h index a9c058a514..a6db961a2b 100644 --- a/xfa/fwl/lightwidget/cfwl_edit.h +++ b/xfa/fwl/lightwidget/cfwl_edit.h @@ -20,7 +20,7 @@ class CFWL_Edit : public CFWL_Widget { ~CFWL_Edit() override; static CFWL_Edit* Create(); - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); FWL_Error SetText(const CFX_WideString& wsText); int32_t GetTextLength() const; FWL_Error GetText(CFX_WideString& wsText, diff --git a/xfa/fwl/lightwidget/cfwl_listbox.cpp b/xfa/fwl/lightwidget/cfwl_listbox.cpp index be6a6b1249..e85e773813 100644 --- a/xfa/fwl/lightwidget/cfwl_listbox.cpp +++ b/xfa/fwl/lightwidget/cfwl_listbox.cpp @@ -81,7 +81,7 @@ int32_t CFWL_ListBox::CountSelItems() { IFWL_ListItem* CFWL_ListBox::GetSelItem(int32_t nIndexSel) { if (!m_pIface) - return NULL; + return nullptr; return static_cast(m_pIface)->GetSelItem(nIndexSel); } @@ -164,9 +164,7 @@ FWL_Error CFWL_ListBox::SetItemData(IFWL_ListItem* pItem, void* pData) { } void* CFWL_ListBox::GetItemData(IFWL_ListItem* pItem) { - if (!pItem) - return NULL; - return static_cast(pItem)->m_pData; + return pItem ? static_cast(pItem)->m_pData : nullptr; } IFWL_ListItem* CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) { @@ -178,20 +176,20 @@ IFWL_ListItem* CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) { FX_FLOAT fPosY = 0; static_cast(m_pIface)->GetScrollPos(fx); static_cast(m_pIface)->GetScrollPos(fy, FALSE); - int32_t nCount = m_ListBoxDP.CountItems(NULL); + int32_t nCount = m_ListBoxDP.CountItems(nullptr); for (int32_t i = 0; i < nCount; i++) { - IFWL_ListItem* pItem = m_ListBoxDP.GetItem(NULL, i); + IFWL_ListItem* pItem = m_ListBoxDP.GetItem(nullptr, i); if (!pItem) { continue; } CFX_RectF rtItem; - m_ListBoxDP.GetItemRect(NULL, pItem, rtItem); + m_ListBoxDP.GetItemRect(nullptr, pItem, rtItem); rtItem.Offset(-fPosX, -fPosY); if (rtItem.Contains(fx, fy)) { return pItem; } } - return NULL; + return nullptr; } uint32_t CFWL_ListBox::GetItemStates(IFWL_ListItem* pItem) { @@ -273,9 +271,7 @@ FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetItemRect(IFWL_Widget* pWidget, void* CFWL_ListBox::CFWL_ListBoxDP::GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) { - if (!pItem) - return NULL; - return static_cast(pItem)->m_pData; + return pItem ? static_cast(pItem)->m_pData : nullptr; } FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemStyles(IFWL_Widget* pWidget, @@ -346,8 +342,8 @@ CFWL_ListItem::CFWL_ListItem() { m_rtItem.Reset(); m_dwStates = 0; m_wsText = L""; - m_pDIB = NULL; - m_pData = NULL; + m_pDIB = nullptr; + m_pData = nullptr; m_dwCheckState = 0; m_rtCheckBox.Reset(); } diff --git a/xfa/fwl/lightwidget/cfwl_listbox.h b/xfa/fwl/lightwidget/cfwl_listbox.h index c684015b61..725a7248a1 100644 --- a/xfa/fwl/lightwidget/cfwl_listbox.h +++ b/xfa/fwl/lightwidget/cfwl_listbox.h @@ -23,7 +23,7 @@ class CFWL_ListBox : public CFWL_Widget { ~CFWL_ListBox() override; static CFWL_ListBox* Create(); - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); FWL_Error AddDIBitmap(CFX_DIBitmap* pDIB, IFWL_ListItem* pItem); IFWL_ListItem* AddString(const CFX_WideStringC& wsAdd, FX_BOOL bSelect = FALSE); diff --git a/xfa/fwl/lightwidget/cfwl_picturebox.h b/xfa/fwl/lightwidget/cfwl_picturebox.h index 95a0117224..ffc67f4446 100644 --- a/xfa/fwl/lightwidget/cfwl_picturebox.h +++ b/xfa/fwl/lightwidget/cfwl_picturebox.h @@ -18,7 +18,7 @@ class CFWL_PictureBox : public CFWL_Widget { static CFWL_PictureBox* Create(); - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); CFX_DIBitmap* GetPicture(); FWL_Error SetPicture(CFX_DIBitmap* pBitmap); FX_FLOAT GetRotation(); diff --git a/xfa/fwl/lightwidget/cfwl_pushbutton.h b/xfa/fwl/lightwidget/cfwl_pushbutton.h index 145f5ed6f0..c2b71681c2 100644 --- a/xfa/fwl/lightwidget/cfwl_pushbutton.h +++ b/xfa/fwl/lightwidget/cfwl_pushbutton.h @@ -17,7 +17,7 @@ class CFWL_PushButton : public CFWL_Widget { static CFWL_PushButton* Create(); - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); FWL_Error GetCaption(CFX_WideString& wsCaption); FWL_Error SetCaption(const CFX_WideStringC& wsCaption); CFX_DIBitmap* GetPicture(); @@ -26,7 +26,7 @@ class CFWL_PushButton : public CFWL_Widget { protected: class CFWL_PushButtonDP : public IFWL_PushButtonDP { public: - CFWL_PushButtonDP() : m_pBitmap(NULL) {} + CFWL_PushButtonDP() : m_pBitmap(nullptr) {} // IFWL_DataProvider FWL_Error GetCaption(IFWL_Widget* pWidget, diff --git a/xfa/fwl/lightwidget/cfwl_widget.h b/xfa/fwl/lightwidget/cfwl_widget.h index ea17627063..2c180bad8f 100644 --- a/xfa/fwl/lightwidget/cfwl_widget.h +++ b/xfa/fwl/lightwidget/cfwl_widget.h @@ -57,14 +57,14 @@ class CFWL_Widget { FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); FWL_Error SetMatrix(const CFX_Matrix& matrix); FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + const CFX_Matrix* pMatrix = nullptr); IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); - FWL_Error Repaint(const CFX_RectF* pRect = NULL); + FWL_Error Repaint(const CFX_RectF* pRect = nullptr); FWL_Error SetFocus(FX_BOOL bFocus); FWL_Error SetGrab(FX_BOOL bSet); CFWL_Widget(); - void RegisterEventTarget(CFWL_Widget* pEventSource = NULL, + void RegisterEventTarget(CFWL_Widget* pEventSource = nullptr, uint32_t dwFilter = FWL_EVENT_ALL_MASK); void DispatchEvent(CFWL_Event* pEvent); CFX_SizeF CalcTextSize(const CFX_WideString& wsText, @@ -76,7 +76,7 @@ class CFWL_Widget { CFWL_WidgetProperties* m_pProperties; protected: - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); }; #endif // XFA_FWL_LIGHTWIDGET_CFWL_WIDGET_H_ -- cgit v1.2.3