diff options
author | dsinclair <dsinclair@chromium.org> | 2016-04-27 12:26:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-27 12:26:01 -0700 |
commit | 43854a5073602a4613131aa6dbac5f7b9a095bcd (patch) | |
tree | 653ebf0cd690e13d1ca9e315ffeb34f8ac85cfbb /core/fxcrt/include | |
parent | b2f6f9158f54cee1825830c7ed57fe9d89cff26e (diff) | |
download | pdfium-43854a5073602a4613131aa6dbac5f7b9a095bcd.tar.xz |
Standardize on ASSERT.
There are currently three ways to assert in the code (ASSERT, FXSYS_assert and
assert). This CL standardizes on ASSERT. The benefit of ASSERT is that it can
be overridden if the platform requies and we can pickup the Chromium version
if it has already been defined in the build.
This does change behaviour. Currently FXSYS_assert is always defined but ASSERT
is only defined in debug builds. So, the FXSYS_assert's would fire in Release
builds. That will no longer happen.
BUG=pdfium:219
Review-Url: https://codereview.chromium.org/1914303003
Diffstat (limited to 'core/fxcrt/include')
-rw-r--r-- | core/fxcrt/include/fx_basic.h | 12 | ||||
-rw-r--r-- | core/fxcrt/include/fx_ext.h | 2 | ||||
-rw-r--r-- | core/fxcrt/include/fx_system.h | 3 |
3 files changed, 8 insertions, 9 deletions
diff --git a/core/fxcrt/include/fx_basic.h b/core/fxcrt/include/fx_basic.h index 676996c5d5..5ec55062aa 100644 --- a/core/fxcrt/include/fx_basic.h +++ b/core/fxcrt/include/fx_basic.h @@ -407,7 +407,7 @@ class CFX_ObjectArray : public CFX_BasicArray { if (!nSize) { return 0; } - FXSYS_assert(nStart > -1 && nStart < nSize); + ASSERT(nStart > -1 && nStart < nSize); if (nCount < 0) { nCount = nSize; } @@ -437,7 +437,7 @@ class CFX_ObjectArray : public CFX_BasicArray { if (!nSize) { return 0; } - FXSYS_assert(nStart > -1 && nStart < nSize); + ASSERT(nStart > -1 && nStart < nSize); if (nCount < 0) { nCount = nSize; } @@ -460,7 +460,7 @@ class CFX_ObjectArray : public CFX_BasicArray { int GetSize() const { return m_nSize; } ObjectClass& operator[](int index) const { - FXSYS_assert(index < m_nSize); + ASSERT(index < m_nSize); return *(ObjectClass*)CFX_BasicArray::GetDataPtr(index); } @@ -469,7 +469,7 @@ class CFX_ObjectArray : public CFX_BasicArray { } void RemoveAt(int index) { - FXSYS_assert(index < m_nSize); + ASSERT(index < m_nSize); ((ObjectClass*)GetDataPtr(index))->~ObjectClass(); CFX_BasicArray::RemoveAt(index, 1); } @@ -806,7 +806,7 @@ class CFX_CountRef { } void operator=(void* p) { - FXSYS_assert(p == 0); + ASSERT(p == 0); if (!m_pObject) { return; } @@ -982,7 +982,7 @@ class CFX_ListArrayTemplate { T2& operator[](int32_t nIndex) { uint8_t* data = m_Data.GetAt(nIndex); - FXSYS_assert(data); + ASSERT(data); return (T2&)(*(volatile T2*)data); } diff --git a/core/fxcrt/include/fx_ext.h b/core/fxcrt/include/fx_ext.h index e956d3cb43..b6c05ae9bc 100644 --- a/core/fxcrt/include/fx_ext.h +++ b/core/fxcrt/include/fx_ext.h @@ -110,7 +110,7 @@ template <class baseType> class CFX_SSortTemplate { public: void ShellSort(baseType* pArray, int32_t iCount) { - FXSYS_assert(pArray && iCount > 0); + ASSERT(pArray && iCount > 0); int32_t i, j, gap; baseType v1, v2; gap = iCount >> 1; diff --git a/core/fxcrt/include/fx_system.h b/core/fxcrt/include/fx_system.h index 4900634aa5..795a0c2794 100644 --- a/core/fxcrt/include/fx_system.h +++ b/core/fxcrt/include/fx_system.h @@ -95,10 +95,9 @@ static_assert(FALSE == false, "false_needs_to_be_false"); #define NULL 0 #endif -#define FXSYS_assert assert #ifndef ASSERT #ifndef NDEBUG -#define ASSERT FXSYS_assert +#define ASSERT assert #else #define ASSERT(a) #endif |