mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-10-08 23:12:52 -04:00
newer standards prefer nullptr over NULL - this is most of them but there are others too
This commit is contained in:
@@ -92,7 +92,7 @@ XmlTreeDocument* XmlTreeDocument::createDocument(const char * rootNodeName)
|
||||
doc = xmlNewDoc(BAD_CAST "1.0");
|
||||
DEBUG_FATAL( !doc, ("Attempted to make new xmlDoc but failed") );
|
||||
|
||||
xmlNode * node = xmlNewNode( NULL, BAD_CAST rootNodeName );
|
||||
xmlNode * node = xmlNewNode( nullptr, BAD_CAST rootNodeName );
|
||||
DEBUG_FATAL( !node, ("Attempted to make root node for new xml document, but failed"));
|
||||
xmlDocSetRootElement(doc, node);
|
||||
|
||||
@@ -136,8 +136,8 @@ XmlTreeDocument::XmlTreeDocument(CrcString const &name, xmlDoc *xmlDocument) :
|
||||
m_referenceCount(0),
|
||||
m_track( true )
|
||||
{
|
||||
DEBUG_FATAL(m_xmlDocument == NULL, ("XmlTreeDocument(): tried to construct with a NULL xmlDocument."));
|
||||
WARNING(m_xmlDocument == NULL, ("XmlTreeDocument(): tried to construct with a NULL xmlDocument."));
|
||||
DEBUG_FATAL(m_xmlDocument == nullptr, ("XmlTreeDocument(): tried to construct with a nullptr xmlDocument."));
|
||||
WARNING(m_xmlDocument == nullptr, ("XmlTreeDocument(): tried to construct with a nullptr xmlDocument."));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -148,14 +148,14 @@ m_xmlDocument(xmlDocument),
|
||||
m_referenceCount(0),
|
||||
m_track(false) // documents without names are temporary documents for creation of formatted xml
|
||||
{
|
||||
DEBUG_FATAL(m_xmlDocument == NULL, ("XmlTreeDocument(): tried to construct with a NULL xmlDocument."));
|
||||
DEBUG_FATAL(m_xmlDocument == nullptr, ("XmlTreeDocument(): tried to construct with a nullptr xmlDocument."));
|
||||
}
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
XmlTreeDocument::~XmlTreeDocument()
|
||||
{
|
||||
xmlFreeDoc(m_xmlDocument);
|
||||
m_xmlDocument = NULL;
|
||||
m_xmlDocument = nullptr;
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -61,7 +61,7 @@ void XmlTreeDocumentListNamespace::remove()
|
||||
NamedDocumentMap::iterator const endIt = s_documents.end();
|
||||
for (NamedDocumentMap::iterator it = s_documents.begin(); it != endIt; ++it)
|
||||
{
|
||||
DEBUG_REPORT_LOG(true, ("-- xml tree document name [%s], reference count [%d].\n", it->first ? it->first->getString() : "<null name>", it->second ? it->second->getReferenceCount() : -1));
|
||||
DEBUG_REPORT_LOG(true, ("-- xml tree document name [%s], reference count [%d].\n", it->first ? it->first->getString() : "<nullptr name>", it->second ? it->second->getReferenceCount() : -1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ XmlTreeDocument const *XmlTreeDocumentList::fetch(CrcString const &filename)
|
||||
//-- Handle existing entry.
|
||||
if (haveEntry)
|
||||
{
|
||||
FATAL(!lowerBound->second, ("XmlTreeDocumentList::fetch() found an entry for filename [%s] but the mapped document was NULL.", filename.getString()));
|
||||
FATAL(!lowerBound->second, ("XmlTreeDocumentList::fetch() found an entry for filename [%s] but the mapped document was nullptr.", filename.getString()));
|
||||
|
||||
// Increment reference count and return.
|
||||
lowerBound->second->fetch();
|
||||
@@ -121,7 +121,7 @@ XmlTreeDocument const *XmlTreeDocumentList::fetch(CrcString const &filename)
|
||||
#endif
|
||||
|
||||
xmlDocPtr const xmlDocument = xmlParseMemory(reinterpret_cast<char const *>(fileContents), fileSize);
|
||||
FATAL(!xmlDocument, ("xmlParseMemory() returned NULL when parsing contents of file [%s].", cPathName));
|
||||
FATAL(!xmlDocument, ("xmlParseMemory() returned nullptr when parsing contents of file [%s].", cPathName));
|
||||
|
||||
#ifdef _DEBUG
|
||||
unsigned long const postDomBytesAllocated = MemoryManager::getCurrentNumberOfBytesAllocated();
|
||||
@@ -148,7 +148,7 @@ XmlTreeDocument const *XmlTreeDocumentList::fetch(CrcString const &filename)
|
||||
void XmlTreeDocumentList::stopTracking(XmlTreeDocument const *document)
|
||||
{
|
||||
FATAL(!s_installed, ("XmlTreeDocumentList not installed."));
|
||||
FATAL(!document, ("XmlTreeDocumentList::stopTracking(): null document passed in."));
|
||||
FATAL(!document, ("XmlTreeDocumentList::stopTracking(): nullptr document passed in."));
|
||||
|
||||
//-- Find the map entry for the xml tree document.
|
||||
NamedDocumentMap::iterator const findIt = s_documents.find(&(document->getName()));
|
||||
|
||||
@@ -42,7 +42,7 @@ XmlTreeNode::XmlTreeNode(const std::string &name, const std::string &content) :
|
||||
}
|
||||
|
||||
xmlNode *textNode = xmlNewText(BAD_CAST contentCopy.c_str() );
|
||||
m_treeNode = xmlNewNode(NULL, BAD_CAST nameCopy.c_str());
|
||||
m_treeNode = xmlNewNode(nullptr, BAD_CAST nameCopy.c_str());
|
||||
|
||||
// verify new nodes
|
||||
DEBUG_FATAL(!textNode, ("Failed to create xml text node"));
|
||||
@@ -70,7 +70,7 @@ XmlTreeNode::XmlTreeNode(const std::string &name) :
|
||||
nameCopy = "garbage";
|
||||
}
|
||||
|
||||
m_treeNode = xmlNewNode(NULL, BAD_CAST nameCopy.c_str());
|
||||
m_treeNode = xmlNewNode(nullptr, BAD_CAST nameCopy.c_str());
|
||||
|
||||
// verify new nodes
|
||||
DEBUG_FATAL(!m_treeNode, ("Failed to create new xml tree node"));
|
||||
@@ -80,7 +80,7 @@ XmlTreeNode::XmlTreeNode(const std::string &name) :
|
||||
|
||||
XmlTreeNode XmlTreeNode::addChildNode(const char * name)
|
||||
{
|
||||
DEBUG_FATAL( !m_treeNode, ("Attempted to add child to null xml node"));
|
||||
DEBUG_FATAL( !m_treeNode, ("Attempted to add child to nullptr xml node"));
|
||||
|
||||
XmlTreeNode node(name);
|
||||
if (m_treeNode)
|
||||
@@ -109,7 +109,7 @@ void XmlTreeNode::addChild( const XmlTreeNode& node )
|
||||
|
||||
bool XmlTreeNode::isNull() const
|
||||
{
|
||||
return (m_treeNode == NULL);
|
||||
return (m_treeNode == nullptr);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -140,7 +140,7 @@ void XmlTreeNode::assertIsElement(char const *const elementName) const
|
||||
char const *const nodeName = getName();
|
||||
UNREF(elementName);
|
||||
UNREF(nodeName);
|
||||
DEBUG_FATAL(!isElement(), ("expecting element named [%s], found non-element entity named [%s].", elementName ? elementName : "<null element name>", nodeName));
|
||||
DEBUG_FATAL(!isElement(), ("expecting element named [%s], found non-element entity named [%s].", elementName ? elementName : "<nullptr element name>", nodeName));
|
||||
DEBUG_FATAL(_stricmp(elementName, nodeName), ("expecting element named [%s], found element named [%s] instead.", nodeName));
|
||||
}
|
||||
|
||||
@@ -148,14 +148,14 @@ void XmlTreeNode::assertIsElement(char const *const elementName) const
|
||||
|
||||
char const *XmlTreeNode::getName() const
|
||||
{
|
||||
return (m_treeNode ? reinterpret_cast<char const*>(m_treeNode->name) : "<null tree node>");
|
||||
return (m_treeNode ? reinterpret_cast<char const*>(m_treeNode->name) : "<nullptr tree node>");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
XmlTreeNode XmlTreeNode::getNextSiblingElementNode() const
|
||||
{
|
||||
xmlNode *siblingNode = m_treeNode ? m_treeNode->next : NULL;
|
||||
xmlNode *siblingNode = m_treeNode ? m_treeNode->next : nullptr;
|
||||
while (siblingNode && (siblingNode->type != XML_ELEMENT_NODE))
|
||||
siblingNode = siblingNode->next;
|
||||
|
||||
@@ -166,16 +166,16 @@ XmlTreeNode XmlTreeNode::getNextSiblingElementNode() const
|
||||
|
||||
XmlTreeNode XmlTreeNode::getFirstChildNode() const
|
||||
{
|
||||
return XmlTreeNode(m_treeNode ? m_treeNode->children : NULL);
|
||||
return XmlTreeNode(m_treeNode ? m_treeNode->children : nullptr);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
XmlTreeNode XmlTreeNode::getFirstChildElementNode() const
|
||||
{
|
||||
//-- Check if we have a NULL node.
|
||||
//-- Check if we have a nullptr node.
|
||||
if (!m_treeNode)
|
||||
return XmlTreeNode(NULL);
|
||||
return XmlTreeNode(nullptr);
|
||||
|
||||
//-- Look for the first child node that is an element.
|
||||
xmlNode *childNode = m_treeNode->children;
|
||||
@@ -190,9 +190,9 @@ XmlTreeNode XmlTreeNode::getFirstChildElementNode() const
|
||||
|
||||
XmlTreeNode XmlTreeNode::getFirstChildTextNode() const
|
||||
{
|
||||
//-- Check if we have a NULL node.
|
||||
//-- Check if we have a nullptr node.
|
||||
if (!m_treeNode)
|
||||
return XmlTreeNode(NULL);
|
||||
return XmlTreeNode(nullptr);
|
||||
|
||||
//-- Look for the first child node that is a text node.
|
||||
xmlNode *childNode = m_treeNode->children;
|
||||
@@ -212,18 +212,18 @@ XmlTreeNode XmlTreeNode::getElementAttributeValueNode(char const *attributeName,
|
||||
//-- Validate parameters and preconditions.
|
||||
if (!isElement())
|
||||
{
|
||||
DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): node [%s] is not an element.", m_treeNode ? reinterpret_cast<char const*>(m_treeNode->name) : "<null node>"));
|
||||
return XmlTreeNode(NULL);
|
||||
DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): node [%s] is not an element.", m_treeNode ? reinterpret_cast<char const*>(m_treeNode->name) : "<nullptr node>"));
|
||||
return XmlTreeNode(nullptr);
|
||||
}
|
||||
|
||||
if (!attributeName)
|
||||
{
|
||||
DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): attributeName is NULL."));
|
||||
return XmlTreeNode(NULL);
|
||||
DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): attributeName is nullptr."));
|
||||
return XmlTreeNode(nullptr);
|
||||
}
|
||||
|
||||
//-- Check the attribute nodes for a match on the given name. Ignore case.
|
||||
for (xmlAttr *attributeNode = m_treeNode ? m_treeNode->properties : NULL; attributeNode; attributeNode = attributeNode->next)
|
||||
for (xmlAttr *attributeNode = m_treeNode ? m_treeNode->properties : nullptr; attributeNode; attributeNode = attributeNode->next)
|
||||
{
|
||||
if (!_stricmp(attributeName, reinterpret_cast<char const*>(attributeNode->name)))
|
||||
{
|
||||
@@ -234,7 +234,7 @@ XmlTreeNode XmlTreeNode::getElementAttributeValueNode(char const *attributeName,
|
||||
|
||||
//-- No attribute node matched the attribute name.
|
||||
DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): failed to find attribute [%s] on element node [%s].", attributeName, getName()));
|
||||
return XmlTreeNode(NULL);
|
||||
return XmlTreeNode(nullptr);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -250,7 +250,7 @@ bool XmlTreeNode::getElementAttributeAsBool(char const *attributeName, bool &val
|
||||
char const *const contents = attributeValueNode.getTextValue();
|
||||
if (!contents)
|
||||
{
|
||||
DEBUG_FATAL(!contents, ("contents of attribute [%s] is NULL.", attributeName));
|
||||
DEBUG_FATAL(!contents, ("contents of attribute [%s] is nullptr.", attributeName));
|
||||
return false; //lint !e527 // unreachable // reachable in release.
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ bool XmlTreeNode::getElementAttributeAsFloat(char const *attributeName, float &v
|
||||
char const *const contents = attributeValueNode.getTextValue();
|
||||
if (!contents)
|
||||
{
|
||||
DEBUG_FATAL(!contents, ("contents of attribute [%s] is NULL.", attributeName));
|
||||
DEBUG_FATAL(!contents, ("contents of attribute [%s] is nullptr.", attributeName));
|
||||
return false; //lint !e527 // unreachable // reachable in release.
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ bool XmlTreeNode::getElementAttributeAsInt(char const *attributeName, int &value
|
||||
char const *const contents = attributeValueNode.getTextValue();
|
||||
if (!contents)
|
||||
{
|
||||
DEBUG_FATAL(!contents, ("contents of attribute [%s] is NULL.", attributeName));
|
||||
DEBUG_FATAL(!contents, ("contents of attribute [%s] is nullptr.", attributeName));
|
||||
return false; //lint !e527 // unreachable // reachable in release.
|
||||
}
|
||||
|
||||
@@ -366,12 +366,12 @@ char const *XmlTreeNode::getTextValue() const
|
||||
//-- Ensure we're a text node.
|
||||
if(!node.isText())
|
||||
{
|
||||
DEBUG_FATAL(true, ("node [%s] is not a text node", m_treeNode ? reinterpret_cast<char const*>(m_treeNode->name) : "<null>"));
|
||||
return NULL; //lint !e527 // unreachable // reachable in release.
|
||||
DEBUG_FATAL(true, ("node [%s] is not a text node", m_treeNode ? reinterpret_cast<char const*>(m_treeNode->name) : "<nullptr>"));
|
||||
return nullptr; //lint !e527 // unreachable // reachable in release.
|
||||
}
|
||||
|
||||
//-- Return contents.
|
||||
return node.m_treeNode ? reinterpret_cast<char const*>(node.m_treeNode->content) : NULL;
|
||||
return node.m_treeNode ? reinterpret_cast<char const*>(node.m_treeNode->content) : nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user