chore(XML): modernization: use nullptr instead of 0

This commit is contained in:
Günter Obiltschnig 2024-09-26 09:14:44 +02:00
parent 3b4a8ea6e7
commit ce9c08a2d8
9 changed files with 44 additions and 44 deletions

View File

@ -51,8 +51,8 @@ AbstractContainerNode::~AbstractContainerNode()
{
AbstractNode* pDelNode = pChild;
pChild = pChild->_pNext;
pDelNode->_pNext = 0;
pDelNode->_pParent = 0;
pDelNode->_pNext = nullptr;
pDelNode->_pParent = nullptr;
pDelNode->release();
}
}
@ -89,8 +89,8 @@ Node* AbstractContainerNode::insertBefore(Node* newChild, Node* refChild)
if (this == newChild)
throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);
AbstractNode* pFirst = 0;
AbstractNode* pLast = 0;
AbstractNode* pFirst = nullptr;
AbstractNode* pLast = nullptr;
if (newChild->nodeType() == Node::DOCUMENT_FRAGMENT_NODE)
{
AbstractContainerNode* pFrag = static_cast<AbstractContainerNode*>(newChild);
@ -105,7 +105,7 @@ Node* AbstractContainerNode::insertBefore(Node* newChild, Node* refChild)
}
pLast->_pParent = this;
}
pFrag->_pFirstChild = 0;
pFrag->_pFirstChild = nullptr;
}
else
{
@ -165,8 +165,8 @@ Node* AbstractContainerNode::insertAfterNP(Node* newChild, Node* refChild)
if (this == newChild)
throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);
AbstractNode* pFirst = 0;
AbstractNode* pLast = 0;
AbstractNode* pFirst = nullptr;
AbstractNode* pLast = nullptr;
if (newChild->nodeType() == Node::DOCUMENT_FRAGMENT_NODE)
{
AbstractContainerNode* pFrag = static_cast<AbstractContainerNode*>(newChild);
@ -181,7 +181,7 @@ Node* AbstractContainerNode::insertAfterNP(Node* newChild, Node* refChild)
}
pLast->_pParent = this;
}
pFrag->_pFirstChild = 0;
pFrag->_pFirstChild = nullptr;
}
else
{
@ -259,8 +259,8 @@ Node* AbstractContainerNode::replaceChild(Node* newChild, Node* oldChild)
}
static_cast<AbstractNode*>(newChild)->_pNext = static_cast<AbstractNode*>(oldChild)->_pNext;
static_cast<AbstractNode*>(newChild)->_pParent = this;
_pFirstChild->_pNext = 0;
_pFirstChild->_pParent = 0;
_pFirstChild->_pNext = nullptr;
_pFirstChild->_pParent = nullptr;
_pFirstChild = static_cast<AbstractNode*>(newChild);
if (doEvents)
{
@ -283,8 +283,8 @@ Node* AbstractContainerNode::replaceChild(Node* newChild, Node* oldChild)
}
static_cast<AbstractNode*>(newChild)->_pNext = static_cast<AbstractNode*>(oldChild)->_pNext;
static_cast<AbstractNode*>(newChild)->_pParent = this;
static_cast<AbstractNode*>(oldChild)->_pNext = 0;
static_cast<AbstractNode*>(oldChild)->_pParent = 0;
static_cast<AbstractNode*>(oldChild)->_pNext = nullptr;
static_cast<AbstractNode*>(oldChild)->_pParent = nullptr;
pCur->_pNext = static_cast<AbstractNode*>(newChild);
if (doEvents)
{
@ -315,8 +315,8 @@ Node* AbstractContainerNode::removeChild(Node* oldChild)
static_cast<AbstractNode*>(oldChild)->dispatchNodeRemovedFromDocument();
}
_pFirstChild = _pFirstChild->_pNext;
static_cast<AbstractNode*>(oldChild)->_pNext = 0;
static_cast<AbstractNode*>(oldChild)->_pParent = 0;
static_cast<AbstractNode*>(oldChild)->_pNext = nullptr;
static_cast<AbstractNode*>(oldChild)->_pParent = nullptr;
}
else
{
@ -330,8 +330,8 @@ Node* AbstractContainerNode::removeChild(Node* oldChild)
static_cast<AbstractNode*>(oldChild)->dispatchNodeRemovedFromDocument();
}
pCur->_pNext = pCur->_pNext->_pNext;
static_cast<AbstractNode*>(oldChild)->_pNext = 0;
static_cast<AbstractNode*>(oldChild)->_pParent = 0;
static_cast<AbstractNode*>(oldChild)->_pNext = nullptr;
static_cast<AbstractNode*>(oldChild)->_pParent = nullptr;
}
else throw DOMException(DOMException::NOT_FOUND_ERR);
}
@ -373,7 +373,7 @@ void AbstractContainerNode::dispatchNodeInsertedIntoDocument()
bool AbstractContainerNode::hasChildNodes() const
{
return _pFirstChild != 0;
return _pFirstChild != nullptr;
}
@ -516,7 +516,7 @@ const Node* AbstractContainerNode::findNode(XMLString::const_iterator& it, const
while (it != end && *it != '/' && *it != '[') key += *it++;
XMLString::const_iterator itStart(it);
const Node* pFound = 0;
const Node* pFound = nullptr;
const Node* pElem = findElement(key, pNode->firstChild(), pNSMap);
while (!pFound && pElem)
{

View File

@ -74,9 +74,9 @@ Document* DOMBuilder::parse(const XMLString& uri)
catch (...)
{
_pDocument->release();
_pDocument = 0;
_pParent = 0;
_pPrevious = 0;
_pDocument = nullptr;
_pParent = nullptr;
_pPrevious = nullptr;
throw;
}
_pDocument->resumeEvents();
@ -96,9 +96,9 @@ Document* DOMBuilder::parse(InputSource* pInputSource)
catch (...)
{
_pDocument->release();
_pDocument = 0;
_pParent = 0;
_pPrevious = 0;
_pDocument = nullptr;
_pParent = nullptr;
_pPrevious = nullptr;
throw;
}
_pDocument->resumeEvents();
@ -118,9 +118,9 @@ Document* DOMBuilder::parseMemoryNP(const char* xml, std::size_t size)
catch (...)
{
_pDocument->release();
_pDocument = 0;
_pParent = 0;
_pPrevious = 0;
_pDocument = nullptr;
_pParent = nullptr;
_pPrevious = nullptr;
throw;
}
_pDocument->resumeEvents();
@ -133,7 +133,7 @@ void DOMBuilder::setupParse()
{
_pDocument = new Document(_pNamePool);
_pParent = _pDocument;
_pPrevious = 0;
_pPrevious = nullptr;
_inCDATA = false;
_namespaces = _xmlReader.getFeature(XMLReader::FEATURE_NAMESPACES);
}
@ -197,7 +197,7 @@ void DOMBuilder::startElement(const XMLString& uri, const XMLString& localName,
AutoPtr<Element> pElem = _namespaces ? _pDocument->createElementNS(uri, qname.empty() ? localName : qname) : _pDocument->createElement(qname);
const AttributesImpl& attrs = dynamic_cast<const AttributesImpl&>(attributes);
Attr* pPrevAttr = 0;
Attr* pPrevAttr = nullptr;
for (const auto& attr: attrs)
{
AutoPtr<Attr> pAttr = new Attr(_pDocument, 0, attr.namespaceURI, attr.localName, attr.qname, attr.value, attr.specified);

View File

@ -143,8 +143,8 @@ Attr* Element::removeAttributeNode(Attr* oldAttr)
else throw DOMException(DOMException::NOT_FOUND_ERR);
}
else _pFirstAttr = static_cast<Attr*>(_pFirstAttr->_pNext);
oldAttr->_pNext = 0;
oldAttr->_pParent = 0;
oldAttr->_pNext = nullptr;
oldAttr->_pParent = nullptr;
oldAttr->autoRelease();
return oldAttr;
@ -298,13 +298,13 @@ Attr* Element::setAttributeNodeNS(Attr* newAttr)
bool Element::hasAttribute(const XMLString& name) const
{
return getAttributeNode(name) != 0;
return getAttributeNode(name) != nullptr;
}
bool Element::hasAttributeNS(const XMLString& namespaceURI, const XMLString& localName) const
{
return getAttributeNodeNS(namespaceURI, localName) != 0;
return getAttributeNodeNS(namespaceURI, localName) != nullptr;
}
@ -328,7 +328,7 @@ const XMLString& Element::localName() const
bool Element::hasAttributes() const
{
return _pFirstAttr != 0;
return _pFirstAttr != nullptr;
}

View File

@ -71,7 +71,7 @@ void EventDispatcher::removeEventListener(const XMLString& type, EventListener*
{
if (it->type == type && it->pListener == listener && it->useCapture == useCapture)
{
it->pListener = 0;
it->pListener = nullptr;
}
if (!_inDispatch && !it->pListener)
{

View File

@ -60,7 +60,7 @@ void NodeAppender::appendChild(Node* newChild)
pChild->_pParent = _pParent;
pChild = pChild->_pNext;
}
pFrag->_pFirstChild = 0;
pFrag->_pFirstChild = nullptr;
}
}
else

View File

@ -88,8 +88,8 @@ Node* NodeIterator::previousNode()
void NodeIterator::detach()
{
_pRoot = 0;
_pCurrent = 0;
_pRoot = nullptr;
_pCurrent = nullptr;
}
@ -163,7 +163,7 @@ Node* NodeIterator::previous() const
Node* NodeIterator::last()
{
_pCurrent = _pRoot;
Node* pLast = 0;
Node* pLast = nullptr;
while (_pCurrent)
{
pLast = _pCurrent;

View File

@ -748,8 +748,8 @@ int ParserEngine::handleExternalEntityRef(XML_Parser parser, const XML_Char* con
if (!context && !pThis->_externalParameterEntities) return XML_STATUS_ERROR;
if (context && !pThis->_externalGeneralEntities) return XML_STATUS_ERROR;
InputSource* pInputSource = 0;
EntityResolver* pEntityResolver = 0;
InputSource* pInputSource = nullptr;
EntityResolver* pEntityResolver = nullptr;
EntityResolverImpl defaultResolver;
XMLString sysId(systemId);
@ -798,7 +798,7 @@ int ParserEngine::handleUnknownEncoding(void* encodingHandlerData, const XML_Cha
ParserEngine* pThis = reinterpret_cast<ParserEngine*>(encodingHandlerData);
XMLString encoding(name);
TextEncoding* knownEncoding = 0;
TextEncoding* knownEncoding = nullptr;
EncodingMap::const_iterator it = pThis->_encodings.find(encoding);
if (it != pThis->_encodings.end())

View File

@ -73,7 +73,7 @@ Node* TreeWalker::parentNode()
if (pParent && accept(pParent) == NodeFilter::FILTER_ACCEPT)
_pCurrent = pParent;
else
pParent = 0;
pParent = nullptr;
return pParent;
}

View File

@ -34,7 +34,7 @@ NamePoolTest::~NamePoolTest()
void NamePoolTest::testNamePool()
{
AutoPtr<NamePool> pool = new NamePool;
const Name* pName = 0;
const Name* pName = nullptr;
Name name("pre:local", "http://www.appinf.com");
pName = &pool->insert(name);