summaryrefslogtreecommitdiff
path: root/core
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
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')
-rw-r--r--core/fdrm/crypto/fx_crypt_sha.cpp4
-rw-r--r--core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp14
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_colorspace.cpp2
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_countedobject.h2
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_document.cpp6
-rw-r--r--core/fpdfdoc/doc_ocg.cpp4
-rw-r--r--core/fxcodec/codec/fx_codec.cpp4
-rw-r--r--core/fxcodec/codec/fx_codec_jpeg.cpp2
-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
19 files changed, 97 insertions, 98 deletions
diff --git a/core/fdrm/crypto/fx_crypt_sha.cpp b/core/fdrm/crypto/fx_crypt_sha.cpp
index ed5da2f504..222ab9eb80 100644
--- a/core/fdrm/crypto/fx_crypt_sha.cpp
+++ b/core/fdrm/crypto/fx_crypt_sha.cpp
@@ -369,7 +369,7 @@ typedef struct {
uint8_t buffer[128];
} sha384_context;
uint64_t FX_ato64i(const FX_CHAR* str) {
- FXSYS_assert(str);
+ ASSERT(str);
uint64_t ret = 0;
int len = (int)FXSYS_strlen(str);
len = len > 16 ? 16 : len;
@@ -384,7 +384,7 @@ uint64_t FX_ato64i(const FX_CHAR* str) {
} else if (str[i] >= 'A' && str[i] <= 'F') {
ret |= (str[i] - 'A' + 10) & 0xFF;
} else {
- FXSYS_assert(FALSE);
+ ASSERT(FALSE);
}
}
return ret;
diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index 3b5012fdec..2c4dc32fde 100644
--- a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -193,7 +193,7 @@ int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument,
FX_BOOL bCompress) {
FX_FILESIZE offset = 0;
int32_t len = 0;
- FXSYS_assert(pDocument && pFile);
+ ASSERT(pDocument && pFile);
CPDF_Parser* pParser = (CPDF_Parser*)pDocument->GetParser();
if (pParser) {
CPDF_Dictionary* p = pParser->GetTrailer();
@@ -283,7 +283,7 @@ int32_t PDF_CreatorWriteEncrypt(const CPDF_Dictionary* pEncryptDict,
if (!pEncryptDict) {
return 0;
}
- FXSYS_assert(pFile);
+ ASSERT(pFile);
FX_FILESIZE offset = 0;
int32_t len = 0;
if (pFile->AppendString("/Encrypt") < 0) {
@@ -538,7 +538,7 @@ void CPDF_ObjectStream::CompressIndirectObject(uint32_t dwObjNum,
}
FX_FILESIZE CPDF_ObjectStream::End(CPDF_Creator* pCreator) {
- FXSYS_assert(pCreator);
+ ASSERT(pCreator);
if (m_Items.empty())
return 0;
@@ -1467,7 +1467,7 @@ void CPDF_Creator::AppendNewObjNum(uint32_t objbum) {
m_NewObjNumArray.InsertAt(iFind, objbum);
}
int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) {
- FXSYS_assert(m_iStage > -1 || m_iStage < 20);
+ ASSERT(m_iStage > -1 || m_iStage < 20);
if (m_iStage == 0) {
if (!m_pParser) {
m_dwFlags &= ~FPDFCREATE_INCREMENTAL;
@@ -1562,7 +1562,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) {
return m_iStage;
}
int32_t CPDF_Creator::WriteDoc_Stage2(IFX_Pause* pPause) {
- FXSYS_assert(m_iStage >= 20 || m_iStage < 30);
+ ASSERT(m_iStage >= 20 || m_iStage < 30);
if (m_iStage == 20) {
if ((m_dwFlags & FPDFCREATE_INCREMENTAL) == 0 && m_pParser) {
m_Pos = (void*)(uintptr_t)0;
@@ -1609,7 +1609,7 @@ int32_t CPDF_Creator::WriteDoc_Stage2(IFX_Pause* pPause) {
return m_iStage;
}
int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) {
- FXSYS_assert(m_iStage >= 80 || m_iStage < 90);
+ ASSERT(m_iStage >= 80 || m_iStage < 90);
uint32_t dwLastObjNum = m_dwLastObjNum;
if (m_iStage == 80) {
m_XrefStart = m_Offset;
@@ -1723,7 +1723,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) {
}
int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
- FXSYS_assert(m_iStage >= 90);
+ ASSERT(m_iStage >= 90);
if ((m_dwFlags & FPDFCREATE_OBJECTSTREAM) == 0) {
FX_BOOL bXRefStream =
(m_dwFlags & FPDFCREATE_INCREMENTAL) != 0 && m_pParser->IsXRefStream();
diff --git a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
index 32e2945818..48fdc1c914 100644
--- a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
@@ -676,7 +676,7 @@ void CPDF_LabCS::GetDefaultValue(int iComponent,
FX_FLOAT& value,
FX_FLOAT& min,
FX_FLOAT& max) const {
- assert(iComponent < 3);
+ ASSERT(iComponent < 3);
value = 0;
if (iComponent == 0) {
min = 0;
diff --git a/core/fpdfapi/fpdf_page/cpdf_countedobject.h b/core/fpdfapi/fpdf_page/cpdf_countedobject.h
index da840bec60..e7f4ab6af0 100644
--- a/core/fpdfapi/fpdf_page/cpdf_countedobject.h
+++ b/core/fpdfapi/fpdf_page/cpdf_countedobject.h
@@ -25,7 +25,7 @@ class CPDF_CountedObject {
}
T* get() const { return m_pObj; }
T* AddRef() {
- FXSYS_assert(m_pObj);
+ ASSERT(m_pObj);
++m_nCount;
return m_pObj;
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
index ead1ac0455..39694c1c1a 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
@@ -238,7 +238,7 @@ const FX_LANG2CS gs_FXLang2CharsetTable[] = {
};
uint32_t FX_GetLangHashCode(const FX_CHAR* pStr) {
- FXSYS_assert(pStr);
+ ASSERT(pStr);
int32_t iLength = FXSYS_strlen(pStr);
const FX_CHAR* pStrEnd = pStr + iLength;
uint32_t uHashCode = 0;
@@ -265,7 +265,7 @@ uint8_t FX_GetCsFromLangCode(uint32_t uCode) {
}
uint8_t FX_GetCharsetFromLang(const FX_CHAR* pLang, int32_t iLength) {
- FXSYS_assert(pLang);
+ ASSERT(pLang);
if (iLength < 0)
iLength = FXSYS_strlen(pLang);
@@ -765,7 +765,7 @@ CPDF_Image* CPDF_Document::LoadImageF(CPDF_Object* pObj) {
if (!pObj)
return nullptr;
- FXSYS_assert(pObj->GetObjNum());
+ ASSERT(pObj->GetObjNum());
return m_pDocPage->GetImage(pObj);
}
diff --git a/core/fpdfdoc/doc_ocg.cpp b/core/fpdfdoc/doc_ocg.cpp
index bc5c00b540..2249574b7f 100644
--- a/core/fpdfdoc/doc_ocg.cpp
+++ b/core/fpdfdoc/doc_ocg.cpp
@@ -46,7 +46,7 @@ static FX_BOOL FPDFDOC_OCG_HasIntent(const CPDF_Dictionary* pDict,
static CPDF_Dictionary* FPDFDOC_OCG_GetConfig(CPDF_Document* pDoc,
const CPDF_Dictionary* pOCGDict,
const CFX_ByteStringC& bsState) {
- FXSYS_assert(pDoc && pOCGDict);
+ ASSERT(pDoc && pOCGDict);
CPDF_Dictionary* pOCProperties = pDoc->GetRoot()->GetDictBy("OCProperties");
if (!pOCProperties) {
return NULL;
@@ -89,7 +89,7 @@ static CFX_ByteString FPDFDOC_OCG_GetUsageTypeString(
return csState;
}
CPDF_OCContext::CPDF_OCContext(CPDF_Document* pDoc, UsageType eUsageType) {
- FXSYS_assert(pDoc);
+ ASSERT(pDoc);
m_pDocument = pDoc;
m_eUsageType = eUsageType;
}
diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp
index a0356929a5..f0f03ab0e9 100644
--- a/core/fxcodec/codec/fx_codec.cpp
+++ b/core/fxcodec/codec/fx_codec.cpp
@@ -375,7 +375,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) {
return;
}
if (m_Operator < 128) {
- FXSYS_assert((uint32_t)m_Operator + 1 >= used_bytes);
+ ASSERT((uint32_t)m_Operator + 1 >= used_bytes);
if (used_bytes == m_Operator + 1) {
m_SrcOffset += used_bytes;
GetNextOperator();
@@ -389,7 +389,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) {
return;
}
uint8_t count = 257 - m_Operator;
- FXSYS_assert((uint32_t)count >= used_bytes);
+ ASSERT((uint32_t)count >= used_bytes);
if (used_bytes == count) {
m_SrcOffset++;
GetNextOperator();
diff --git a/core/fxcodec/codec/fx_codec_jpeg.cpp b/core/fxcodec/codec/fx_codec_jpeg.cpp
index 608bf52969..ebe6106945 100644
--- a/core/fxcodec/codec/fx_codec_jpeg.cpp
+++ b/core/fxcodec/codec/fx_codec_jpeg.cpp
@@ -457,7 +457,7 @@ FX_BOOL CCodec_JpegDecoder::v_Rewind() {
return FALSE;
}
if ((int)cinfo.output_width > m_OrigWidth) {
- FXSYS_assert(FALSE);
+ ASSERT(FALSE);
return FALSE;
}
m_bStarted = TRUE;
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); }