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

Unified Diff: xfa/fxfa/parser/xfa_basic_imp.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_basic_imp.h ('k') | xfa/fxfa/parser/xfa_document_datadescription_imp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/parser/xfa_basic_imp.cpp
diff --git a/xfa/fxfa/parser/xfa_basic_imp.cpp b/xfa/fxfa/parser/xfa_basic_imp.cpp
index 86a96bbd63db6e807ce8ee8c4a32090daa288402..4c3b8125478c11c4f24b34aaad7c9cd448fe6e64 100644
--- a/xfa/fxfa/parser/xfa_basic_imp.cpp
+++ b/xfa/fxfa/parser/xfa_basic_imp.cpp
@@ -36,7 +36,7 @@ const XFA_PACKETINFO* XFA_GetPacketByName(const CFX_WideStringC& wsName) {
iStart = iMid + 1;
}
} while (iStart <= iEnd);
- return NULL;
+ return nullptr;
}
const XFA_PACKETINFO* XFA_GetPacketByID(uint32_t dwPacket) {
@@ -52,7 +52,7 @@ const XFA_PACKETINFO* XFA_GetPacketByID(uint32_t dwPacket) {
iStart = iMid + 1;
}
} while (iStart <= iEnd);
- return NULL;
+ return nullptr;
}
const XFA_PACKETINFO* XFA_GetPacketByIndex(XFA_PACKET ePacket) {
@@ -78,7 +78,7 @@ const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName(
iStart = iMid + 1;
}
} while (iStart <= iEnd);
- return NULL;
+ return nullptr;
}
const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByID(XFA_ATTRIBUTEENUM eName) {
return g_XFAEnumData + eName;
@@ -105,7 +105,8 @@ const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName) {
return nullptr;
}
const XFA_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_ATTRIBUTE eName) {
- return (eName < g_iXFAAttributeCount) ? (g_XFAAttributeData + eName) : NULL;
+ return (eName < g_iXFAAttributeCount) ? (g_XFAAttributeData + eName)
+ : nullptr;
}
FX_BOOL XFA_GetAttributeDefaultValue(void*& pValue,
XFA_ELEMENT eElement,
@@ -113,9 +114,9 @@ FX_BOOL XFA_GetAttributeDefaultValue(void*& pValue,
XFA_ATTRIBUTETYPE eType,
uint32_t dwPacket) {
const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttribute);
- if (pInfo == NULL) {
+ if (!pInfo)
return FALSE;
- }
+
if (dwPacket && (dwPacket & pInfo->dwPackets) == 0) {
return FALSE;
}
@@ -150,7 +151,7 @@ CFX_WideStringC XFA_GetAttributeDefaultValue_Cdata(XFA_ELEMENT eElement,
XFA_ATTRIBUTETYPE_Cdata, dwPacket)) {
return (const FX_WCHAR*)pValue;
}
- return NULL;
+ return nullptr;
}
FX_BOOL XFA_GetAttributeDefaultValue_Boolean(XFA_ELEMENT eElement,
XFA_ATTRIBUTE eAttribute,
@@ -192,14 +193,14 @@ const XFA_ELEMENTINFO* XFA_GetElementByName(const CFX_WideStringC& wsName) {
iStart = iMid + 1;
}
} while (iStart <= iEnd);
- return NULL;
+ return nullptr;
}
const XFA_ELEMENTINFO* XFA_GetElementByID(XFA_ELEMENT eName) {
- return (eName < g_iXFAElementCount) ? (g_XFAElementData + eName) : NULL;
+ return (eName < g_iXFAElementCount) ? (g_XFAElementData + eName) : nullptr;
}
const uint16_t* XFA_GetElementChildren(XFA_ELEMENT eElement, int32_t& iCount) {
if (eElement >= g_iXFAElementCount) {
- return NULL;
+ return nullptr;
}
const XFA_ELEMENTHIERARCHY* pElement = g_XFAElementChildrenIndex + eElement;
iCount = pElement->wCount;
@@ -207,7 +208,7 @@ const uint16_t* XFA_GetElementChildren(XFA_ELEMENT eElement, int32_t& iCount) {
}
const uint8_t* XFA_GetElementAttributes(XFA_ELEMENT eElement, int32_t& iCount) {
if (eElement >= g_iXFAElementCount) {
- return NULL;
+ return nullptr;
}
const XFA_ELEMENTHIERARCHY* pElement = g_XFAElementAttributeIndex + eElement;
iCount = pElement->wCount;
@@ -235,7 +236,7 @@ const XFA_ATTRIBUTEINFO* XFA_GetAttributeOfElement(XFA_ELEMENT eElement,
const XFA_PROPERTY* XFA_GetElementProperties(XFA_ELEMENT eElement,
int32_t& iCount) {
if (eElement >= g_iXFAElementCount) {
- return NULL;
+ return nullptr;
}
const XFA_ELEMENTHIERARCHY* pElement = g_XFAElementPropertyIndex + eElement;
iCount = pElement->wCount;
@@ -246,9 +247,9 @@ const XFA_PROPERTY* XFA_GetPropertyOfElement(XFA_ELEMENT eElement,
uint32_t dwPacket) {
int32_t iCount = 0;
const XFA_PROPERTY* pProperty = XFA_GetElementProperties(eElement, iCount);
- if (pProperty == NULL || iCount < 1) {
- return NULL;
- }
+ if (!pProperty || iCount < 1)
+ return nullptr;
+
int32_t iStart = 0, iEnd = iCount - 1, iMid;
do {
iMid = (iStart + iEnd) / 2;
@@ -262,13 +263,13 @@ const XFA_PROPERTY* XFA_GetPropertyOfElement(XFA_ELEMENT eElement,
}
} while (iStart <= iEnd);
if (iStart > iEnd) {
- return NULL;
+ return nullptr;
}
const XFA_ELEMENTINFO* pInfo = XFA_GetElementByID(eProperty);
ASSERT(pInfo);
if (dwPacket == XFA_XDPPACKET_UNKNOWN)
return pProperty + iMid;
- return (dwPacket & pInfo->dwPackets) ? (pProperty + iMid) : NULL;
+ return (dwPacket & pInfo->dwPackets) ? (pProperty + iMid) : nullptr;
}
const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_ELEMENT eElement,
XFA_ATTRIBUTE eAttribute,
@@ -282,7 +283,7 @@ const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_ELEMENT eElement,
if (eType == XFA_ATTRIBUTETYPE_NOTSURE || eType == pAttr->eType) {
return pAttr;
}
- return NULL;
+ return nullptr;
} else {
int32_t iBefore = iMid - 1;
if (iBefore >= 0) {
@@ -292,7 +293,7 @@ const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_ELEMENT eElement,
if (eType == XFA_ATTRIBUTETYPE_NOTSURE || eType == pAttr->eType) {
return pAttr;
}
- return NULL;
+ return nullptr;
}
iBefore--;
if (iBefore < 0) {
@@ -309,7 +310,7 @@ const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_ELEMENT eElement,
if (eType == XFA_ATTRIBUTETYPE_NOTSURE || eType == pAttr->eType) {
return pAttr;
}
- return NULL;
+ return nullptr;
}
iAfter++;
if (iAfter > g_iXFANotsureCount - 1) {
@@ -318,7 +319,7 @@ const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_ELEMENT eElement,
pAttr = g_XFANotsureAttributes + iAfter;
}
}
- return NULL;
+ return nullptr;
}
} else if (eElement < pAttr->eElement) {
iEnd = iMid - 1;
@@ -326,7 +327,7 @@ const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_ELEMENT eElement,
iStart = iMid + 1;
}
} while (iStart <= iEnd);
- return NULL;
+ return nullptr;
}
const XFA_METHODINFO* XFA_GetMethodByName(XFA_ELEMENT eElement,
@@ -358,7 +359,7 @@ const XFA_METHODINFO* XFA_GetMethodByName(XFA_ELEMENT eElement,
} while (iStart <= iEnd);
iElementIndex = scriptIndex->wParentIndex;
}
- return NULL;
+ return nullptr;
}
const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName(
XFA_ELEMENT eElement,
@@ -389,7 +390,7 @@ const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName(
} while (iStart <= iEnd);
iElementIndex = scriptIndex->wParentIndex;
}
- return NULL;
+ return nullptr;
}
void CXFA_Measurement::Set(const CFX_WideStringC& wsMeasure) {
if (wsMeasure.IsEmpty()) {
« no previous file with comments | « xfa/fxfa/parser/xfa_basic_imp.h ('k') | xfa/fxfa/parser/xfa_document_datadescription_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698