summaryrefslogtreecommitdiff
path: root/xfa/fgas/layout
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 /xfa/fgas/layout
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 'xfa/fgas/layout')
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.cpp26
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.h18
-rw-r--r--xfa/fgas/layout/fgas_textbreak.cpp16
-rw-r--r--xfa/fgas/layout/fgas_textbreak.h10
-rw-r--r--xfa/fgas/layout/fgas_unicode.cpp4
5 files changed, 37 insertions, 37 deletions
diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp
index 3adb251254..b44af96c77 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/fgas_rtfbreak.cpp
@@ -238,8 +238,8 @@ void CFX_RTFBreak::SetReadingOrder(FX_BOOL bRTL) {
m_bRTL = bRTL;
}
void CFX_RTFBreak::SetAlignment(int32_t iAlignment) {
- FXSYS_assert(iAlignment >= FX_RTFLINEALIGNMENT_Left &&
- iAlignment <= FX_RTFLINEALIGNMENT_Distributed);
+ ASSERT(iAlignment >= FX_RTFLINEALIGNMENT_Left &&
+ iAlignment <= FX_RTFLINEALIGNMENT_Distributed);
m_iAlignment = iAlignment;
}
void CFX_RTFBreak::SetUserData(IFX_Unknown* pUserData) {
@@ -299,7 +299,7 @@ CFX_RTFLine* CFX_RTFBreak::GetRTFLine(FX_BOOL bReady) const {
return NULL;
}
}
- FXSYS_assert(m_pCurLine != NULL);
+ ASSERT(m_pCurLine != NULL);
return m_pCurLine;
}
CFX_RTFPieceArray* CFX_RTFBreak::GetRTFPieces(FX_BOOL bReady) const {
@@ -343,7 +343,7 @@ static const FX_RTFBreak_LPFAppendChar g_FX_RTFBreak_lpfAppendChar[16] = {
&CFX_RTFBreak::AppendChar_Others, &CFX_RTFBreak::AppendChar_Others,
};
uint32_t CFX_RTFBreak::AppendChar(FX_WCHAR wch) {
- FXSYS_assert(m_pFont != NULL && m_pCurLine != NULL && m_pArabicChar != NULL);
+ ASSERT(m_pFont != NULL && m_pCurLine != NULL && m_pArabicChar != NULL);
if (m_bCharCode) {
return AppendChar_CharCode(wch);
}
@@ -392,8 +392,8 @@ uint32_t CFX_RTFBreak::AppendChar(FX_WCHAR wch) {
return std::max(dwRet1, dwRet2);
}
uint32_t CFX_RTFBreak::AppendChar_CharCode(FX_WCHAR wch) {
- FXSYS_assert(m_pFont != NULL && m_pCurLine != NULL);
- FXSYS_assert(m_bCharCode);
+ ASSERT(m_pFont != NULL && m_pCurLine != NULL);
+ ASSERT(m_bCharCode);
m_pCurLine->m_iMBCSChars++;
CFX_RTFCharArray& tca = m_pCurLine->m_LineChars;
CFX_RTFChar* pCurChar = tca.AddSpace();
@@ -606,8 +606,8 @@ uint32_t CFX_RTFBreak::AppendChar_Others(CFX_RTFChar* pCurChar,
return FX_RTFBREAK_None;
}
uint32_t CFX_RTFBreak::EndBreak(uint32_t dwStatus) {
- FXSYS_assert(dwStatus >= FX_RTFBREAK_PieceBreak &&
- dwStatus <= FX_RTFBREAK_PageBreak);
+ ASSERT(dwStatus >= FX_RTFBREAK_PieceBreak &&
+ dwStatus <= FX_RTFBREAK_PageBreak);
m_dwIdentity++;
CFX_RTFPieceArray* pCurPieces = &m_pCurLine->m_LinePieces;
int32_t iCount = pCurPieces->GetSize();
@@ -1067,7 +1067,7 @@ int32_t CFX_RTFBreak::GetBreakPos(CFX_RTFCharArray& tca,
void CFX_RTFBreak::SplitTextLine(CFX_RTFLine* pCurLine,
CFX_RTFLine* pNextLine,
FX_BOOL bAllChars) {
- FXSYS_assert(pCurLine != NULL && pNextLine != NULL);
+ ASSERT(pCurLine != NULL && pNextLine != NULL);
int32_t iCount = pCurLine->CountChars();
if (iCount < 2) {
return;
@@ -1181,8 +1181,8 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
if (pText == NULL || pText->iLength < 1) {
return 0;
}
- FXSYS_assert(pText->pStr != NULL && pText->pWidths != NULL &&
- pText->pFont != NULL && pText->pRect != NULL);
+ ASSERT(pText->pStr != NULL && pText->pWidths != NULL &&
+ pText->pFont != NULL && pText->pRect != NULL);
const FX_WCHAR* pStr = pText->pStr;
int32_t* pWidths = pText->pWidths;
int32_t iLength = pText->iLength - 1;
@@ -1422,8 +1422,8 @@ int32_t CFX_RTFBreak::GetCharRects(const FX_RTFTEXTOBJ* pText,
if (pText == NULL || pText->iLength < 1) {
return 0;
}
- FXSYS_assert(pText->pStr != NULL && pText->pWidths != NULL &&
- pText->pFont != NULL && pText->pRect != NULL);
+ ASSERT(pText->pStr != NULL && pText->pWidths != NULL &&
+ pText->pFont != NULL && pText->pRect != NULL);
const FX_WCHAR* pStr = pText->pStr;
int32_t* pWidths = pText->pWidths;
int32_t iLength = pText->iLength;
diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h
index 8a66dd9e93..95de85bde6 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.h
+++ b/xfa/fgas/layout/fgas_rtfbreak.h
@@ -115,7 +115,7 @@ class CFX_RTFPiece : public CFX_Target {
m_pUserData(NULL) {}
~CFX_RTFPiece() { Reset(); }
void AppendChar(const CFX_RTFChar& tc) {
- FXSYS_assert(m_pChars != NULL);
+ ASSERT(m_pChars != NULL);
m_pChars->Add(tc);
if (m_iWidth < 0) {
m_iWidth = tc.m_iCharWidth;
@@ -130,15 +130,15 @@ class CFX_RTFPiece : public CFX_Target {
int32_t GetLength() const { return m_iChars; }
int32_t GetEndChar() const { return m_iStartChar + m_iChars; }
CFX_RTFChar& GetChar(int32_t index) {
- FXSYS_assert(index > -1 && index < m_iChars && m_pChars != NULL);
+ ASSERT(index > -1 && index < m_iChars && m_pChars != NULL);
return *m_pChars->GetDataPtr(m_iStartChar + index);
}
CFX_RTFChar* GetCharPtr(int32_t index) const {
- FXSYS_assert(index > -1 && index < m_iChars && m_pChars != NULL);
+ ASSERT(index > -1 && index < m_iChars && m_pChars != NULL);
return m_pChars->GetDataPtr(m_iStartChar + index);
}
void GetString(FX_WCHAR* pText) const {
- FXSYS_assert(pText != NULL);
+ ASSERT(pText != NULL);
int32_t iEndChar = m_iStartChar + m_iChars;
CFX_RTFChar* pChar;
for (int32_t i = m_iStartChar; i < iEndChar; i++) {
@@ -152,7 +152,7 @@ class CFX_RTFPiece : public CFX_Target {
wsText.ReleaseBuffer(m_iChars);
}
void GetWidths(int32_t* pWidths) const {
- FXSYS_assert(pWidths != NULL);
+ ASSERT(pWidths != NULL);
int32_t iEndChar = m_iStartChar + m_iChars;
CFX_RTFChar* pChar;
for (int32_t i = m_iStartChar; i < iEndChar; i++) {
@@ -202,20 +202,20 @@ class CFX_RTFLine {
~CFX_RTFLine() { RemoveAll(); }
int32_t CountChars() const { return m_LineChars.GetSize(); }
CFX_RTFChar& GetChar(int32_t index) {
- FXSYS_assert(index > -1 && index < m_LineChars.GetSize());
+ ASSERT(index > -1 && index < m_LineChars.GetSize());
return *m_LineChars.GetDataPtr(index);
}
CFX_RTFChar* GetCharPtr(int32_t index) {
- FXSYS_assert(index > -1 && index < m_LineChars.GetSize());
+ ASSERT(index > -1 && index < m_LineChars.GetSize());
return m_LineChars.GetDataPtr(index);
}
int32_t CountPieces() const { return m_LinePieces.GetSize(); }
CFX_RTFPiece& GetPiece(int32_t index) const {
- FXSYS_assert(index > -1 && index < m_LinePieces.GetSize());
+ ASSERT(index > -1 && index < m_LinePieces.GetSize());
return m_LinePieces.GetAt(index);
}
CFX_RTFPiece* GetPiecePtr(int32_t index) const {
- FXSYS_assert(index > -1 && index < m_LinePieces.GetSize());
+ ASSERT(index > -1 && index < m_LinePieces.GetSize());
return m_LinePieces.GetPtrAt(index);
}
int32_t GetLineEnd() const { return m_iStart + m_iWidth; }
diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp
index f8cfcd0066..86fecbeef4 100644
--- a/xfa/fgas/layout/fgas_textbreak.cpp
+++ b/xfa/fgas/layout/fgas_textbreak.cpp
@@ -70,7 +70,7 @@ CFX_TxtBreak::~CFX_TxtBreak() {
}
void CFX_TxtBreak::SetLineWidth(FX_FLOAT fLineWidth) {
m_iLineWidth = FXSYS_round(fLineWidth * 20000.0f);
- FXSYS_assert(m_iLineWidth >= 20000);
+ ASSERT(m_iLineWidth >= 20000);
}
void CFX_TxtBreak::SetLinePos(FX_FLOAT fLinePos) {
int32_t iLinePos = FXSYS_round(fLinePos * 20000.0f);
@@ -167,8 +167,8 @@ void CFX_TxtBreak::SetCharRotation(int32_t iCharRotation) {
m_iRotation %= 4;
}
void CFX_TxtBreak::SetAlignment(int32_t iAlignment) {
- FXSYS_assert(iAlignment >= FX_TXTLINEALIGNMENT_Left &&
- iAlignment <= FX_TXTLINEALIGNMENT_Distributed);
+ ASSERT(iAlignment >= FX_TXTLINEALIGNMENT_Left &&
+ iAlignment <= FX_TXTLINEALIGNMENT_Distributed);
m_iAlignment = iAlignment;
ResetArabicContext();
}
@@ -342,7 +342,7 @@ void CFX_TxtBreak::AppendChar_PageLoad(CFX_Char* pCurChar, uint32_t dwProps) {
}
uint32_t CFX_TxtBreak::AppendChar_Combination(CFX_Char* pCurChar,
int32_t iRotation) {
- FXSYS_assert(pCurChar != NULL);
+ ASSERT(pCurChar != NULL);
FX_WCHAR wch = pCurChar->m_wCharCode;
FX_WCHAR wForm;
int32_t iCharWidth = 0;
@@ -608,7 +608,7 @@ uint32_t CFX_TxtBreak::AppendChar(FX_WCHAR wch) {
return std::max(dwRet1, dwRet2);
}
void CFX_TxtBreak::EndBreak_UpdateArabicShapes() {
- FXSYS_assert(m_bArabicShapes);
+ ASSERT(m_bArabicShapes);
int32_t iCount = m_pCurLine->CountChars();
if (iCount < 2) {
return;
@@ -907,8 +907,8 @@ void CFX_TxtBreak::EndBreak_Alignment(CFX_TPOArray& tpos,
}
}
uint32_t CFX_TxtBreak::EndBreak(uint32_t dwStatus) {
- FXSYS_assert(dwStatus >= FX_TXTBREAK_PieceBreak &&
- dwStatus <= FX_TXTBREAK_PageBreak);
+ ASSERT(dwStatus >= FX_TXTBREAK_PieceBreak &&
+ dwStatus <= FX_TXTBREAK_PageBreak);
CFX_TxtPieceArray* pCurPieces = m_pCurLine->m_pLinePieces;
int32_t iCount = pCurPieces->GetSize();
if (iCount > 0) {
@@ -1074,7 +1074,7 @@ int32_t CFX_TxtBreak::GetBreakPos(CFX_TxtCharArray& ca,
void CFX_TxtBreak::SplitTextLine(CFX_TxtLine* pCurLine,
CFX_TxtLine* pNextLine,
FX_BOOL bAllChars) {
- FXSYS_assert(pCurLine != NULL && pNextLine != NULL);
+ ASSERT(pCurLine != NULL && pNextLine != NULL);
int32_t iCount = pCurLine->CountChars();
if (iCount < 2) {
return;
diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h
index af6d52163f..41bd8f4921 100644
--- a/xfa/fgas/layout/fgas_textbreak.h
+++ b/xfa/fgas/layout/fgas_textbreak.h
@@ -133,11 +133,11 @@ class CFX_TxtPiece : public CFX_Target {
int32_t GetLength() const { return m_iChars; }
int32_t GetEndChar() const { return m_iStartChar + m_iChars; }
CFX_TxtChar* GetCharPtr(int32_t index) const {
- FXSYS_assert(index > -1 && index < m_iChars && m_pChars != NULL);
+ ASSERT(index > -1 && index < m_iChars && m_pChars != NULL);
return m_pChars->GetDataPtr(m_iStartChar + index);
}
void GetString(FX_WCHAR* pText) const {
- FXSYS_assert(pText != NULL);
+ ASSERT(pText != NULL);
int32_t iEndChar = m_iStartChar + m_iChars;
CFX_Char* pChar;
for (int32_t i = m_iStartChar; i < iEndChar; i++) {
@@ -152,7 +152,7 @@ class CFX_TxtPiece : public CFX_Target {
wsText.ReleaseBuffer(m_iChars);
}
void GetWidths(int32_t* pWidths) const {
- FXSYS_assert(pWidths != NULL);
+ ASSERT(pWidths != NULL);
int32_t iEndChar = m_iStartChar + m_iChars;
CFX_Char* pChar;
for (int32_t i = m_iStartChar; i < iEndChar; i++) {
@@ -189,12 +189,12 @@ class CFX_TxtLine {
}
int32_t CountChars() const { return m_pLineChars->GetSize(); }
CFX_TxtChar* GetCharPtr(int32_t index) const {
- FXSYS_assert(index > -1 && index < m_pLineChars->GetSize());
+ ASSERT(index > -1 && index < m_pLineChars->GetSize());
return m_pLineChars->GetDataPtr(index);
}
int32_t CountPieces() const { return m_pLinePieces->GetSize(); }
CFX_TxtPiece* GetPiecePtr(int32_t index) const {
- FXSYS_assert(index > -1 && index < m_pLinePieces->GetSize());
+ ASSERT(index > -1 && index < m_pLinePieces->GetSize());
return m_pLinePieces->GetPtrAt(index);
}
void GetString(CFX_WideString& wsStr) const {
diff --git a/xfa/fgas/layout/fgas_unicode.cpp b/xfa/fgas/layout/fgas_unicode.cpp
index a4cbee03b7..94f06253ac 100644
--- a/xfa/fgas/layout/fgas_unicode.cpp
+++ b/xfa/fgas/layout/fgas_unicode.cpp
@@ -7,8 +7,8 @@
#include "xfa/fgas/layout/fgas_unicode.h"
void FX_TEXTLAYOUT_PieceSort(CFX_TPOArray& tpos, int32_t iStart, int32_t iEnd) {
- FXSYS_assert(iStart > -1 && iStart < tpos.GetSize());
- FXSYS_assert(iEnd > -1 && iEnd < tpos.GetSize());
+ ASSERT(iStart > -1 && iStart < tpos.GetSize());
+ ASSERT(iEnd > -1 && iEnd < tpos.GetSize());
if (iStart >= iEnd) {
return;
}