diff options
author | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-11-13 15:03:31 +0100 |
---|---|---|
committer | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-11-13 15:07:33 +0100 |
commit | a7c24ca48995cf2bf436156302f96b91bf135409 (patch) | |
tree | 953835509ff1b778833e78fd7b74b05e05e77c84 /plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp | |
parent | 591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff) |
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp')
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp b/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp index 2c7a65bec9..eb5e97134e 100644 --- a/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp +++ b/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp @@ -303,7 +303,7 @@ void TiXmlParsingData::Stamp(const char* now, TiXmlEncoding encoding) const char* TiXmlBase::SkipWhiteSpace(const char* p, TiXmlEncoding encoding)
{
if (!p || !*p) {
- return 0;
+ return nullptr;
}
if (encoding == TIXML_ENCODING_UTF8) {
while (*p) {
@@ -400,7 +400,7 @@ const char* TiXmlBase::ReadName(const char* p, TIXML_STRING * name, TiXmlEncodin }
return p;
}
- return 0;
+ return nullptr;
}
const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlEncoding encoding)
@@ -417,12 +417,12 @@ const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlE if (*(p + 2) == 'x') {
// Hexadecimal.
- if (!*(p + 3)) return 0;
+ if (!*(p + 3)) return nullptr;
const char* q = p + 3;
q = strchr(q, ';');
- if (!q || !*q) return 0;
+ if (!q || !*q) return nullptr;
delta = q - p;
--q;
@@ -435,19 +435,19 @@ const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlE else if (*q >= 'A' && *q <= 'F')
ucs += mult * (*q - 'A' + 10);
else
- return 0;
+ return nullptr;
mult *= 16;
--q;
}
}
else {
// Decimal.
- if (!*(p + 2)) return 0;
+ if (!*(p + 2)) return nullptr;
const char* q = p + 2;
q = strchr(q, ';');
- if (!q || !*q) return 0;
+ if (!q || !*q) return nullptr;
delta = q - p;
--q;
@@ -456,7 +456,7 @@ const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlE if (*q >= '0' && *q <= '9')
ucs += mult * (*q - '0');
else
- return 0;
+ return nullptr;
mult *= 10;
--q;
}
@@ -646,8 +646,8 @@ const char* TiXmlDocument::Parse(const char* p, TiXmlParsingData* prevData, TiXm // contains nothing but other tags, most of what happens
// here is skipping white space.
if (!p || !*p) {
- SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN);
- return 0;
+ SetError(TIXML_ERROR_DOCUMENT_EMPTY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN);
+ return nullptr;
}
// Note that, for a document, this needs to come
@@ -678,8 +678,8 @@ const char* TiXmlDocument::Parse(const char* p, TiXmlParsingData* prevData, TiXm p = SkipWhiteSpace(p, encoding);
if (!p) {
- SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN);
- return 0;
+ SetError(TIXML_ERROR_DOCUMENT_EMPTY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN);
+ return nullptr;
}
while (p && *p) {
@@ -714,8 +714,8 @@ const char* TiXmlDocument::Parse(const char* p, TiXmlParsingData* prevData, TiXm // Was this empty?
if (!firstChild) {
- SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding);
- return 0;
+ SetError(TIXML_ERROR_DOCUMENT_EMPTY, nullptr, nullptr, encoding);
+ return nullptr;
}
// All is well.
@@ -743,18 +743,18 @@ void TiXmlDocument::SetError(int err, const char* pError, TiXmlParsingData* data TiXmlNode* TiXmlNode::Identify(const char* p, TiXmlEncoding encoding)
{
- TiXmlNode* returnNode = 0;
+ TiXmlNode* returnNode = nullptr;
p = SkipWhiteSpace(p, encoding);
if (!p || !*p || *p != '<') {
- return 0;
+ return nullptr;
}
TiXmlDocument* doc = GetDocument();
p = SkipWhiteSpace(p, encoding);
if (!p || !*p) {
- return 0;
+ return nullptr;
}
// What is this thing?
@@ -815,7 +815,7 @@ TiXmlNode* TiXmlNode::Identify(const char* p, TiXmlEncoding encoding) }
else {
if (doc)
- doc->SetError(TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN);
+ doc->SetError(TIXML_ERROR_OUT_OF_MEMORY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN);
}
return returnNode;
}
@@ -944,8 +944,8 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco TiXmlDocument* document = GetDocument();
if (!p || !*p) {
- if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, 0, 0, encoding);
- return 0;
+ if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, nullptr, nullptr, encoding);
+ return nullptr;
}
if (data) {
@@ -955,7 +955,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco if (*p != '<') {
if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, p, data, encoding);
- return 0;
+ return nullptr;
}
p = SkipWhiteSpace(p + 1, encoding);
@@ -966,7 +966,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco p = ReadName(p, &value, encoding);
if (!p || !*p) {
if (document) document->SetError(TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data, encoding);
- return 0;
+ return nullptr;
}
TIXML_STRING endTag("</");
@@ -980,14 +980,14 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco p = SkipWhiteSpace(p, encoding);
if (!p || !*p) {
if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding);
- return 0;
+ return nullptr;
}
if (*p == '/') {
++p;
// Empty tag.
if (*p != '>') {
if (document) document->SetError(TIXML_ERROR_PARSING_EMPTY, p, data, encoding);
- return 0;
+ return nullptr;
}
return (p + 1);
}
@@ -998,7 +998,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco ++p;
p = ReadValue(p, data, encoding); // Note this is an Element method, and will set the error if one happens.
if (!p || !*p)
- return 0;
+ return nullptr;
// We should find the end tag now
if (StringEqual(p, endTag.c_str(), false, encoding)) {
@@ -1007,7 +1007,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco }
else {
if (document) document->SetError(TIXML_ERROR_READING_END_TAG, p, data, encoding);
- return 0;
+ return nullptr;
}
}
else {
@@ -1015,7 +1015,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco TiXmlAttribute* attrib = new TiXmlAttribute();
if (!attrib) {
if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, pErr, data, encoding);
- return 0;
+ return nullptr;
}
attrib->SetDocument(document);
@@ -1025,7 +1025,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco if (!p || !*p) {
if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding);
delete attrib;
- return 0;
+ return nullptr;
}
// Handle the strange case of double attributes:
@@ -1033,7 +1033,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco if (node) {
node->SetValue(attrib->Value());
delete attrib;
- return 0;
+ return nullptr;
}
attributeSet.Add(attrib);
@@ -1057,8 +1057,8 @@ const char* TiXmlElement::ReadValue(const char* p, TiXmlParsingData* data, TiXml TiXmlText* textNode = new TiXmlText("");
if (!textNode) {
- if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, 0, 0, encoding);
- return 0;
+ if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, nullptr, nullptr, encoding);
+ return nullptr;
}
if (TiXmlBase::IsWhiteSpaceCondensed()) {
@@ -1089,7 +1089,7 @@ const char* TiXmlElement::ReadValue(const char* p, TiXmlParsingData* data, TiXml LinkEndChild(node);
}
else {
- return 0;
+ return nullptr;
}
}
}
@@ -1098,7 +1098,7 @@ const char* TiXmlElement::ReadValue(const char* p, TiXmlParsingData* data, TiXml }
if (!p) {
- if (document) document->SetError(TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0, encoding);
+ if (document) document->SetError(TIXML_ERROR_READING_ELEMENT_VALUE, nullptr, nullptr, encoding);
}
return p;
}
@@ -1137,7 +1137,7 @@ const char* TiXmlUnknown::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco }
if (!p || !*p || *p != '<') {
if (document) document->SetError(TIXML_ERROR_PARSING_UNKNOWN, p, data, encoding);
- return 0;
+ return nullptr;
}
++p;
value = "";
@@ -1148,7 +1148,7 @@ const char* TiXmlUnknown::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco }
if (!p) {
- if (document) document->SetError(TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding);
+ if (document) document->SetError(TIXML_ERROR_PARSING_UNKNOWN, nullptr, nullptr, encoding);
}
if (*p == '>')
return p + 1;
@@ -1196,7 +1196,7 @@ const char* TiXmlComment::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco if (!StringEqual(p, startTag, false, encoding)) {
document->SetError(TIXML_ERROR_PARSING_COMMENT, p, data, encoding);
- return 0;
+ return nullptr;
}
p += mir_strlen(startTag);
p = ReadText(p, &value, false, endTag, false, encoding);
@@ -1207,7 +1207,7 @@ const char* TiXmlComment::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco const char* TiXmlAttribute::Parse(const char* p, TiXmlParsingData* data, TiXmlEncoding encoding)
{
p = SkipWhiteSpace(p, encoding);
- if (!p || !*p) return 0;
+ if (!p || !*p) return nullptr;
// int tabsize = 4;
// if (document)
@@ -1222,19 +1222,19 @@ const char* TiXmlAttribute::Parse(const char* p, TiXmlParsingData* data, TiXmlEn p = ReadName(p, &name, encoding);
if (!p || !*p) {
if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding);
- return 0;
+ return nullptr;
}
p = SkipWhiteSpace(p, encoding);
if (!p || !*p || *p != '=') {
if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding);
- return 0;
+ return nullptr;
}
++p; // skip '='
p = SkipWhiteSpace(p, encoding);
if (!p || !*p) {
if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding);
- return 0;
+ return nullptr;
}
const char* end;
@@ -1265,7 +1265,7 @@ const char* TiXmlAttribute::Parse(const char* p, TiXmlParsingData* data, TiXmlEn // We did not have an opening quote but seem to have a
// closing one. Give up and throw an error.
if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding);
- return 0;
+ return nullptr;
}
value += *p;
++p;
@@ -1332,7 +1332,7 @@ const char* TiXmlText::Parse(const char* p, TiXmlParsingData* data, TiXmlEncodin if (!StringEqual(p, startTag, false, encoding)) {
document->SetError(TIXML_ERROR_PARSING_CDATA, p, data, encoding);
- return 0;
+ return nullptr;
}
p += mir_strlen(startTag);
@@ -1355,7 +1355,7 @@ const char* TiXmlText::Parse(const char* p, TiXmlParsingData* data, TiXmlEncodin p = ReadText(p, &value, ignoreWhite, end, false, encoding);
if (p)
return p - 1; // don't truncate the '<'
- return 0;
+ return nullptr;
}
}
@@ -1387,8 +1387,8 @@ const char* TiXmlDeclaration::Parse(const char* p, TiXmlParsingData* data, TiXml // the stuff in-between.
TiXmlDocument* document = GetDocument();
if (!p || !*p || !StringEqual(p, "<?xml", true, _encoding)) {
- if (document) document->SetError(TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding);
- return 0;
+ if (document) document->SetError(TIXML_ERROR_PARSING_DECLARATION, nullptr, nullptr, _encoding);
+ return nullptr;
}
if (data) {
data->Stamp(p, _encoding);
@@ -1428,7 +1428,7 @@ const char* TiXmlDeclaration::Parse(const char* p, TiXmlParsingData* data, TiXml ++p;
}
}
- return 0;
+ return nullptr;
}
bool TiXmlText::Blank() const
|