diff options
author | Tobias Markmann <tm@ayena.de> | 2016-04-01 12:36:16 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-04-01 15:56:34 (GMT) |
commit | eddd92ed76ae68cb1e202602fd3ebd11b69191a2 (patch) | |
tree | 8d396e5801d77a2f0ee4ab8e4c5093d8cf8118e6 /Swiften/Parser | |
parent | a79db8d446e152b715f435550c2a6e10a36ee532 (diff) | |
download | swift-eddd92ed76ae68cb1e202602fd3ebd11b69191a2.zip swift-eddd92ed76ae68cb1e202602fd3ebd11b69191a2.tar.bz2 |
Modernize code to use C++11 nullptr using clang-tidy
Run 'clang-tidy -fix -checks=modernize-use-nullptr' on all
source code files on OS X. This does not modernize platform
specific code on Linux and Windows
Test-Information:
Code builds and unit tests pass on OS X 10.11.4.
Change-Id: Ic43ffeb1b76c1a933a55af03db3c54977f5f60dd
Diffstat (limited to 'Swiften/Parser')
14 files changed, 27 insertions, 27 deletions
diff --git a/Swiften/Parser/LibXMLParser.cpp b/Swiften/Parser/LibXMLParser.cpp index 62484fa..10de4f8 100644 --- a/Swiften/Parser/LibXMLParser.cpp +++ b/Swiften/Parser/LibXMLParser.cpp @@ -81,7 +81,7 @@ LibXMLParser::LibXMLParser(XMLParserClient* client) : XMLParser(client), p(new P p->handler_.warning = &handleWarning; p->handler_.error = &handleError; - p->context_ = xmlCreatePushParserCtxt(&p->handler_, this, 0, 0, 0); + p->context_ = xmlCreatePushParserCtxt(&p->handler_, this, nullptr, 0, nullptr); xmlCtxtUseOptions(p->context_, XML_PARSE_NOENT); assert(p->context_); } diff --git a/Swiften/Parser/PayloadParserFactoryCollection.cpp b/Swiften/Parser/PayloadParserFactoryCollection.cpp index f1c1c03..4426428 100644 --- a/Swiften/Parser/PayloadParserFactoryCollection.cpp +++ b/Swiften/Parser/PayloadParserFactoryCollection.cpp @@ -14,7 +14,7 @@ namespace Swift { -PayloadParserFactoryCollection::PayloadParserFactoryCollection() : defaultFactory_(NULL) { +PayloadParserFactoryCollection::PayloadParserFactoryCollection() : defaultFactory_(nullptr) { } void PayloadParserFactoryCollection::addFactory(PayloadParserFactory* factory) { diff --git a/Swiften/Parser/PayloadParsers/CommandParser.cpp b/Swiften/Parser/PayloadParsers/CommandParser.cpp index 1d2ddea..bdfeaec 100644 --- a/Swiften/Parser/PayloadParsers/CommandParser.cpp +++ b/Swiften/Parser/PayloadParsers/CommandParser.cpp @@ -13,7 +13,7 @@ namespace Swift { -CommandParser::CommandParser() : level_(TopLevel), inNote_(false), inActions_(false), noteType_(Command::Note::Info), formParser_(0) { +CommandParser::CommandParser() : level_(TopLevel), inNote_(false), inActions_(false), noteType_(Command::Note::Info), formParser_(nullptr) { formParserFactory_ = new FormParserFactory(); } @@ -93,7 +93,7 @@ void CommandParser::handleEndElement(const std::string& element, const std::stri assert(form); getPayloadInternal()->setForm(form); delete formParser_; - formParser_ = 0; + formParser_ = nullptr; } else if (inNote_) { inNote_ = false; diff --git a/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp b/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp index 7dffa88..9b7dec1 100644 --- a/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp +++ b/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp @@ -12,7 +12,7 @@ namespace Swift { -DiscoInfoParser::DiscoInfoParser() : level_(TopLevel), formParser_(NULL) { +DiscoInfoParser::DiscoInfoParser() : level_(TopLevel), formParser_(nullptr) { } void DiscoInfoParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { @@ -47,7 +47,7 @@ void DiscoInfoParser::handleEndElement(const std::string& element, const std::st if (level_ == PayloadLevel && formParser_) { getPayloadInternal()->addExtension(formParser_->getPayloadInternal()); delete formParser_; - formParser_ = NULL; + formParser_ = nullptr; } } diff --git a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp index 0d0c424..d59d9a0 100644 --- a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp +++ b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp @@ -177,7 +177,7 @@ FullPayloadParserFactoryCollection::FullPayloadParserFactoryCollection() { } FullPayloadParserFactoryCollection::~FullPayloadParserFactoryCollection() { - setDefaultFactory(NULL); + setDefaultFactory(nullptr); delete defaultFactory_; foreach(shared_ptr<PayloadParserFactory> factory, factories_) { removeFactory(factory.get()); diff --git a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp index b019626..7fb10af 100644 --- a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp +++ b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp @@ -13,7 +13,7 @@ namespace Swift { -InBandRegistrationPayloadParser::InBandRegistrationPayloadParser() : level(TopLevel), formParser(NULL) { +InBandRegistrationPayloadParser::InBandRegistrationPayloadParser() : level(TopLevel), formParser(nullptr) { formParserFactory = new FormParserFactory(); } @@ -54,7 +54,7 @@ void InBandRegistrationPayloadParser::handleEndElement(const std::string& elemen if (formParser) { getPayloadInternal()->setForm(formParser->getPayloadInternal()); delete formParser; - formParser = NULL; + formParser = nullptr; } else if (element == "registered") { getPayloadInternal()->setRegistered(true); diff --git a/Swiften/Parser/PayloadParsers/RosterParser.cpp b/Swiften/Parser/PayloadParsers/RosterParser.cpp index 0cb47d3..741d026 100644 --- a/Swiften/Parser/PayloadParsers/RosterParser.cpp +++ b/Swiften/Parser/PayloadParsers/RosterParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -12,7 +12,7 @@ namespace Swift { -RosterParser::RosterParser() : level_(TopLevel), inItem_(false), unknownContentParser_(0) { +RosterParser::RosterParser() : level_(TopLevel), inItem_(false), unknownContentParser_(nullptr) { } void RosterParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { @@ -81,7 +81,7 @@ void RosterParser::handleEndElement(const std::string& element, const std::strin unknownContentParser_->handleEndElement(element, ns); currentItem_.addUnknownContent(unknownContentParser_->getResult()); delete unknownContentParser_; - unknownContentParser_ = NULL; + unknownContentParser_ = nullptr; } else if (element == "group") { currentItem_.addGroup(currentText_); diff --git a/Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp b/Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp index 5322b4c..f03310f 100644 --- a/Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp +++ b/Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp @@ -13,7 +13,7 @@ namespace Swift { -SearchPayloadParser::SearchPayloadParser() : level(TopLevel), formParser(NULL) { +SearchPayloadParser::SearchPayloadParser() : level(TopLevel), formParser(nullptr) { formParserFactory = new FormParserFactory(); } @@ -62,7 +62,7 @@ void SearchPayloadParser::handleEndElement(const std::string& element, const std if (formParser) { getPayloadInternal()->setForm(formParser->getPayloadInternal()); delete formParser; - formParser = NULL; + formParser = nullptr; } else if (element == "item") { assert(currentItem); diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp b/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp index 43b8043..b3a8c67 100644 --- a/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp +++ b/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp @@ -10,7 +10,7 @@ namespace Swift { -SecurityLabelParser::SecurityLabelParser() : level_(TopLevel), labelParser_(0) { +SecurityLabelParser::SecurityLabelParser() : level_(TopLevel), labelParser_(nullptr) { } void SecurityLabelParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { @@ -44,7 +44,7 @@ void SecurityLabelParser::handleEndElement(const std::string& element, const std getPayloadInternal()->addEquivalentLabel(labelParser_->getResult()); } delete labelParser_; - labelParser_ = 0; + labelParser_ = nullptr; } } else if (labelParser_ && level_ >= SecurityLabelLevel) { diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp index 0aa4100..024d587 100644 --- a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp +++ b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp @@ -13,7 +13,7 @@ namespace Swift { -SecurityLabelsCatalogParser::SecurityLabelsCatalogParser() : level_(TopLevel), labelParser_(0) { +SecurityLabelsCatalogParser::SecurityLabelsCatalogParser() : level_(TopLevel), labelParser_(nullptr) { labelParserFactory_ = new SecurityLabelParserFactory(); } @@ -55,7 +55,7 @@ void SecurityLabelsCatalogParser::handleEndElement(const std::string& element, c assert(currentLabel); currentItem_->setLabel(currentLabel); delete labelParser_; - labelParser_ = 0; + labelParser_ = nullptr; } else if (level_ == ItemLevel && element == "item" && ns == "urn:xmpp:sec-label:catalog:2") { if (currentItem_) { diff --git a/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp b/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp index 8be93c4..12dace9 100644 --- a/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp +++ b/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -19,7 +19,7 @@ namespace Swift { -StreamInitiationParser::StreamInitiationParser() : level(TopLevel), formParser(0), inFile(false), inFeature(false) { +StreamInitiationParser::StreamInitiationParser() : level(TopLevel), formParser(nullptr), inFile(false), inFeature(false) { formParserFactory = new FormParserFactory(); } @@ -103,7 +103,7 @@ void StreamInitiationParser::handleEndElement(const std::string& element, const } } delete formParser; - formParser = NULL; + formParser = nullptr; } } } diff --git a/Swiften/Parser/PayloadParsers/VCardParser.cpp b/Swiften/Parser/PayloadParsers/VCardParser.cpp index 9f22c23..4c3b240 100644 --- a/Swiften/Parser/PayloadParsers/VCardParser.cpp +++ b/Swiften/Parser/PayloadParsers/VCardParser.cpp @@ -13,7 +13,7 @@ namespace Swift { -VCardParser::VCardParser() : unknownContentParser_(NULL) { +VCardParser::VCardParser() : unknownContentParser_(nullptr) { } void VCardParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { @@ -266,7 +266,7 @@ void VCardParser::handleEndElement(const std::string& element, const std::string if (elementStack_.size() == 2 && unknownContentParser_) { delete unknownContentParser_; - unknownContentParser_ = NULL; + unknownContentParser_ = nullptr; } elementStack_.pop_back(); } diff --git a/Swiften/Parser/UnitTest/PayloadParserFactoryCollectionTest.cpp b/Swiften/Parser/UnitTest/PayloadParserFactoryCollectionTest.cpp index b2279f8..f7234d9 100644 --- a/Swiften/Parser/UnitTest/PayloadParserFactoryCollectionTest.cpp +++ b/Swiften/Parser/UnitTest/PayloadParserFactoryCollectionTest.cpp @@ -95,7 +95,7 @@ class PayloadParserFactoryCollectionTest : public CppUnit::TestFixture virtual bool canParse(const std::string& e, const std::string&, const AttributeMap&) const { return element.empty() ? true : element == e; } - virtual PayloadParser* createPayloadParser() { return NULL; } + virtual PayloadParser* createPayloadParser() { return nullptr; } std::string element; }; }; diff --git a/Swiften/Parser/XMPPParser.cpp b/Swiften/Parser/XMPPParser.cpp index 10083ba..29c02a0 100644 --- a/Swiften/Parser/XMPPParser.cpp +++ b/Swiften/Parser/XMPPParser.cpp @@ -50,11 +50,11 @@ XMPPParser::XMPPParser( XMPPParserClient* client, PayloadParserFactoryCollection* payloadParserFactories, XMLParserFactory* xmlParserFactory) : - xmlParser_(0), + xmlParser_(nullptr), client_(client), payloadParserFactories_(payloadParserFactories), level_(0), - currentElementParser_(0), + currentElementParser_(nullptr), parseErrorOccurred_(false) { xmlParser_ = xmlParserFactory->createXMLParser(this); } @@ -109,7 +109,7 @@ void XMPPParser::handleEndElement(const std::string& element, const std::string& if (level_ == StreamLevel) { client_->handleElement(currentElementParser_->getElement()); delete currentElementParser_; - currentElementParser_ = NULL; + currentElementParser_ = nullptr; } } } |