From a7c24ca48995cf2bf436156302f96b91bf135409 Mon Sep 17 00:00:00 2001 From: Goraf <22941576+Goraf@users.noreply.github.com> Date: Mon, 13 Nov 2017 15:03:31 +0100 Subject: Code modernize ... * replace 0/NULL with nullptr [using clang-tidy] --- plugins/UserInfoEx/src/ex_import/tinyxml.cpp | 164 +++++++++++++-------------- 1 file changed, 82 insertions(+), 82 deletions(-) (limited to 'plugins/UserInfoEx/src/ex_import/tinyxml.cpp') diff --git a/plugins/UserInfoEx/src/ex_import/tinyxml.cpp b/plugins/UserInfoEx/src/ex_import/tinyxml.cpp index 61342c94fe..be5292e438 100644 --- a/plugins/UserInfoEx/src/ex_import/tinyxml.cpp +++ b/plugins/UserInfoEx/src/ex_import/tinyxml.cpp @@ -148,19 +148,19 @@ TiXmlBase::StringToBuffer::~StringToBuffer() TiXmlNode::TiXmlNode(NodeType _type) : TiXmlBase() { - parent = 0; + parent = nullptr; type = _type; - firstChild = 0; - lastChild = 0; - prev = 0; - next = 0; + firstChild = nullptr; + lastChild = nullptr; + prev = nullptr; + next = nullptr; } TiXmlNode::~TiXmlNode() { TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; + TiXmlNode* temp = nullptr; while (node) { @@ -182,7 +182,7 @@ void TiXmlNode::CopyTo(TiXmlNode* target) const void TiXmlNode::Clear() { TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; + TiXmlNode* temp = nullptr; while (node) { @@ -191,27 +191,27 @@ void TiXmlNode::Clear() delete temp; } - firstChild = 0; - lastChild = 0; + firstChild = nullptr; + lastChild = nullptr; } TiXmlNode* TiXmlNode::LinkEndChild(TiXmlNode* node) { - assert(node->parent == 0 || node->parent == this); - assert(node->GetDocument() == 0 || node->GetDocument() == this->GetDocument()); + assert(node->parent == nullptr || node->parent == this); + assert(node->GetDocument() == nullptr || node->GetDocument() == this->GetDocument()); if (node->Type() == TiXmlNode::DOCUMENT) { delete node; - if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN); - return 0; + if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); + return nullptr; } node->parent = this; node->prev = lastChild; - node->next = 0; + node->next = nullptr; if (lastChild) lastChild->next = node; @@ -227,12 +227,12 @@ TiXmlNode* TiXmlNode::InsertEndChild(const TiXmlNode& addThis) { if (addThis.Type() == TiXmlNode::DOCUMENT) { - if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN); - return 0; + if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); + return nullptr; } TiXmlNode* node = addThis.Clone(); if (!node) - return 0; + return nullptr; return LinkEndChild(node); } @@ -241,17 +241,17 @@ TiXmlNode* TiXmlNode::InsertEndChild(const TiXmlNode& addThis) TiXmlNode* TiXmlNode::InsertBeforeChild(TiXmlNode* beforeThis, const TiXmlNode& addThis) { if (!beforeThis || beforeThis->parent != this) { - return 0; + return nullptr; } if (addThis.Type() == TiXmlNode::DOCUMENT) { - if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN); - return 0; + if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); + return nullptr; } TiXmlNode* node = addThis.Clone(); if (!node) - return 0; + return nullptr; node->parent = this; node->next = beforeThis; @@ -273,17 +273,17 @@ TiXmlNode* TiXmlNode::InsertBeforeChild(TiXmlNode* beforeThis, const TiXmlNode& TiXmlNode* TiXmlNode::InsertAfterChild(TiXmlNode* afterThis, const TiXmlNode& addThis) { if (!afterThis || afterThis->parent != this) { - return 0; + return nullptr; } if (addThis.Type() == TiXmlNode::DOCUMENT) { - if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN); - return 0; + if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); + return nullptr; } TiXmlNode* node = addThis.Clone(); if (!node) - return 0; + return nullptr; node->parent = this; node->prev = afterThis; @@ -305,11 +305,11 @@ TiXmlNode* TiXmlNode::InsertAfterChild(TiXmlNode* afterThis, const TiXmlNode& ad TiXmlNode* TiXmlNode::ReplaceChild(TiXmlNode* replaceThis, const TiXmlNode& withThis) { if (replaceThis->parent != this) - return 0; + return nullptr; TiXmlNode* node = withThis.Clone(); if (!node) - return 0; + return nullptr; node->next = replaceThis->next; node->prev = replaceThis->prev; @@ -360,7 +360,7 @@ const TiXmlNode* TiXmlNode::FirstChild(const char * _value) const if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } @@ -372,7 +372,7 @@ TiXmlNode* TiXmlNode::FirstChild(const char * _value) if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } @@ -384,7 +384,7 @@ const TiXmlNode* TiXmlNode::LastChild(const char * _value) const if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } TiXmlNode* TiXmlNode::LastChild(const char * _value) @@ -395,7 +395,7 @@ TiXmlNode* TiXmlNode::LastChild(const char * _value) if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } const TiXmlNode* TiXmlNode::IterateChildren(const TiXmlNode* previous) const @@ -458,7 +458,7 @@ const TiXmlNode* TiXmlNode::NextSibling(const char * _value) const if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } TiXmlNode* TiXmlNode::NextSibling(const char * _value) @@ -469,7 +469,7 @@ TiXmlNode* TiXmlNode::NextSibling(const char * _value) if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } const TiXmlNode* TiXmlNode::PreviousSibling(const char * _value) const @@ -480,7 +480,7 @@ const TiXmlNode* TiXmlNode::PreviousSibling(const char * _value) const if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } TiXmlNode* TiXmlNode::PreviousSibling(const char * _value) @@ -491,7 +491,7 @@ TiXmlNode* TiXmlNode::PreviousSibling(const char * _value) if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } void TiXmlElement::RemoveAttribute(const char * name) @@ -516,7 +516,7 @@ const TiXmlElement* TiXmlNode::FirstChildElement() const if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } TiXmlElement* TiXmlNode::FirstChildElement() @@ -530,7 +530,7 @@ TiXmlElement* TiXmlNode::FirstChildElement() if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } const TiXmlElement* TiXmlNode::FirstChildElement(const char * _value) const @@ -544,7 +544,7 @@ const TiXmlElement* TiXmlNode::FirstChildElement(const char * _value) const if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } TiXmlElement* TiXmlNode::FirstChildElement(const char * _value) @@ -558,7 +558,7 @@ TiXmlElement* TiXmlNode::FirstChildElement(const char * _value) if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } const TiXmlElement* TiXmlNode::NextSiblingElement() const @@ -572,7 +572,7 @@ const TiXmlElement* TiXmlNode::NextSiblingElement() const if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } TiXmlElement* TiXmlNode::NextSiblingElement() @@ -586,7 +586,7 @@ TiXmlElement* TiXmlNode::NextSiblingElement() if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } const TiXmlElement* TiXmlNode::NextSiblingElement(const char * _value) const @@ -600,7 +600,7 @@ const TiXmlElement* TiXmlNode::NextSiblingElement(const char * _value) const if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } TiXmlElement* TiXmlNode::NextSiblingElement(const char * _value) @@ -614,7 +614,7 @@ TiXmlElement* TiXmlNode::NextSiblingElement(const char * _value) if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } @@ -627,7 +627,7 @@ const TiXmlDocument* TiXmlNode::GetDocument() const if (node->ToDocument()) return node->ToDocument(); } - return 0; + return nullptr; } TiXmlDocument* TiXmlNode::GetDocument() @@ -639,13 +639,13 @@ TiXmlDocument* TiXmlNode::GetDocument() if (node->ToDocument()) return node->ToDocument(); } - return 0; + return nullptr; } TiXmlElement::TiXmlElement (const char * _value) : TiXmlNode(TiXmlNode::ELEMENT) { - firstChild = lastChild = 0; + firstChild = lastChild = nullptr; value = _value; } @@ -663,7 +663,7 @@ TiXmlElement::TiXmlElement(const std::string& _value) TiXmlElement::TiXmlElement(const TiXmlElement& copy) : TiXmlNode(TiXmlNode::ELEMENT) { - firstChild = lastChild = 0; + firstChild = lastChild = nullptr; copy.CopyTo(this); } @@ -701,7 +701,7 @@ const char * TiXmlElement::Attribute(const char * name) const if (node) return node->Value(); - return 0; + return nullptr; } @@ -801,7 +801,7 @@ void TiXmlElement::SetAttribute(const char * cname, const char * cvalue) else { TiXmlDocument* document = GetDocument(); - if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN); + if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); } } @@ -965,7 +965,7 @@ void TiXmlElement::CopyTo(TiXmlElement* target) const // Element class: // Clone the attributes, then clone the children. - const TiXmlAttribute* attribute = 0; + const TiXmlAttribute* attribute = nullptr; for ( attribute = attributeSet.First(); attribute; attribute = attribute->Next()) @@ -973,7 +973,7 @@ void TiXmlElement::CopyTo(TiXmlElement* target) const target->SetAttribute(attribute->Name(), attribute->Value()); } - TiXmlNode* node = 0; + TiXmlNode* node = nullptr; for (node = firstChild; node; node = node->NextSibling()) { target->LinkEndChild(node->Clone()); @@ -985,7 +985,7 @@ TiXmlNode* TiXmlElement::Clone() const { TiXmlElement* clone = new TiXmlElement(Value()); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1001,7 +1001,7 @@ const char* TiXmlElement::GetText() const return childText->Value(); } } - return 0; + return nullptr; } @@ -1120,7 +1120,7 @@ bool TiXmlDocument::LoadFile(const char* filename, TiXmlEncoding encoding) } else { - SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN); + SetError(TIXML_ERROR_OPENING_FILE, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); return false; } } @@ -1129,7 +1129,7 @@ bool TiXmlDocument::LoadFile(FILE* file, TiXmlEncoding encoding) { if (!file) { - SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN); + SetError(TIXML_ERROR_OPENING_FILE, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); return false; } @@ -1146,7 +1146,7 @@ bool TiXmlDocument::LoadFile(FILE* file, TiXmlEncoding encoding) // Strange case, but good to handle up front. if (length == 0) { - SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN); + SetError(TIXML_ERROR_DOCUMENT_EMPTY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); return false; } @@ -1181,7 +1181,7 @@ bool TiXmlDocument::LoadFile(FILE* file, TiXmlEncoding encoding) if (fread(buf, length, 1, file) != 1) { delete [] buf; - SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN); + SetError(TIXML_ERROR_OPENING_FILE, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); return false; } @@ -1229,9 +1229,9 @@ bool TiXmlDocument::LoadFile(FILE* file, TiXmlEncoding encoding) data.append(lastPos, p-lastPos); } delete [] buf; - buf = 0; + buf = nullptr; - Parse(data.c_str(), 0, encoding); + Parse(data.c_str(), nullptr, encoding); if ( Error()) return false; @@ -1278,7 +1278,7 @@ void TiXmlDocument::CopyTo(TiXmlDocument* target) const target->error = error; target->errorDesc = errorDesc.c_str (); - TiXmlNode* node = 0; + TiXmlNode* node = nullptr; for (node = firstChild; node; node = node->NextSibling()) { target->LinkEndChild(node->Clone()); @@ -1290,7 +1290,7 @@ TiXmlNode* TiXmlDocument::Clone() const { TiXmlDocument* clone = new TiXmlDocument(); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1342,7 +1342,7 @@ const TiXmlAttribute* TiXmlAttribute::Next() const // We are using knowledge of the sentinel. The sentinel // have a value or name. if (next->value.empty() && next->name.empty()) - return 0; + return nullptr; return next; } @@ -1351,7 +1351,7 @@ TiXmlAttribute* TiXmlAttribute::Next() // We are using knowledge of the sentinel. The sentinel // have a value or name. if (next->value.empty() && next->name.empty()) - return 0; + return nullptr; return next; } @@ -1360,7 +1360,7 @@ const TiXmlAttribute* TiXmlAttribute::Previous() const // We are using knowledge of the sentinel. The sentinel // have a value or name. if (prev->value.empty() && prev->name.empty()) - return 0; + return nullptr; return prev; } @@ -1369,7 +1369,7 @@ TiXmlAttribute* TiXmlAttribute::Previous() // We are using knowledge of the sentinel. The sentinel // have a value or name. if (prev->value.empty() && prev->name.empty()) - return 0; + return nullptr; return prev; } @@ -1494,7 +1494,7 @@ TiXmlNode* TiXmlComment::Clone() const TiXmlComment* clone = new TiXmlComment(); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1558,11 +1558,11 @@ void TiXmlText::CopyTo(TiXmlText* target) const TiXmlNode* TiXmlText::Clone() const { - TiXmlText* clone = 0; + TiXmlText* clone = nullptr; clone = new TiXmlText(""); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1667,7 +1667,7 @@ TiXmlNode* TiXmlDeclaration::Clone() const TiXmlDeclaration* clone = new TiXmlDeclaration(); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1704,7 +1704,7 @@ TiXmlNode* TiXmlUnknown::Clone() const TiXmlUnknown* clone = new TiXmlUnknown(); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1746,8 +1746,8 @@ void TiXmlAttributeSet::Remove(TiXmlAttribute* removeMe) { node->prev->next = node->next; node->next->prev = node->prev; - node->next = 0; - node->prev = 0; + node->next = nullptr; + node->prev = nullptr; return; } } @@ -1763,7 +1763,7 @@ const TiXmlAttribute* TiXmlAttributeSet::Find(const TIXML_STRING& name) const if (node->name == name) return node; } - return 0; + return nullptr; } TiXmlAttribute* TiXmlAttributeSet::Find(const TIXML_STRING& name) @@ -1775,7 +1775,7 @@ TiXmlAttribute* TiXmlAttributeSet::Find(const TIXML_STRING& name) if (node->name == name) return node; } - return 0; + return nullptr; } #ifdef TIXML_USE_STL @@ -1818,7 +1818,7 @@ TiXmlHandle TiXmlHandle::FirstChild() const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1830,7 +1830,7 @@ TiXmlHandle TiXmlHandle::FirstChild(const char * value) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1842,7 +1842,7 @@ TiXmlHandle TiXmlHandle::FirstChildElement() const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1854,7 +1854,7 @@ TiXmlHandle TiXmlHandle::FirstChildElement(const char * value) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1873,7 +1873,7 @@ TiXmlHandle TiXmlHandle::Child(int count) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1892,7 +1892,7 @@ TiXmlHandle TiXmlHandle::Child(const char* value, int count) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1911,7 +1911,7 @@ TiXmlHandle TiXmlHandle::ChildElement(int count) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1930,5 +1930,5 @@ TiXmlHandle TiXmlHandle::ChildElement(const char* value, int count) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } -- cgit v1.2.3