Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1024)

Unified Diff: xfa/fxfa/parser/xfa_script_nodehelper.cpp

Issue 2031873003: Get rid of NULLs in xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@nullptr_fpdfsdk
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp ('k') | xfa/fxfa/parser/xfa_script_resolveprocessor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/parser/xfa_script_nodehelper.cpp
diff --git a/xfa/fxfa/parser/xfa_script_nodehelper.cpp b/xfa/fxfa/parser/xfa_script_nodehelper.cpp
index 9d699757f92a5f357752741b229f5fee5ebce716..1b60b8bf46e54d34c1c845a9fd93901c8324833e 100644
--- a/xfa/fxfa/parser/xfa_script_nodehelper.cpp
+++ b/xfa/fxfa/parser/xfa_script_nodehelper.cpp
@@ -18,24 +18,24 @@
CXFA_NodeHelper::CXFA_NodeHelper(void)
: m_eLastCreateType(XFA_ELEMENT_DataValue),
- m_pCreateParent(NULL),
+ m_pCreateParent(nullptr),
m_iCreateCount(0),
m_iCreateFlag(XFA_RESOLVENODE_RSTYPE_CreateNodeOne),
m_iCurAllStart(-1),
- m_pAllStartParent(NULL) {}
+ m_pAllStartParent(nullptr) {}
CXFA_NodeHelper::~CXFA_NodeHelper(void) {}
CXFA_Node* CXFA_NodeHelper::XFA_ResolveNodes_GetOneChild(
CXFA_Node* parent,
const FX_WCHAR* pwsName,
FX_BOOL bIsClassName) {
- if (parent == NULL) {
- return NULL;
- }
+ if (!parent)
+ return nullptr;
+
CXFA_NodeArray siblings;
uint32_t uNameHash = FX_HashCode_GetW(CFX_WideStringC(pwsName), false);
XFA_NodeAcc_TraverseAnySiblings(parent, uNameHash, &siblings, bIsClassName);
if (siblings.GetSize() == 0) {
- return NULL;
+ return nullptr;
}
return siblings[0];
}
@@ -53,9 +53,8 @@ int32_t CXFA_NodeHelper::XFA_CountSiblings(CXFA_Node* pNode,
parent->GetClassID(), pNode->GetClassID(), XFA_XDPPACKET_UNKNOWN);
if (!pProperty && eLogicType == XFA_LOGIC_Transparent) {
parent = XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_Transparent);
- if (parent == NULL) {
+ if (!parent)
return 0;
- }
}
if (bIsClassName) {
return XFA_NodeAcc_TraverseSiblings(parent, pNode->GetClassHashCode(),
@@ -70,9 +69,9 @@ int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseAnySiblings(
uint32_t dNameHash,
CXFA_NodeArray* pSiblings,
FX_BOOL bIsClassName) {
- if (parent == NULL || pSiblings == NULL) {
+ if (!parent || !pSiblings)
return 0;
- }
+
int32_t nCount = 0;
int32_t i = 0;
CXFA_NodeArray properties;
@@ -131,9 +130,9 @@ int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseSiblings(CXFA_Node* parent,
XFA_LOGIC_TYPE eLogicType,
FX_BOOL bIsClassName,
FX_BOOL bIsFindProperty) {
- if (parent == NULL || pSiblings == NULL) {
+ if (!parent || !pSiblings)
return 0;
- }
+
int32_t nCount = 0;
int32_t i = 0;
if (bIsFindProperty) {
@@ -204,7 +203,7 @@ CXFA_Node* CXFA_NodeHelper::XFA_ResolveNodes_GetParent(
CXFA_Node* pNode,
XFA_LOGIC_TYPE eLogicType) {
if (!pNode) {
- return NULL;
+ return nullptr;
}
if (eLogicType == XFA_LOGIC_NoTransparent) {
return pNode->GetNodeItem(XFA_NODEITEM_Parent);
@@ -213,9 +212,9 @@ CXFA_Node* CXFA_NodeHelper::XFA_ResolveNodes_GetParent(
CXFA_Node* node = pNode;
while (TRUE) {
parent = XFA_ResolveNodes_GetParent(node);
- if (parent == NULL) {
+ if (!parent)
break;
- }
+
XFA_ELEMENT parentElement = parent->GetClassID();
if ((!parent->IsUnnamed() && parentElement != XFA_ELEMENT_SubformSet) ||
parentElement == XFA_ELEMENT_Variables) {
@@ -231,14 +230,13 @@ int32_t CXFA_NodeHelper::XFA_GetIndex(CXFA_Node* pNode,
FX_BOOL bIsClassIndex) {
CXFA_Node* parent =
XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_NoTransparent);
- if (parent == NULL) {
+ if (!parent)
return 0;
- }
+
if (!bIsProperty && eLogicType == XFA_LOGIC_Transparent) {
parent = XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_Transparent);
- if (parent == NULL) {
+ if (!parent)
return 0;
- }
}
uint32_t dwHashName = pNode->GetNameHash();
if (bIsClassIndex) {
@@ -293,9 +291,9 @@ void CXFA_NodeHelper::XFA_GetNameExpression(CXFA_Node* refNode,
}
FX_BOOL CXFA_NodeHelper::XFA_NodeIsTransparent(CXFA_Node* refNode) {
- if (refNode == NULL) {
+ if (!refNode)
return FALSE;
- }
+
XFA_ELEMENT eRefNode = refNode->GetClassID();
if ((refNode->IsUnnamed() && refNode->IsContainerNode()) ||
eRefNode == XFA_ELEMENT_SubformSet || eRefNode == XFA_ELEMENT_Area ||
@@ -347,9 +345,9 @@ FX_BOOL CXFA_NodeHelper::XFA_ResolveNodes_CreateNode(
CFX_WideString wsCondition,
FX_BOOL bLastNode,
CXFA_ScriptContext* pScriptContext) {
- if (m_pCreateParent == NULL) {
+ if (!m_pCreateParent)
return FALSE;
- }
+
FX_BOOL bIsClassName = FALSE;
FX_BOOL bResult = FALSE;
if (wsName.GetAt(0) == '!') {
@@ -366,9 +364,9 @@ FX_BOOL CXFA_NodeHelper::XFA_ResolveNodes_CreateNode(
}
if (bIsClassName) {
const XFA_ELEMENTINFO* lpElement = XFA_GetElementByName(wsName.AsStringC());
- if (lpElement == NULL) {
+ if (!lpElement)
return FALSE;
- }
+
for (int32_t iIndex = 0; iIndex < m_iCreateCount; iIndex++) {
CXFA_Node* pNewNode =
m_pCreateParent->CreateSamePacketNode(lpElement->eName);
@@ -399,14 +397,14 @@ FX_BOOL CXFA_NodeHelper::XFA_ResolveNodes_CreateNode(
}
}
if (!bResult) {
- m_pCreateParent = NULL;
+ m_pCreateParent = nullptr;
}
return bResult;
}
void CXFA_NodeHelper::XFA_SetCreateNodeType(CXFA_Node* refNode) {
- if (refNode == NULL) {
+ if (!refNode)
return;
- }
+
if (refNode->GetClassID() == XFA_ELEMENT_Subform) {
m_eLastCreateType = XFA_ELEMENT_DataGroup;
} else if (refNode->GetClassID() == XFA_ELEMENT_Field) {
« no previous file with comments | « xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp ('k') | xfa/fxfa/parser/xfa_script_resolveprocessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698