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/cfx_string_data_template.h | |
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/cfx_string_data_template.h')
-rw-r--r-- | core/fxcrt/cfx_string_data_template.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/core/fxcrt/cfx_string_data_template.h b/core/fxcrt/cfx_string_data_template.h index b53b2511c2..225020a7dd 100644 --- a/core/fxcrt/cfx_string_data_template.h +++ b/core/fxcrt/cfx_string_data_template.h @@ -15,7 +15,7 @@ template <typename CharType> class CFX_StringDataTemplate { public: static CFX_StringDataTemplate* Create(FX_STRSIZE nLen) { - FXSYS_assert(nLen > 0); + ASSERT(nLen > 0); // Calculate space needed for the fixed portion of the struct plus the // NUL char that is not included in |m_nAllocLength|. @@ -32,7 +32,7 @@ class CFX_StringDataTemplate { nSize += 7; int totalSize = nSize.ValueOrDie() & ~7; int usableLen = (totalSize - overhead) / sizeof(CharType); - FXSYS_assert(usableLen >= nLen); + ASSERT(usableLen >= nLen); void* pData = FX_Alloc(uint8_t, totalSize); return new (pData) CFX_StringDataTemplate(nLen, usableLen); @@ -61,13 +61,13 @@ class CFX_StringDataTemplate { } void CopyContents(const CFX_StringDataTemplate& other) { - FXSYS_assert(other.m_nDataLength <= m_nAllocLength); + ASSERT(other.m_nDataLength <= m_nAllocLength); FXSYS_memcpy(m_String, other.m_String, (other.m_nDataLength + 1) * sizeof(CharType)); } void CopyContents(const CharType* pStr, FX_STRSIZE nLen) { - FXSYS_assert(nLen >= 0 && nLen <= m_nAllocLength); + ASSERT(nLen >= 0 && nLen <= m_nAllocLength); FXSYS_memcpy(m_String, pStr, nLen * sizeof(CharType)); m_String[nLen] = 0; } @@ -75,7 +75,7 @@ class CFX_StringDataTemplate { void CopyContentsAt(FX_STRSIZE offset, const CharType* pStr, FX_STRSIZE nLen) { - FXSYS_assert(offset >= 0 && nLen >= 0 && offset + nLen <= m_nAllocLength); + ASSERT(offset >= 0 && nLen >= 0 && offset + nLen <= m_nAllocLength); FXSYS_memcpy(m_String + offset, pStr, nLen * sizeof(CharType)); m_String[offset + nLen] = 0; } @@ -101,8 +101,8 @@ class CFX_StringDataTemplate { private: CFX_StringDataTemplate(FX_STRSIZE dataLen, FX_STRSIZE allocLen) : m_nRefs(0), m_nDataLength(dataLen), m_nAllocLength(allocLen) { - FXSYS_assert(dataLen >= 0); - FXSYS_assert(dataLen <= allocLen); + ASSERT(dataLen >= 0); + ASSERT(dataLen <= allocLen); m_String[dataLen] = 0; } |