From 4997b22f84307521a62838f874928bf56cd3423c Mon Sep 17 00:00:00 2001 From: thestig Date: Tue, 7 Jun 2016 10:46:22 -0700 Subject: Get rid of NULLs in core/ Review-Url: https://codereview.chromium.org/2032613003 --- core/fxcrt/include/fx_basic.h | 23 ++++++++++++----------- core/fxcrt/include/fx_ext.h | 4 ++-- core/fxcrt/include/fx_system.h | 4 ---- core/fxcrt/include/fx_ucd.h | 4 ++-- core/fxcrt/include/fx_xml.h | 6 +++--- 5 files changed, 19 insertions(+), 22 deletions(-) (limited to 'core/fxcrt/include') diff --git a/core/fxcrt/include/fx_basic.h b/core/fxcrt/include/fx_basic.h index 13b51bd3fa..8e39f5577a 100644 --- a/core/fxcrt/include/fx_basic.h +++ b/core/fxcrt/include/fx_basic.h @@ -476,7 +476,7 @@ class CFX_MapPtrToPtr { void RemoveAll(); FX_POSITION GetStartPosition() const { - return (m_nCount == 0) ? NULL : (FX_POSITION)-1; + return m_nCount == 0 ? nullptr : (FX_POSITION)-1; } void GetNextAssoc(FX_POSITION& rNextPosition, @@ -515,7 +515,7 @@ class CFX_MapPtrTemplate : public CFX_MapPtrToPtr { CFX_MapPtrTemplate() : CFX_MapPtrToPtr(10) {} FX_BOOL Lookup(KeyType key, ValueType& rValue) const { - void* pValue = NULL; + void* pValue = nullptr; if (!CFX_MapPtrToPtr::Lookup((void*)(uintptr_t)key, pValue)) { return FALSE; } @@ -538,8 +538,8 @@ class CFX_MapPtrTemplate : public CFX_MapPtrToPtr { void GetNextAssoc(FX_POSITION& rNextPosition, KeyType& rKey, ValueType& rValue) const { - void* pKey = NULL; - void* pValue = NULL; + void* pKey = nullptr; + void* pValue = nullptr; CFX_MapPtrToPtr::GetNextAssoc(rNextPosition, pKey, pValue); rKey = (KeyType)(uintptr_t)pKey; rValue = (ValueType)(uintptr_t)pValue; @@ -596,7 +596,7 @@ class CFX_PtrList { } FX_POSITION InsertAfter(FX_POSITION pos, void* newElement); - FX_POSITION Find(void* searchValue, FX_POSITION startAfter = NULL) const; + FX_POSITION Find(void* searchValue, FX_POSITION startAfter = nullptr) const; FX_POSITION FindIndex(int index) const; void RemoveAt(FX_POSITION pos); @@ -662,7 +662,7 @@ class CFX_CountRef { int m_RefCount; }; - CFX_CountRef() { m_pObject = NULL; } + CFX_CountRef() { m_pObject = nullptr; } CFX_CountRef(const Ref& ref) { m_pObject = ref.m_pObject; @@ -716,7 +716,7 @@ class CFX_CountRef { if (m_pObject->m_RefCount <= 0) { delete m_pObject; } - m_pObject = NULL; + m_pObject = nullptr; } bool operator==(const Ref& ref) const { return m_pObject == ref.m_pObject; } @@ -785,15 +785,15 @@ class CFX_SortListArray { uint8_t* GetAt(int32_t nIndex) { if (nIndex < 0) { - return NULL; + return nullptr; } if (m_CurList < 0 || m_CurList >= m_DataLists.GetSize()) { - return NULL; + return nullptr; } DataList* pCurList = m_DataLists.GetDataPtr(m_CurList); if (!pCurList || nIndex < pCurList->start || nIndex >= pCurList->start + pCurList->count) { - pCurList = NULL; + pCurList = nullptr; int32_t iStart = 0; int32_t iEnd = m_DataLists.GetUpperBound(); int32_t iMid = 0; @@ -811,7 +811,8 @@ class CFX_SortListArray { } } } - return pCurList ? pCurList->data + (nIndex - pCurList->start) * unit : NULL; + return pCurList ? pCurList->data + (nIndex - pCurList->start) * unit + : nullptr; } protected: diff --git a/core/fxcrt/include/fx_ext.h b/core/fxcrt/include/fx_ext.h index b6c05ae9bc..d37db67d4a 100644 --- a/core/fxcrt/include/fx_ext.h +++ b/core/fxcrt/include/fx_ext.h @@ -24,10 +24,10 @@ FX_FLOAT FXSYS_tan(FX_FLOAT a); FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x); FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, int32_t iLength = -1, - int32_t* pUsedLen = NULL); + int32_t* pUsedLen = nullptr); FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, int32_t iLength = -1, - int32_t* pUsedLen = NULL); + int32_t* pUsedLen = nullptr); FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count); int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count); int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count); diff --git a/core/fxcrt/include/fx_system.h b/core/fxcrt/include/fx_system.h index 61acd73492..ca5d49aad6 100644 --- a/core/fxcrt/include/fx_system.h +++ b/core/fxcrt/include/fx_system.h @@ -91,10 +91,6 @@ static_assert(TRUE == true, "true_needs_to_be_true"); static_assert(FALSE == false, "false_needs_to_be_false"); #endif -#ifndef NULL -#define NULL 0 -#endif - #ifndef ASSERT #ifndef NDEBUG #define ASSERT assert diff --git a/core/fxcrt/include/fx_ucd.h b/core/fxcrt/include/fx_ucd.h index fbf3187c86..c2c4688628 100644 --- a/core/fxcrt/include/fx_ucd.h +++ b/core/fxcrt/include/fx_ucd.h @@ -158,7 +158,7 @@ class CFX_TxtChar : public CFX_Char { m_iBidiLevel(0), m_iBidiPos(0), m_iBidiOrder(0), - m_pUserData(NULL) {} + m_pUserData(nullptr) {} uint32_t m_dwStatus; int16_t m_iBidiClass; int16_t m_iBidiLevel; @@ -179,7 +179,7 @@ class CFX_RTFChar : public CFX_Char { m_iBidiPos(0), m_dwLayoutStyles(0), m_dwIdentity(0), - m_pUserData(NULL) {} + m_pUserData(nullptr) {} uint32_t m_dwStatus; int32_t m_iFontSize; int32_t m_iFontHeight; diff --git a/core/fxcrt/include/fx_xml.h b/core/fxcrt/include/fx_xml.h index 8816e2eae1..0e8c82b103 100644 --- a/core/fxcrt/include/fx_xml.h +++ b/core/fxcrt/include/fx_xml.h @@ -53,13 +53,13 @@ class CXML_Element { static CXML_Element* Parse(const void* pBuffer, size_t size, FX_BOOL bSaveSpaceChars = FALSE, - FX_FILESIZE* pParsedSize = NULL); + FX_FILESIZE* pParsedSize = nullptr); static CXML_Element* Parse(IFX_FileRead* pFile, FX_BOOL bSaveSpaceChars = FALSE, - FX_FILESIZE* pParsedSize = NULL); + FX_FILESIZE* pParsedSize = nullptr); static CXML_Element* Parse(IFX_BufferRead* pBuffer, FX_BOOL bSaveSpaceChars = FALSE, - FX_FILESIZE* pParsedSize = NULL); + FX_FILESIZE* pParsedSize = nullptr); CXML_Element(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagName); CXML_Element(const CFX_ByteStringC& qTagName); -- cgit v1.2.3