summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-27 12:26:00 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-27 12:26:01 -0700
commit43854a5073602a4613131aa6dbac5f7b9a095bcd (patch)
tree653ebf0cd690e13d1ca9e315ffeb34f8ac85cfbb /core/fxcrt
parentb2f6f9158f54cee1825830c7ed57fe9d89cff26e (diff)
downloadpdfium-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')
-rw-r--r--core/fxcrt/cfx_string_data_template.h14
-rw-r--r--core/fxcrt/fx_arabic.cpp94
-rw-r--r--core/fxcrt/fx_basic_bstring.cpp6
-rw-r--r--core/fxcrt/fx_basic_buffer.cpp2
-rw-r--r--core/fxcrt/fx_basic_utf.cpp2
-rw-r--r--core/fxcrt/fx_basic_wstring.cpp6
-rw-r--r--core/fxcrt/fx_extension.cpp14
-rw-r--r--core/fxcrt/include/fx_basic.h12
-rw-r--r--core/fxcrt/include/fx_ext.h2
-rw-r--r--core/fxcrt/include/fx_system.h3
-rw-r--r--core/fxcrt/xml_int.h2
11 files changed, 78 insertions, 79 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;
}
diff --git a/core/fxcrt/fx_arabic.cpp b/core/fxcrt/fx_arabic.cpp
index 8c5230731f..191350e24d 100644
--- a/core/fxcrt/fx_arabic.cpp
+++ b/core/fxcrt/fx_arabic.cpp
@@ -218,8 +218,8 @@ const FX_ARBFORMTABLE* CFX_ArabicChar::ParseChar(const CFX_Char* pTC,
void FX_BidiReverseString(CFX_WideString& wsText,
int32_t iStart,
int32_t iCount) {
- FXSYS_assert(iStart > -1 && iStart < wsText.GetLength());
- FXSYS_assert(iCount >= 0 && iStart + iCount <= wsText.GetLength());
+ ASSERT(iStart > -1 && iStart < wsText.GetLength());
+ ASSERT(iCount >= 0 && iStart + iCount <= wsText.GetLength());
FX_WCHAR wch;
FX_WCHAR* pStart = const_cast<FX_WCHAR*>(wsText.c_str());
pStart += iStart;
@@ -234,8 +234,8 @@ void FX_BidiSetDeferredRun(CFX_Int32Array& values,
int32_t iStart,
int32_t iCount,
int32_t iValue) {
- FXSYS_assert(iStart > -1 && iStart <= values.GetSize());
- FXSYS_assert(iStart - iCount > -1);
+ ASSERT(iStart > -1 && iStart <= values.GetSize());
+ ASSERT(iStart - iCount > -1);
for (int32_t i = iStart - 1; i >= iStart - iCount; i--) {
values.SetAt(i, iValue);
}
@@ -250,7 +250,7 @@ const int32_t gc_FX_BidiNTypes[] = {
void FX_BidiClassify(const CFX_WideString& wsText,
CFX_Int32Array& classes,
FX_BOOL bWS) {
- FXSYS_assert(wsText.GetLength() == classes.GetSize());
+ ASSERT(wsText.GetLength() == classes.GetSize());
int32_t iCount = wsText.GetLength();
const FX_WCHAR* pwsStart = wsText.c_str();
FX_WCHAR wch;
@@ -280,10 +280,10 @@ int32_t FX_BidiResolveExplicit(int32_t iBaseLevel,
int32_t iStart,
int32_t iCount,
int32_t iNest) {
- FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL && iNest >= 0);
- FXSYS_assert(classes.GetSize() == levels.GetSize());
- FXSYS_assert(iStart >= 0 && iStart < classes.GetSize());
- FXSYS_assert(iCount >= 0 && iStart + iCount <= classes.GetSize());
+ ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL && iNest >= 0);
+ ASSERT(classes.GetSize() == levels.GetSize());
+ ASSERT(iStart >= 0 && iStart < classes.GetSize());
+ ASSERT(iCount >= 0 && iStart + iCount <= classes.GetSize());
if (iCount < 1) {
return 0;
}
@@ -390,8 +390,8 @@ const int32_t gc_FX_BidiWeakActions[][10] = {
void FX_BidiResolveWeak(int32_t iBaseLevel,
CFX_Int32Array& classes,
CFX_Int32Array& levels) {
- FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
- FXSYS_assert(classes.GetSize() == levels.GetSize());
+ ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
+ ASSERT(classes.GetSize() == levels.GetSize());
int32_t iSize = classes.GetSize();
if (iSize < 1) {
return;
@@ -403,7 +403,7 @@ void FX_BidiResolveWeak(int32_t iBaseLevel,
for (; i <= iSize; i++) {
iClsCur = classes.GetAt(i);
- FXSYS_assert(iClsCur <= FX_BIDICLASS_BN);
+ ASSERT(iClsCur <= FX_BIDICLASS_BN);
iAction = gc_FX_BidiWeakActions[iState][iClsCur];
iClsRun = FX_BidiGetDeferredType(iAction);
if (iClsRun != FX_BIDIWEAKACTION_XX && iCount > 0) {
@@ -460,8 +460,8 @@ int32_t FX_BidiGetResolvedNeutrals(int32_t iAction) {
void FX_BidiResolveNeutrals(int32_t iBaseLevel,
CFX_Int32Array& classes,
const CFX_Int32Array& levels) {
- FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
- FXSYS_assert(classes.GetSize() == levels.GetSize());
+ ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
+ ASSERT(classes.GetSize() == levels.GetSize());
int32_t iSize = classes.GetSize();
if (iSize < 1) {
return;
@@ -478,7 +478,7 @@ void FX_BidiResolveNeutrals(int32_t iBaseLevel,
}
continue;
}
- FXSYS_assert(iClsCur < FX_BIDICLASS_AL);
+ ASSERT(iClsCur < FX_BIDICLASS_AL);
iAction = gc_FX_BidiNeutralActions[iState][iClsCur];
iClsRun = FX_BidiGetDeferredNeutrals(iAction, iLevel);
if (iClsRun != FX_BIDICLASS_N && iCount > 0) {
@@ -508,7 +508,7 @@ const int32_t gc_FX_BidiAddLevel[][4] = {
};
void FX_BidiResolveImplicit(const CFX_Int32Array& classes,
CFX_Int32Array& levels) {
- FXSYS_assert(classes.GetSize() == levels.GetSize());
+ ASSERT(classes.GetSize() == levels.GetSize());
int32_t iSize = classes.GetSize();
if (iSize < 1) {
return;
@@ -520,7 +520,7 @@ void FX_BidiResolveImplicit(const CFX_Int32Array& classes,
if (iCls == FX_BIDICLASS_BN) {
continue;
}
- FXSYS_assert(iCls > FX_BIDICLASS_ON && iCls < FX_BIDICLASS_AL);
+ ASSERT(iCls > FX_BIDICLASS_ON && iCls < FX_BIDICLASS_AL);
iLevel = levels.GetAt(i);
iLevel += gc_FX_BidiAddLevel[FX_IsOdd(iLevel)][iCls - 1];
levels.SetAt(i, iLevel);
@@ -529,8 +529,8 @@ void FX_BidiResolveImplicit(const CFX_Int32Array& classes,
void FX_BidiResolveWhitespace(int32_t iBaseLevel,
const CFX_Int32Array& classes,
CFX_Int32Array& levels) {
- FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
- FXSYS_assert(classes.GetSize() == levels.GetSize());
+ ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
+ ASSERT(classes.GetSize() == levels.GetSize());
int32_t iSize = classes.GetSize();
if (iSize < 1) {
return;
@@ -575,9 +575,9 @@ int32_t FX_BidiReorderLevel(int32_t iBaseLevel,
const CFX_Int32Array& levels,
int32_t iStart,
FX_BOOL bReverse) {
- FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
- FXSYS_assert(wsText.GetLength() == levels.GetSize());
- FXSYS_assert(iStart >= 0 && iStart < wsText.GetLength());
+ ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
+ ASSERT(wsText.GetLength() == levels.GetSize());
+ ASSERT(iStart >= 0 && iStart < wsText.GetLength());
int32_t iSize = wsText.GetLength();
if (iSize < 1) {
return 0;
@@ -602,8 +602,8 @@ int32_t FX_BidiReorderLevel(int32_t iBaseLevel,
void FX_BidiReorder(int32_t iBaseLevel,
CFX_WideString& wsText,
const CFX_Int32Array& levels) {
- FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
- FXSYS_assert(wsText.GetLength() == levels.GetSize());
+ ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
+ ASSERT(wsText.GetLength() == levels.GetSize());
int32_t iSize = wsText.GetLength();
if (iSize < 1) {
return;
@@ -639,8 +639,8 @@ class CFX_BidiLineTemplate {
void FX_BidiReverseString(CFX_ArrayTemplate<baseType>& chars,
int32_t iStart,
int32_t iCount) {
- FXSYS_assert(iStart > -1 && iStart < chars.GetSize());
- FXSYS_assert(iCount >= 0 && iStart + iCount <= chars.GetSize());
+ ASSERT(iStart > -1 && iStart < chars.GetSize());
+ ASSERT(iCount >= 0 && iStart + iCount <= chars.GetSize());
baseType *pStart, *pEnd;
int32_t iEnd = iStart + iCount - 1, iTemp;
while (iStart < iEnd) {
@@ -656,8 +656,8 @@ class CFX_BidiLineTemplate {
int32_t iStart,
int32_t iCount,
int32_t iValue) {
- FXSYS_assert(iStart > -1 && iStart <= chars.GetSize());
- FXSYS_assert(iStart - iCount > -1);
+ ASSERT(iStart > -1 && iStart <= chars.GetSize());
+ ASSERT(iStart - iCount > -1);
baseType* pTC;
int32_t iLast = iStart - iCount;
if (bClass) {
@@ -675,7 +675,7 @@ class CFX_BidiLineTemplate {
void FX_BidiClassify(CFX_ArrayTemplate<baseType>& chars,
int32_t iCount,
FX_BOOL bWS) {
- FXSYS_assert(iCount > -1 && iCount <= chars.GetSize());
+ ASSERT(iCount > -1 && iCount <= chars.GetSize());
baseType* pTC;
if (bWS) {
for (int32_t i = 0; i < iCount; i++) {
@@ -696,8 +696,8 @@ class CFX_BidiLineTemplate {
void FX_BidiResolveExplicit(CFX_ArrayTemplate<baseType>& chars,
int32_t iCount,
int32_t iBaseLevel) {
- FXSYS_assert(iCount > -1 && iCount <= chars.GetSize());
- FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
+ ASSERT(iCount > -1 && iCount <= chars.GetSize());
+ ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
if (iCount < 1) {
return;
}
@@ -710,7 +710,7 @@ class CFX_BidiLineTemplate {
void FX_BidiResolveWeak(CFX_ArrayTemplate<baseType>& chars,
int32_t iCount,
int32_t iBaseLevel) {
- FXSYS_assert(iCount > -1 && iCount <= chars.GetSize());
+ ASSERT(iCount > -1 && iCount <= chars.GetSize());
iCount--;
if (iCount < 1) {
return;
@@ -754,7 +754,7 @@ class CFX_BidiLineTemplate {
continue;
}
}
- FXSYS_assert(iClsCur <= FX_BIDICLASS_BN);
+ ASSERT(iClsCur <= FX_BIDICLASS_BN);
iAction = gc_FX_BidiWeakActions[iState][iClsCur];
iClsRun = FX_BidiGetDeferredType(iAction);
if (iClsRun != FX_BIDIWEAKACTION_XX && iNum > 0) {
@@ -781,8 +781,8 @@ class CFX_BidiLineTemplate {
void FX_BidiResolveNeutrals(CFX_ArrayTemplate<baseType>& chars,
int32_t iCount,
int32_t iBaseLevel) {
- FXSYS_assert(iCount > -1 && iCount <= chars.GetSize());
- FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
+ ASSERT(iCount > -1 && iCount <= chars.GetSize());
+ ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
iCount--;
if (iCount < 1) {
return;
@@ -800,7 +800,7 @@ class CFX_BidiLineTemplate {
}
continue;
}
- FXSYS_assert(iClsCur < FX_BIDICLASS_AL);
+ ASSERT(iClsCur < FX_BIDICLASS_AL);
iAction = gc_FX_BidiNeutralActions[iState][iClsCur];
iClsRun = FX_BidiGetDeferredNeutrals(iAction, iLevel);
if (iClsRun != FX_BIDICLASS_N && iNum > 0) {
@@ -828,7 +828,7 @@ class CFX_BidiLineTemplate {
}
void FX_BidiResolveImplicit(CFX_ArrayTemplate<baseType>& chars,
int32_t iCount) {
- FXSYS_assert(iCount > -1 && iCount <= chars.GetSize());
+ ASSERT(iCount > -1 && iCount <= chars.GetSize());
baseType* pTC;
int32_t iCls, iLevel;
for (int32_t i = 0; i < iCount; i++) {
@@ -837,7 +837,7 @@ class CFX_BidiLineTemplate {
if (iCls == FX_BIDICLASS_BN) {
continue;
}
- FXSYS_assert(iCls > FX_BIDICLASS_ON && iCls < FX_BIDICLASS_AL);
+ ASSERT(iCls > FX_BIDICLASS_ON && iCls < FX_BIDICLASS_AL);
iLevel = pTC->m_iBidiLevel;
iLevel += gc_FX_BidiAddLevel[FX_IsOdd(iLevel)][iCls - 1];
pTC->m_iBidiLevel = (int16_t)iLevel;
@@ -846,8 +846,8 @@ class CFX_BidiLineTemplate {
void FX_BidiResolveWhitespace(CFX_ArrayTemplate<baseType>& chars,
int32_t iCount,
int32_t iBaseLevel) {
- FXSYS_assert(iCount > -1 && iCount <= chars.GetSize());
- FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
+ ASSERT(iCount > -1 && iCount <= chars.GetSize());
+ ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
if (iCount < 1) {
return;
}
@@ -893,9 +893,9 @@ class CFX_BidiLineTemplate {
int32_t iBaseLevel,
int32_t iStart,
FX_BOOL bReverse) {
- FXSYS_assert(iCount > -1 && iCount <= chars.GetSize());
- FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
- FXSYS_assert(iStart >= 0 && iStart < iCount);
+ ASSERT(iCount > -1 && iCount <= chars.GetSize());
+ ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
+ ASSERT(iStart >= 0 && iStart < iCount);
if (iCount < 1) {
return 0;
}
@@ -921,15 +921,15 @@ class CFX_BidiLineTemplate {
void FX_BidiReorder(CFX_ArrayTemplate<baseType>& chars,
int32_t iCount,
int32_t iBaseLevel) {
- FXSYS_assert(iCount > -1 && iCount <= chars.GetSize());
- FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
+ ASSERT(iCount > -1 && iCount <= chars.GetSize());
+ ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
int32_t i = 0;
while (i < iCount) {
i += FX_BidiReorderLevel(chars, iCount, iBaseLevel, i, FALSE);
}
}
void FX_BidiPosition(CFX_ArrayTemplate<baseType>& chars, int32_t iCount) {
- FXSYS_assert(iCount > -1 && iCount <= chars.GetSize());
+ ASSERT(iCount > -1 && iCount <= chars.GetSize());
baseType* pTC;
int32_t i = 0;
while (i < iCount) {
@@ -942,7 +942,7 @@ class CFX_BidiLineTemplate {
void FX_BidiLine(CFX_ArrayTemplate<baseType>& chars,
int32_t iCount,
int32_t iBaseLevel) {
- FXSYS_assert(iCount > -1 && iCount <= chars.GetSize());
+ ASSERT(iCount > -1 && iCount <= chars.GetSize());
if (iCount < 2) {
return;
}
diff --git a/core/fxcrt/fx_basic_bstring.cpp b/core/fxcrt/fx_basic_bstring.cpp
index e098d8fe50..cd7b616fbe 100644
--- a/core/fxcrt/fx_basic_bstring.cpp
+++ b/core/fxcrt/fx_basic_bstring.cpp
@@ -282,7 +282,7 @@ void CFX_ByteString::ReleaseBuffer(FX_STRSIZE nNewLength) {
return;
}
- FXSYS_assert(m_pData->m_nRefs == 1);
+ ASSERT(m_pData->m_nRefs == 1);
m_pData->m_nDataLength = nNewLength;
m_pData->m_String[nNewLength] = 0;
if (m_pData->m_nAllocLength - nNewLength >= 32) {
@@ -808,8 +808,8 @@ void CFX_ByteString::SetAt(FX_STRSIZE nIndex, FX_CHAR ch) {
if (!m_pData) {
return;
}
- FXSYS_assert(nIndex >= 0);
- FXSYS_assert(nIndex < m_pData->m_nDataLength);
+ ASSERT(nIndex >= 0);
+ ASSERT(nIndex < m_pData->m_nDataLength);
ReallocBeforeWrite(m_pData->m_nDataLength);
m_pData->m_String[nIndex] = ch;
}
diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp
index 338edc16c9..5a75f8b487 100644
--- a/core/fxcrt/fx_basic_buffer.cpp
+++ b/core/fxcrt/fx_basic_buffer.cpp
@@ -423,6 +423,6 @@ int32_t CFX_FileBufferArchive::AppendString(const CFX_ByteStringC& lpsz) {
}
void CFX_FileBufferArchive::AttachFile(IFX_StreamWrite* pFile) {
- FXSYS_assert(pFile);
+ ASSERT(pFile);
m_pFile = pFile;
}
diff --git a/core/fxcrt/fx_basic_utf.cpp b/core/fxcrt/fx_basic_utf.cpp
index e1996999f8..61b200fab4 100644
--- a/core/fxcrt/fx_basic_utf.cpp
+++ b/core/fxcrt/fx_basic_utf.cpp
@@ -74,7 +74,7 @@ void CFX_UTF8Encoder::Input(FX_WCHAR unicode) {
}
}
CFX_ByteString FX_UTF8Encode(const FX_WCHAR* pwsStr, FX_STRSIZE len) {
- FXSYS_assert(pwsStr);
+ ASSERT(pwsStr);
if (len < 0) {
len = FXSYS_wcslen(pwsStr);
}
diff --git a/core/fxcrt/fx_basic_wstring.cpp b/core/fxcrt/fx_basic_wstring.cpp
index 38fd15e13f..354bb5014a 100644
--- a/core/fxcrt/fx_basic_wstring.cpp
+++ b/core/fxcrt/fx_basic_wstring.cpp
@@ -230,7 +230,7 @@ void CFX_WideString::ReleaseBuffer(FX_STRSIZE nNewLength) {
return;
}
- FXSYS_assert(m_pData->m_nRefs == 1);
+ ASSERT(m_pData->m_nRefs == 1);
m_pData->m_nDataLength = nNewLength;
m_pData->m_String[nNewLength] = 0;
if (m_pData->m_nAllocLength - nNewLength >= 32) {
@@ -968,7 +968,7 @@ FX_FLOAT CFX_WideString::GetFloat() const {
// static
CFX_ByteString CFX_CharMap::GetByteString(uint16_t codepage,
const CFX_WideStringC& wstr) {
- FXSYS_assert(IsValidCodePage(codepage));
+ ASSERT(IsValidCodePage(codepage));
int src_len = wstr.GetLength();
int dest_len = FXSYS_WideCharToMultiByte(codepage, 0, wstr.c_str(), src_len,
nullptr, 0, nullptr, nullptr);
@@ -985,7 +985,7 @@ CFX_ByteString CFX_CharMap::GetByteString(uint16_t codepage,
// static
CFX_WideString CFX_CharMap::GetWideString(uint16_t codepage,
const CFX_ByteStringC& bstr) {
- FXSYS_assert(IsValidCodePage(codepage));
+ ASSERT(IsValidCodePage(codepage));
int src_len = bstr.GetLength();
int dest_len =
FXSYS_MultiByteToWideChar(codepage, 0, bstr.c_str(), src_len, nullptr, 0);
diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp
index 53fcf45ef5..0b55fc91dd 100644
--- a/core/fxcrt/fx_extension.cpp
+++ b/core/fxcrt/fx_extension.cpp
@@ -129,7 +129,7 @@ FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x) {
FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr,
int32_t iLength,
int32_t* pUsedLen) {
- FXSYS_assert(pcsStr);
+ ASSERT(pcsStr);
if (iLength < 0) {
iLength = (int32_t)FXSYS_strlen(pcsStr);
}
@@ -140,7 +140,7 @@ FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr,
FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr,
int32_t iLength,
int32_t* pUsedLen) {
- FXSYS_assert(pwsStr);
+ ASSERT(pwsStr);
if (iLength < 0) {
iLength = (int32_t)FXSYS_wcslen(pwsStr);
}
@@ -186,7 +186,7 @@ FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr,
FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr,
const FX_WCHAR* srcStr,
size_t count) {
- FXSYS_assert(dstStr && srcStr && count > 0);
+ ASSERT(dstStr && srcStr && count > 0);
for (size_t i = 0; i < count; ++i)
if ((dstStr[i] = srcStr[i]) == L'\0') {
break;
@@ -194,7 +194,7 @@ FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr,
return dstStr;
}
int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count) {
- FXSYS_assert(s1 && s2 && count > 0);
+ ASSERT(s1 && s2 && count > 0);
FX_WCHAR wch1 = 0, wch2 = 0;
while (count-- > 0) {
wch1 = (FX_WCHAR)FXSYS_tolower(*s1++);
@@ -206,7 +206,7 @@ int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count) {
return wch1 - wch2;
}
int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count) {
- FXSYS_assert(s1 && s2 && count > 0);
+ ASSERT(s1 && s2 && count > 0);
FX_CHAR ch1 = 0, ch2 = 0;
while (count-- > 0) {
ch1 = (FX_CHAR)FXSYS_tolower(*s1++);
@@ -262,7 +262,7 @@ void* FX_Random_MT_Start(uint32_t dwSeed) {
return pContext;
}
uint32_t FX_Random_MT_Generate(void* pContext) {
- FXSYS_assert(pContext);
+ ASSERT(pContext);
FX_MTRANDOMCONTEXT* pMTC = static_cast<FX_MTRANDOMCONTEXT*>(pContext);
uint32_t v;
static uint32_t mag[2] = {0, MT_Matrix_A};
@@ -293,7 +293,7 @@ uint32_t FX_Random_MT_Generate(void* pContext) {
return v;
}
void FX_Random_MT_Close(void* pContext) {
- FXSYS_assert(pContext);
+ ASSERT(pContext);
FX_Free(pContext);
}
void FX_Random_GenerateMT(uint32_t* pBuffer, int32_t iCount) {
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
diff --git a/core/fxcrt/xml_int.h b/core/fxcrt/xml_int.h
index 2dae7b5231..864b4e8789 100644
--- a/core/fxcrt/xml_int.h
+++ b/core/fxcrt/xml_int.h
@@ -49,7 +49,7 @@ class CXML_DataStmAcc : public IFX_BufferRead {
public:
explicit CXML_DataStmAcc(IFX_FileRead* pFileRead)
: m_pFileRead(pFileRead), m_pBuffer(NULL), m_nStart(0), m_dwSize(0) {
- FXSYS_assert(m_pFileRead);
+ ASSERT(m_pFileRead);
}
~CXML_DataStmAcc() override { FX_Free(m_pBuffer); }