summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-06-10 12:21:53 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-10 12:21:53 -0700
commitcfb77ccb1c057d6beb73f0043e42eee8c4822f84 (patch)
treec71d7097de50879080a237f47b42e22e1d6784db /xfa
parent7f3a15f714c8311b1adb7bdce1ac83c7113af598 (diff)
downloadpdfium-cfb77ccb1c057d6beb73f0043e42eee8c4822f84.tar.xz
Get rid of NULLs in xfa/fde/
Review-Url: https://codereview.chromium.org/2039923004
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fde/cfde_txtedtbuf.cpp7
-rw-r--r--xfa/fde/cfde_txtedtengine.cpp19
-rw-r--r--xfa/fde/cfde_txtedtengine.h2
-rw-r--r--xfa/fde/cfde_txtedtparag.cpp15
-rw-r--r--xfa/fde/css/fde_cssdatatable.cpp29
-rw-r--r--xfa/fde/css/fde_cssdatatable.h6
-rw-r--r--xfa/fde/css/fde_cssdeclaration.cpp330
-rw-r--r--xfa/fde/css/fde_cssstyleselector.cpp65
-rw-r--r--xfa/fde/css/fde_cssstyleselector.h6
-rw-r--r--xfa/fde/css/fde_cssstylesheet.cpp121
-rw-r--r--xfa/fde/css/fde_cssstylesheet.h2
-rw-r--r--xfa/fde/css/fde_csssyntax.cpp52
-rw-r--r--xfa/fde/fde_gedevice.cpp13
-rw-r--r--xfa/fde/fde_gedevice.h32
-rw-r--r--xfa/fde/tto/fde_textout.cpp45
-rw-r--r--xfa/fde/xml/fde_xml.h2
-rw-r--r--xfa/fde/xml/fde_xml_imp.cpp361
-rw-r--r--xfa/fde/xml/fde_xml_imp.h11
18 files changed, 527 insertions, 591 deletions
diff --git a/xfa/fde/cfde_txtedtbuf.cpp b/xfa/fde/cfde_txtedtbuf.cpp
index 81b586f075..7af5a1892b 100644
--- a/xfa/fde/cfde_txtedtbuf.cpp
+++ b/xfa/fde/cfde_txtedtbuf.cpp
@@ -19,7 +19,7 @@ CFDE_TxtEdtBuf::CFDE_TxtEdtBuf()
: m_nChunkSize(kDefaultChunkSize),
m_nTotal(0),
m_bChanged(FALSE),
- m_pAllocator(NULL) {
+ m_pAllocator(nullptr) {
ASSERT(m_nChunkSize);
ResetChunkBuffer(kDefaultChunkCount, m_nChunkSize);
}
@@ -196,7 +196,7 @@ void CFDE_TxtEdtBuf::Delete(int32_t nIndex, int32_t nLength) {
if (lpChunk->nUsed == 0) {
m_pAllocator->Free(lpChunk);
m_Chunks.RemoveAt(cpEnd.nChunkIndex);
- lpChunk = NULL;
+ lpChunk = nullptr;
}
nLength -= nDeleted;
cpEnd.nChunkIndex--;
@@ -260,9 +260,8 @@ FX_BOOL CFDE_TxtEdtBuf::Optimize(IFX_Pause* pPause) {
} else {
lpPreChunk = lpCurChunk;
}
- if (pPause != NULL && pPause->NeedToPauseNow()) {
+ if (pPause && pPause->NeedToPauseNow())
return FALSE;
- }
}
m_bChanged = FALSE;
return TRUE;
diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp
index 8980488abc..11a6d5c3f7 100644
--- a/xfa/fde/cfde_txtedtengine.cpp
+++ b/xfa/fde/cfde_txtedtengine.cpp
@@ -51,7 +51,7 @@ CFDE_TxtEdtEngine::~CFDE_TxtEdtEngine() {
delete m_pTextBreak;
RemoveAllParags();
RemoveAllPages();
- m_Param.pEventSink = NULL;
+ m_Param.pEventSink = nullptr;
ClearSelection();
}
@@ -78,7 +78,7 @@ int32_t CFDE_TxtEdtEngine::CountPages() const {
IFDE_TxtEdtPage* CFDE_TxtEdtEngine::GetPage(int32_t nIndex) {
if (m_PagePtrArray.GetSize() <= nIndex) {
- return NULL;
+ return nullptr;
}
return m_PagePtrArray[nIndex];
}
@@ -86,7 +86,7 @@ IFDE_TxtEdtPage* CFDE_TxtEdtEngine::GetPage(int32_t nIndex) {
void CFDE_TxtEdtEngine::SetTextByStream(IFX_Stream* pStream) {
ResetEngine();
int32_t nIndex = 0;
- if (pStream != NULL && pStream->GetLength()) {
+ if (pStream && pStream->GetLength()) {
int32_t nStreamLength = pStream->GetLength();
FX_BOOL bValid = TRUE;
if (m_nLimit > 0 && nStreamLength > m_nLimit) {
@@ -668,14 +668,13 @@ int32_t CFDE_TxtEdtEngine::StartLayout() {
int32_t CFDE_TxtEdtEngine::DoLayout(IFX_Pause* pPause) {
int32_t nCount = m_ParagPtrArray.GetSize();
- CFDE_TxtEdtParag* pParag = NULL;
+ CFDE_TxtEdtParag* pParag = nullptr;
int32_t nLineCount = 0;
for (; m_nLayoutPos < nCount; m_nLayoutPos++) {
pParag = m_ParagPtrArray[m_nLayoutPos];
pParag->CalcLines();
nLineCount += pParag->GetLineCount();
- if ((pPause != NULL) && (nLineCount > m_nPageLineCount) &&
- pPause->NeedToPauseNow()) {
+ if (nLineCount > m_nPageLineCount && pPause && pPause->NeedToPauseNow()) {
m_nLineCount += nLineCount;
return (++m_nLayoutPos * 100) / nCount;
}
@@ -732,7 +731,7 @@ CFDE_TxtEdtParag* CFDE_TxtEdtEngine::GetParag(int32_t nParagIndex) const {
IFX_CharIter* CFDE_TxtEdtEngine::CreateCharIter() {
if (!m_pTxtBuf) {
- return NULL;
+ return nullptr;
}
return new CFDE_TxtEdtBufIter(static_cast<CFDE_TxtEdtBuf*>(m_pTxtBuf));
}
@@ -743,7 +742,7 @@ int32_t CFDE_TxtEdtEngine::Line2Parag(int32_t nStartParag,
int32_t& nStartLine) const {
int32_t nLineTotal = nStartLineofParag;
int32_t nCount = m_ParagPtrArray.GetSize();
- CFDE_TxtEdtParag* pParag = NULL;
+ CFDE_TxtEdtParag* pParag = nullptr;
int32_t i = nStartParag;
for (; i < nCount; i++) {
pParag = m_ParagPtrArray[i];
@@ -996,7 +995,7 @@ void CFDE_TxtEdtEngine::UpdateParags() {
if (nCount == 0) {
return;
}
- CFDE_TxtEdtParag* pParag = NULL;
+ CFDE_TxtEdtParag* pParag = nullptr;
int32_t nLineCount = 0;
int32_t i = 0;
for (i = 0; i < nCount; i++) {
@@ -1230,7 +1229,7 @@ int32_t CFDE_TxtEdtEngine::MovePage2Char(int32_t nIndex) {
}
m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0);
}
- CFDE_TxtEdtParag* pParag = NULL;
+ CFDE_TxtEdtParag* pParag = nullptr;
int32_t nLineCount = 0;
int32_t nParagCount = m_ParagPtrArray.GetSize();
int32_t i = 0;
diff --git a/xfa/fde/cfde_txtedtengine.h b/xfa/fde/cfde_txtedtengine.h
index 1ce1ce30ec..4bafce6864 100644
--- a/xfa/fde/cfde_txtedtengine.h
+++ b/xfa/fde/cfde_txtedtengine.h
@@ -66,7 +66,7 @@ class CFDE_TxtEdtEngine {
int32_t DoLayout(IFX_Pause* pPause);
void EndLayout();
- FX_BOOL Optimize(IFX_Pause* pPause = NULL);
+ FX_BOOL Optimize(IFX_Pause* pPause = nullptr);
int32_t CountParags() const;
CFDE_TxtEdtParag* GetParag(int32_t nParagIndex) const;
IFX_CharIter* CreateCharIter();
diff --git a/xfa/fde/cfde_txtedtparag.cpp b/xfa/fde/cfde_txtedtparag.cpp
index 63e9a939b5..11015f59fd 100644
--- a/xfa/fde/cfde_txtedtparag.cpp
+++ b/xfa/fde/cfde_txtedtparag.cpp
@@ -17,7 +17,7 @@ CFDE_TxtEdtParag::CFDE_TxtEdtParag(CFDE_TxtEdtEngine* pEngine)
: m_nCharStart(0),
m_nCharCount(0),
m_nLineCount(0),
- m_lpData(NULL),
+ m_lpData(nullptr),
m_pEngine(pEngine) {
ASSERT(m_pEngine);
}
@@ -28,7 +28,7 @@ CFDE_TxtEdtParag::~CFDE_TxtEdtParag() {
}
void CFDE_TxtEdtParag::LoadParag() {
- if (m_lpData != NULL) {
+ if (m_lpData) {
((int32_t*)m_lpData)[0]++;
return;
}
@@ -77,11 +77,11 @@ void CFDE_TxtEdtParag::LoadParag() {
pTxtBreak->ClearBreakPieces();
int32_t nLineCount = LineBaseArr.GetSize();
m_nLineCount = nLineCount;
- if (m_lpData == NULL) {
- m_lpData = FX_Alloc(int32_t, nLineCount + 1);
- } else {
+ if (m_lpData)
m_lpData = FX_Realloc(int32_t, m_lpData, (nLineCount + 1));
- }
+ else
+ m_lpData = FX_Alloc(int32_t, nLineCount + 1);
+
int32_t* pIntArr = (int32_t*)m_lpData;
pIntArr[0] = 1;
m_nLineCount = nLineCount;
@@ -93,12 +93,11 @@ void CFDE_TxtEdtParag::LoadParag() {
}
void CFDE_TxtEdtParag::UnloadParag() {
- ASSERT(m_lpData != NULL);
((int32_t*)m_lpData)[0]--;
ASSERT(((int32_t*)m_lpData)[0] >= 0);
if (((int32_t*)m_lpData)[0] == 0) {
FX_Free(m_lpData);
- m_lpData = NULL;
+ m_lpData = nullptr;
}
}
diff --git a/xfa/fde/css/fde_cssdatatable.cpp b/xfa/fde/css/fde_cssdatatable.cpp
index 1af0059cb6..ac8c466932 100644
--- a/xfa/fde/css/fde_cssdatatable.cpp
+++ b/xfa/fde/css/fde_cssdatatable.cpp
@@ -37,13 +37,12 @@ CFX_FloatRect FDE_CSSBoundaryToRect(IFDE_CSSBoundaryStyle* pBoundStyle,
FX_BOOL bPadding,
FX_BOOL bBorder,
FX_BOOL bMargin) {
- ASSERT(pBoundStyle != NULL);
FX_FLOAT fResult;
const FDE_CSSRECT* pRect;
CFX_FloatRect rect(0, 0, 0, 0);
if (bPadding) {
pRect = pBoundStyle->GetPaddingWidth();
- if (pRect != NULL) {
+ if (pRect) {
if (FDE_CSSLengthToFloat(pRect->left, fContainerWidth, fResult)) {
rect.left += fResult;
}
@@ -60,7 +59,7 @@ CFX_FloatRect FDE_CSSBoundaryToRect(IFDE_CSSBoundaryStyle* pBoundStyle,
}
if (bBorder) {
pRect = pBoundStyle->GetBorderWidth();
- if (pRect != NULL) {
+ if (pRect) {
if (FDE_CSSLengthToFloat(pRect->left, fContainerWidth, fResult)) {
rect.left += fResult;
}
@@ -77,7 +76,7 @@ CFX_FloatRect FDE_CSSBoundaryToRect(IFDE_CSSBoundaryStyle* pBoundStyle,
}
if (bMargin) {
pRect = pBoundStyle->GetMarginWidth();
- if (pRect != NULL) {
+ if (pRect) {
if (FDE_CSSLengthToFloat(pRect->left, fContainerWidth, fResult)) {
rect.left += fResult;
}
@@ -95,7 +94,6 @@ CFX_FloatRect FDE_CSSBoundaryToRect(IFDE_CSSBoundaryStyle* pBoundStyle,
return rect;
}
uint32_t FDE_CSSFontStyleToFDE(IFDE_CSSFontStyle* pFontStyle) {
- ASSERT(pFontStyle != NULL);
uint32_t dwFontStyle = FX_FONTSTYLE_Normal;
if (pFontStyle->GetFontStyle() == FDE_CSSFONTSTYLE_Italic) {
dwFontStyle |= FX_FONTSTYLE_Italic;
@@ -562,7 +560,7 @@ static const FDE_CSSPERSUDOTABLE g_FDE_CSSPersudoType[] = {
};
FDE_LPCCSSPERSUDOTABLE FDE_GetCSSPersudoByEnum(FDE_CSSPERSUDO ePersudo) {
return (ePersudo < FDE_CSSPERSUDO_NONE) ? (g_FDE_CSSPersudoType + ePersudo)
- : NULL;
+ : nullptr;
}
const FDE_CSSPROPERTYTABLE* FDE_GetCSSPropertyByName(
const CFX_WideStringC& wsName) {
@@ -582,10 +580,11 @@ const FDE_CSSPROPERTYTABLE* FDE_GetCSSPropertyByName(
iEnd = iMid - 1;
}
} while (iStart <= iEnd);
- return NULL;
+ return nullptr;
}
const FDE_CSSPROPERTYTABLE* FDE_GetCSSPropertyByEnum(FDE_CSSPROPERTY eName) {
- return (eName < FDE_CSSPROPERTY_MAX) ? (g_FDE_CSSProperties + eName) : NULL;
+ return (eName < FDE_CSSPROPERTY_MAX) ? (g_FDE_CSSProperties + eName)
+ : nullptr;
}
const FDE_CSSPROPERTYVALUETABLE* FDE_GetCSSPropertyValueByName(
const CFX_WideStringC& wsName) {
@@ -605,12 +604,12 @@ const FDE_CSSPROPERTYVALUETABLE* FDE_GetCSSPropertyValueByName(
iEnd = iMid - 1;
}
} while (iStart <= iEnd);
- return NULL;
+ return nullptr;
}
const FDE_CSSPROPERTYVALUETABLE* FDE_GetCSSPropertyValueByEnum(
FDE_CSSPROPERTYVALUE eName) {
return (eName < FDE_CSSPROPERTYVALUE_MAX) ? (g_FDE_CSSPropertyValues + eName)
- : NULL;
+ : nullptr;
}
FDE_LPCCSSMEDIATYPETABLE FDE_GetCSSMediaTypeByName(
const CFX_WideStringC& wsName) {
@@ -631,7 +630,7 @@ FDE_LPCCSSMEDIATYPETABLE FDE_GetCSSMediaTypeByName(
iEnd = iMid - 1;
}
} while (iStart <= iEnd);
- return NULL;
+ return nullptr;
}
FDE_LPCCSSLENGTHUNITTABLE FDE_GetCSSLengthUnitByName(
const CFX_WideStringC& wsName) {
@@ -652,7 +651,7 @@ FDE_LPCCSSLENGTHUNITTABLE FDE_GetCSSLengthUnitByName(
iEnd = iMid - 1;
}
} while (iStart <= iEnd);
- return NULL;
+ return nullptr;
}
FDE_LPCCSSCOLORTABLE FDE_GetCSSColorByName(const CFX_WideStringC& wsName) {
ASSERT(!wsName.IsEmpty());
@@ -671,7 +670,7 @@ FDE_LPCCSSCOLORTABLE FDE_GetCSSColorByName(const CFX_WideStringC& wsName) {
iEnd = iMid - 1;
}
} while (iStart <= iEnd);
- return NULL;
+ return nullptr;
}
FX_BOOL FDE_ParseCSSNumber(const FX_WCHAR* pszValue,
@@ -702,7 +701,7 @@ FX_BOOL FDE_ParseCSSString(const FX_WCHAR* pszValue,
int32_t iValueLen,
int32_t& iOffset,
int32_t& iLength) {
- ASSERT(pszValue != NULL && iValueLen > 0);
+ ASSERT(pszValue && iValueLen > 0);
iOffset = 0;
iLength = iValueLen;
if (iValueLen >= 2) {
@@ -718,7 +717,7 @@ FX_BOOL FDE_ParseCSSURI(const FX_WCHAR* pszValue,
int32_t iValueLen,
int32_t& iOffset,
int32_t& iLength) {
- ASSERT(pszValue != NULL && iValueLen > 0);
+ ASSERT(pszValue && iValueLen > 0);
if (iValueLen < 6 || pszValue[iValueLen - 1] != ')' ||
FX_wcsnicmp(L"url(", pszValue, 4)) {
return FALSE;
diff --git a/xfa/fde/css/fde_cssdatatable.h b/xfa/fde/css/fde_cssdatatable.h
index 2cc6c48fde..d61ff09ae7 100644
--- a/xfa/fde/css/fde_cssdatatable.h
+++ b/xfa/fde/css/fde_cssdatatable.h
@@ -15,7 +15,7 @@ class CFDE_CSSFunction : public CFX_Target {
public:
CFDE_CSSFunction(const FX_WCHAR* pszFuncName, IFDE_CSSValueList* pArgList)
: m_pArgList(pArgList), m_pszFuncName(pszFuncName) {
- ASSERT(pArgList != NULL);
+ ASSERT(pArgList);
}
int32_t CountArgs() const { return m_pArgList->CountValues(); }
IFDE_CSSValue* GetArgs(int32_t index) const {
@@ -39,7 +39,7 @@ class CFDE_CSSPrimitiveValue : public IFDE_CSSPrimitiveValue,
: m_eType(eType), m_fNumber(fValue) {}
CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, const FX_WCHAR* pValue)
: m_eType(eType), m_pString(pValue) {
- ASSERT(m_pString != NULL);
+ ASSERT(m_pString);
}
CFDE_CSSPrimitiveValue(CFDE_CSSFunction* pFunction)
: m_eType(FDE_CSSPRIMITIVETYPE_Function), m_pFunction(pFunction) {}
@@ -106,7 +106,7 @@ class CFDE_CSSValueListParser : public CFX_Target {
public:
CFDE_CSSValueListParser(const FX_WCHAR* psz, int32_t iLen, FX_WCHAR separator)
: m_Separator(separator), m_pCur(psz), m_pEnd(psz + iLen) {
- ASSERT(psz != NULL && iLen > 0);
+ ASSERT(psz && iLen > 0);
}
FX_BOOL NextValue(FDE_CSSPRIMITIVETYPE& eType,
const FX_WCHAR*& pStart,
diff --git a/xfa/fde/css/fde_cssdeclaration.cpp b/xfa/fde/css/fde_cssdeclaration.cpp
index 570b60c670..da1f42fabd 100644
--- a/xfa/fde/css/fde_cssdeclaration.cpp
+++ b/xfa/fde/css/fde_cssdeclaration.cpp
@@ -18,7 +18,7 @@ IFDE_CSSValue* CFDE_CSSDeclaration::GetProperty(FDE_CSSPROPERTY eProperty,
return pHolder->pValue;
}
}
- return NULL;
+ return nullptr;
}
FX_POSITION CFDE_CSSDeclaration::GetStartPosition() const {
return (FX_POSITION)m_pFirstProperty;
@@ -28,7 +28,6 @@ void CFDE_CSSDeclaration::GetNextProperty(FX_POSITION& pos,
IFDE_CSSValue*& pValue,
FX_BOOL& bImportant) const {
const FDE_CSSPropertyHolder* pHolder = (const FDE_CSSPropertyHolder*)pos;
- ASSERT(pHolder != NULL);
bImportant = pHolder->bImportant;
eProperty = (FDE_CSSPROPERTY)pHolder->eProperty;
pValue = pHolder->pValue;
@@ -41,9 +40,9 @@ void CFDE_CSSDeclaration::GetNextCustom(FX_POSITION& pos,
CFX_WideString& wsName,
CFX_WideString& wsValue) const {
const FDE_CSSCustomProperty* pProperty = (const FDE_CSSCustomProperty*)pos;
- if (pProperty == NULL) {
+ if (!pProperty)
return;
- }
+
wsName = pProperty->pwsName;
wsValue = pProperty->pwsValue;
pos = (FX_POSITION)pProperty->pNext;
@@ -94,13 +93,12 @@ void CFDE_CSSDeclaration::AddPropertyHolder(IFX_MemoryAllocator* pStaticStore,
pHolder->bImportant = bImportant;
pHolder->eProperty = eProperty;
pHolder->pValue = pValue;
- pHolder->pNext = NULL;
- if (m_pLastProperty == NULL) {
- m_pLastProperty = m_pFirstProperty = pHolder;
- } else {
+ pHolder->pNext = nullptr;
+ if (m_pLastProperty)
m_pLastProperty->pNext = pHolder;
- m_pLastProperty = pHolder;
- }
+ else
+ m_pFirstProperty = pHolder;
+ m_pLastProperty = pHolder;
}
FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs,
const FX_WCHAR* pszValue,
@@ -129,7 +127,7 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs,
if (dwMatch == 0) {
continue;
}
- IFDE_CSSValue* pCSSValue = NULL;
+ IFDE_CSSValue* pCSSValue = nullptr;
switch (dwMatch) {
case FDE_CSSVALUETYPE_MaybeFunction:
pCSSValue = ParseFunction(pArgs, pszValue, iValueLen);
@@ -152,7 +150,7 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs,
default:
break;
}
- if (pCSSValue != NULL) {
+ if (pCSSValue) {
AddPropertyHolder(pArgs->pStaticStore, pArgs->pProperty->eName,
pCSSValue, bImportant);
return TRUE;
@@ -269,13 +267,12 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs,
FXTARGET_NewWith(pArgs->pStaticStore) FDE_CSSCustomProperty;
pProperty->pwsName = CopyToLocal(pArgs, pszName, iNameLen);
pProperty->pwsValue = CopyToLocal(pArgs, pszValue, iValueLen);
- pProperty->pNext = NULL;
- if (m_pLastCustom == NULL) {
- m_pLastCustom = m_pFirstCustom = pProperty;
- } else {
+ pProperty->pNext = nullptr;
+ if (m_pLastCustom)
m_pLastCustom->pNext = pProperty;
- m_pLastCustom = pProperty;
- }
+ else
+ m_pFirstCustom = pProperty;
+ m_pLastCustom = pProperty;
return TRUE;
}
IFDE_CSSValue* CFDE_CSSDeclaration::ParseNumber(
@@ -285,7 +282,7 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseNumber(
FX_FLOAT fValue;
FDE_CSSPRIMITIVETYPE eUnit;
if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eUnit)) {
- return NULL;
+ return nullptr;
}
return NewNumberValue(pArgs->pStaticStore, eUnit, fValue);
}
@@ -294,14 +291,14 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseEnum(const FDE_CSSPROPERTYARGS* pArgs,
int32_t iValueLen) {
const FDE_CSSPROPERTYVALUETABLE* pValue =
FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
- return pValue ? NewEnumValue(pArgs->pStaticStore, pValue->eName) : NULL;
+ return pValue ? NewEnumValue(pArgs->pStaticStore, pValue->eName) : nullptr;
}
IFDE_CSSValue* CFDE_CSSDeclaration::ParseColor(const FDE_CSSPROPERTYARGS* pArgs,
const FX_WCHAR* pszValue,
int32_t iValueLen) {
FX_ARGB dwColor;
if (!FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) {
- return NULL;
+ return nullptr;
}
return FXTARGET_NewWith(pArgs->pStaticStore) CFDE_CSSPrimitiveValue(dwColor);
}
@@ -310,16 +307,16 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseURI(const FDE_CSSPROPERTYARGS* pArgs,
int32_t iValueLen) {
int32_t iOffset;
if (!FDE_ParseCSSURI(pszValue, iValueLen, iOffset, iValueLen)) {
- return NULL;
+ return nullptr;
}
if (iValueLen <= 0) {
- return NULL;
+ return nullptr;
}
pszValue = CopyToLocal(pArgs, pszValue + iOffset, iValueLen);
return pszValue
? FXTARGET_NewWith(pArgs->pStaticStore)
CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_URI, pszValue)
- : NULL;
+ : nullptr;
}
IFDE_CSSValue* CFDE_CSSDeclaration::ParseString(
const FDE_CSSPROPERTYARGS* pArgs,
@@ -327,34 +324,34 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseString(
int32_t iValueLen) {
int32_t iOffset;
if (!FDE_ParseCSSString(pszValue, iValueLen, iOffset, iValueLen)) {
- return NULL;
+ return nullptr;
}
if (iValueLen <= 0) {
- return NULL;
+ return nullptr;
}
pszValue = CopyToLocal(pArgs, pszValue + iOffset, iValueLen);
return pszValue
? FXTARGET_NewWith(pArgs->pStaticStore)
CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, pszValue)
- : NULL;
+ : nullptr;
}
IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction(
const FDE_CSSPROPERTYARGS* pArgs,
const FX_WCHAR* pszValue,
int32_t iValueLen) {
if (pszValue[iValueLen - 1] != ')') {
- return NULL;
+ return nullptr;
}
int32_t iStartBracket = 0;
while (pszValue[iStartBracket] != '(') {
if (iStartBracket < iValueLen) {
iStartBracket++;
} else {
- return NULL;
+ return nullptr;
}
}
if (iStartBracket == 0) {
- return NULL;
+ return nullptr;
}
const FX_WCHAR* pszFuncName = CopyToLocal(pArgs, pszValue, iStartBracket);
pszValue += (iStartBracket + 1);
@@ -367,14 +364,14 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction(
case FDE_CSSPRIMITIVETYPE_String: {
const FDE_CSSPROPERTYVALUETABLE* pPropertyValue =
FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
- if (pPropertyValue != NULL) {
+ if (pPropertyValue) {
argumentArr.Add(
NewEnumValue(pArgs->pStaticStore, pPropertyValue->eName));
continue;
}
IFDE_CSSValue* pFunctionValue =
ParseFunction(pArgs, pszValue, iValueLen);
- if (pFunctionValue != NULL) {
+ if (pFunctionValue) {
argumentArr.Add(pFunctionValue);
continue;
}
@@ -425,7 +422,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseContentProperty(
case FDE_CSSPRIMITIVETYPE_String: {
const FDE_CSSPROPERTYVALUETABLE* pValue =
FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
- if (pValue != NULL) {
+ if (pValue) {
switch (pValue->eName) {
case FDE_CSSPROPERTYVALUE_Normal:
case FDE_CSSPROPERTYVALUE_None: {
@@ -447,7 +444,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseContentProperty(
continue;
}
IFDE_CSSValue* pFunction = ParseFunction(pArgs, pszValue, iValueLen);
- if (pFunction != NULL) {
+ if (pFunction) {
list.Add(pFunction);
continue;
}
@@ -560,7 +557,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseValueListProperty(
const FDE_CSSPROPERTYVALUETABLE* pValue =
FDE_GetCSSPropertyValueByName(
CFX_WideStringC(pszValue, iValueLen));
- if (pValue != NULL) {
+ if (pValue) {
list.Add(NewEnumValue(pStaticStore, pValue->eName));
continue;
}
@@ -668,13 +665,13 @@ FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty(
IFDE_CSSValue*& pColor,
IFDE_CSSValue*& pStyle,
IFDE_CSSValue*& pWidth) const {
- pColor = pStyle = pWidth = NULL;
+ pColor = pStyle = pWidth = nullptr;
CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
FDE_CSSPRIMITIVETYPE eType;
while (parser.NextValue(eType, pszValue, iValueLen)) {
switch (eType) {
case FDE_CSSPRIMITIVETYPE_Number:
- if (pWidth == NULL) {
+ if (!pWidth) {
FX_FLOAT fValue;
if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) {
pWidth = NewNumberValue(pStaticStore, eType, fValue);
@@ -682,7 +679,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty(
}
break;
case FDE_CSSPRIMITIVETYPE_RGB:
- if (pColor == NULL) {
+ if (!pColor) {
FX_ARGB dwColor;
if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) {
pColor =
@@ -693,8 +690,8 @@ FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty(
case FDE_CSSPRIMITIVETYPE_String: {
const FDE_CSSCOLORTABLE* pColorItem =
FDE_GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen));
- if (pColorItem != NULL) {
- if (pColor == NULL) {
+ if (pColorItem) {
+ if (!pColor) {
pColor = FXTARGET_NewWith(pStaticStore)
CFDE_CSSPrimitiveValue(pColorItem->dwValue);
}
@@ -702,12 +699,12 @@ FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty(
}
const FDE_CSSPROPERTYVALUETABLE* pValue =
FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
- if (pValue == NULL) {
+ if (!pValue)
continue;
- }
+
switch (pValue->eName) {
case FDE_CSSPROPERTYVALUE_Transparent:
- if (pColor == NULL) {
+ if (!pColor) {
pColor = FXTARGET_NewWith(pStaticStore)
CFDE_CSSPrimitiveValue((FX_ARGB)0);
}
@@ -715,9 +712,8 @@ FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty(
case FDE_CSSPROPERTYVALUE_Thin:
case FDE_CSSPROPERTYVALUE_Thick:
case FDE_CSSPROPERTYVALUE_Medium:
- if (pWidth == NULL) {
+ if (!pWidth)
pWidth = NewEnumValue(pStaticStore, pValue->eName);
- }
break;
case FDE_CSSPROPERTYVALUE_None:
case FDE_CSSPROPERTYVALUE_Hidden:
@@ -729,9 +725,8 @@ FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty(
case FDE_CSSPROPERTYVALUE_Ridge:
case FDE_CSSPROPERTYVALUE_Inset:
case FDE_CSSPROPERTYVALUE_Outset:
- if (pStyle == NULL) {
+ if (!pStyle)
pStyle = NewEnumValue(pStaticStore, pValue->eName);
- }
break;
default:
break;
@@ -741,15 +736,12 @@ FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty(
break;
}
}
- if (pColor == NULL) {
+ if (!pColor)
pColor = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue((FX_ARGB)0);
- }
- if (pStyle == NULL) {
+ if (!pStyle)
pStyle = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None);
- }
- if (pWidth == NULL) {
+ if (!pWidth)
pWidth = NewNumberValue(pStaticStore, FDE_CSSPRIMITIVETYPE_Number, 0.0f);
- }
return TRUE;
}
void CFDE_CSSDeclaration::AddBorderProperty(IFX_MemoryAllocator* pStaticStore,
@@ -771,12 +763,14 @@ FX_BOOL CFDE_CSSDeclaration::ParseListStyleProperty(
FX_BOOL bImportant) {
IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
- IFDE_CSSPrimitiveValue *pType = NULL, *pImage = NULL, *pPosition = NULL;
+ IFDE_CSSPrimitiveValue* pType = nullptr;
+ IFDE_CSSPrimitiveValue* pImage = nullptr;
+ IFDE_CSSPrimitiveValue* pPosition = nullptr;
FDE_CSSPRIMITIVETYPE eType;
while (parser.NextValue(eType, pszValue, iValueLen)) {
switch (eType) {
case FDE_CSSPRIMITIVETYPE_URI:
- if (pImage == NULL) {
+ if (!pImage) {
pImage = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(
eType, CopyToLocal(pArgs, pszValue, iValueLen));
}
@@ -784,22 +778,20 @@ FX_BOOL CFDE_CSSDeclaration::ParseListStyleProperty(
case FDE_CSSPRIMITIVETYPE_String: {
const FDE_CSSPROPERTYVALUETABLE* pValue =
FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
- if (pValue == NULL) {
+ if (!pValue)
break;
- }
+
switch (pValue->eName) {
case FDE_CSSPROPERTYVALUE_None:
- if (pImage == NULL) {
+ if (!pImage)
pImage = NewEnumValue(pStaticStore, pValue->eName);
- } else if (pType == NULL) {
+ else if (!pType)
pImage = NewEnumValue(pStaticStore, pValue->eName);
- }
break;
case FDE_CSSPROPERTYVALUE_Inside:
case FDE_CSSPROPERTYVALUE_Outside:
- if (pPosition == NULL) {
+ if (!pPosition)
pPosition = NewEnumValue(pStaticStore, pValue->eName);
- }
break;
case FDE_CSSPROPERTYVALUE_Disc:
case FDE_CSSPROPERTYVALUE_Circle:
@@ -815,9 +807,8 @@ FX_BOOL CFDE_CSSDeclaration::ParseListStyleProperty(
case FDE_CSSPROPERTYVALUE_Georgian:
case FDE_CSSPROPERTYVALUE_LowerAlpha:
case FDE_CSSPROPERTYVALUE_UpperAlpha:
- if (pType == NULL) {
+ if (!pType)
pType = NewEnumValue(pStaticStore, pValue->eName);
- }
break;
default:
break;
@@ -827,15 +818,12 @@ FX_BOOL CFDE_CSSDeclaration::ParseListStyleProperty(
break;
}
}
- if (pPosition == NULL) {
+ if (!pPosition)
pPosition = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Outside);
- }
- if (pImage == NULL) {
+ if (!pImage)
pImage = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None);
- }
- if (pType == NULL) {
+ if (!pType)
pType = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None);
- }
AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ListStylePosition, pPosition,
bImportant);
AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ListStyleImage, pImage,
@@ -851,13 +839,17 @@ FX_BOOL CFDE_CSSDeclaration::ParseBackgroundProperty(
FX_BOOL bImportant) {
IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
- IFDE_CSSPrimitiveValue *pColor = NULL, *pImage = NULL, *pRepeat = NULL;
- IFDE_CSSPrimitiveValue *pPosX = NULL, *pPosY = NULL, *pAttachment = NULL;
+ IFDE_CSSPrimitiveValue* pColor = nullptr;
+ IFDE_CSSPrimitiveValue* pImage = nullptr;
+ IFDE_CSSPrimitiveValue* pRepeat = nullptr;
+ IFDE_CSSPrimitiveValue* pPosX = nullptr;
+ IFDE_CSSPrimitiveValue* pPosY = nullptr;
+ IFDE_CSSPrimitiveValue* pAttachment = nullptr;
FDE_CSSPRIMITIVETYPE eType;
while (parser.NextValue(eType, pszValue, iValueLen)) {
switch (eType) {
case FDE_CSSPRIMITIVETYPE_URI:
- if (pImage == NULL) {
+ if (!pImage) {
pImage = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(
eType, CopyToLocal(pArgs, pszValue, iValueLen));
}
@@ -867,60 +859,53 @@ FX_BOOL CFDE_CSSDeclaration::ParseBackgroundProperty(
if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) {
break;
}
- if (pPosX == NULL) {
+ if (!pPosX)
pPosX = NewNumberValue(pStaticStore, eType, fValue);
- } else if (pPosY == NULL) {
+ else if (!pPosY)
pPosY = NewNumberValue(pStaticStore, eType, fValue);
- }
} break;
case FDE_CSSPRIMITIVETYPE_String: {
const FDE_CSSPROPERTYVALUETABLE* pValue =
FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
- if (pValue != NULL) {
+ if (pValue) {
switch (pValue->eName) {
case FDE_CSSPROPERTYVALUE_None:
- if (pImage == NULL) {
+ if (!pImage)
pImage = NewEnumValue(pStaticStore, pValue->eName);
- }
break;
case FDE_CSSPROPERTYVALUE_Transparent:
- if (pColor == NULL) {
+ if (!pColor) {
pColor = FXTARGET_NewWith(pStaticStore)
CFDE_CSSPrimitiveValue((FX_ARGB)0);
}
break;
case FDE_CSSPROPERTYVALUE_Fixed:
case FDE_CSSPROPERTYVALUE_Scroll:
- if (pAttachment == NULL) {
+ if (!pAttachment)
pAttachment = NewEnumValue(pStaticStore, pValue->eName);
- }
break;
case FDE_CSSPROPERTYVALUE_Repeat:
case FDE_CSSPROPERTYVALUE_RepeatX:
case FDE_CSSPROPERTYVALUE_RepeatY:
case FDE_CSSPROPERTYVALUE_NoRepeat:
- if (pRepeat == NULL) {
+ if (!pRepeat)
pRepeat = NewEnumValue(pStaticStore, pValue->eName);
- }
break;
case FDE_CSSPROPERTYVALUE_Left:
case FDE_CSSPROPERTYVALUE_Right:
- if (pPosX == NULL) {
+ if (!pPosX)
pPosX = NewEnumValue(pStaticStore, pValue->eName);
- }
break;
case FDE_CSSPROPERTYVALUE_Top:
case FDE_CSSPROPERTYVALUE_Bottom:
- if (pPosY == NULL) {
+ if (!pPosY)
pPosX = NewEnumValue(pStaticStore, pValue->eName);
- }
break;
case FDE_CSSPROPERTYVALUE_Center:
- if (pPosX == NULL) {
+ if (!pPosX)
pPosX = NewEnumValue(pStaticStore, pValue->eName);
- } else if (pPosY == NULL) {
+ else if (!pPosY)
pPosX = NewEnumValue(pStaticStore, pValue->eName);
- }
break;
default:
break;
@@ -929,15 +914,15 @@ FX_BOOL CFDE_CSSDeclaration::ParseBackgroundProperty(
}
const FDE_CSSCOLORTABLE* pColorItem =
FDE_GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen));
- if (pColorItem != NULL) {
- if (pColor == NULL) {
+ if (pColorItem) {
+ if (!pColor) {
pColor = FXTARGET_NewWith(pStaticStore)
CFDE_CSSPrimitiveValue(pColorItem->dwValue);
}
}
} break;
case FDE_CSSPRIMITIVETYPE_RGB:
- if (pColor == NULL) {
+ if (!pColor) {
FX_ARGB dwColor;
if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) {
pColor =
@@ -949,22 +934,22 @@ FX_BOOL CFDE_CSSDeclaration::ParseBackgroundProperty(
break;
}
}
- if (pColor == NULL) {
+ if (!pColor) {
pColor = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue((FX_ARGB)0);
}
- if (pImage == NULL) {
+ if (!pImage)
pImage = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None);
- }
- if (pRepeat == NULL) {
+
+ if (!pRepeat)
pRepeat = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Repeat);
- }
- if (pAttachment == NULL) {
+
+ if (!pAttachment)
pAttachment = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Scroll);
- }
- if (pPosX == NULL) {
+
+ if (!pPosX) {
pPosX = NewNumberValue(pStaticStore, FDE_CSSPRIMITIVETYPE_Number, 0.0f);
pPosY = NewNumberValue(pStaticStore, FDE_CSSPRIMITIVETYPE_Number, 0.0f);
- } else if (pPosY == NULL) {
+ } else if (!pPosY) {
pPosY = NewNumberValue(pStaticStore, FDE_CSSPRIMITIVETYPE_Number, 0.0f);
}
CFDE_CSSValueArray position;
@@ -990,8 +975,11 @@ FX_BOOL CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs,
FX_BOOL bImportant) {
IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
CFDE_CSSValueListParser parser(pszValue, iValueLen, '/');
- IFDE_CSSPrimitiveValue *pStyle = NULL, *pVariant = NULL, *pWeight = NULL;
- IFDE_CSSPrimitiveValue *pFontSize = NULL, *pLineHeight = NULL;
+ IFDE_CSSPrimitiveValue* pStyle = nullptr;
+ IFDE_CSSPrimitiveValue* pVariant = nullptr;
+ IFDE_CSSPrimitiveValue* pWeight = nullptr;
+ IFDE_CSSPrimitiveValue* pFontSize = nullptr;
+ IFDE_CSSPrimitiveValue* pLineHeight = nullptr;
CFDE_CSSValueArray familyList;
FDE_CSSPRIMITIVETYPE eType;
while (parser.NextValue(eType, pszValue, iValueLen)) {
@@ -999,7 +987,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs,
case FDE_CSSPRIMITIVETYPE_String: {
const FDE_CSSPROPERTYVALUETABLE* pValue =
FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
- if (pValue != NULL) {
+ if (pValue) {
switch (pValue->eName) {
case FDE_CSSPROPERTYVALUE_XxSmall:
case FDE_CSSPROPERTYVALUE_XSmall:
@@ -1010,46 +998,41 @@ FX_BOOL CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs,
case FDE_CSSPROPERTYVALUE_XxLarge:
case FDE_CSSPROPERTYVALUE_Smaller:
case FDE_CSSPROPERTYVALUE_Larger:
- if (pFontSize == NULL) {
+ if (!pFontSize)
pFontSize = NewEnumValue(pStaticStore, pValue->eName);
- }
continue;
case FDE_CSSPROPERTYVALUE_Bold:
case FDE_CSSPROPERTYVALUE_Bolder:
case FDE_CSSPROPERTYVALUE_Lighter:
- if (pWeight == NULL) {
+ if (!pWeight)
pWeight = NewEnumValue(pStaticStore, pValue->eName);
- }
continue;
case FDE_CSSPROPERTYVALUE_Italic:
case FDE_CSSPROPERTYVALUE_Oblique:
- if (pStyle == NULL) {
+ if (!pStyle)
pStyle = NewEnumValue(pStaticStore, pValue->eName);
- }
continue;
case FDE_CSSPROPERTYVALUE_SmallCaps:
- if (pVariant == NULL) {
+ if (!pVariant)
pVariant = NewEnumValue(pStaticStore, pValue->eName);
- }
continue;
case FDE_CSSPROPERTYVALUE_Normal:
- if (pStyle == NULL) {
+ if (!pStyle)
pStyle = NewEnumValue(pStaticStore, pValue->eName);
- } else if (pVariant == NULL) {
+ else if (!pVariant)
pVariant = NewEnumValue(pStaticStore, pValue->eName);
- } else if (pWeight == NULL) {
+ else if (!pWeight)
pWeight = NewEnumValue(pStaticStore, pValue->eName);
- } else if (pFontSize == NULL) {
+ else if (!pFontSize)
pFontSize = NewEnumValue(pStaticStore, pValue->eName);
- } else if (pLineHeight == NULL) {
+ else if (!pLineHeight)
pLineHeight = NewEnumValue(pStaticStore, pValue->eName);
- }
continue;
default:
break;
}
}
- if (pFontSize != NULL) {
+ if (pFontSize) {
familyList.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(
eType, CopyToLocal(pArgs, pszValue, iValueLen)));
}
@@ -1071,38 +1054,33 @@ FX_BOOL CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs,
case 700:
case 800:
case 900:
- if (pWeight == NULL) {
+ if (!pWeight) {
pWeight = NewNumberValue(pStaticStore,
FDE_CSSPRIMITIVETYPE_Number, fValue);
}
continue;
}
}
- if (pFontSize == NULL) {
+ if (!pFontSize)
pFontSize = NewNumberValue(pStaticStore, eType, fValue);
- } else if (pLineHeight == NULL) {
+ else if (!pLineHeight)
pLineHeight = NewNumberValue(pStaticStore, eType, fValue);
- }
} break;
default:
break;
}
}
- if (pStyle == NULL) {
+ if (!pStyle)
pStyle = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Normal);
- }
- if (pVariant == NULL) {
+ if (!pVariant)
pVariant = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Normal);
- }
- if (pWeight == NULL) {
+ if (!pWeight)
pWeight = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Normal);
- }
- if (pFontSize == NULL) {
+ if (!pFontSize)
pFontSize = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Medium);
- }
- if (pLineHeight == NULL) {
+ if (!pLineHeight)
pLineHeight = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Normal);
- }
+
AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_FontStyle, pStyle,
bImportant);
AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_FontVariant, pVariant,
@@ -1128,16 +1106,16 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnRuleProperty(
FX_BOOL bImportant) {
IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
- IFDE_CSSPrimitiveValue* pColumnRuleWidth = NULL;
- IFDE_CSSPrimitiveValue* pColumnRuleStyle = NULL;
- IFDE_CSSPrimitiveValue* pColumnRuleColor = NULL;
+ IFDE_CSSPrimitiveValue* pColumnRuleWidth = nullptr;
+ IFDE_CSSPrimitiveValue* pColumnRuleStyle = nullptr;
+ IFDE_CSSPrimitiveValue* pColumnRuleColor = nullptr;
FDE_CSSPRIMITIVETYPE eType;
while (parser.NextValue(eType, pszValue, iValueLen)) {
switch (eType) {
case FDE_CSSPRIMITIVETYPE_String: {
const FDE_CSSPROPERTYVALUETABLE* pValue =
FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
- if (pValue != NULL) {
+ if (pValue) {
switch (pValue->eName) {
case FDE_CSSPROPERTYVALUE_None:
case FDE_CSSPROPERTYVALUE_Hidden:
@@ -1149,21 +1127,18 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnRuleProperty(
case FDE_CSSPROPERTYVALUE_Ridge:
case FDE_CSSPROPERTYVALUE_Inset:
case FDE_CSSPROPERTYVALUE_Outset:
- if (pColumnRuleStyle == NULL) {
+ if (!pColumnRuleStyle)
pColumnRuleStyle = NewEnumValue(pStaticStore, pValue->eName);
- }
break;
case FDE_CSSPROPERTYVALUE_Transparent:
- if (pColumnRuleColor == NULL) {
+ if (!pColumnRuleColor)
pColumnRuleColor = NewEnumValue(pStaticStore, pValue->eName);
- }
break;
case FDE_CSSPROPERTYVALUE_Thin:
case FDE_CSSPROPERTYVALUE_Medium:
case FDE_CSSPROPERTYVALUE_Thick:
- if (pColumnRuleWidth == NULL) {
+ if (!pColumnRuleWidth)
pColumnRuleWidth = NewEnumValue(pStaticStore, pValue->eName);
- }
break;
default:
break;
@@ -1172,7 +1147,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnRuleProperty(
}
FX_ARGB dwColor;
if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor) &&
- pColumnRuleColor == NULL) {
+ !pColumnRuleColor) {
pColumnRuleColor = FXTARGET_NewWith(pStaticStore)
CFDE_CSSPrimitiveValue((FX_ARGB)dwColor);
continue;
@@ -1181,13 +1156,13 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnRuleProperty(
case FDE_CSSPRIMITIVETYPE_Number: {
FX_FLOAT fValue;
if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType) &&
- pColumnRuleWidth == NULL) {
+ !pColumnRuleWidth) {
pColumnRuleWidth = NewNumberValue(pStaticStore, eType, fValue);
}
} break;
case FDE_CSSPRIMITIVETYPE_RGB: {
FX_ARGB dwColor;
- if (pColumnRuleColor == NULL &&
+ if (!pColumnRuleColor &&
FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) {
pColumnRuleColor = FXTARGET_NewWith(pStaticStore)
CFDE_CSSPrimitiveValue((FX_ARGB)dwColor);
@@ -1197,17 +1172,14 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnRuleProperty(
break;
}
}
- if (pColumnRuleColor == NULL && pColumnRuleStyle == NULL &&
- pColumnRuleWidth == NULL) {
+ if (!pColumnRuleColor && !pColumnRuleStyle && !pColumnRuleWidth)
return FALSE;
- }
- if (pColumnRuleStyle == NULL) {
+
+ if (!pColumnRuleStyle)
pColumnRuleStyle = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None);
- }
- if (pColumnRuleWidth == NULL) {
+ if (!pColumnRuleWidth)
pColumnRuleWidth = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Medium);
- }
- if (pColumnRuleColor == NULL) {
+ if (!pColumnRuleColor) {
pColumnRuleColor =
FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue((FX_ARGB)0);
}
@@ -1228,13 +1200,13 @@ FX_BOOL CFDE_CSSDeclaration::ParseTextEmphasisProperty(
CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
CFDE_CSSValueArray arrEmphasisStyle;
FDE_CSSPRIMITIVETYPE eType;
- IFDE_CSSPrimitiveValue* pEmphasisColor = NULL;
+ IFDE_CSSPrimitiveValue* pEmphasisColor = nullptr;
while (parser.NextValue(eType, pszValue, iValueLen)) {
switch (eType) {
case FDE_CSSPRIMITIVETYPE_String: {
const FDE_CSSPROPERTYVALUETABLE* pValue =
FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
- if (pValue != NULL) {
+ if (pValue) {
arrEmphasisStyle.Add(NewEnumValue(pStaticStore, pValue->eName));
continue;
}
@@ -1266,7 +1238,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseTextEmphasisProperty(
CFDE_CSSValueList(pStaticStore, arrEmphasisStyle),
bImportant);
}
- if (pEmphasisColor != NULL) {
+ if (pEmphasisColor) {
AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_TextEmphasisColor,
pEmphasisColor, bImportant);
}
@@ -1279,15 +1251,15 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnsProperty(
FX_BOOL bImportant) {
IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
- IFDE_CSSPrimitiveValue* pColumnWidth = NULL;
- IFDE_CSSPrimitiveValue* pColumnCount = NULL;
+ IFDE_CSSPrimitiveValue* pColumnWidth = nullptr;
+ IFDE_CSSPrimitiveValue* pColumnCount = nullptr;
FDE_CSSPRIMITIVETYPE eType;
while (parser.NextValue(eType, pszValue, iValueLen)) {
switch (eType) {
case FDE_CSSPRIMITIVETYPE_String: {
const FDE_CSSPROPERTYVALUETABLE* pValue =
FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
- if (pValue == NULL && pValue->eName == FDE_CSSPROPERTYVALUE_Auto) {
+ if (!pValue && pValue->eName == FDE_CSSPROPERTYVALUE_Auto) {
pColumnWidth = NewEnumValue(pStaticStore, pValue->eName);
}
} break;
@@ -1296,14 +1268,12 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnsProperty(
if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) {
switch (eType) {
case FDE_CSSPRIMITIVETYPE_Number:
- if (pColumnCount == NULL) {
+ if (!pColumnCount)
pColumnCount = NewNumberValue(pStaticStore, eType, fValue);
- }
break;
default:
- if (pColumnWidth == NULL) {
+ if (!pColumnWidth)
pColumnWidth = NewNumberValue(pStaticStore, eType, fValue);
- }
break;
}
}
@@ -1312,13 +1282,14 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnsProperty(
break;
}
}
- if (pColumnWidth == NULL && pColumnCount == NULL) {
+ if (!pColumnWidth && !pColumnCount)
return FALSE;
- } else if (pColumnWidth == NULL) {
+
+ if (!pColumnWidth)
pColumnWidth = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Auto);
- } else if (pColumnCount == NULL) {
+ else if (!pColumnCount)
pColumnCount = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Auto);
- }
+
AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnWidth, pColumnWidth,
bImportant);
AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnCount, pColumnCount,
@@ -1332,14 +1303,14 @@ FX_BOOL CFDE_CSSDeclaration::ParseOverflowProperty(
FX_BOOL bImportant) {
IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
- IFDE_CSSPrimitiveValue* pOverflowX = NULL;
- IFDE_CSSPrimitiveValue* pOverflowY = NULL;
+ IFDE_CSSPrimitiveValue* pOverflowX = nullptr;
+ IFDE_CSSPrimitiveValue* pOverflowY = nullptr;
FDE_CSSPRIMITIVETYPE eType;
while (parser.NextValue(eType, pszValue, iValueLen)) {
if (eType == FDE_CSSPRIMITIVETYPE_String) {
const FDE_CSSPROPERTYVALUETABLE* pValue =
FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
- if (pValue != NULL) {
+ if (pValue) {
switch (pValue->eName) {
case FDE_CSSOVERFLOW_Visible:
case FDE_CSSOVERFLOW_Hidden:
@@ -1347,11 +1318,11 @@ FX_BOOL CFDE_CSSDeclaration::ParseOverflowProperty(
case FDE_CSSOVERFLOW_Auto:
case FDE_CSSOVERFLOW_NoDisplay:
case FDE_CSSOVERFLOW_NoContent:
- if (pOverflowX != NULL && pOverflowY != NULL) {
+ if (pOverflowX && pOverflowY)
return FALSE;
- } else if (pOverflowX == NULL) {
+ if (!pOverflowX) {
pOverflowX = NewEnumValue(pStaticStore, pValue->eName);
- } else if (pOverflowY == NULL) {
+ } else if (!pOverflowY) {
pOverflowY = NewEnumValue(pStaticStore, pValue->eName);
}
break;
@@ -1361,11 +1332,12 @@ FX_BOOL CFDE_CSSDeclaration::ParseOverflowProperty(
}
}
}
- if (pOverflowX == NULL && pOverflowY == NULL) {
+ if (!pOverflowX && !pOverflowY)
return FALSE;
- } else if (pOverflowY == NULL) {
+
+ if (!pOverflowY)
pOverflowY = NewEnumValue(pStaticStore, pOverflowX->GetEnum());
- }
+
AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowX, pOverflowX,
bImportant);
AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowY, pOverflowY,
diff --git a/xfa/fde/css/fde_cssstyleselector.cpp b/xfa/fde/css/fde_cssstyleselector.cpp
index 12f6bc9879..007657d154 100644
--- a/xfa/fde/css/fde_cssstyleselector.cpp
+++ b/xfa/fde/css/fde_cssstyleselector.cpp
@@ -28,9 +28,9 @@ int32_t CFDE_CSSCounterStyle::FindIndex(const FX_WCHAR* pszIdentifier) {
return -1;
}
void CFDE_CSSCounterStyle::DoUpdateIndex(IFDE_CSSValueList* pList) {
- if (pList == NULL) {
+ if (!pList)
return;
- }
+
int32_t iCount = pList->CountValues();
FX_FLOAT fDefValue = 1.0;
FX_BOOL bDefIncrement = TRUE;
@@ -87,10 +87,10 @@ void CFDE_CSSCounterStyle::UpdateIndex() {
FDE_CSSRuleData::FDE_CSSRuleData(CFDE_CSSSelector* pSel,
CFDE_CSSDeclaration* pDecl,
uint32_t dwPos)
- : pSelector(pSel), pDeclaration(pDecl), dwPriority(dwPos), pNext(NULL) {
+ : pSelector(pSel), pDeclaration(pDecl), dwPriority(dwPos), pNext(nullptr) {
static const uint32_t s_Specific[5] = {0x00010000, 0x00010000, 0x00100000,
0x00100000, 0x01000000};
- for (; pSel != NULL; pSel = pSel->GetNextSelector()) {
+ for (; pSel; pSel = pSel->GetNextSelector()) {
FDE_CSSSELECTORTYPE eType = pSel->GetType();
if (eType > FDE_CSSSELECTORTYPE_Descendant ||
pSel->GetNameHash() != FDE_CSSUNIVERSALHASH) {
@@ -102,8 +102,8 @@ void CFDE_CSSRuleCollection::Clear() {
m_IDRules.RemoveAll();
m_TagRules.RemoveAll();
m_ClassRules.RemoveAll();
- m_pUniversalRules = NULL;
- m_pStaticStore = NULL;
+ m_pUniversalRules = nullptr;
+ m_pStaticStore = nullptr;
m_iSelectors = 0;
}
void CFDE_CSSRuleCollection::AddRulesFrom(const CFDE_CSSStyleSheetArray& sheets,
@@ -185,7 +185,7 @@ void CFDE_CSSRuleCollection::AddRuleTo(CFX_MapPtrToPtr& map,
CFDE_CSSDeclaration* pDecl) {
void* pKey = (void*)(uintptr_t)dwKey;
FDE_CSSRuleData* pData = NewRuleData(pSel, pDecl);
- FDE_CSSRuleData* pList = NULL;
+ FDE_CSSRuleData* pList = nullptr;
if (!map.Lookup(pKey, (void*&)pList)) {
map.SetAt(pKey, pData);
} else if (AddRuleTo(pList, pData)) {
@@ -213,12 +213,12 @@ FDE_CSSRuleData* CFDE_CSSRuleCollection::NewRuleData(
}
CFDE_CSSStyleSelector::CFDE_CSSStyleSelector()
- : m_pFontMgr(NULL),
+ : m_pFontMgr(nullptr),
m_fDefFontSize(12.0f),
- m_pRuleDataStore(NULL),
- m_pInlineStyleStore(NULL),
- m_pFixedStyleStore(NULL),
- m_pAccelerator(NULL) {
+ m_pRuleDataStore(nullptr),
+ m_pInlineStyleStore(nullptr),
+ m_pFixedStyleStore(nullptr),
+ m_pAccelerator(nullptr) {
m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_High] = FDE_CSSSTYLESHEETGROUP_Author;
m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_Mid] = FDE_CSSSTYLESHEETGROUP_User;
m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_Low] =
@@ -269,9 +269,8 @@ FX_BOOL CFDE_CSSStyleSelector::SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType,
ASSERT(eType < FDE_CSSSTYLESHEETGROUP_MAX);
CFDE_CSSStyleSheetArray& dest = m_SheetGroups[eType];
dest.RemoveAt(0, dest.GetSize());
- if (pSheet != NULL) {
+ if (pSheet)
dest.Add(pSheet);
- }
return TRUE;
}
FX_BOOL CFDE_CSSStyleSelector::SetStyleSheets(
@@ -279,11 +278,10 @@ FX_BOOL CFDE_CSSStyleSelector::SetStyleSheets(
const CFDE_CSSStyleSheetArray* pArray) {
ASSERT(eType < FDE_CSSSTYLESHEETGROUP_MAX);
CFDE_CSSStyleSheetArray& dest = m_SheetGroups[eType];
- if (pArray == NULL) {
- dest.RemoveAt(0, dest.GetSize());
- } else {
+ if (pArray)
dest.Copy(*pArray);
- }
+ else
+ dest.RemoveAt(0, dest.GetSize());
return TRUE;
}
void CFDE_CSSStyleSelector::SetStylePriority(
@@ -365,11 +363,11 @@ FX_BOOL CFDE_CSSStyleSelector::MatchSelector(FDE_CSSTagCache* pCache,
CFDE_CSSSelector* pSel,
FDE_CSSPERSUDO ePersudoType) {
uint32_t dwHash;
- while (pSel != NULL && pCache != NULL) {
+ while (pSel && pCache) {
switch (pSel->GetType()) {
case FDE_CSSSELECTORTYPE_Descendant:
dwHash = pSel->GetNameHash();
- while ((pCache = pCache->GetParent()) != NULL) {
+ while ((pCache = pCache->GetParent()) != nullptr) {
if (dwHash != FDE_CSSUNIVERSALHASH && dwHash != pCache->HashTag()) {
continue;
}
@@ -408,7 +406,7 @@ FX_BOOL CFDE_CSSStyleSelector::MatchSelector(FDE_CSSTagCache* pCache,
}
pSel = pSel->GetNextSelector();
}
- return pSel == NULL && pCache != NULL;
+ return !pSel && pCache;
}
void CFDE_CSSStyleSelector::ComputeStyle(
@@ -484,16 +482,17 @@ void CFDE_CSSStyleSelector::ApplyDeclarations(
FX_BOOL bImportant;
int32_t i;
if (bPriority) {
- IFDE_CSSValue *pLastest = NULL, *pImportant = NULL;
+ IFDE_CSSValue* pLastest = nullptr;
+ IFDE_CSSValue* pImportant = nullptr;
for (i = 0; i < iDeclCount; ++i) {
pVal = ppDeclArray[i]->GetProperty(FDE_CSSPROPERTY_FontSize, bImportant);
- if (pVal == NULL) {
+ if (!pVal)
continue;
- } else if (bImportant) {
+
+ if (bImportant)
pImportant = pVal;
- } else {
+ else
pLastest = pVal;
- }
}
if (pImportant) {
ApplyProperty(FDE_CSSPROPERTY_FontSize, pImportant, pComputedStyle);
@@ -508,7 +507,7 @@ void CFDE_CSSStyleSelector::ApplyDeclarations(
for (i = 0; i < iDeclCount; ++i) {
pDecl = ppDeclArray[i];
pos = pDecl->GetStartPosition();
- while (pos != NULL) {
+ while (pos) {
pDecl->GetNextProperty(pos, eProp, pVal, bImportant);
if (eProp == FDE_CSSPROPERTY_FontSize) {
continue;
@@ -524,7 +523,7 @@ void CFDE_CSSStyleSelector::ApplyDeclarations(
for (i = 0; i < iDeclCount; ++i) {
pDecl = importants[i];
pos = pDecl->GetStartPosition();
- while (pos != NULL) {
+ while (pos) {
pDecl->GetNextProperty(pos, eProp, pVal, bImportant);
if (bImportant && eProp != FDE_CSSPROPERTY_FontSize) {
ApplyProperty(eProp, pVal, pComputedStyle);
@@ -960,7 +959,7 @@ void CFDE_CSSStyleSelector::ApplyProperty(
break;
case FDE_CSSPROPERTY_BackgroundImage:
if (eType == FDE_CSSPRIMITIVETYPE_Enum) {
- FDE_CSSNONINHERITS.m_pszBKGImage = NULL;
+ FDE_CSSNONINHERITS.m_pszBKGImage = nullptr;
} else if (eType == FDE_CSSPRIMITIVETYPE_URI) {
int32_t iLength;
FDE_CSSNONINHERITS.m_pszBKGImage = pPrimitive->GetString(iLength);
@@ -989,7 +988,7 @@ void CFDE_CSSStyleSelector::ApplyProperty(
break;
case FDE_CSSPROPERTY_ListStyleImage:
if (eType == FDE_CSSPRIMITIVETYPE_Enum) {
- FDE_CSSINHERITS.m_pszListStyleImage = NULL;
+ FDE_CSSINHERITS.m_pszListStyleImage = nullptr;
} else if (eType == FDE_CSSPRIMITIVETYPE_URI) {
int32_t iLength;
FDE_CSSINHERITS.m_pszListStyleImage = pPrimitive->GetString(iLength);
@@ -1046,15 +1045,13 @@ void CFDE_CSSStyleSelector::ApplyProperty(
FDE_CSSNONINHERITS.m_dwTextDecoration = ToTextDecoration(pList);
break;
case FDE_CSSPROPERTY_CounterIncrement: {
- if (FDE_CSSNONINHERITS.m_pCounterStyle == NULL) {
+ if (!FDE_CSSNONINHERITS.m_pCounterStyle)
FDE_CSSNONINHERITS.m_pCounterStyle = new CFDE_CSSCounterStyle;
- }
FDE_CSSNONINHERITS.m_pCounterStyle->SetCounterIncrementList(pList);
} break;
case FDE_CSSPROPERTY_CounterReset: {
- if (FDE_CSSNONINHERITS.m_pCounterStyle == NULL) {
+ if (!FDE_CSSNONINHERITS.m_pCounterStyle)
FDE_CSSNONINHERITS.m_pCounterStyle = new CFDE_CSSCounterStyle;
- }
FDE_CSSNONINHERITS.m_pCounterStyle->SetCounterResetList(pList);
} break;
case FDE_CSSPROPERTY_Content:
diff --git a/xfa/fde/css/fde_cssstyleselector.h b/xfa/fde/css/fde_cssstyleselector.h
index 1b6d10c9f7..3af75a7b9e 100644
--- a/xfa/fde/css/fde_cssstyleselector.h
+++ b/xfa/fde/css/fde_cssstyleselector.h
@@ -51,19 +51,19 @@ class CFDE_CSSRuleCollection : public CFX_Target {
void* pData;
return m_IDRules.Lookup((void*)(uintptr_t)dwIDHash, pData)
? (FDE_CSSRuleData*)pData
- : NULL;
+ : nullptr;
}
FDE_CSSRuleData* GetTagRuleData(uint32_t dwTagHasn) {
void* pData;
return m_TagRules.Lookup((void*)(uintptr_t)dwTagHasn, pData)
? (FDE_CSSRuleData*)pData
- : NULL;
+ : nullptr;
}
FDE_CSSRuleData* GetClassRuleData(uint32_t dwIDHash) {
void* pData;
return m_ClassRules.Lookup((void*)(uintptr_t)dwIDHash, pData)
? (FDE_CSSRuleData*)pData
- : NULL;
+ : nullptr;
}
FDE_CSSRuleData* GetUniversalRuleData() { return m_pUniversalRules; }
FDE_CSSRuleData* GetPersudoRuleData() { return m_pPersudoRules; }
diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp
index 1ea8d8061d..6708ca2e72 100644
--- a/xfa/fde/css/fde_cssstylesheet.cpp
+++ b/xfa/fde/css/fde_cssstylesheet.cpp
@@ -55,7 +55,7 @@ IFDE_CSSStyleSheet* IFDE_CSSStyleSheet::LoadFromStream(
CFDE_CSSStyleSheet* pStyleSheet = new CFDE_CSSStyleSheet(dwMediaList);
if (!pStyleSheet->LoadFromStream(szUrl, pStream, wCodePage)) {
pStyleSheet->Release();
- pStyleSheet = NULL;
+ pStyleSheet = nullptr;
}
return pStyleSheet;
}
@@ -68,7 +68,7 @@ IFDE_CSSStyleSheet* IFDE_CSSStyleSheet::LoadFromBuffer(
CFDE_CSSStyleSheet* pStyleSheet = new CFDE_CSSStyleSheet(dwMediaList);
if (!pStyleSheet->LoadFromBuffer(szUrl, pBuffer, iBufSize, wCodePage)) {
pStyleSheet->Release();
- pStyleSheet = NULL;
+ pStyleSheet = nullptr;
}
return pStyleSheet;
}
@@ -76,7 +76,7 @@ CFDE_CSSStyleSheet::CFDE_CSSStyleSheet(uint32_t dwMediaList)
: m_wCodePage(FX_CODEPAGE_UTF8),
m_wRefCount(1),
m_dwMediaList(dwMediaList),
- m_pAllocator(NULL) {
+ m_pAllocator(nullptr) {
ASSERT(m_dwMediaList > 0);
}
CFDE_CSSStyleSheet::~CFDE_CSSStyleSheet() {
@@ -181,7 +181,7 @@ FX_BOOL CFDE_CSSStyleSheet::LoadFromSyntax(CFDE_CSSSyntaxParser* pSyntax) {
FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadMediaRule(
CFDE_CSSSyntaxParser* pSyntax) {
uint32_t dwMediaList = 0;
- CFDE_CSSMediaRule* pMediaRule = NULL;
+ CFDE_CSSMediaRule* pMediaRule = nullptr;
for (;;) {
switch (pSyntax->DoSyntaxParse()) {
case FDE_CSSSYNTAXSTATUS_MediaType: {
@@ -189,23 +189,22 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadMediaRule(
const FX_WCHAR* psz = pSyntax->GetCurrentString(iLen);
FDE_LPCCSSMEDIATYPETABLE pMediaType =
FDE_GetCSSMediaTypeByName(CFX_WideStringC(psz, iLen));
- if (pMediaType != NULL) {
+ if (pMediaType)
dwMediaList |= pMediaType->wValue;
- }
} break;
case FDE_CSSSYNTAXSTATUS_StyleRule:
- if (pMediaRule == NULL) {
- SkipRuleSet(pSyntax);
- } else {
+ if (pMediaRule) {
FDE_CSSSYNTAXSTATUS eStatus =
LoadStyleRule(pSyntax, pMediaRule->GetArray());
if (eStatus < FDE_CSSSYNTAXSTATUS_None) {
return eStatus;
}
+ } else {
+ SkipRuleSet(pSyntax);
}
break;
case FDE_CSSSYNTAXSTATUS_DeclOpen:
- if ((dwMediaList & m_dwMediaList) > 0 && pMediaRule == NULL) {
+ if ((dwMediaList & m_dwMediaList) > 0 && !pMediaRule) {
pMediaRule =
FXTARGET_NewWith(m_pAllocator) CFDE_CSSMediaRule(dwMediaList);
m_RuleArray.Add(pMediaRule);
@@ -221,13 +220,13 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadStyleRule(
CFDE_CSSSyntaxParser* pSyntax,
CFDE_CSSRuleArray& ruleArray) {
m_Selectors.RemoveAt(0, m_Selectors.GetSize());
- CFDE_CSSStyleRule* pStyleRule = NULL;
- const FX_WCHAR* pszValue = NULL;
+ CFDE_CSSStyleRule* pStyleRule = nullptr;
+ const FX_WCHAR* pszValue = nullptr;
int32_t iValueLen = 0;
FDE_CSSPROPERTYARGS propertyArgs;
propertyArgs.pStaticStore = m_pAllocator;
propertyArgs.pStringCache = &m_StringCache;
- propertyArgs.pProperty = NULL;
+ propertyArgs.pProperty = nullptr;
CFX_WideString wsName;
for (;;) {
switch (pSyntax->DoSyntaxParse()) {
@@ -235,20 +234,18 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadStyleRule(
pszValue = pSyntax->GetCurrentString(iValueLen);
CFDE_CSSSelector* pSelector =
CFDE_CSSSelector::FromString(m_pAllocator, pszValue, iValueLen);
- if (pSelector != NULL) {
+ if (pSelector)
m_Selectors.Add(pSelector);
- }
} break;
case FDE_CSSSYNTAXSTATUS_PropertyName:
pszValue = pSyntax->GetCurrentString(iValueLen);
propertyArgs.pProperty =
FDE_GetCSSPropertyByName(CFX_WideStringC(pszValue, iValueLen));
- if (propertyArgs.pProperty == NULL) {
+ if (!propertyArgs.pProperty)
wsName = CFX_WideStringC(pszValue, iValueLen);
- }
break;
case FDE_CSSSYNTAXSTATUS_PropertyValue:
- if (propertyArgs.pProperty != NULL) {
+ if (propertyArgs.pProperty) {
pszValue = pSyntax->GetCurrentString(iValueLen);
if (iValueLen > 0) {
pStyleRule->GetDeclImp().AddProperty(&propertyArgs, pszValue,
@@ -264,7 +261,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadStyleRule(
}
break;
case FDE_CSSSYNTAXSTATUS_DeclOpen:
- if (pStyleRule == NULL && m_Selectors.GetSize() > 0) {
+ if (!pStyleRule && m_Selectors.GetSize() > 0) {
pStyleRule = FXTARGET_NewWith(m_pAllocator) CFDE_CSSStyleRule;
pStyleRule->SetSelector(m_pAllocator, m_Selectors);
ruleArray.Add(pStyleRule);
@@ -274,8 +271,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadStyleRule(
}
break;
case FDE_CSSSYNTAXSTATUS_DeclClose:
- if (pStyleRule != NULL &&
- pStyleRule->GetDeclImp().GetStartPosition() == NULL) {
+ if (pStyleRule && !pStyleRule->GetDeclImp().GetStartPosition()) {
pStyleRule->~CFDE_CSSStyleRule();
ruleArray.RemoveLast(1);
}
@@ -287,13 +283,13 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadStyleRule(
FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadFontFaceRule(
CFDE_CSSSyntaxParser* pSyntax,
CFDE_CSSRuleArray& ruleArray) {
- CFDE_CSSFontFaceRule* pFontFaceRule = NULL;
- const FX_WCHAR* pszValue = NULL;
+ CFDE_CSSFontFaceRule* pFontFaceRule = nullptr;
+ const FX_WCHAR* pszValue = nullptr;
int32_t iValueLen = 0;
FDE_CSSPROPERTYARGS propertyArgs;
propertyArgs.pStaticStore = m_pAllocator;
propertyArgs.pStringCache = &m_StringCache;
- propertyArgs.pProperty = NULL;
+ propertyArgs.pProperty = nullptr;
for (;;) {
switch (pSyntax->DoSyntaxParse()) {
case FDE_CSSSYNTAXSTATUS_PropertyName:
@@ -302,7 +298,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadFontFaceRule(
FDE_GetCSSPropertyByName(CFX_WideStringC(pszValue, iValueLen));
break;
case FDE_CSSSYNTAXSTATUS_PropertyValue:
- if (propertyArgs.pProperty != NULL) {
+ if (propertyArgs.pProperty) {
pszValue = pSyntax->GetCurrentString(iValueLen);
if (iValueLen > 0) {
pFontFaceRule->GetDeclImp().AddProperty(&propertyArgs, pszValue,
@@ -311,7 +307,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadFontFaceRule(
}
break;
case FDE_CSSSYNTAXSTATUS_DeclOpen:
- if (pFontFaceRule == NULL) {
+ if (!pFontFaceRule) {
pFontFaceRule = FXTARGET_NewWith(m_pAllocator) CFDE_CSSFontFaceRule;
ruleArray.Add(pFontFaceRule);
}
@@ -355,7 +351,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::SkipRuleSet(
}
void CFDE_CSSStyleRule::SetSelector(IFX_MemoryAllocator* pStaticStore,
const CFDE_CSSSelectorArray& list) {
- ASSERT(m_ppSelector == NULL);
+ ASSERT(!m_ppSelector);
m_iSelectors = list.GetSize();
m_ppSelector = static_cast<CFDE_CSSSelector**>(
pStaticStore->Alloc(m_iSelectors * sizeof(CFDE_CSSSelector*)));
@@ -409,7 +405,7 @@ CFDE_CSSSelector* CFDE_CSSSelector::FromString(
IFX_MemoryAllocator* pStaticStore,
const FX_WCHAR* psz,
int32_t iLen) {
- ASSERT(pStaticStore != NULL && psz != NULL && iLen > 0);
+ ASSERT(pStaticStore && psz && iLen > 0);
const FX_WCHAR* pStart = psz;
const FX_WCHAR* pEnd = psz + iLen;
for (; psz < pEnd; ++psz) {
@@ -417,38 +413,40 @@ CFDE_CSSSelector* CFDE_CSSSelector::FromString(
case '>':
case '[':
case '+':
- return NULL;
+ return nullptr;
}
}
- CFDE_CSSSelector *pFirst = NULL, *pLast = NULL;
- CFDE_CSSSelector *pPersudoFirst = NULL, *pPersudoLast = NULL;
+ CFDE_CSSSelector* pFirst = nullptr;
+ CFDE_CSSSelector* pLast = nullptr;
+ CFDE_CSSSelector* pPersudoFirst = nullptr;
+ CFDE_CSSSelector* pPersudoLast = nullptr;
for (psz = pStart; psz < pEnd;) {
FX_WCHAR wch = *psz;
if (wch == '.' || wch == '#') {
if (psz == pStart || psz[-1] == ' ') {
CFDE_CSSSelector* p = FXTARGET_NewWith(pStaticStore)
CFDE_CSSSelector(FDE_CSSSELECTORTYPE_Element, L"*", 1, true);
- if (p == NULL) {
- return NULL;
- }
- if (pFirst != NULL) {
+ if (!p)
+ return nullptr;
+
+ if (pFirst) {
pFirst->SetType(FDE_CSSSELECTORTYPE_Descendant);
p->SetNext(pFirst);
}
pFirst = pLast = p;
}
- ASSERT(pLast != NULL);
+ ASSERT(pLast);
int32_t iNameLen = FDE_GetCSSNameLen(++psz, pEnd);
if (iNameLen == 0) {
- return NULL;
+ return nullptr;
}
FDE_CSSSELECTORTYPE eType =
wch == '.' ? FDE_CSSSELECTORTYPE_Class : FDE_CSSSELECTORTYPE_ID;
CFDE_CSSSelector* p = FXTARGET_NewWith(pStaticStore)
CFDE_CSSSelector(eType, psz, iNameLen, false);
- if (p == NULL) {
- return NULL;
- }
+ if (!p)
+ return nullptr;
+
p->SetNext(pLast->GetNextSelector());
pLast->SetNext(p);
pLast = p;
@@ -456,48 +454,45 @@ CFDE_CSSSelector* CFDE_CSSSelector::FromString(
} else if (FDE_IsCSSChar(wch) || wch == '*') {
int32_t iNameLen = wch == '*' ? 1 : FDE_GetCSSNameLen(psz, pEnd);
if (iNameLen == 0) {
- return NULL;
+ return nullptr;
}
CFDE_CSSSelector* p = FXTARGET_NewWith(pStaticStore)
CFDE_CSSSelector(FDE_CSSSELECTORTYPE_Element, psz, iNameLen, true);
- if (p == NULL) {
- return NULL;
- }
- if (pFirst == NULL) {
- pFirst = pLast = p;
- } else {
+ if (!p)
+ return nullptr;
+
+ if (pFirst) {
pFirst->SetType(FDE_CSSSELECTORTYPE_Descendant);
p->SetNext(pFirst);
- pFirst = pLast = p;
}
+ pFirst = p;
+ pLast = p;
psz += iNameLen;
} else if (wch == ':') {
int32_t iNameLen = FDE_GetCSSPersudoLen(psz, pEnd);
if (iNameLen == 0) {
- return NULL;
+ return nullptr;
}
CFDE_CSSSelector* p = FXTARGET_NewWith(pStaticStore)
CFDE_CSSSelector(FDE_CSSSELECTORTYPE_Persudo, psz, iNameLen, true);
- if (p == NULL) {
- return NULL;
- }
- if (pPersudoFirst == NULL) {
- pPersudoFirst = pPersudoLast = p;
- } else {
+ if (!p)
+ return nullptr;
+
+ if (pPersudoFirst)
pPersudoLast->SetNext(p);
- pPersudoLast = p;
- }
+ else
+ pPersudoFirst = p;
+ pPersudoLast = p;
psz += iNameLen;
} else if (wch == ' ') {
psz++;
} else {
- return NULL;
+ return nullptr;
}
}
- if (pPersudoFirst == NULL) {
+ if (!pPersudoFirst)
return pFirst;
- } else {
- pPersudoLast->SetNext(pFirst);
- return pPersudoFirst;
- }
+
+ pPersudoLast->SetNext(pFirst);
+ return pPersudoFirst;
}
diff --git a/xfa/fde/css/fde_cssstylesheet.h b/xfa/fde/css/fde_cssstylesheet.h
index 76eddda4a3..4c51579661 100644
--- a/xfa/fde/css/fde_cssstylesheet.h
+++ b/xfa/fde/css/fde_cssstylesheet.h
@@ -48,7 +48,7 @@ typedef CFX_ArrayTemplate<CFDE_CSSSelector*> CFDE_CSSSelectorArray;
class CFDE_CSSStyleRule : public IFDE_CSSStyleRule, public CFX_Target {
public:
- CFDE_CSSStyleRule() : m_ppSelector(NULL), m_iSelectors(0) {}
+ CFDE_CSSStyleRule() : m_ppSelector(nullptr), m_iSelectors(0) {}
int32_t CountSelectorLists() const override { return m_iSelectors; }
CFDE_CSSSelector* GetSelectorList(int32_t index) const override {
return m_ppSelector[index];
diff --git a/xfa/fde/css/fde_csssyntax.cpp b/xfa/fde/css/fde_csssyntax.cpp
index 4583595686..4595396c13 100644
--- a/xfa/fde/css/fde_csssyntax.cpp
+++ b/xfa/fde/css/fde_csssyntax.cpp
@@ -9,21 +9,17 @@
#include "xfa/fde/css/fde_cssdatatable.h"
#include "xfa/fgas/crt/fgas_codepage.h"
-#ifdef _cplusplus
-extern "C" {
-#endif
+namespace {
-inline FX_BOOL FDE_IsSelectorStart(FX_WCHAR wch) {
+bool FDE_IsSelectorStart(FX_WCHAR wch) {
return wch == '.' || wch == '#' || wch == '*' || (wch >= 'a' && wch <= 'z') ||
(wch >= 'A' && wch <= 'Z');
}
-#ifdef _cplusplus
-};
-#endif
+} // namespace
CFDE_CSSSyntaxParser::CFDE_CSSSyntaxParser()
- : m_pStream(NULL),
+ : m_pStream(nullptr),
m_iStreamPos(0),
m_iPlaneSize(0),
m_iTextDatLen(0),
@@ -38,7 +34,7 @@ FX_BOOL CFDE_CSSSyntaxParser::Init(IFX_Stream* pStream,
int32_t iCSSPlaneSize,
int32_t iTextDataSize,
FX_BOOL bOnlyDeclaration) {
- ASSERT(pStream != NULL && iCSSPlaneSize > 0 && iTextDataSize > 0);
+ ASSERT(pStream && iCSSPlaneSize > 0 && iTextDataSize > 0);
Reset(bOnlyDeclaration);
if (!m_TextData.EstimateSize(iTextDataSize)) {
return FALSE;
@@ -53,7 +49,7 @@ FX_BOOL CFDE_CSSSyntaxParser::Init(const FX_WCHAR* pBuffer,
int32_t iBufferSize,
int32_t iTextDatSize,
FX_BOOL bOnlyDeclaration) {
- ASSERT(pBuffer != NULL && iBufferSize > 0 && iTextDatSize > 0);
+ ASSERT(pBuffer && iBufferSize > 0 && iTextDatSize > 0);
Reset(bOnlyDeclaration);
if (!m_TextData.EstimateSize(iTextDatSize)) {
return FALSE;
@@ -63,7 +59,7 @@ FX_BOOL CFDE_CSSSyntaxParser::Init(const FX_WCHAR* pBuffer,
void CFDE_CSSSyntaxParser::Reset(FX_BOOL bOnlyDeclaration) {
m_TextPlane.Reset();
m_TextData.Reset();
- m_pStream = NULL;
+ m_pStream = nullptr;
m_iStreamPos = 0;
m_iTextDatLen = 0;
m_dwCheck = (uint32_t)-1;
@@ -74,7 +70,7 @@ void CFDE_CSSSyntaxParser::Reset(FX_BOOL bOnlyDeclaration) {
FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() {
while (m_eStatus >= FDE_CSSSYNTAXSTATUS_None) {
if (m_TextPlane.IsEOF()) {
- if (m_pStream == NULL) {
+ if (!m_pStream) {
if (m_eMode == FDE_CSSSYNTAXMODE_PropertyValue &&
m_TextData.GetLength() > 0) {
SaveTextData();
@@ -228,9 +224,9 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() {
break;
case '{': {
FDE_CSSSYNTAXMODE* pMode = m_ModeStack.GetTopElement();
- if (pMode == NULL || *pMode != FDE_CSSSYNTAXMODE_MediaRule) {
+ if (!pMode || *pMode != FDE_CSSSYNTAXMODE_MediaRule)
return m_eStatus = FDE_CSSSYNTAXSTATUS_Error;
- }
+
if (m_TextData.GetLength() > 0) {
SaveTextData();
return FDE_CSSSYNTAXSTATUS_MediaType;
@@ -243,9 +239,9 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() {
} break;
case ';': {
FDE_CSSSYNTAXMODE* pMode = m_ModeStack.GetTopElement();
- if (pMode == NULL || *pMode != FDE_CSSSYNTAXMODE_Import) {
+ if (!pMode || *pMode != FDE_CSSSYNTAXMODE_Import)
return m_eStatus = FDE_CSSSYNTAXSTATUS_Error;
- }
+
if (m_TextData.GetLength() > 0) {
SaveTextData();
if (IsImportEnabled()) {
@@ -276,9 +272,9 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() {
break;
case FDE_CSSSYNTAXMODE_URI: {
FDE_CSSSYNTAXMODE* pMode = m_ModeStack.GetTopElement();
- if (pMode == NULL || *pMode != FDE_CSSSYNTAXMODE_Import) {
+ if (!pMode || *pMode != FDE_CSSSYNTAXMODE_Import)
return m_eStatus = FDE_CSSSYNTAXSTATUS_Error;
- }
+
if (wch <= ' ' || wch == ';') {
int32_t iURIStart, iURILength = m_TextData.GetLength();
if (iURILength > 0 &&
@@ -333,7 +329,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() {
if (IsCharsetEnabled()) {
DisableCharset();
if (m_iTextDatLen > 0) {
- if (m_pStream != NULL) {
+ if (m_pStream) {
uint16_t wCodePage = FX_GetCodePageFromStringW(
m_TextData.GetBuffer(), m_iTextDatLen);
if (wCodePage < 0xFFFF &&
@@ -371,7 +367,7 @@ FX_BOOL CFDE_CSSSyntaxParser::IsImportEnabled() const {
}
return TRUE;
}
-inline FX_BOOL CFDE_CSSSyntaxParser::AppendChar(FX_WCHAR wch) {
+FX_BOOL CFDE_CSSSyntaxParser::AppendChar(FX_WCHAR wch) {
m_TextPlane.MoveNext();
if (m_TextData.GetLength() > 0 || wch > ' ') {
m_TextData.AppendChar(wch);
@@ -379,26 +375,26 @@ inline FX_BOOL CFDE_CSSSyntaxParser::AppendChar(FX_WCHAR wch) {
}
return FALSE;
}
-inline int32_t CFDE_CSSSyntaxParser::SaveTextData() {
+int32_t CFDE_CSSSyntaxParser::SaveTextData() {
m_iTextDatLen = m_TextData.TrimEnd();
m_TextData.Clear();
return m_iTextDatLen;
}
-inline void CFDE_CSSSyntaxParser::SwitchMode(FDE_CSSSYNTAXMODE eMode) {
+void CFDE_CSSSyntaxParser::SwitchMode(FDE_CSSSYNTAXMODE eMode) {
m_eMode = eMode;
SaveTextData();
}
-inline int32_t CFDE_CSSSyntaxParser::SwitchToComment() {
+int32_t CFDE_CSSSyntaxParser::SwitchToComment() {
int32_t iLength = m_TextData.GetLength();
m_ModeStack.Push(m_eMode);
SwitchMode(FDE_CSSSYNTAXMODE_Comment);
return iLength;
}
-inline FX_BOOL CFDE_CSSSyntaxParser::RestoreMode() {
+FX_BOOL CFDE_CSSSyntaxParser::RestoreMode() {
FDE_CSSSYNTAXMODE* pMode = m_ModeStack.GetTopElement();
- if (pMode == NULL) {
+ if (!pMode)
return FALSE;
- }
+
SwitchMode(*pMode);
m_ModeStack.Pop();
return TRUE;
@@ -409,7 +405,7 @@ const FX_WCHAR* CFDE_CSSSyntaxParser::GetCurrentString(int32_t& iLength) const {
}
CFDE_CSSTextBuf::CFDE_CSSTextBuf()
: m_bExtBuf(FALSE),
- m_pBuffer(NULL),
+ m_pBuffer(nullptr),
m_iBufLen(0),
m_iDatLen(0),
m_iDatPos(0) {}
@@ -419,7 +415,7 @@ CFDE_CSSTextBuf::~CFDE_CSSTextBuf() {
void CFDE_CSSTextBuf::Reset() {
if (!m_bExtBuf) {
FX_Free(m_pBuffer);
- m_pBuffer = NULL;
+ m_pBuffer = nullptr;
}
m_iDatPos = m_iDatLen = m_iBufLen;
}
diff --git a/xfa/fde/fde_gedevice.cpp b/xfa/fde/fde_gedevice.cpp
index 03065d751c..c7c5cfb970 100644
--- a/xfa/fde/fde_gedevice.cpp
+++ b/xfa/fde/fde_gedevice.cpp
@@ -60,7 +60,7 @@ FX_BOOL CFDE_RenderDevice::SetClipPath(const CFDE_Path* pClip) {
return FALSE;
}
CFDE_Path* CFDE_RenderDevice::GetClipPath() const {
- return NULL;
+ return nullptr;
}
FX_FLOAT CFDE_RenderDevice::GetDpiX() const {
return 96;
@@ -73,7 +73,6 @@ FX_BOOL CFDE_RenderDevice::DrawImage(CFX_DIBSource* pDib,
const CFX_RectF& dstRect,
const CFX_Matrix* pImgMatrix,
const CFX_Matrix* pDevMatrix) {
- ASSERT(pDib != NULL);
CFX_RectF srcRect;
if (pSrcRect) {
srcRect = *pSrcRect;
@@ -96,13 +95,13 @@ FX_BOOL CFDE_RenderDevice::DrawImage(CFX_DIBSource* pDib,
if (pDevMatrix) {
dib2fxdev.Concat(*pDevMatrix);
}
- void* handle = NULL;
+ void* handle = nullptr;
m_pDevice->StartDIBits(pDib, 255, 0, (const CFX_Matrix*)&dib2fxdev, 0,
handle);
- while (m_pDevice->ContinueDIBits(handle, NULL)) {
+ while (m_pDevice->ContinueDIBits(handle, nullptr)) {
}
m_pDevice->CancelDIBits(handle);
- return handle != NULL;
+ return !!handle;
}
FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush,
CFGAS_GEFont* pFont,
@@ -250,9 +249,9 @@ FX_BOOL CFDE_RenderDevice::DrawPath(CFDE_Pen* pPen,
const CFDE_Path* pPath,
const CFX_Matrix* pMatrix) {
CFDE_Path* pGePath = (CFDE_Path*)pPath;
- if (pGePath == NULL) {
+ if (!pGePath)
return FALSE;
- }
+
CFX_GraphStateData graphState;
if (!CreatePen(pPen, fPenWidth, graphState)) {
return FALSE;
diff --git a/xfa/fde/fde_gedevice.h b/xfa/fde/fde_gedevice.h
index debb69115c..2d2a901904 100644
--- a/xfa/fde/fde_gedevice.h
+++ b/xfa/fde/fde_gedevice.h
@@ -35,68 +35,68 @@ class CFDE_RenderDevice : public CFX_Target {
FX_BOOL DrawImage(CFX_DIBSource* pDib,
const CFX_RectF* pSrcRect,
const CFX_RectF& dstRect,
- const CFX_Matrix* pImgMatrix = NULL,
- const CFX_Matrix* pDevMatrix = NULL);
+ const CFX_Matrix* pImgMatrix = nullptr,
+ const CFX_Matrix* pDevMatrix = nullptr);
FX_BOOL DrawString(CFDE_Brush* pBrush,
CFGAS_GEFont* pFont,
const FXTEXT_CHARPOS* pCharPos,
int32_t iCount,
FX_FLOAT fFontSize,
- const CFX_Matrix* pMatrix = NULL);
+ const CFX_Matrix* pMatrix = nullptr);
FX_BOOL DrawBezier(CFDE_Pen* pPen,
FX_FLOAT fPenWidth,
const CFX_PointF& pt1,
const CFX_PointF& pt2,
const CFX_PointF& pt3,
const CFX_PointF& pt4,
- const CFX_Matrix* pMatrix = NULL);
+ const CFX_Matrix* pMatrix = nullptr);
FX_BOOL DrawCurve(CFDE_Pen* pPen,
FX_FLOAT fPenWidth,
const CFX_PointsF& points,
FX_BOOL bClosed,
FX_FLOAT fTension = 0.5f,
- const CFX_Matrix* pMatrix = NULL);
+ const CFX_Matrix* pMatrix = nullptr);
FX_BOOL DrawEllipse(CFDE_Pen* pPen,
FX_FLOAT fPenWidth,
const CFX_RectF& rect,
- const CFX_Matrix* pMatrix = NULL);
+ const CFX_Matrix* pMatrix = nullptr);
FX_BOOL DrawLines(CFDE_Pen* pPen,
FX_FLOAT fPenWidth,
const CFX_PointsF& points,
- const CFX_Matrix* pMatrix = NULL);
+ const CFX_Matrix* pMatrix = nullptr);
FX_BOOL DrawLine(CFDE_Pen* pPen,
FX_FLOAT fPenWidth,
const CFX_PointF& pt1,
const CFX_PointF& pt2,
- const CFX_Matrix* pMatrix = NULL);
+ const CFX_Matrix* pMatrix = nullptr);
FX_BOOL DrawPath(CFDE_Pen* pPen,
FX_FLOAT fPenWidth,
const CFDE_Path* pPath,
- const CFX_Matrix* pMatrix = NULL);
+ const CFX_Matrix* pMatrix = nullptr);
FX_BOOL DrawPolygon(CFDE_Pen* pPen,
FX_FLOAT fPenWidth,
const CFX_PointsF& points,
- const CFX_Matrix* pMatrix = NULL);
+ const CFX_Matrix* pMatrix = nullptr);
FX_BOOL DrawRectangle(CFDE_Pen* pPen,
FX_FLOAT fPenWidth,
const CFX_RectF& rect,
- const CFX_Matrix* pMatrix = NULL);
+ const CFX_Matrix* pMatrix = nullptr);
FX_BOOL FillClosedCurve(CFDE_Brush* pBrush,
const CFX_PointsF& points,
FX_FLOAT fTension = 0.5f,
- const CFX_Matrix* pMatrix = NULL);
+ const CFX_Matrix* pMatrix = nullptr);
FX_BOOL FillEllipse(CFDE_Brush* pBrush,
const CFX_RectF& rect,
- const CFX_Matrix* pMatrix = NULL);
+ const CFX_Matrix* pMatrix = nullptr);
FX_BOOL FillPath(CFDE_Brush* pBrush,
const CFDE_Path* pPath,
- const CFX_Matrix* pMatrix = NULL);
+ const CFX_Matrix* pMatrix = nullptr);
FX_BOOL FillPolygon(CFDE_Brush* pBrush,
const CFX_PointsF& points,
- const CFX_Matrix* pMatrix = NULL);
+ const CFX_Matrix* pMatrix = nullptr);
FX_BOOL FillRectangle(CFDE_Brush* pBrush,
const CFX_RectF& rect,
- const CFX_Matrix* pMatrix = NULL);
+ const CFX_Matrix* pMatrix = nullptr);
FX_BOOL DrawSolidString(CFDE_Brush* pBrush,
CFGAS_GEFont* pFont,
diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp
index 6b9f8522b5..b0c4bdd234 100644
--- a/xfa/fde/tto/fde_textout.cpp
+++ b/xfa/fde/tto/fde_textout.cpp
@@ -18,16 +18,16 @@
#include "xfa/fgas/layout/fgas_textbreak.h"
CFDE_TextOut::CFDE_TextOut()
- : m_pFont(NULL),
+ : m_pFont(nullptr),
m_fFontSize(12.0f),
m_fLineSpace(m_fFontSize),
m_fLinePos(0.0f),
m_fTolerance(0.0f),
m_iAlignment(0),
m_iTxtBkAlignment(0),
- m_pCharWidths(NULL),
+ m_pCharWidths(nullptr),
m_iChars(0),
- m_pEllCharWidths(NULL),
+ m_pEllCharWidths(nullptr),
m_iEllChars(0),
m_wParagraphBkChar(L'\n'),
m_TxtColor(0xFF000000),
@@ -39,7 +39,7 @@ CFDE_TextOut::CFDE_TextOut()
m_iCurLine(0),
m_iCurPiece(0),
m_iTotalLines(0),
- m_pCharPos(NULL),
+ m_pCharPos(nullptr),
m_iCharPosSize(0) {
m_pTxtBreak = new CFX_TxtBreak(FX_TXTBREAKPOLICY_None);
m_Matrix.SetIdentity();
@@ -191,7 +191,7 @@ void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr,
void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr,
int32_t iLength,
CFX_RectF& rect) {
- if (pwsStr == NULL || iLength < 1) {
+ if (!pwsStr || iLength < 1) {
rect.width = 0.0f;
rect.height = 0.0f;
} else {
@@ -214,7 +214,7 @@ void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr,
void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr,
int32_t iLength,
CFX_RectF& rect) {
- if (pwsStr == NULL || iLength < 1) {
+ if (!pwsStr || iLength < 1) {
rect.width = 0.0f;
rect.height = 0.0f;
} else {
@@ -224,7 +224,7 @@ void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr,
void CFDE_TextOut::CalcTextSize(const FX_WCHAR* pwsStr,
int32_t iLength,
CFX_RectF& rect) {
- ASSERT(m_pFont != NULL && m_fFontSize >= 1.0f);
+ ASSERT(m_pFont && m_fFontSize >= 1.0f);
SetLineWidth(rect);
m_iTotalLines = 0;
const FX_WCHAR* pStr = pwsStr;
@@ -386,10 +386,10 @@ void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr,
int32_t iLength,
const CFX_RectF& rect,
const CFX_RectF& rtClip) {
- ASSERT(m_pFont != NULL && m_fFontSize >= 1.0f);
- if (pwsStr == NULL || iLength < 1) {
+ ASSERT(m_pFont && m_fFontSize >= 1.0f);
+ if (!pwsStr || iLength < 1)
return;
- }
+
if (rect.width < m_fFontSize || rect.height < m_fFontSize) {
return;
}
@@ -431,7 +431,7 @@ void CFDE_TextOut::ExpandBuffer(int32_t iSize, int32_t iType) {
FXSYS_memset(m_pEllCharWidths, 0, iSize * sizeof(int32_t));
break;
case 2:
- if (m_pCharPos == NULL) {
+ if (!m_pCharPos) {
m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, iSize);
m_iCharPosSize = iSize;
} else if (m_iCharPosSize < iSize) {
@@ -513,10 +513,9 @@ void CFDE_TextOut::LoadText(const FX_WCHAR* pwsStr,
FX_BOOL bRet = FALSE;
while (iTxtLength-- > 0) {
wch = *pwsStr++;
- if (wch == L'&' && bHotKey && (pStr - 1) != NULL && *(pStr - 1) != L'&') {
- if (iTxtLength > 0) {
+ if (bHotKey && wch == L'&' && *(pStr - 1) != L'&') {
+ if (iTxtLength > 0)
m_hotKeys.Add(iChars);
- }
continue;
}
*pStr++ = wch;
@@ -565,7 +564,7 @@ FX_BOOL CFDE_TextOut::RetriecePieces(uint32_t dwBreakStatus,
if (bVertical) {
fLineStep = -fLineStep;
}
- CFX_Char* pTC = NULL;
+ CFX_Char* pTC = nullptr;
FX_BOOL bNeedReload = FALSE;
FX_FLOAT fLineWidth = bVertical ? rect.Height() : rect.Width();
int32_t iLineWidth = FXSYS_round(fLineWidth * 20000.0f);
@@ -663,9 +662,9 @@ void CFDE_TextOut::ReplaceWidthEllipsis() {
int32_t iPiece = pLine->GetSize();
while (iPiece-- > 0) {
FDE_TTOPIECE* pPiece = pLine->GetPtrAt(iPiece);
- if (pPiece == NULL) {
+ if (!pPiece)
break;
- }
+
for (int32_t j = pPiece->iChars - 1; j >= 0; j--) {
if (iEllipsisCharIndex < 0) {
break;
@@ -692,9 +691,9 @@ void CFDE_TextOut::Reload(const CFX_RectF& rect) {
int32_t iCount = m_ttoLines.GetSize();
for (int32_t i = 0; i < iCount; i++) {
CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i);
- if (pLine == NULL || !pLine->m_bNewReload) {
+ if (!pLine || !pLine->m_bNewReload)
continue;
- }
+
m_iCurLine = i;
m_iCurPiece = 0;
ReloadLinePiece(pLine, rect);
@@ -774,7 +773,7 @@ void CFDE_TextOut::OnDraw(const CFX_RectF& rtClip) {
CFDE_Brush* pBrush = new CFDE_Brush;
pBrush->SetColor(m_TxtColor);
- CFDE_Pen* pPen = NULL;
+ CFDE_Pen* pPen = nullptr;
m_pRenderDevice->SaveState();
if (rtClip.Width() > 0.0f && rtClip.Height() > 0.0f) {
m_pRenderDevice->SetClipRect(rtClip);
@@ -784,9 +783,9 @@ void CFDE_TextOut::OnDraw(const CFX_RectF& rtClip) {
int32_t iPieces = pLine->GetSize();
for (int32_t j = 0; j < iPieces; j++) {
FDE_TTOPIECE* pPiece = pLine->GetPtrAt(j);
- if (pPiece == NULL) {
+ if (!pPiece)
continue;
- }
+
int32_t iCount = GetDisplayPos(pPiece);
if (iCount > 0) {
m_pRenderDevice->DrawString(pBrush, m_pFont, m_pCharPos, iCount,
@@ -928,7 +927,7 @@ int32_t CFDE_TTOLine::GetSize() const {
}
FDE_TTOPIECE* CFDE_TTOLine::GetPtrAt(int32_t index) {
if (index >= m_iPieceCount) {
- return NULL;
+ return nullptr;
}
return m_pieces.GetPtrAt(index);
}
diff --git a/xfa/fde/xml/fde_xml.h b/xfa/fde/xml/fde_xml.h
index 61dd4b040e..b4601a9310 100644
--- a/xfa/fde/xml/fde_xml.h
+++ b/xfa/fde/xml/fde_xml.h
@@ -43,8 +43,6 @@ struct FDE_XMLNODE {
typedef CFX_StackTemplate<FDE_XMLNODE> CFDE_XMLNodeStack;
FX_BOOL FDE_IsXMLValidChar(FX_WCHAR ch);
-FX_BOOL FDE_IsXMLWhiteSpace(FX_WCHAR ch);
-FX_BOOL FDE_IsXMLNameChar(FX_WCHAR ch, FX_BOOL bFirstChar);
struct FDE_XMLREADERHANDLER {
void* pData;
diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp
index 6a2c9fe57d..6b7bdaaed3 100644
--- a/xfa/fde/xml/fde_xml_imp.cpp
+++ b/xfa/fde/xml/fde_xml_imp.cpp
@@ -12,29 +12,15 @@
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fgas/crt/fgas_system.h"
-#define FDE_XMLVALIDCHARRANGENUM 5
-static const uint16_t g_XMLValidCharRange[FDE_XMLVALIDCHARRANGENUM][2] = {
- {0x09, 0x09},
- {0x0A, 0x0A},
- {0x0D, 0x0D},
- {0x20, 0xD7FF},
- {0xE000, 0xFFFD}};
+namespace {
-FX_BOOL FDE_IsXMLValidChar(FX_WCHAR ch) {
- int32_t iStart = 0, iEnd = FDE_XMLVALIDCHARRANGENUM - 1, iMid;
- while (iStart <= iEnd) {
- iMid = (iStart + iEnd) / 2;
- if (ch < g_XMLValidCharRange[iMid][0]) {
- iEnd = iMid - 1;
- } else if (ch > g_XMLValidCharRange[iMid][1]) {
- iStart = iMid + 1;
- } else {
- return TRUE;
- }
- }
- return FALSE;
-}
-FX_BOOL FDE_IsXMLWhiteSpace(FX_WCHAR ch) {
+const uint16_t g_XMLValidCharRange[][2] = {{0x09, 0x09},
+ {0x0A, 0x0A},
+ {0x0D, 0x0D},
+ {0x20, 0xD7FF},
+ {0xE000, 0xFFFD}};
+
+bool FDE_IsXMLWhiteSpace(FX_WCHAR ch) {
return ch == L' ' || ch == 0x0A || ch == 0x0D || ch == 0x09;
}
@@ -44,8 +30,7 @@ struct FDE_XMLNAMECHAR {
bool bStartChar;
};
-#define FDE_XMLNAMECHARSNUM 20
-static const FDE_XMLNAMECHAR g_XMLNameChars[FDE_XMLNAMECHARSNUM] = {
+const FDE_XMLNAMECHAR g_XMLNameChars[] = {
{L'-', L'.', false}, {L'0', L'9', false}, {L':', L':', false},
{L'A', L'Z', true}, {L'_', L'_', true}, {L'a', L'z', true},
{0xB7, 0xB7, false}, {0xC0, 0xD6, true}, {0xD8, 0xF6, true},
@@ -55,18 +40,34 @@ static const FDE_XMLNAMECHAR g_XMLNameChars[FDE_XMLNAMECHARSNUM] = {
{0xF900, 0xFDCF, true}, {0xFDF0, 0xFFFD, true},
};
-FX_BOOL FDE_IsXMLNameChar(FX_WCHAR ch, FX_BOOL bFirstChar) {
- int32_t iStart = 0, iEnd = FDE_XMLNAMECHARSNUM - 1, iMid;
+bool FDE_IsXMLNameChar(FX_WCHAR ch, FX_BOOL bFirstChar) {
+ int32_t iStart = 0;
+ int32_t iEnd = FX_ArraySize(g_XMLNameChars) - 1;
while (iStart <= iEnd) {
- iMid = (iStart + iEnd) / 2;
+ int32_t iMid = (iStart + iEnd) / 2;
if (ch < g_XMLNameChars[iMid].wStart) {
iEnd = iMid - 1;
} else if (ch > g_XMLNameChars[iMid].wEnd) {
iStart = iMid + 1;
} else {
- if (bFirstChar) {
- return g_XMLNameChars[iMid].bStartChar;
- }
+ return bFirstChar ? g_XMLNameChars[iMid].bStartChar : true;
+ }
+ }
+ return false;
+}
+
+} // namespace
+
+FX_BOOL FDE_IsXMLValidChar(FX_WCHAR ch) {
+ int32_t iStart = 0;
+ int32_t iEnd = FX_ArraySize(g_XMLValidCharRange) - 1;
+ while (iStart <= iEnd) {
+ int32_t iMid = (iStart + iEnd) / 2;
+ if (ch < g_XMLValidCharRange[iMid][0]) {
+ iEnd = iMid - 1;
+ } else if (ch > g_XMLValidCharRange[iMid][1]) {
+ iStart = iMid + 1;
+ } else {
return TRUE;
}
}
@@ -74,23 +75,28 @@ FX_BOOL FDE_IsXMLNameChar(FX_WCHAR ch, FX_BOOL bFirstChar) {
}
CFDE_XMLNode::CFDE_XMLNode()
- : m_pParent(NULL), m_pChild(NULL), m_pPrior(NULL), m_pNext(NULL) {}
+ : m_pParent(nullptr),
+ m_pChild(nullptr),
+ m_pPrior(nullptr),
+ m_pNext(nullptr) {}
+
CFDE_XMLNode::~CFDE_XMLNode() {
DeleteChildren();
}
+
void CFDE_XMLNode::DeleteChildren() {
- CFDE_XMLNode *pChild = m_pChild, *pTemp;
- while (pChild != NULL) {
- pTemp = pChild->m_pNext;
+ CFDE_XMLNode* pChild = m_pChild;
+ while (pChild) {
+ CFDE_XMLNode* pTemp = pChild->m_pNext;
pChild->Release();
pChild = pTemp;
}
- m_pChild = NULL;
+ m_pChild = nullptr;
}
int32_t CFDE_XMLNode::CountChildNodes() const {
int32_t iCount = 0;
CFDE_XMLNode* pChild = m_pChild;
- while (pChild != NULL) {
+ while (pChild) {
iCount++;
pChild = pChild->m_pNext;
}
@@ -98,19 +104,19 @@ int32_t CFDE_XMLNode::CountChildNodes() const {
}
CFDE_XMLNode* CFDE_XMLNode::GetChildNode(int32_t index) const {
CFDE_XMLNode* pChild = m_pChild;
- while (pChild != NULL) {
+ while (pChild) {
if (index == 0) {
return pChild;
}
index--;
pChild = pChild->m_pNext;
}
- return NULL;
+ return nullptr;
}
int32_t CFDE_XMLNode::GetChildNodeIndex(CFDE_XMLNode* pNode) const {
int32_t index = 0;
CFDE_XMLNode* pChild = m_pChild;
- while (pChild != NULL) {
+ while (pChild) {
if (pChild == pNode) {
return index;
}
@@ -122,12 +128,12 @@ int32_t CFDE_XMLNode::GetChildNodeIndex(CFDE_XMLNode* pNode) const {
CFDE_XMLNode* CFDE_XMLNode::GetPath(const FX_WCHAR* pPath,
int32_t iLength,
FX_BOOL bQualifiedName) const {
- ASSERT(pPath != NULL);
+ ASSERT(pPath);
if (iLength < 0) {
iLength = FXSYS_wcslen(pPath);
}
if (iLength == 0) {
- return NULL;
+ return nullptr;
}
CFX_WideString csPath;
const FX_WCHAR* pStart = pPath;
@@ -142,7 +148,7 @@ CFDE_XMLNode* CFDE_XMLNode::GetPath(const FX_WCHAR* pPath,
}
}
iLength -= pStart - pPath;
- CFDE_XMLNode* pFind = NULL;
+ CFDE_XMLNode* pFind = nullptr;
if (csPath.GetLength() < 1) {
pFind = GetNodeItem(CFDE_XMLNode::Root);
} else if (csPath.Compare(L"..") == 0) {
@@ -152,7 +158,7 @@ CFDE_XMLNode* CFDE_XMLNode::GetPath(const FX_WCHAR* pPath,
} else {
CFX_WideString wsTag;
CFDE_XMLNode* pNode = m_pChild;
- while (pNode != NULL) {
+ while (pNode) {
if (pNode->GetType() == FDE_XMLNODE_Element) {
if (bQualifiedName) {
((CFDE_XMLElement*)pNode)->GetTagName(wsTag);
@@ -165,66 +171,63 @@ CFDE_XMLNode* CFDE_XMLNode::GetPath(const FX_WCHAR* pPath,
} else {
pFind = pNode->GetPath(pStart, iLength, bQualifiedName);
}
- if (pFind != NULL) {
+ if (pFind)
return pFind;
- }
}
}
pNode = pNode->m_pNext;
}
}
- if (pFind == NULL || iLength < 1) {
+ if (!pFind || iLength < 1)
return pFind;
- }
return pFind->GetPath(pStart, iLength, bQualifiedName);
}
int32_t CFDE_XMLNode::InsertChildNode(CFDE_XMLNode* pNode, int32_t index) {
- ASSERT(pNode != NULL);
pNode->m_pParent = this;
- if (m_pChild == NULL) {
+ if (!m_pChild) {
m_pChild = pNode;
- pNode->m_pPrior = NULL;
- pNode->m_pNext = NULL;
+ pNode->m_pPrior = nullptr;
+ pNode->m_pNext = nullptr;
return 0;
- } else if (index == 0) {
+ }
+ if (index == 0) {
pNode->m_pNext = m_pChild;
- pNode->m_pPrior = NULL;
+ pNode->m_pPrior = nullptr;
m_pChild->m_pPrior = pNode;
m_pChild = pNode;
return 0;
}
int32_t iCount = 0;
CFDE_XMLNode* pFind = m_pChild;
- while (++iCount != index && pFind->m_pNext != NULL) {
+ while (++iCount != index && pFind->m_pNext) {
pFind = pFind->m_pNext;
}
pNode->m_pPrior = pFind;
pNode->m_pNext = pFind->m_pNext;
- if (pFind->m_pNext != NULL) {
+ if (pFind->m_pNext)
pFind->m_pNext->m_pPrior = pNode;
- }
pFind->m_pNext = pNode;
return iCount;
}
void CFDE_XMLNode::RemoveChildNode(CFDE_XMLNode* pNode) {
- ASSERT(m_pChild != NULL && pNode != NULL);
+ ASSERT(m_pChild && pNode);
if (m_pChild == pNode) {
m_pChild = pNode->m_pNext;
} else {
pNode->m_pPrior->m_pNext = pNode->m_pNext;
}
- if (pNode->m_pNext != NULL) {
+ if (pNode->m_pNext)
pNode->m_pNext->m_pPrior = pNode->m_pPrior;
- }
- pNode->m_pParent = NULL;
- pNode->m_pNext = NULL;
- pNode->m_pPrior = NULL;
+ pNode->m_pParent = nullptr;
+ pNode->m_pNext = nullptr;
+ pNode->m_pPrior = nullptr;
}
+
CFDE_XMLNode* CFDE_XMLNode::GetNodeItem(CFDE_XMLNode::NodeItem eItem) const {
switch (eItem) {
case CFDE_XMLNode::Root: {
CFDE_XMLNode* pParent = (CFDE_XMLNode*)this;
- while (pParent->m_pParent != NULL) {
+ while (pParent->m_pParent) {
pParent = pParent->m_pParent;
}
return pParent;
@@ -233,10 +236,10 @@ CFDE_XMLNode* CFDE_XMLNode::GetNodeItem(CFDE_XMLNode::NodeItem eItem) const {
return m_pParent;
case CFDE_XMLNode::FirstSibling: {
CFDE_XMLNode* pItem = (CFDE_XMLNode*)this;
- while (pItem->m_pPrior != NULL) {
+ while (pItem->m_pPrior) {
pItem = pItem->m_pPrior;
}
- return pItem == (CFDE_XMLNode*)this ? NULL : pItem;
+ return pItem == (CFDE_XMLNode*)this ? nullptr : pItem;
}
case CFDE_XMLNode::PriorSibling:
return m_pPrior;
@@ -244,91 +247,84 @@ CFDE_XMLNode* CFDE_XMLNode::GetNodeItem(CFDE_XMLNode::NodeItem eItem) const {
return m_pNext;
case CFDE_XMLNode::LastSibling: {
CFDE_XMLNode* pItem = (CFDE_XMLNode*)this;
- while (pItem->m_pNext != NULL) {
+ while (pItem->m_pNext)
pItem = pItem->m_pNext;
- }
- return pItem == (CFDE_XMLNode*)this ? NULL : pItem;
+ return pItem == (CFDE_XMLNode*)this ? nullptr : pItem;
}
case CFDE_XMLNode::FirstNeighbor: {
CFDE_XMLNode* pParent = (CFDE_XMLNode*)this;
- while (pParent->m_pParent != NULL) {
+ while (pParent->m_pParent)
pParent = pParent->m_pParent;
- }
- return pParent == (CFDE_XMLNode*)this ? NULL : pParent;
+ return pParent == (CFDE_XMLNode*)this ? nullptr : pParent;
}
case CFDE_XMLNode::PriorNeighbor: {
- if (m_pPrior == NULL) {
+ if (!m_pPrior)
return m_pParent;
- }
+
CFDE_XMLNode* pItem = m_pPrior;
- while (CFDE_XMLNode* pTemp = pItem->m_pChild) {
- pItem = pTemp;
- while ((pTemp = pItem->m_pNext) != NULL) {
- pItem = pTemp;
- }
+ while (pItem->m_pChild) {
+ pItem = pItem->m_pChild;
+ while (pItem->m_pNext)
+ pItem = pItem->m_pNext;
}
return pItem;
}
case CFDE_XMLNode::NextNeighbor: {
- if (m_pChild != NULL) {
+ if (m_pChild)
return m_pChild;
- }
- if (m_pNext != NULL) {
+ if (m_pNext)
return m_pNext;
- }
CFDE_XMLNode* pItem = m_pParent;
- while (pItem != NULL) {
- if (pItem->m_pNext != NULL) {
+ while (pItem) {
+ if (pItem->m_pNext)
return pItem->m_pNext;
- }
pItem = pItem->m_pParent;
}
- return NULL;
+ return nullptr;
}
case CFDE_XMLNode::LastNeighbor: {
CFDE_XMLNode* pItem = (CFDE_XMLNode*)this;
- while (pItem->m_pParent != NULL) {
+ while (pItem->m_pParent) {
pItem = pItem->m_pParent;
}
while (TRUE) {
- while (pItem->m_pNext != NULL) {
+ while (pItem->m_pNext)
pItem = pItem->m_pNext;
- }
- if (pItem->m_pChild == NULL) {
+ if (!pItem->m_pChild)
break;
- }
pItem = pItem->m_pChild;
}
- return pItem == (CFDE_XMLNode*)this ? NULL : pItem;
+ return pItem == (CFDE_XMLNode*)this ? nullptr : pItem;
}
case CFDE_XMLNode::FirstChild:
return m_pChild;
case CFDE_XMLNode::LastChild: {
- if (m_pChild == NULL) {
- return NULL;
- }
+ if (!m_pChild)
+ return nullptr;
+
CFDE_XMLNode* pChild = m_pChild;
- while (pChild->m_pNext != NULL) {
+ while (pChild->m_pNext)
pChild = pChild->m_pNext;
- }
return pChild;
}
default:
break;
}
- return NULL;
+ return nullptr;
}
+
int32_t CFDE_XMLNode::GetNodeLevel() const {
int32_t iLevel = 0;
- CFDE_XMLNode* pItem = (CFDE_XMLNode*)this;
- while ((pItem = pItem->m_pParent) != NULL) {
+ const CFDE_XMLNode* pItem = m_pParent;
+ while (pItem) {
iLevel++;
+ pItem = pItem->m_pParent;
}
return iLevel;
}
+
FX_BOOL CFDE_XMLNode::InsertNodeItem(CFDE_XMLNode::NodeItem eItem,
CFDE_XMLNode* pNode) {
- ASSERT(pNode != NULL);
switch (eItem) {
case CFDE_XMLNode::NextSibling: {
pNode->m_pParent = m_pParent;
@@ -357,7 +353,7 @@ FX_BOOL CFDE_XMLNode::InsertNodeItem(CFDE_XMLNode::NodeItem eItem,
}
}
CFDE_XMLNode* CFDE_XMLNode::RemoveNodeItem(CFDE_XMLNode::NodeItem eItem) {
- CFDE_XMLNode* pNode = NULL;
+ CFDE_XMLNode* pNode = nullptr;
switch (eItem) {
case CFDE_XMLNode::NextSibling:
if (m_pNext) {
@@ -366,9 +362,9 @@ CFDE_XMLNode* CFDE_XMLNode::RemoveNodeItem(CFDE_XMLNode::NodeItem eItem) {
if (m_pNext) {
m_pNext->m_pPrior = this;
}
- pNode->m_pParent = NULL;
- pNode->m_pNext = NULL;
- pNode->m_pPrior = NULL;
+ pNode->m_pParent = nullptr;
+ pNode->m_pNext = nullptr;
+ pNode->m_pPrior = nullptr;
}
break;
default:
@@ -377,11 +373,10 @@ CFDE_XMLNode* CFDE_XMLNode::RemoveNodeItem(CFDE_XMLNode::NodeItem eItem) {
return pNode;
}
CFDE_XMLNode* CFDE_XMLNode::Clone(FX_BOOL bRecursive) {
- return NULL;
+ return nullptr;
}
void CFDE_XMLNode::SaveXMLNode(IFX_Stream* pXMLStream) {
CFDE_XMLNode* pNode = (CFDE_XMLNode*)this;
- ASSERT(pXMLStream != NULL && pNode != NULL);
switch (pNode->GetType()) {
case FDE_XMLNODE_Instruction: {
CFX_WideString ws;
@@ -452,22 +447,21 @@ void CFDE_XMLNode::SaveXMLNode(IFX_Stream* pXMLStream) {
ws += L"\"";
pXMLStream->WriteString(ws.c_str(), ws.GetLength());
}
- if (pNode->m_pChild == NULL) {
- ws = L"\n/>";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- } else {
+ if (pNode->m_pChild) {
ws = L"\n>";
pXMLStream->WriteString(ws.c_str(), ws.GetLength());
CFDE_XMLNode* pChild = pNode->m_pChild;
- while (pChild != NULL) {
+ while (pChild) {
pChild->SaveXMLNode(pXMLStream);
pChild = pChild->m_pNext;
}
ws = L"</";
ws += ((CFDE_XMLElement*)pNode)->m_wsTag;
ws += L"\n>";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ } else {
+ ws = L"\n/>";
}
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
} break;
case FDE_XMLNODE_Text: {
CFX_WideString ws = ((CFDE_XMLText*)pNode)->m_wsText;
@@ -645,7 +639,7 @@ CFDE_XMLElement::~CFDE_XMLElement() {
CFDE_XMLNode* CFDE_XMLElement::Clone(FX_BOOL bRecursive) {
CFDE_XMLElement* pClone = new CFDE_XMLElement(m_wsTag);
if (!pClone) {
- return NULL;
+ return nullptr;
}
pClone->m_Attributes.Copy(m_Attributes);
if (bRecursive) {
@@ -653,7 +647,7 @@ CFDE_XMLNode* CFDE_XMLElement::Clone(FX_BOOL bRecursive) {
} else {
CFX_WideString wsText;
CFDE_XMLNode* pChild = m_pChild;
- while (pChild != NULL) {
+ while (pChild) {
switch (pChild->GetType()) {
case FDE_XMLNODE_Text:
wsText += ((CFDE_XMLText*)pChild)->m_wsText;
@@ -695,7 +689,7 @@ void CFDE_XMLElement::GetNamespaceURI(CFX_WideString& wsNamespace) const {
}
wsNamespace.clear();
CFDE_XMLNode* pNode = (CFDE_XMLNode*)this;
- while (pNode != NULL) {
+ while (pNode) {
if (pNode->GetType() != FDE_XMLNODE_Element) {
break;
}
@@ -806,7 +800,7 @@ void CFDE_XMLElement::RemoveAttribute(const FX_WCHAR* pwsAttriName) {
void CFDE_XMLElement::GetTextData(CFX_WideString& wsText) const {
CFX_WideTextBuf buffer;
CFDE_XMLNode* pChild = m_pChild;
- while (pChild != NULL) {
+ while (pChild) {
switch (pChild->GetType()) {
case FDE_XMLNODE_Text:
buffer << ((CFDE_XMLText*)pChild)->m_wsText;
@@ -842,7 +836,7 @@ CFDE_XMLNode* CFDE_XMLCharData::Clone(FX_BOOL bRecursive) {
}
CFDE_XMLDoc::CFDE_XMLDoc()
- : m_pRoot(NULL), m_pSyntaxParser(NULL), m_pXMLParser(NULL) {
+ : m_pRoot(nullptr), m_pSyntaxParser(nullptr), m_pXMLParser(nullptr) {
Reset(TRUE);
CFDE_XMLInstruction* pXML = new CFDE_XMLInstruction(L"xml");
m_pRoot->InsertChildNode(pXML);
@@ -852,38 +846,37 @@ CFDE_XMLDoc::~CFDE_XMLDoc() {
}
void CFDE_XMLDoc::Reset(FX_BOOL bInitRoot) {
m_iStatus = 0;
- m_pStream = NULL;
+ m_pStream = nullptr;
if (bInitRoot) {
- if (m_pRoot == NULL) {
- m_pRoot = new CFDE_XMLNode;
- } else {
+ if (m_pRoot)
m_pRoot->DeleteChildren();
- }
+ else
+ m_pRoot = new CFDE_XMLNode;
} else {
- if (m_pRoot != NULL) {
+ if (m_pRoot) {
m_pRoot->Release();
- m_pRoot = NULL;
+ m_pRoot = nullptr;
}
}
ReleaseParser();
}
void CFDE_XMLDoc::ReleaseParser() {
- if (m_pXMLParser != NULL) {
+ if (m_pXMLParser) {
m_pXMLParser->Release();
- m_pXMLParser = NULL;
+ m_pXMLParser = nullptr;
}
- if (m_pSyntaxParser != NULL) {
+ if (m_pSyntaxParser) {
m_pSyntaxParser->Release();
- m_pSyntaxParser = NULL;
+ m_pSyntaxParser = nullptr;
}
}
FX_BOOL CFDE_XMLDoc::LoadXML(IFX_Stream* pXMLStream,
int32_t iXMLPlaneSize,
int32_t iTextDataSize,
FDE_XMLREADERHANDLER* pHandler) {
- if (pXMLStream == NULL) {
+ if (!pXMLStream)
return FALSE;
- }
+
Reset(TRUE);
iXMLPlaneSize = iXMLPlaneSize / 1024;
if (iXMLPlaneSize < 1) {
@@ -908,30 +901,25 @@ FX_BOOL CFDE_XMLDoc::LoadXML(IFX_Stream* pXMLStream,
m_pStream->SetCodePage(FX_CODEPAGE_UTF8);
}
m_pSyntaxParser = new CFDE_XMLSyntaxParser;
- if (m_pSyntaxParser == NULL) {
- return FALSE;
- }
+
m_pSyntaxParser->Init(m_pStream, iXMLPlaneSize, iTextDataSize);
- if (pHandler == NULL) {
- m_pXMLParser = new CFDE_XMLDOMParser(m_pRoot, m_pSyntaxParser);
- } else {
+ if (pHandler)
m_pXMLParser = new CFDE_XMLSAXParser(pHandler, m_pSyntaxParser);
- }
+ else
+ m_pXMLParser = new CFDE_XMLDOMParser(m_pRoot, m_pSyntaxParser);
return TRUE;
}
FX_BOOL CFDE_XMLDoc::LoadXML(CFDE_XMLParser* pXMLParser) {
- if (pXMLParser == NULL) {
+ if (!pXMLParser)
return FALSE;
- }
+
Reset(TRUE);
m_pXMLParser = pXMLParser;
- return m_pXMLParser != NULL;
+ return !!m_pXMLParser;
}
int32_t CFDE_XMLDoc::DoLoad(IFX_Pause* pPause) {
- if (m_iStatus >= 100) {
+ if (m_iStatus >= 100)
return m_iStatus;
- }
- ASSERT(m_pXMLParser != NULL);
return m_iStatus = m_pXMLParser->DoParser(pPause);
}
void CFDE_XMLDoc::CloseXML() {
@@ -939,7 +927,6 @@ void CFDE_XMLDoc::CloseXML() {
}
void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) {
CFDE_XMLNode* pNode = (CFDE_XMLNode*)pINode;
- ASSERT(pXMLStream != NULL && pNode != NULL);
switch (pNode->GetType()) {
case FDE_XMLNODE_Instruction: {
CFX_WideString ws;
@@ -1010,22 +997,21 @@ void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) {
ws += L"\"";
pXMLStream->WriteString(ws.c_str(), ws.GetLength());
}
- if (pNode->m_pChild == NULL) {
- ws = L"\n/>";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- } else {
+ if (pNode->m_pChild) {
ws = L"\n>";
pXMLStream->WriteString(ws.c_str(), ws.GetLength());
CFDE_XMLNode* pChild = pNode->m_pChild;
- while (pChild != NULL) {
+ while (pChild) {
SaveXMLNode(pXMLStream, static_cast<CFDE_XMLNode*>(pChild));
pChild = pChild->m_pNext;
}
ws = L"</";
ws += ((CFDE_XMLElement*)pNode)->m_wsTag;
ws += L"\n>";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ } else {
+ ws = L"\n/>";
}
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
} break;
case FDE_XMLNODE_Text: {
CFX_WideString ws = ((CFDE_XMLText*)pNode)->m_wsText;
@@ -1049,7 +1035,7 @@ void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) {
}
}
void CFDE_XMLDoc::SaveXML(IFX_Stream* pXMLStream, FX_BOOL bSaveBOM) {
- if (pXMLStream == NULL || pXMLStream == m_pStream) {
+ if (!pXMLStream || pXMLStream == m_pStream) {
m_pStream->Seek(FX_STREAMSEEK_Begin, 0);
pXMLStream = m_pStream;
}
@@ -1065,7 +1051,7 @@ void CFDE_XMLDoc::SaveXML(IFX_Stream* pXMLStream, FX_BOOL bSaveBOM) {
pXMLStream->WriteString(L"\xFEFF", 1);
}
CFDE_XMLNode* pNode = m_pRoot->m_pChild;
- while (pNode != NULL) {
+ while (pNode) {
SaveXMLNode(pXMLStream, static_cast<CFDE_XMLNode*>(pNode));
pNode = pNode->m_pNext;
}
@@ -1078,7 +1064,7 @@ CFDE_XMLDOMParser::CFDE_XMLDOMParser(CFDE_XMLNode* pRoot,
CFDE_XMLSyntaxParser* pParser)
: m_pParser(pParser),
m_pParent(pRoot),
- m_pChild(NULL),
+ m_pChild(nullptr),
m_NodeStack(16),
m_ws1(),
m_ws2() {
@@ -1145,7 +1131,7 @@ int32_t CFDE_XMLDOMParser::DoParser(IFX_Pause* pPause) {
m_pParser->GetAttributeName(m_ws1);
break;
case FDE_XmlSyntaxResult::AttriValue:
- if (m_pChild == NULL) {
+ if (!m_pChild) {
syntaxParserResult = FDE_XmlSyntaxResult::Error;
break;
}
@@ -1170,8 +1156,7 @@ int32_t CFDE_XMLDOMParser::DoParser(IFX_Pause* pPause) {
m_pChild = m_pParent;
break;
case FDE_XmlSyntaxResult::TargetData:
- if (m_pChild == NULL ||
- m_pChild->GetType() != FDE_XMLNODE_Instruction) {
+ if (!m_pChild || m_pChild->GetType() != FDE_XMLNODE_Instruction) {
syntaxParserResult = FDE_XmlSyntaxResult::Error;
break;
}
@@ -1189,18 +1174,18 @@ int32_t CFDE_XMLDOMParser::DoParser(IFX_Pause* pPause) {
syntaxParserResult == FDE_XmlSyntaxResult::EndOfString) {
break;
}
- if (pPause != NULL && iCount > 500 && pPause->NeedToPauseNow()) {
+ if (iCount > 500 && pPause && pPause->NeedToPauseNow())
break;
- }
}
return m_pParser->GetStatus();
}
+
CFDE_XMLSAXParser::CFDE_XMLSAXParser(FDE_XMLREADERHANDLER* pHandler,
CFDE_XMLSyntaxParser* pParser)
: m_pHandler(pHandler),
m_pParser(pParser),
m_TagStack(16),
- m_pTagTop(NULL),
+ m_pTagTop(nullptr),
m_ws1(),
m_ws2() {}
CFDE_XMLSAXParser::~CFDE_XMLSAXParser() {
@@ -1215,7 +1200,7 @@ int32_t CFDE_XMLSAXParser::DoParser(IFX_Pause* pPause) {
syntaxParserResult = m_pParser->DoSyntaxParse();
switch (syntaxParserResult) {
case FDE_XmlSyntaxResult::ElementBreak:
- if (m_pTagTop == NULL) {
+ if (!m_pTagTop) {
syntaxParserResult = FDE_XmlSyntaxResult::Error;
break;
}
@@ -1224,7 +1209,7 @@ int32_t CFDE_XMLSAXParser::DoParser(IFX_Pause* pPause) {
}
break;
case FDE_XmlSyntaxResult::ElementClose:
- if (m_pTagTop == NULL || m_pTagTop->eType != FDE_XMLNODE_Element) {
+ if (!m_pTagTop || m_pTagTop->eType != FDE_XMLNODE_Element) {
syntaxParserResult = FDE_XmlSyntaxResult::Error;
break;
}
@@ -1263,7 +1248,7 @@ int32_t CFDE_XMLSAXParser::DoParser(IFX_Pause* pPause) {
break;
case FDE_XmlSyntaxResult::AttriValue:
m_pParser->GetAttributeName(m_ws2);
- if (m_pTagTop == NULL) {
+ if (!m_pTagTop) {
syntaxParserResult = FDE_XmlSyntaxResult::Error;
break;
}
@@ -1292,12 +1277,12 @@ int32_t CFDE_XMLSAXParser::DoParser(IFX_Pause* pPause) {
syntaxParserResult == FDE_XmlSyntaxResult::EndOfString) {
break;
}
- if (pPause != NULL && iCount > 500 && pPause->NeedToPauseNow()) {
+ if (iCount > 500 && pPause && pPause->NeedToPauseNow())
break;
- }
}
return m_pParser->GetStatus();
}
+
inline void CFDE_XMLSAXParser::Push(const CFDE_XMLTAG& xmlTag) {
m_TagStack.Push(xmlTag);
m_pTagTop = m_TagStack.GetTopElement();
@@ -1466,15 +1451,15 @@ CFDE_XMLSyntaxParser::CFDE_XMLSyntaxParser()
void CFDE_XMLSyntaxParser::Init(IFX_Stream* pStream,
int32_t iXMLPlaneSize,
int32_t iTextDataSize) {
- ASSERT(m_pStream == NULL && m_pBuffer == NULL);
- ASSERT(pStream != NULL && iXMLPlaneSize > 0);
+ ASSERT(!m_pStream && !m_pBuffer);
+ ASSERT(pStream && iXMLPlaneSize > 0);
int32_t iStreamLength = pStream->GetLength();
ASSERT(iStreamLength > 0);
m_pStream = pStream;
m_iXMLPlaneSize = std::min(iXMLPlaneSize, iStreamLength);
uint8_t bom[4];
m_iCurrentPos = m_pStream->GetBOM(bom);
- ASSERT(m_pBuffer == NULL);
+ ASSERT(!m_pBuffer);
FX_SAFE_INT32 alloc_size_safe = m_iXMLPlaneSize;
alloc_size_safe += 1; // For NUL.
@@ -1721,17 +1706,17 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
} else {
m_pStart++;
FDE_XMLNODE* pXMLNode = m_XMLNodeStack.GetTopElement();
- if (pXMLNode == NULL) {
+ if (!pXMLNode) {
m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
return m_syntaxParserResult;
}
m_XMLNodeStack.Pop();
pXMLNode = m_XMLNodeStack.GetTopElement();
- if (pXMLNode == NULL) {
+ if (pXMLNode) {
+ m_CurNode = *pXMLNode;
+ } else {
m_CurNode.iNodeNum = -1;
m_CurNode.eNodeType = FDE_XMLNODE_Unknown;
- } else {
- m_CurNode = *pXMLNode;
}
m_iCurrentNodeNum = m_CurNode.iNodeNum;
m_BlockBuffer.Reset();
@@ -1756,17 +1741,17 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
if (!FDE_IsXMLNameChar(ch, m_iDataLength < 1)) {
if (ch == L'>') {
FDE_XMLNODE* pXMLNode = m_XMLNodeStack.GetTopElement();
- if (pXMLNode == NULL) {
+ if (!pXMLNode) {
m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
return m_syntaxParserResult;
}
m_XMLNodeStack.Pop();
pXMLNode = m_XMLNodeStack.GetTopElement();
- if (pXMLNode == NULL) {
+ if (pXMLNode) {
+ m_CurNode = *pXMLNode;
+ } else {
m_CurNode.iNodeNum = -1;
m_CurNode.eNodeType = FDE_XMLNODE_Unknown;
- } else {
- m_CurNode = *pXMLNode;
}
m_iCurrentNodeNum = m_CurNode.iNodeNum;
m_iTextDataLength = m_iDataLength;
@@ -1961,28 +1946,26 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
}
CFDE_XMLSyntaxParser::~CFDE_XMLSyntaxParser() {
- if (m_pCurrentBlock) {
- m_pCurrentBlock = NULL;
- }
+ m_pCurrentBlock = nullptr;
FX_Free(m_pBuffer);
}
int32_t CFDE_XMLSyntaxParser::GetStatus() const {
- if (m_pStream == NULL) {
+ if (!m_pStream)
return -1;
- }
+
int32_t iStreamLength = m_pStream->GetLength();
- if (iStreamLength < 1) {
+ if (iStreamLength < 1)
return 100;
- }
- if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error) {
+
+ if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error)
return -1;
- }
- if (m_syntaxParserResult == FDE_XmlSyntaxResult::EndOfString) {
+
+ if (m_syntaxParserResult == FDE_XmlSyntaxResult::EndOfString)
return 100;
- }
return m_iParsedBytes * 100 / iStreamLength;
}
+
static int32_t FX_GetUTF8EncodeLength(const FX_WCHAR* pSrc, int32_t iSrcLen) {
uint32_t unicode = 0;
int32_t iDstNum = 0;
@@ -2007,9 +1990,9 @@ static int32_t FX_GetUTF8EncodeLength(const FX_WCHAR* pSrc, int32_t iSrcLen) {
return iDstNum;
}
FX_FILESIZE CFDE_XMLSyntaxParser::GetCurrentBinaryPos() const {
- if (m_pStream == NULL) {
+ if (!m_pStream)
return 0;
- }
+
int32_t nSrcLen = m_pStart - m_pBuffer;
int32_t nDstLen = FX_GetUTF8EncodeLength(m_pBuffer, nSrcLen);
return m_iParsedBytes + nDstLen;
diff --git a/xfa/fde/xml/fde_xml_imp.h b/xfa/fde/xml/fde_xml_imp.h
index bad970e5be..5a0931f482 100644
--- a/xfa/fde/xml/fde_xml_imp.h
+++ b/xfa/fde/xml/fde_xml_imp.h
@@ -84,7 +84,7 @@ class CFDE_XMLInstruction : public CFDE_XMLNode {
virtual FX_BOOL HasAttribute(const FX_WCHAR* pwsAttriName) const;
virtual void GetString(const FX_WCHAR* pwsAttriName,
CFX_WideString& wsAttriValue,
- const FX_WCHAR* pwsDefValue = NULL) const;
+ const FX_WCHAR* pwsDefValue = nullptr) const;
virtual void SetString(const CFX_WideString& wsAttriName,
const CFX_WideString& wsAttriValue);
virtual int32_t GetInteger(const FX_WCHAR* pwsAttriName,
@@ -122,7 +122,7 @@ class CFDE_XMLElement : public CFDE_XMLNode {
virtual FX_BOOL HasAttribute(const FX_WCHAR* pwsAttriName) const;
virtual void GetString(const FX_WCHAR* pwsAttriName,
CFX_WideString& wsAttriValue,
- const FX_WCHAR* pwsDefValue = NULL) const;
+ const FX_WCHAR* pwsDefValue = nullptr) const;
virtual void SetString(const CFX_WideString& wsAttriName,
const CFX_WideString& wsAttriValue);
virtual int32_t GetInteger(const FX_WCHAR* pwsAttriName,
@@ -184,12 +184,13 @@ class CFDE_XMLDoc : public CFX_Target {
virtual FX_BOOL LoadXML(IFX_Stream* pXMLStream,
int32_t iXMLPlaneSize = 8192,
int32_t iTextDataSize = 256,
- FDE_XMLREADERHANDLER* pHandler = NULL);
+ FDE_XMLREADERHANDLER* pHandler = nullptr);
virtual FX_BOOL LoadXML(CFDE_XMLParser* pXMLParser);
- virtual int32_t DoLoad(IFX_Pause* pPause = NULL);
+ virtual int32_t DoLoad(IFX_Pause* pPause = nullptr);
virtual void CloseXML();
virtual CFDE_XMLNode* GetRoot() const { return m_pRoot; }
- virtual void SaveXML(IFX_Stream* pXMLStream = NULL, FX_BOOL bSaveBOM = TRUE);
+ virtual void SaveXML(IFX_Stream* pXMLStream = nullptr,
+ FX_BOOL bSaveBOM = TRUE);
virtual void SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pNode);
protected: