summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-04-01 12:36:16 (GMT)
committerTobias Markmann <tm@ayena.de>2016-04-01 15:56:34 (GMT)
commiteddd92ed76ae68cb1e202602fd3ebd11b69191a2 (patch)
tree8d396e5801d77a2f0ee4ab8e4c5093d8cf8118e6 /Swiften
parenta79db8d446e152b715f435550c2a6e10a36ee532 (diff)
downloadswift-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')
-rw-r--r--Swiften/Avatars/AvatarManagerImpl.h4
-rw-r--r--Swiften/Avatars/VCardAvatarManager.h2
-rw-r--r--Swiften/Avatars/VCardUpdateAvatarManager.h2
-rw-r--r--Swiften/Base/BoostRandomGenerator.cpp2
-rw-r--r--Swiften/Base/ByteArray.h4
-rw-r--r--Swiften/Base/FileSize.cpp2
-rw-r--r--Swiften/Client/Client.cpp4
-rw-r--r--Swiften/Client/Client.h2
-rw-r--r--Swiften/Client/ClientSession.cpp10
-rw-r--r--Swiften/Client/CoreClient.cpp4
-rw-r--r--Swiften/Client/MemoryStorages.cpp6
-rw-r--r--Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp16
-rw-r--r--Swiften/Client/XMLBeautifier.cpp2
-rw-r--r--Swiften/Component/CoreComponent.cpp2
-rw-r--r--Swiften/Crypto/PlatformCryptoProvider.cpp4
-rw-r--r--Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp2
-rw-r--r--Swiften/Examples/SendFile/SendFile.cpp4
-rw-r--r--Swiften/Examples/SendMessage/SendMessage.cpp2
-rw-r--r--Swiften/FileTransfer/FileReadBytestream.cpp6
-rw-r--r--Swiften/FileTransfer/FileWriteBytestream.cpp6
-rw-r--r--Swiften/FileTransfer/IncomingJingleFileTransfer.cpp6
-rw-r--r--Swiften/FileTransfer/IncrementalBytestreamHashCalculator.cpp4
-rw-r--r--Swiften/FileTransfer/JingleFileTransfer.cpp6
-rw-r--r--Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp2
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp4
-rw-r--r--Swiften/FileTransfer/UnitTest/DummyFileTransferTransporterFactory.h2
-rw-r--r--Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp4
-rw-r--r--Swiften/History/SQLiteHistoryStorage.cpp22
-rw-r--r--Swiften/IDN/LibIDNConverter.cpp4
-rw-r--r--Swiften/IDN/PlatformIDNConverter.cpp4
-rw-r--r--Swiften/JID/JID.cpp2
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h4
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp6
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp2
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h8
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h4
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h2
-rw-r--r--Swiften/Network/BoostConnectionServer.cpp8
-rw-r--r--Swiften/Network/BoostIOServiceThread.cpp2
-rw-r--r--Swiften/Network/EnvironmentProxyProvider.cpp6
-rw-r--r--Swiften/Network/MacOSXProxyProvider.cpp18
-rw-r--r--Swiften/Network/MiniUPnPInterface.cpp6
-rw-r--r--Swiften/Network/NATPMPInterface.cpp6
-rw-r--r--Swiften/Network/PlatformNATTraversalWorker.cpp8
-rw-r--r--Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp4
-rw-r--r--Swiften/Network/UnitTest/BOSHConnectionTest.cpp4
-rw-r--r--Swiften/Network/UnixNetworkEnvironment.cpp10
-rw-r--r--Swiften/Network/UnixProxyProvider.cpp8
-rw-r--r--Swiften/Parser/LibXMLParser.cpp2
-rw-r--r--Swiften/Parser/PayloadParserFactoryCollection.cpp2
-rw-r--r--Swiften/Parser/PayloadParsers/CommandParser.cpp4
-rw-r--r--Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp4
-rw-r--r--Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp2
-rw-r--r--Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp4
-rw-r--r--Swiften/Parser/PayloadParsers/RosterParser.cpp6
-rw-r--r--Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp4
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp4
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp4
-rw-r--r--Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp6
-rw-r--r--Swiften/Parser/PayloadParsers/VCardParser.cpp4
-rw-r--r--Swiften/Parser/UnitTest/PayloadParserFactoryCollectionTest.cpp2
-rw-r--r--Swiften/Parser/XMPPParser.cpp6
-rw-r--r--Swiften/QA/ClientTest/ClientTest.cpp2
-rw-r--r--Swiften/Serializer/CompressRequestSerializer.cpp4
-rw-r--r--Swiften/Serializer/GenericStanzaSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializerCollection.cpp2
-rw-r--r--Swiften/Session/BOSHSessionStream.cpp8
-rw-r--r--Swiften/Session/BasicSessionStream.cpp6
-rw-r--r--Swiften/Session/Session.cpp6
-rw-r--r--Swiften/StreamStack/HighLayer.cpp4
-rw-r--r--Swiften/StreamStack/LowLayer.cpp4
-rw-r--r--Swiften/StreamStack/StreamStack.h2
-rw-r--r--Swiften/TLS/PlatformTLSFactories.cpp2
-rw-r--r--Swiften/TLS/SecureTransport/SecureTransportCertificate.mm10
-rw-r--r--Swiften/TLS/SecureTransport/SecureTransportContext.mm20
-rw-r--r--Swiften/TLS/ServerIdentityVerifier.cpp4
-rw-r--r--Swiften/Whiteboard/WhiteboardResponder.cpp2
77 files changed, 202 insertions, 184 deletions
diff --git a/Swiften/Avatars/AvatarManagerImpl.h b/Swiften/Avatars/AvatarManagerImpl.h
index 7176c25..d58e09f 100644
--- a/Swiften/Avatars/AvatarManagerImpl.h
+++ b/Swiften/Avatars/AvatarManagerImpl.h
@@ -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.
*/
@@ -21,7 +21,7 @@ namespace Swift {
class AvatarManagerImpl : public AvatarManager {
public:
- AvatarManagerImpl(VCardManager*, StanzaChannel*, AvatarStorage*, CryptoProvider* crypto, MUCRegistry* = NULL);
+ AvatarManagerImpl(VCardManager*, StanzaChannel*, AvatarStorage*, CryptoProvider* crypto, MUCRegistry* = nullptr);
virtual ~AvatarManagerImpl();
virtual boost::filesystem::path getAvatarPath(const JID&) const;
diff --git a/Swiften/Avatars/VCardAvatarManager.h b/Swiften/Avatars/VCardAvatarManager.h
index 03b3afa..70df6a8 100644
--- a/Swiften/Avatars/VCardAvatarManager.h
+++ b/Swiften/Avatars/VCardAvatarManager.h
@@ -18,7 +18,7 @@ namespace Swift {
class SWIFTEN_API VCardAvatarManager : public AvatarProvider {
public:
- VCardAvatarManager(VCardManager*, AvatarStorage*, CryptoProvider* crypto, MUCRegistry* = NULL);
+ VCardAvatarManager(VCardManager*, AvatarStorage*, CryptoProvider* crypto, MUCRegistry* = nullptr);
boost::optional<std::string> getAvatarHash(const JID&) const;
diff --git a/Swiften/Avatars/VCardUpdateAvatarManager.h b/Swiften/Avatars/VCardUpdateAvatarManager.h
index 07fe011..d66da3a 100644
--- a/Swiften/Avatars/VCardUpdateAvatarManager.h
+++ b/Swiften/Avatars/VCardUpdateAvatarManager.h
@@ -26,7 +26,7 @@ namespace Swift {
class SWIFTEN_API VCardUpdateAvatarManager : public AvatarProvider, public boost::bsignals::trackable {
public:
- VCardUpdateAvatarManager(VCardManager*, StanzaChannel*, AvatarStorage*, CryptoProvider* crypto, MUCRegistry* = NULL);
+ VCardUpdateAvatarManager(VCardManager*, StanzaChannel*, AvatarStorage*, CryptoProvider* crypto, MUCRegistry* = nullptr);
boost::optional<std::string> getAvatarHash(const JID&) const;
diff --git a/Swiften/Base/BoostRandomGenerator.cpp b/Swiften/Base/BoostRandomGenerator.cpp
index 8db3ca6..d893d4d 100644
--- a/Swiften/Base/BoostRandomGenerator.cpp
+++ b/Swiften/Base/BoostRandomGenerator.cpp
@@ -16,7 +16,7 @@ namespace Swift {
BoostRandomGenerator::BoostRandomGenerator() {
// FIXME: Not a good seed
- generator.seed(static_cast<unsigned int>(std::time(0)));
+ generator.seed(static_cast<unsigned int>(std::time(nullptr)));
}
int BoostRandomGenerator::generateRandomInteger(int maximum) {
diff --git a/Swiften/Base/ByteArray.h b/Swiften/Base/ByteArray.h
index c0babdf..b567b5a 100644
--- a/Swiften/Base/ByteArray.h
+++ b/Swiften/Base/ByteArray.h
@@ -33,12 +33,12 @@ namespace Swift {
template<typename T, typename A>
static const T* vecptr(const std::vector<T, A>& v) {
- return v.empty() ? NULL : &v[0];
+ return v.empty() ? nullptr : &v[0];
}
template<typename T, typename A>
static T* vecptr(std::vector<T, A>& v) {
- return v.empty() ? NULL : &v[0];
+ return v.empty() ? nullptr : &v[0];
}
SWIFTEN_API std::string byteArrayToString(const ByteArray& b);
diff --git a/Swiften/Base/FileSize.cpp b/Swiften/Base/FileSize.cpp
index d9ab5ec..a335337 100644
--- a/Swiften/Base/FileSize.cpp
+++ b/Swiften/Base/FileSize.cpp
@@ -11,7 +11,7 @@
namespace Swift {
std::string formatSize(const boost::uintmax_t bytes) {
- static const char *siPrefix[] = {"k", "M", "G", "T", "P", "E", "Z", "Y", NULL};
+ static const char *siPrefix[] = {"k", "M", "G", "T", "P", "E", "Z", "Y", nullptr};
int power = 0;
double engBytes = bytes;
while (engBytes >= 1000) {
diff --git a/Swiften/Client/Client.cpp b/Swiften/Client/Client.cpp
index 89b66b8..48576d4 100644
--- a/Swiften/Client/Client.cpp
+++ b/Swiften/Client/Client.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -72,7 +72,7 @@ Client::Client(const JID& jid, const SafeString& password, NetworkFactories* net
jingleSessionManager = new JingleSessionManager(getIQRouter());
blockListManager = new ClientBlockListManager(getIQRouter());
- whiteboardSessionManager = NULL;
+ whiteboardSessionManager = nullptr;
#ifdef SWIFT_EXPERIMENTAL_WB
whiteboardSessionManager = new WhiteboardSessionManager(getIQRouter(), getStanzaChannel(), presenceOracle, getEntityCapsProvider());
#endif
diff --git a/Swiften/Client/Client.h b/Swiften/Client/Client.h
index a3d11a1..7763745 100644
--- a/Swiften/Client/Client.h
+++ b/Swiften/Client/Client.h
@@ -55,7 +55,7 @@ namespace Swift {
* this is NULL,
* all data will be stored in memory (and be lost on shutdown)
*/
- Client(const JID& jid, const SafeString& password, NetworkFactories* networkFactories, Storages* storages = NULL);
+ Client(const JID& jid, const SafeString& password, NetworkFactories* networkFactories, Storages* storages = nullptr);
virtual ~Client();
diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp
index e38dde8..1b67c96 100644
--- a/Swiften/Client/ClientSession.cpp
+++ b/Swiften/Client/ClientSession.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -73,8 +73,8 @@ ClientSession::ClientSession(
needResourceBind(false),
needAcking(false),
rosterVersioningSupported(false),
- authenticator(NULL),
- certificateTrustChecker(NULL),
+ authenticator(nullptr),
+ certificateTrustChecker(nullptr),
singleSignOn(false),
authenticationPort(-1) {
#ifdef SWIFTEN_PLATFORM_WIN32
@@ -348,7 +348,7 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) {
else {
state = WaitingForStreamStart;
delete authenticator;
- authenticator = NULL;
+ authenticator = nullptr;
stream->resetXMPPParser();
sendStreamHeader();
}
@@ -493,7 +493,7 @@ void ClientSession::finishSession(boost::shared_ptr<Swift::Error> error) {
}
if (authenticator) {
delete authenticator;
- authenticator = NULL;
+ authenticator = nullptr;
}
stream->writeFooter();
stream->close();
diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp
index fd7f894..44fadc6 100644
--- a/Swiften/Client/CoreClient.cpp
+++ b/Swiften/Client/CoreClient.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -31,7 +31,7 @@
namespace Swift {
-CoreClient::CoreClient(const JID& jid, const SafeByteArray& password, NetworkFactories* networkFactories) : jid_(jid), password_(password), networkFactories(networkFactories), disconnectRequested_(false), certificateTrustChecker(NULL) {
+CoreClient::CoreClient(const JID& jid, const SafeByteArray& password, NetworkFactories* networkFactories) : jid_(jid), password_(password), networkFactories(networkFactories), disconnectRequested_(false), certificateTrustChecker(nullptr) {
stanzaChannel_ = new ClientSessionStanzaChannel();
stanzaChannel_->onMessageReceived.connect(boost::bind(&CoreClient::handleMessageReceived, this, _1));
stanzaChannel_->onPresenceReceived.connect(boost::bind(&CoreClient::handlePresenceReceived, this, _1));
diff --git a/Swiften/Client/MemoryStorages.cpp b/Swiften/Client/MemoryStorages.cpp
index 14aa63a..5e52799 100644
--- a/Swiften/Client/MemoryStorages.cpp
+++ b/Swiften/Client/MemoryStorages.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -23,7 +23,7 @@ MemoryStorages::MemoryStorages(CryptoProvider* crypto) {
#ifdef SWIFT_EXPERIMENTAL_HISTORY
historyStorage = new SQLiteHistoryStorage(":memory:");
#else
- historyStorage = NULL;
+ historyStorage = nullptr;
#endif
}
@@ -57,7 +57,7 @@ HistoryStorage* MemoryStorages::getHistoryStorage() const {
#ifdef SWIFT_EXPERIMENTAL_HISTORY
return historyStorage;
#else
- return NULL;
+ return nullptr;
#endif
}
diff --git a/Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp b/Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp
index ef2f537..2f33984 100644
--- a/Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp
+++ b/Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp
@@ -60,9 +60,9 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture {
GenericRequest<BlockPayload>::ref blockRequest = clientBlockListManager_->createBlockJIDRequest(JID("romeo@montague.net"));
blockRequest->send();
IQ::ref request = stanzaChannel_->getStanzaAtIndex<IQ>(2);
- CPPUNIT_ASSERT(request.get() != NULL);
+ CPPUNIT_ASSERT(request.get() != nullptr);
boost::shared_ptr<BlockPayload> blockPayload = request->getPayload<BlockPayload>();
- CPPUNIT_ASSERT(blockPayload.get() != NULL);
+ CPPUNIT_ASSERT(blockPayload.get() != nullptr);
CPPUNIT_ASSERT_EQUAL(JID("romeo@montague.net"), blockPayload->getItems().at(0));
IQ::ref blockRequestResponse = IQ::createResult(request->getFrom(), JID(), request->getID());
@@ -94,9 +94,9 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture {
GenericRequest<UnblockPayload>::ref unblockRequest = clientBlockListManager_->createUnblockJIDRequest(JID("romeo@montague.net"));
unblockRequest->send();
IQ::ref request = stanzaChannel_->getStanzaAtIndex<IQ>(2);
- CPPUNIT_ASSERT(request.get() != NULL);
+ CPPUNIT_ASSERT(request.get() != nullptr);
boost::shared_ptr<UnblockPayload> unblockPayload = request->getPayload<UnblockPayload>();
- CPPUNIT_ASSERT(unblockPayload.get() != NULL);
+ CPPUNIT_ASSERT(unblockPayload.get() != nullptr);
CPPUNIT_ASSERT_EQUAL(JID("romeo@montague.net"), unblockPayload->getItems().at(0));
IQ::ref unblockRequestResponse = IQ::createResult(request->getFrom(), JID(), request->getID());
@@ -129,9 +129,9 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture {
GenericRequest<UnblockPayload>::ref unblockRequest = clientBlockListManager_->createUnblockAllRequest();
unblockRequest->send();
IQ::ref request = stanzaChannel_->getStanzaAtIndex<IQ>(2);
- CPPUNIT_ASSERT(request.get() != NULL);
+ CPPUNIT_ASSERT(request.get() != nullptr);
boost::shared_ptr<UnblockPayload> unblockPayload = request->getPayload<UnblockPayload>();
- CPPUNIT_ASSERT(unblockPayload.get() != NULL);
+ CPPUNIT_ASSERT(unblockPayload.get() != nullptr);
CPPUNIT_ASSERT_EQUAL(true, unblockPayload->getItems().empty());
IQ::ref unblockRequestResponse = IQ::createResult(request->getFrom(), JID(), request->getID());
@@ -162,9 +162,9 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture {
// check for IQ request
IQ::ref request = stanzaChannel_->getStanzaAtIndex<IQ>(0);
- CPPUNIT_ASSERT(request.get() != NULL);
+ CPPUNIT_ASSERT(request.get() != nullptr);
boost::shared_ptr<BlockListPayload> requestPayload = request->getPayload<BlockListPayload>();
- CPPUNIT_ASSERT(requestPayload.get() != NULL);
+ CPPUNIT_ASSERT(requestPayload.get() != nullptr);
CPPUNIT_ASSERT_EQUAL(BlockList::Requesting, blockList->getState());
CPPUNIT_ASSERT_EQUAL(BlockList::Requesting, clientBlockListManager_->getBlockList()->getState());
diff --git a/Swiften/Client/XMLBeautifier.cpp b/Swiften/Client/XMLBeautifier.cpp
index f084bb3..9e9c4c5 100644
--- a/Swiften/Client/XMLBeautifier.cpp
+++ b/Swiften/Client/XMLBeautifier.cpp
@@ -21,7 +21,7 @@
namespace Swift {
-XMLBeautifier::XMLBeautifier(bool indention, bool coloring) : doIndention(indention), doColoring(coloring), intLevel(0), parser(NULL), lastWasStepDown(false) {
+XMLBeautifier::XMLBeautifier(bool indention, bool coloring) : doIndention(indention), doColoring(coloring), intLevel(0), parser(nullptr), lastWasStepDown(false) {
factory = new PlatformXMLParserFactory();
}
diff --git a/Swiften/Component/CoreComponent.cpp b/Swiften/Component/CoreComponent.cpp
index 0b8e01c..ac4f14e 100644
--- a/Swiften/Component/CoreComponent.cpp
+++ b/Swiften/Component/CoreComponent.cpp
@@ -65,7 +65,7 @@ void CoreComponent::handleConnectorFinished(boost::shared_ptr<Connection> connec
connection_ = connection;
assert(!sessionStream_);
- sessionStream_ = boost::shared_ptr<BasicSessionStream>(new BasicSessionStream(ComponentStreamType, connection_, getPayloadParserFactories(), getPayloadSerializers(), NULL, networkFactories->getTimerFactory(), networkFactories->getXMLParserFactory(), TLSOptions()));
+ sessionStream_ = boost::shared_ptr<BasicSessionStream>(new BasicSessionStream(ComponentStreamType, connection_, getPayloadParserFactories(), getPayloadSerializers(), nullptr, networkFactories->getTimerFactory(), networkFactories->getXMLParserFactory(), TLSOptions()));
sessionStream_->onDataRead.connect(boost::bind(&CoreComponent::handleDataRead, this, _1));
sessionStream_->onDataWritten.connect(boost::bind(&CoreComponent::handleDataWritten, this, _1));
diff --git a/Swiften/Crypto/PlatformCryptoProvider.cpp b/Swiften/Crypto/PlatformCryptoProvider.cpp
index d67b284..a72bf8e 100644
--- a/Swiften/Crypto/PlatformCryptoProvider.cpp
+++ b/Swiften/Crypto/PlatformCryptoProvider.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 Isode Limited.
+ * Copyright (c) 2013-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -28,5 +28,5 @@ CryptoProvider* PlatformCryptoProvider::create() {
return new OpenSSLCryptoProvider();
#endif
assert(false);
- return NULL;
+ return nullptr;
}
diff --git a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp
index 50f857c..44a5796 100644
--- a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp
+++ b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp
@@ -25,7 +25,7 @@ enum ExitCodes {OK = 0, CANNOT_CONNECT, CANNOT_AUTH, NO_RESPONSE, DISCO_ERROR};
static SimpleEventLoop eventLoop;
static BoostNetworkFactories networkFactories(&eventLoop);
-static Client* client = 0;
+static Client* client = nullptr;
static JID recipient;
static int exitCode = CANNOT_CONNECT;
static boost::bsignals::connection errorConnection;
diff --git a/Swiften/Examples/SendFile/SendFile.cpp b/Swiften/Examples/SendFile/SendFile.cpp
index bed6512..1b70747 100644
--- a/Swiften/Examples/SendFile/SendFile.cpp
+++ b/Swiften/Examples/SendFile/SendFile.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -39,7 +39,7 @@ static int exitCode = 2;
class FileSender {
public:
- FileSender(const JID& jid, const std::string& password, const JID& recipient, const boost::filesystem::path& file) : jid(jid), password(password), recipient(recipient), file(file), tracer(NULL) {
+ FileSender(const JID& jid, const std::string& password, const JID& recipient, const boost::filesystem::path& file) : jid(jid), password(password), recipient(recipient), file(file), tracer(nullptr) {
client = new Swift::Client(jid, password, &networkFactories);
client->onConnected.connect(boost::bind(&FileSender::handleConnected, this));
client->onDisconnected.connect(boost::bind(&FileSender::handleDisconnected, this, _1));
diff --git a/Swiften/Examples/SendMessage/SendMessage.cpp b/Swiften/Examples/SendMessage/SendMessage.cpp
index 973cda5..9a954f2 100644
--- a/Swiften/Examples/SendMessage/SendMessage.cpp
+++ b/Swiften/Examples/SendMessage/SendMessage.cpp
@@ -22,7 +22,7 @@ using namespace Swift;
static SimpleEventLoop eventLoop;
static BoostNetworkFactories networkFactories(&eventLoop);
-static Client* client = 0;
+static Client* client = nullptr;
static JID recipient;
static std::string messageBody;
static int exitCode = 2;
diff --git a/Swiften/FileTransfer/FileReadBytestream.cpp b/Swiften/FileTransfer/FileReadBytestream.cpp
index 7b7127a..ad9a33b 100644
--- a/Swiften/FileTransfer/FileReadBytestream.cpp
+++ b/Swiften/FileTransfer/FileReadBytestream.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -16,14 +16,14 @@
namespace Swift {
-FileReadBytestream::FileReadBytestream(const boost::filesystem::path& file) : file(file), stream(NULL) {
+FileReadBytestream::FileReadBytestream(const boost::filesystem::path& file) : file(file), stream(nullptr) {
}
FileReadBytestream::~FileReadBytestream() {
if (stream) {
stream->close();
delete stream;
- stream = NULL;
+ stream = nullptr;
}
}
diff --git a/Swiften/FileTransfer/FileWriteBytestream.cpp b/Swiften/FileTransfer/FileWriteBytestream.cpp
index b07f444..e7daa2c 100644
--- a/Swiften/FileTransfer/FileWriteBytestream.cpp
+++ b/Swiften/FileTransfer/FileWriteBytestream.cpp
@@ -13,14 +13,14 @@
namespace Swift {
-FileWriteBytestream::FileWriteBytestream(const boost::filesystem::path& file) : file(file), stream(NULL) {
+FileWriteBytestream::FileWriteBytestream(const boost::filesystem::path& file) : file(file), stream(nullptr) {
}
FileWriteBytestream::~FileWriteBytestream() {
if (stream) {
stream->close();
delete stream;
- stream = NULL;
+ stream = nullptr;
}
}
@@ -45,7 +45,7 @@ void FileWriteBytestream::close() {
if (stream) {
stream->close();
delete stream;
- stream = NULL;
+ stream = nullptr;
}
}
diff --git a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
index 40f952e..526c54c 100644
--- a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
+++ b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
@@ -44,7 +44,7 @@ IncomingJingleFileTransfer::IncomingJingleFileTransfer(
crypto(crypto),
state(Initial),
receivedBytes(0),
- hashCalculator(NULL) {
+ hashCalculator(nullptr) {
description = initialContent->getDescription<JingleFileTransferDescription>();
assert(description);
JingleFileTransferFileInfo fileInfo = description->getFileInfo();
@@ -62,7 +62,7 @@ IncomingJingleFileTransfer::~IncomingJingleFileTransfer() {
}
delete hashCalculator;
- hashCalculator = NULL;
+ hashCalculator = nullptr;
}
void IncomingJingleFileTransfer::accept(
@@ -325,7 +325,7 @@ void IncomingJingleFileTransfer::stopAll() {
if (state != Initial) {
writeStreamDataReceivedConnection.disconnect();
delete hashCalculator;
- hashCalculator = NULL;
+ hashCalculator = nullptr;
}
switch (state) {
case Initial: break;
diff --git a/Swiften/FileTransfer/IncrementalBytestreamHashCalculator.cpp b/Swiften/FileTransfer/IncrementalBytestreamHashCalculator.cpp
index f657192..f177304 100644
--- a/Swiften/FileTransfer/IncrementalBytestreamHashCalculator.cpp
+++ b/Swiften/FileTransfer/IncrementalBytestreamHashCalculator.cpp
@@ -19,8 +19,8 @@
namespace Swift {
IncrementalBytestreamHashCalculator::IncrementalBytestreamHashCalculator(bool doMD5, bool doSHA1, CryptoProvider* crypto) {
- md5Hasher = doMD5 ? crypto->createMD5() : NULL;
- sha1Hasher = doSHA1 ? crypto->createSHA1() : NULL;
+ md5Hasher = doMD5 ? crypto->createMD5() : nullptr;
+ sha1Hasher = doSHA1 ? crypto->createSHA1() : nullptr;
}
IncrementalBytestreamHashCalculator::~IncrementalBytestreamHashCalculator() {
diff --git a/Swiften/FileTransfer/JingleFileTransfer.cpp b/Swiften/FileTransfer/JingleFileTransfer.cpp
index 55296f9..53977ec 100644
--- a/Swiften/FileTransfer/JingleFileTransfer.cpp
+++ b/Swiften/FileTransfer/JingleFileTransfer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015 Isode Limited.
+ * Copyright (c) 2013-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -25,7 +25,7 @@ JingleFileTransfer::JingleFileTransfer(
session(session),
target(target),
transporterFactory(transporterFactory),
- transporter(NULL),
+ transporter(nullptr),
ourCandidateSelectFinished(false),
theirCandidateSelectFinished(false) {
@@ -229,7 +229,7 @@ void JingleFileTransfer::removeTransporter() {
remoteTransportCandidateSelectFinishedConnection.release();
proxyActivatedConnection.release();
delete transporter;
- transporter = NULL;
+ transporter = nullptr;
}
}
diff --git a/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp b/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp
index a5a84eb..c7573c2 100644
--- a/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp
+++ b/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp
@@ -82,7 +82,7 @@ OutgoingJingleFileTransfer::~OutgoingJingleFileTransfer() {
stream->onRead.disconnect(
boost::bind(&IncrementalBytestreamHashCalculator::feedData, hashCalculator, _1));
delete hashCalculator;
- hashCalculator = NULL;
+ hashCalculator = nullptr;
removeTransporter();
}
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp
index 2129815..22a07fd 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp
@@ -43,7 +43,7 @@ SOCKS5BytestreamServerManager::SOCKS5BytestreamServerManager(
networkEnvironment(networkEnvironment),
natTraverser(natTraverser),
state(Start),
- server(NULL),
+ server(nullptr),
attemptedPortMapping_(false) {
}
@@ -199,7 +199,7 @@ void SOCKS5BytestreamServerManager::stop() {
if (server) {
server->stop();
delete server;
- server = NULL;
+ server = nullptr;
}
if (connectionServer) {
connectionServer->stop();
diff --git a/Swiften/FileTransfer/UnitTest/DummyFileTransferTransporterFactory.h b/Swiften/FileTransfer/UnitTest/DummyFileTransferTransporterFactory.h
index 59fc40a..f3972ab 100644
--- a/Swiften/FileTransfer/UnitTest/DummyFileTransferTransporterFactory.h
+++ b/Swiften/FileTransfer/UnitTest/DummyFileTransferTransporterFactory.h
@@ -185,7 +185,7 @@ public:
}
virtual FileTransferTransporter* createResponderTransporter(const JID& /* initiator */, const JID& /* responder */, const std::string& /* s5bSessionID */, const FileTransferOptions& /* options */) {
- return NULL;
+ return nullptr;
}
private:
diff --git a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp
index ceffdb7..9690c09 100644
--- a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp
+++ b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2015 Isode Limited.
+ * Copyright (c) 2015-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -57,7 +57,7 @@ public:
void setUp() {
crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
destination = "092a44d859d19c9eed676b551ee80025903351c2";
- randomGen.seed(static_cast<unsigned int>(time(NULL)));
+ randomGen.seed(static_cast<unsigned int>(time(nullptr)));
eventLoop = new DummyEventLoop();
timerFactory = new DummyTimerFactory();
connection = boost::make_shared<MockeryConnection>(failingPorts, true, eventLoop);
diff --git a/Swiften/History/SQLiteHistoryStorage.cpp b/Swiften/History/SQLiteHistoryStorage.cpp
index beb7ba1..d5ef8ad 100644
--- a/Swiften/History/SQLiteHistoryStorage.cpp
+++ b/Swiften/History/SQLiteHistoryStorage.cpp
@@ -29,7 +29,7 @@ inline std::string getEscapedString(const std::string& s) {
namespace Swift {
-SQLiteHistoryStorage::SQLiteHistoryStorage(const boost::filesystem::path& file) : db_(0) {
+SQLiteHistoryStorage::SQLiteHistoryStorage(const boost::filesystem::path& file) : db_(nullptr) {
thread_ = new boost::thread(boost::bind(&SQLiteHistoryStorage::run, this));
sqlite3_open(pathToString(file).c_str(), &db_);
@@ -38,13 +38,13 @@ SQLiteHistoryStorage::SQLiteHistoryStorage(const boost::filesystem::path& file)
}
char* errorMessage;
- int result = sqlite3_exec(db_, "CREATE TABLE IF NOT EXISTS messages('message' STRING, 'fromBare' INTEGER, 'fromResource' STRING, 'toBare' INTEGER, 'toResource' STRING, 'type' INTEGER, 'time' INTEGER, 'offset' INTEGER)", 0, 0, &errorMessage);
+ int result = sqlite3_exec(db_, "CREATE TABLE IF NOT EXISTS messages('message' STRING, 'fromBare' INTEGER, 'fromResource' STRING, 'toBare' INTEGER, 'toResource' STRING, 'type' INTEGER, 'time' INTEGER, 'offset' INTEGER)", nullptr, nullptr, &errorMessage);
if (result != SQLITE_OK) {
std::cerr << "SQL Error: " << errorMessage << std::endl;
sqlite3_free(errorMessage);
}
- result = sqlite3_exec(db_, "CREATE TABLE IF NOT EXISTS jids('id' INTEGER PRIMARY KEY ASC AUTOINCREMENT, 'jid' STRING UNIQUE NOT NULL)", 0, 0, &errorMessage);
+ result = sqlite3_exec(db_, "CREATE TABLE IF NOT EXISTS jids('id' INTEGER PRIMARY KEY ASC AUTOINCREMENT, 'jid' STRING UNIQUE NOT NULL)", nullptr, nullptr, &errorMessage);
if (result != SQLITE_OK) {
std::cerr << "SQL Error: " << errorMessage << std::endl;
sqlite3_free(errorMessage);
@@ -69,7 +69,7 @@ void SQLiteHistoryStorage::addMessage(const HistoryMessage& message) {
boost::lexical_cast<std::string>(secondsSinceEpoch) + ", " +
boost::lexical_cast<std::string>(message.getOffset()) + ")";
char* errorMessage;
- int result = sqlite3_exec(db_, statement.c_str(), 0, 0, &errorMessage);
+ int result = sqlite3_exec(db_, statement.c_str(), nullptr, nullptr, &errorMessage);
if (result != SQLITE_OK) {
std::cerr << "SQL Error: " << errorMessage << std::endl;
sqlite3_free(errorMessage);
@@ -112,7 +112,7 @@ std::vector<HistoryMessage> SQLiteHistoryStorage::getMessagesFromDate(const JID&
" AND time<" + boost::lexical_cast<std::string>(upperBound) + ")";
}
- int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast<int>(selectQuery.size()), &selectStatement, NULL);
+ int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast<int>(selectQuery.size()), &selectStatement, nullptr);
if (r != SQLITE_OK) {
std::cout << "Error: " << sqlite3_errmsg(db_) << std::endl;
}
@@ -171,7 +171,7 @@ long long SQLiteHistoryStorage::getIDForJID(const JID& jid) {
long long SQLiteHistoryStorage::addJID(const JID& jid) {
std::string statement = std::string("INSERT INTO jids('jid') VALUES('") + getEscapedString(jid.toString()) + "')";
char* errorMessage;
- int result = sqlite3_exec(db_, statement.c_str(), 0, 0, &errorMessage);
+ int result = sqlite3_exec(db_, statement.c_str(), nullptr, nullptr, &errorMessage);
if (result != SQLITE_OK) {
std::cerr << "SQL Error: " << errorMessage << std::endl;
sqlite3_free(errorMessage);
@@ -183,7 +183,7 @@ boost::optional<JID> SQLiteHistoryStorage::getJIDFromID(long long id) const {
boost::optional<JID> result;
sqlite3_stmt* selectStatement;
std::string selectQuery("SELECT jid FROM jids WHERE id=" + boost::lexical_cast<std::string>(id));
- int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast<int>(selectQuery.size()), &selectStatement, NULL);
+ int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast<int>(selectQuery.size()), &selectStatement, nullptr);
if (r != SQLITE_OK) {
std::cout << "Error: " << sqlite3_errmsg(db_) << std::endl;
}
@@ -199,7 +199,7 @@ boost::optional<long long> SQLiteHistoryStorage::getIDFromJID(const JID& jid) co
boost::optional<long long> result;
sqlite3_stmt* selectStatement;
std::string selectQuery("SELECT id FROM jids WHERE jid='" + jid.toString() + "'");
- long long r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast<int>(selectQuery.size()), &selectStatement, NULL);
+ long long r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast<int>(selectQuery.size()), &selectStatement, nullptr);
if (r != SQLITE_OK) {
std::cout << "Error: " << sqlite3_errmsg(db_) << std::endl;
}
@@ -232,7 +232,7 @@ ContactsMap SQLiteHistoryStorage::getContacts(const JID& selfJID, HistoryMessage
query += " AND message LIKE '%" + getEscapedString(keyword) + "%'";
}
- int r = sqlite3_prepare(db_, query.c_str(), boost::numeric_cast<int>(query.size()), &selectStatement, NULL);
+ int r = sqlite3_prepare(db_, query.c_str(), boost::numeric_cast<int>(query.size()), &selectStatement, nullptr);
if (r != SQLITE_OK) {
std::cout << "Error: " << sqlite3_errmsg(db_) << std::endl;
}
@@ -311,7 +311,7 @@ boost::gregorian::date SQLiteHistoryStorage::getNextDateWithLogs(const JID& self
selectQuery += " AND time" + (reverseOrder ? std::string("<") : std::string(">")) + boost::lexical_cast<std::string>(timeStamp);
selectQuery += " ORDER BY time " + (reverseOrder ? std::string("DESC") : std::string("ASC")) + " LIMIT 1";
- int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast<int>(selectQuery.size()), &selectStatement, NULL);
+ int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast<int>(selectQuery.size()), &selectStatement, nullptr);
if (r != SQLITE_OK) {
std::cout << "Error: " << sqlite3_errmsg(db_) << std::endl;
}
@@ -362,7 +362,7 @@ boost::posix_time::ptime SQLiteHistoryStorage::getLastTimeStampFromMUC(const JID
boost::lexical_cast<std::string>(*selfID) + " AND fromBare=" +
boost::lexical_cast<std::string>(*mucID) + ") ORDER BY time DESC LIMIT 1";
- int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast<int>(selectQuery.size()), &selectStatement, NULL);
+ int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast<int>(selectQuery.size()), &selectStatement, nullptr);
if (r != SQLITE_OK) {
std::cout << "Error: " << sqlite3_errmsg(db_) << std::endl;
}
diff --git a/Swiften/IDN/LibIDNConverter.cpp b/Swiften/IDN/LibIDNConverter.cpp
index 334f43b..0823bcc 100644
--- a/Swiften/IDN/LibIDNConverter.cpp
+++ b/Swiften/IDN/LibIDNConverter.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2015 Isode Limited.
+ * Copyright (c) 2012-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -34,7 +34,7 @@ namespace {
case IDNConverter::SASLPrep: return stringprep_saslprep;
}
assert(false);
- return 0;
+ return nullptr;
}
template<typename StringType, typename ContainerType>
diff --git a/Swiften/IDN/PlatformIDNConverter.cpp b/Swiften/IDN/PlatformIDNConverter.cpp
index 041c934..c85d3b6 100644
--- a/Swiften/IDN/PlatformIDNConverter.cpp
+++ b/Swiften/IDN/PlatformIDNConverter.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012 Isode Limited.
+ * Copyright (c) 2012-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -22,7 +22,7 @@ IDNConverter* PlatformIDNConverter::create() {
#if defined(NEED_IDN)
#error "No IDN implementation"
#endif
- return 0;
+ return nullptr;
#endif
}
diff --git a/Swiften/JID/JID.cpp b/Swiften/JID/JID.cpp
index ae08386..b1805df 100644
--- a/Swiften/JID/JID.cpp
+++ b/Swiften/JID/JID.cpp
@@ -43,7 +43,7 @@ static PrepCache resourcePrepCache;
static const std::list<char> escapedChars = boost::assign::list_of(' ')('"')('&')('\'')('/')('<')('>')('@')(':');
-static IDNConverter* idnConverter = NULL;
+static IDNConverter* idnConverter = nullptr;
#ifndef SWIFTEN_JID_NO_DEFAULT_IDN_CONVERTER
namespace {
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h
index 6cfaf22..988f025 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h
@@ -19,10 +19,10 @@ namespace Swift {
public:
BonjourBrowseQuery(boost::shared_ptr<BonjourQuerier> q, EventLoop* eventLoop) : BonjourQuery(q, eventLoop) {
DNSServiceErrorType result = DNSServiceBrowse(
- &sdRef, 0, 0, "_presence._tcp", 0,
+ &sdRef, 0, 0, "_presence._tcp", nullptr,
&BonjourBrowseQuery::handleServiceDiscoveredStatic, this);
if (result != kDNSServiceErr_NoError) {
- sdRef = NULL;
+ sdRef = nullptr;
}
}
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp
index 19ebae3..fda5032 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp
@@ -19,7 +19,7 @@
namespace Swift {
-BonjourQuerier::BonjourQuerier(EventLoop* eventLoop) : eventLoop(eventLoop), stopRequested(false), thread(0) {
+BonjourQuerier::BonjourQuerier(EventLoop* eventLoop) : eventLoop(eventLoop), stopRequested(false), thread(nullptr) {
int fds[2];
int result = pipe(fds);
assert(result == 0);
@@ -83,7 +83,7 @@ void BonjourQuerier::stop() {
interruptSelect();
thread->join();
delete thread;
- thread = NULL;
+ thread = nullptr;
stopRequested = false;
}
}
@@ -113,7 +113,7 @@ void BonjourQuerier::run() {
}
}
- if (select(maxSocket+1, &fdSet, NULL, NULL, 0) <= 0) {
+ if (select(maxSocket+1, &fdSet, nullptr, nullptr, nullptr) <= 0) {
continue;
}
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp
index c2a69b4..fa4b6fe 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp
@@ -10,7 +10,7 @@
namespace Swift {
-BonjourQuery::BonjourQuery(boost::shared_ptr<BonjourQuerier> q, EventLoop* eventLoop) : eventLoop(eventLoop), querier(q), sdRef(0) {
+BonjourQuery::BonjourQuery(boost::shared_ptr<BonjourQuerier> q, EventLoop* eventLoop) : eventLoop(eventLoop), querier(q), sdRef(nullptr) {
}
BonjourQuery::~BonjourQuery() {
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
index 58b6fdd..67c96bd 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2014 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -21,11 +21,11 @@ namespace Swift {
public:
BonjourRegisterQuery(const std::string& name, int port, const ByteArray& txtRecord, boost::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) {
DNSServiceErrorType result = DNSServiceRegister(
- &sdRef, 0, 0, name.c_str(), "_presence._tcp", NULL, NULL, boost::numeric_cast<unsigned short>(port),
+ &sdRef, 0, 0, name.c_str(), "_presence._tcp", nullptr, nullptr, boost::numeric_cast<unsigned short>(port),
boost::numeric_cast<unsigned short>(txtRecord.size()), vecptr(txtRecord),
&BonjourRegisterQuery::handleServiceRegisteredStatic, this);
if (result != kDNSServiceErr_NoError) {
- sdRef = NULL;
+ sdRef = nullptr;
}
}
@@ -44,7 +44,7 @@ namespace Swift {
void updateServiceInfo(const ByteArray& txtRecord) {
boost::lock_guard<boost::mutex> lock(sdRefMutex);
- DNSServiceUpdateRecord(sdRef, NULL, 0, boost::numeric_cast<unsigned short>(txtRecord.size()), vecptr(txtRecord), 0);
+ DNSServiceUpdateRecord(sdRef, nullptr, 0, boost::numeric_cast<unsigned short>(txtRecord.size()), vecptr(txtRecord), 0);
}
private:
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h
index 755984c..adc5486 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h
@@ -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.
*/
@@ -28,7 +28,7 @@ namespace Swift {
hostname.c_str(),
&BonjourResolveHostnameQuery::handleHostnameResolvedStatic, this);
if (result != kDNSServiceErr_NoError) {
- sdRef = NULL;
+ sdRef = nullptr;
}
}
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h
index 7833641..ee20a25 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h
@@ -24,7 +24,7 @@ namespace Swift {
service.getDomain().c_str(),
&BonjourResolveServiceQuery::handleServiceResolvedStatic, this);
if (result != kDNSServiceErr_NoError) {
- sdRef = NULL;
+ sdRef = nullptr;
}
}
diff --git a/Swiften/Network/BoostConnectionServer.cpp b/Swiften/Network/BoostConnectionServer.cpp
index 0b20a7f..99fe9b6 100644
--- a/Swiften/Network/BoostConnectionServer.cpp
+++ b/Swiften/Network/BoostConnectionServer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -19,10 +19,10 @@
namespace Swift {
-BoostConnectionServer::BoostConnectionServer(int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : port_(port), ioService_(ioService), eventLoop(eventLoop), acceptor_(NULL) {
+BoostConnectionServer::BoostConnectionServer(int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : port_(port), ioService_(ioService), eventLoop(eventLoop), acceptor_(nullptr) {
}
-BoostConnectionServer::BoostConnectionServer(const HostAddress &address, int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : address_(address), port_(port), ioService_(ioService), eventLoop(eventLoop), acceptor_(NULL) {
+BoostConnectionServer::BoostConnectionServer(const HostAddress &address, int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : address_(address), port_(port), ioService_(ioService), eventLoop(eventLoop), acceptor_(nullptr) {
}
void BoostConnectionServer::start() {
@@ -70,7 +70,7 @@ void BoostConnectionServer::stop(boost::optional<Error> e) {
if (acceptor_) {
acceptor_->close();
delete acceptor_;
- acceptor_ = NULL;
+ acceptor_ = nullptr;
}
eventLoop->postEvent(boost::bind(boost::ref(onStopped), e), shared_from_this());
}
diff --git a/Swiften/Network/BoostIOServiceThread.cpp b/Swiften/Network/BoostIOServiceThread.cpp
index ba9dd5b..79112d8 100644
--- a/Swiften/Network/BoostIOServiceThread.cpp
+++ b/Swiften/Network/BoostIOServiceThread.cpp
@@ -13,7 +13,7 @@ namespace Swift {
BoostIOServiceThread::BoostIOServiceThread(boost::shared_ptr<boost::asio::io_service> ioService) {
if (!!ioService) {
ioService_ = ioService;
- thread_ = NULL;
+ thread_ = nullptr;
}
else {
ioService_ = boost::make_shared<boost::asio::io_service>();
diff --git a/Swiften/Network/EnvironmentProxyProvider.cpp b/Swiften/Network/EnvironmentProxyProvider.cpp
index aa8027f..faf2e5b 100644
--- a/Swiften/Network/EnvironmentProxyProvider.cpp
+++ b/Swiften/Network/EnvironmentProxyProvider.cpp
@@ -36,15 +36,15 @@ HostAddressPort EnvironmentProxyProvider::getSOCKS5Proxy() const {
}
HostAddressPort EnvironmentProxyProvider::getFromEnv(const char* envVarName, std::string proxyProtocol) {
- char* envVar = NULL;
+ char* envVar = nullptr;
std::string address;
int port = 0;
envVar = getenv(envVarName);
proxyProtocol += "://";
- address = envVar != NULL ? envVar : "0.0.0.0";
- if(envVar != NULL && address.compare(0, proxyProtocol.length(), proxyProtocol) == 0) {
+ address = envVar != nullptr ? envVar : "0.0.0.0";
+ if(envVar != nullptr && address.compare(0, proxyProtocol.length(), proxyProtocol) == 0) {
address = address.substr(proxyProtocol.length(), address.length());
port = atoi(address.substr(address.find(':') + 1, address.length()).c_str());
address = address.substr(0, address.find(':'));
diff --git a/Swiften/Network/MacOSXProxyProvider.cpp b/Swiften/Network/MacOSXProxyProvider.cpp
index 858d568..69c6335 100644
--- a/Swiften/Network/MacOSXProxyProvider.cpp
+++ b/Swiften/Network/MacOSXProxyProvider.cpp
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2013 Isode Limited.
+ * Copyright (c) 2013-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -29,13 +29,13 @@ using namespace Swift;
#ifndef SWIFTEN_PLATFORM_IPHONE
static HostAddressPort getFromDictionary(CFDictionaryRef dict, CFStringRef enabledKey, CFStringRef hostKey, CFStringRef portKey) {
- CFNumberRef numberValue = NULL;
+ CFNumberRef numberValue = nullptr;
HostAddressPort ret = HostAddressPort(HostAddress(), 0);
if(CFDictionaryGetValueIfPresent(dict, reinterpret_cast<const void*> (enabledKey), reinterpret_cast<const void**> (&numberValue)) == true) {
const int i = 0;
CFNumberRef zero = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &i);
- CFComparisonResult result = CFNumberCompare(numberValue, zero, NULL);
+ CFComparisonResult result = CFNumberCompare(numberValue, zero, nullptr);
CFRelease(zero);
if(result != kCFCompareEqualTo) {
@@ -44,12 +44,12 @@ static HostAddressPort getFromDictionary(CFDictionaryRef dict, CFStringRef enabl
try {
CFNumberRef numberValue = reinterpret_cast<CFNumberRef> (CFDictionaryGetValue(dict, portKey));
- if(numberValue != NULL) {
+ if(numberValue != nullptr) {
CFNumberGetValue(numberValue, kCFNumberIntType, &port);
}
CFStringRef stringValue = reinterpret_cast<CFStringRef> (CFDictionaryGetValue(dict, hostKey));
- if(stringValue != NULL) {
+ if(stringValue != nullptr) {
std::vector<char> buffer;
// length must be +1 for the ending zero; and the Docu of CFStringGetCString tells it like
// if the string is toby the length must be at least 5.
@@ -82,8 +82,8 @@ MacOSXProxyProvider::MacOSXProxyProvider() {
HostAddressPort MacOSXProxyProvider::getHTTPConnectProxy() const {
HostAddressPort result;
#ifndef SWIFTEN_PLATFORM_IPHONE
- CFDictionaryRef proxies = SCDynamicStoreCopyProxies(NULL);
- if(proxies != NULL) {
+ CFDictionaryRef proxies = SCDynamicStoreCopyProxies(nullptr);
+ if(proxies != nullptr) {
result = getFromDictionary(proxies, kSCPropNetProxiesHTTPEnable, kSCPropNetProxiesHTTPProxy, kSCPropNetProxiesHTTPPort);
CFRelease(proxies);
}
@@ -94,8 +94,8 @@ HostAddressPort MacOSXProxyProvider::getHTTPConnectProxy() const {
HostAddressPort MacOSXProxyProvider::getSOCKS5Proxy() const {
HostAddressPort result;
#ifndef SWIFTEN_PLATFORM_IPHONE
- CFDictionaryRef proxies = SCDynamicStoreCopyProxies(NULL);
- if(proxies != NULL) {
+ CFDictionaryRef proxies = SCDynamicStoreCopyProxies(nullptr);
+ if(proxies != nullptr) {
result = getFromDictionary(proxies, kSCPropNetProxiesSOCKSEnable, kSCPropNetProxiesSOCKSProxy, kSCPropNetProxiesSOCKSPort);
CFRelease(proxies);
}
diff --git a/Swiften/Network/MiniUPnPInterface.cpp b/Swiften/Network/MiniUPnPInterface.cpp
index 3da6572..b298fc6 100644
--- a/Swiften/Network/MiniUPnPInterface.cpp
+++ b/Swiften/Network/MiniUPnPInterface.cpp
@@ -34,7 +34,7 @@ struct MiniUPnPInterface::Private {
MiniUPnPInterface::MiniUPnPInterface() : p(boost::make_shared<Private>()) {
p->isValid = false;
int error = 0;
- p->deviceList = upnpDiscover(1500 /* timeout in ms */, 0, 0, 0, 0 /* do IPv6? */, &error);
+ p->deviceList = upnpDiscover(1500 /* timeout in ms */, nullptr, nullptr, 0, 0 /* do IPv6? */, &error);
if (!p->deviceList) {
return;
}
@@ -87,7 +87,7 @@ boost::optional<NATPortMapping> MiniUPnPInterface::addPortForward(int actualLoca
p->localAddress.c_str(),
"Swift",
mapping.getProtocol() == NATPortMapping::TCP ? "TCP" : "UDP",
- 0,
+ nullptr,
leaseSeconds.c_str());
if (ret == UPNPCOMMAND_SUCCESS) {
return mapping;
@@ -106,7 +106,7 @@ bool MiniUPnPInterface::removePortForward(const NATPortMapping& mapping) {
std::string localPort = boost::lexical_cast<std::string>(mapping.getLocalPort());
std::string leaseSeconds = boost::lexical_cast<std::string>(mapping.getLeaseInSeconds());
- int ret = UPNP_DeletePortMapping(p->urls.controlURL, p->data.first.servicetype, publicPort.c_str(), mapping.getProtocol() == NATPortMapping::TCP ? "TCP" : "UDP", 0);
+ int ret = UPNP_DeletePortMapping(p->urls.controlURL, p->data.first.servicetype, publicPort.c_str(), mapping.getProtocol() == NATPortMapping::TCP ? "TCP" : "UDP", nullptr);
return ret == UPNPCOMMAND_SUCCESS;
}
diff --git a/Swiften/Network/NATPMPInterface.cpp b/Swiften/Network/NATPMPInterface.cpp
index 4818170..3782f75 100644
--- a/Swiften/Network/NATPMPInterface.cpp
+++ b/Swiften/Network/NATPMPInterface.cpp
@@ -60,7 +60,7 @@ boost::optional<HostAddress> NATPMPInterface::getPublicIP() {
timeout.tv_sec = 10;
timeout.tv_usec = 0;
- select(FD_SETSIZE, &fds, NULL, NULL, &timeout);
+ select(FD_SETSIZE, &fds, nullptr, nullptr, &timeout);
r = readnatpmpresponseorretry(&p->natpmp, &response);
} while (false /*r == NATPMP_TRYAGAIN*/);
@@ -98,7 +98,7 @@ boost::optional<NATPortMapping> NATPMPInterface::addPortForward(int localPort, i
timeout.tv_sec = 10;
timeout.tv_usec = 0;
- select(FD_SETSIZE, &fds, NULL, NULL, &timeout);
+ select(FD_SETSIZE, &fds, nullptr, nullptr, &timeout);
r = readnatpmpresponseorretry(&p->natpmp, &response);
} while(false /*r == NATPMP_TRYAGAIN*/);
@@ -126,7 +126,7 @@ bool NATPMPInterface::removePortForward(const NATPortMapping& mapping) {
FD_ZERO(&fds);
FD_SET(p->natpmp.s, &fds);
getnatpmprequesttimeout(&p->natpmp, &timeout);
- select(FD_SETSIZE, &fds, NULL, NULL, &timeout);
+ select(FD_SETSIZE, &fds, nullptr, nullptr, &timeout);
r = readnatpmpresponseorretry(&p->natpmp, &response);
} while(r == NATPMP_TRYAGAIN);
diff --git a/Swiften/Network/PlatformNATTraversalWorker.cpp b/Swiften/Network/PlatformNATTraversalWorker.cpp
index e6fb05f..cb5758e 100644
--- a/Swiften/Network/PlatformNATTraversalWorker.cpp
+++ b/Swiften/Network/PlatformNATTraversalWorker.cpp
@@ -4,6 +4,12 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2016 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#include "PlatformNATTraversalWorker.h"
#include <boost/smart_ptr/make_shared.hpp>
@@ -125,7 +131,7 @@ class PlatformNATTraversalRemovePortForwardingRequest : public NATTraversalRemov
NATPortMapping mapping;
};
-PlatformNATTraversalWorker::PlatformNATTraversalWorker(EventLoop* eventLoop) : eventLoop(eventLoop), stopRequested(false), natPMPSupported(boost::logic::indeterminate), natPMPInterface(NULL), miniUPnPSupported(boost::logic::indeterminate), miniUPnPInterface(NULL) {
+PlatformNATTraversalWorker::PlatformNATTraversalWorker(EventLoop* eventLoop) : eventLoop(eventLoop), stopRequested(false), natPMPSupported(boost::logic::indeterminate), natPMPInterface(nullptr), miniUPnPSupported(boost::logic::indeterminate), miniUPnPInterface(nullptr) {
nullNATTraversalInterface = new NullNATTraversalInterface();
// FIXME: This should be done from start(), and the current start() should be an internal method
thread = new boost::thread(boost::bind(&PlatformNATTraversalWorker::start, this));
diff --git a/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp b/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp
index e781742..12b48a9 100644
--- a/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp
+++ b/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2015 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -322,7 +322,7 @@ class BOSHConnectionPoolTest : public CppUnit::TestFixture {
PoolRef createTestling() {
// make_shared is limited to 9 arguments; instead new is used here.
- PoolRef pool = PoolRef(new BOSHConnectionPool(boshURL, resolver, connectionFactory, &parserFactory, static_cast<TLSContextFactory*>(NULL), timerFactory, eventLoop, to, initialRID, URL(), SafeString(""), SafeString(""), TLSOptions()));
+ PoolRef pool = PoolRef(new BOSHConnectionPool(boshURL, resolver, connectionFactory, &parserFactory, static_cast<TLSContextFactory*>(nullptr), timerFactory, eventLoop, to, initialRID, URL(), SafeString(""), SafeString(""), TLSOptions()));
pool->open();
pool->onXMPPDataRead.connect(boost::bind(&BOSHConnectionPoolTest::handleXMPPDataRead, this, _1));
pool->onBOSHDataRead.connect(boost::bind(&BOSHConnectionPoolTest::handleBOSHDataRead, this, _1));
diff --git a/Swiften/Network/UnitTest/BOSHConnectionTest.cpp b/Swiften/Network/UnitTest/BOSHConnectionTest.cpp
index bae84fd..abd020f 100644
--- a/Swiften/Network/UnitTest/BOSHConnectionTest.cpp
+++ b/Swiften/Network/UnitTest/BOSHConnectionTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2015 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -48,7 +48,7 @@ class BOSHConnectionTest : public CppUnit::TestFixture {
connectionFactory = new MockConnectionFactory(eventLoop);
resolver = new StaticDomainNameResolver(eventLoop);
timerFactory = new DummyTimerFactory();
- tlsContextFactory = NULL;
+ tlsContextFactory = nullptr;
connectFinished = false;
disconnected = false;
disconnectedError = false;
diff --git a/Swiften/Network/UnixNetworkEnvironment.cpp b/Swiften/Network/UnixNetworkEnvironment.cpp
index 3239448..91754ae 100644
--- a/Swiften/Network/UnixNetworkEnvironment.cpp
+++ b/Swiften/Network/UnixNetworkEnvironment.cpp
@@ -4,6 +4,12 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2016 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#include <Swiften/Network/UnixNetworkEnvironment.h>
#include <string>
@@ -28,13 +34,13 @@ namespace Swift {
std::vector<NetworkInterface> UnixNetworkEnvironment::getNetworkInterfaces() const {
std::map<std::string, NetworkInterface> interfaces;
#ifndef __ANDROID__
- ifaddrs* addrs = 0;
+ ifaddrs* addrs = nullptr;
int ret = getifaddrs(&addrs);
if (ret != 0) {
return std::vector<NetworkInterface>();
}
- for (ifaddrs* a = addrs; a != 0; a = a->ifa_next) {
+ for (ifaddrs* a = addrs; a != nullptr; a = a->ifa_next) {
std::string name(a->ifa_name);
boost::optional<HostAddress> address;
if (a->ifa_addr->sa_family == PF_INET) {
diff --git a/Swiften/Network/UnixProxyProvider.cpp b/Swiften/Network/UnixProxyProvider.cpp
index aa86c04..848de52 100644
--- a/Swiften/Network/UnixProxyProvider.cpp
+++ b/Swiften/Network/UnixProxyProvider.cpp
@@ -4,6 +4,12 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2016 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
@@ -17,7 +23,7 @@
namespace Swift {
UnixProxyProvider::UnixProxyProvider() :
- gconfProxyProvider(0),
+ gconfProxyProvider(nullptr),
environmentProxyProvider()
{
#if defined(HAVE_GCONF)
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;
}
}
}
diff --git a/Swiften/QA/ClientTest/ClientTest.cpp b/Swiften/QA/ClientTest/ClientTest.cpp
index 3a8f303..f34a501 100644
--- a/Swiften/QA/ClientTest/ClientTest.cpp
+++ b/Swiften/QA/ClientTest/ClientTest.cpp
@@ -22,7 +22,7 @@ using namespace Swift;
static SimpleEventLoop eventLoop;
static BoostNetworkFactories networkFactories(&eventLoop);
-static Client* client = 0;
+static Client* client = nullptr;
static bool rosterReceived = false;
enum TestStage {
FirstConnect,
diff --git a/Swiften/Serializer/CompressRequestSerializer.cpp b/Swiften/Serializer/CompressRequestSerializer.cpp
index c053cca..e6bc4ff 100644
--- a/Swiften/Serializer/CompressRequestSerializer.cpp
+++ b/Swiften/Serializer/CompressRequestSerializer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2014 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -19,7 +19,7 @@ SafeByteArray CompressRequestSerializer::serialize(boost::shared_ptr<ToplevelEle
}
bool CompressRequestSerializer::canSerialize(boost::shared_ptr<ToplevelElement> element) const {
- return boost::dynamic_pointer_cast<CompressRequest>(element) != 0;
+ return boost::dynamic_pointer_cast<CompressRequest>(element) != nullptr;
}
}
diff --git a/Swiften/Serializer/GenericStanzaSerializer.h b/Swiften/Serializer/GenericStanzaSerializer.h
index e3eaae6..32fcbe9 100644
--- a/Swiften/Serializer/GenericStanzaSerializer.h
+++ b/Swiften/Serializer/GenericStanzaSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -16,7 +16,7 @@ namespace Swift {
GenericStanzaSerializer(const std::string& tag, PayloadSerializerCollection* payloadSerializers, const boost::optional<std::string>& explicitNS = boost::optional<std::string>()) : StanzaSerializer(tag, payloadSerializers, explicitNS) {}
virtual bool canSerialize(boost::shared_ptr<ToplevelElement> element) const {
- return dynamic_cast<STANZA_TYPE*>(element.get()) != 0;
+ return dynamic_cast<STANZA_TYPE*>(element.get()) != nullptr;
}
virtual void setStanzaSpecificAttributes(
diff --git a/Swiften/Serializer/PayloadSerializerCollection.cpp b/Swiften/Serializer/PayloadSerializerCollection.cpp
index ba8b191..05fe445 100644
--- a/Swiften/Serializer/PayloadSerializerCollection.cpp
+++ b/Swiften/Serializer/PayloadSerializerCollection.cpp
@@ -29,7 +29,7 @@ PayloadSerializer* PayloadSerializerCollection::getPayloadSerializer(boost::shar
std::vector<PayloadSerializer*>::const_iterator i = std::find_if(
serializers_.begin(), serializers_.end(),
boost::bind(&PayloadSerializer::canSerialize, _1, payload));
- return (i != serializers_.end() ? *i : NULL);
+ return (i != serializers_.end() ? *i : nullptr);
}
}
diff --git a/Swiften/Session/BOSHSessionStream.cpp b/Swiften/Session/BOSHSessionStream.cpp
index 3794ae3..dd6e83a 100644
--- a/Swiften/Session/BOSHSessionStream.cpp
+++ b/Swiften/Session/BOSHSessionStream.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2015 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -47,7 +47,7 @@ BOSHSessionStream::BOSHSessionStream(const URL& boshURL,
boost::mt19937 random;
boost::uniform_int<unsigned long long> dist(0, (1LL<<53) - 1);
- random.seed(static_cast<unsigned int>(time(NULL)));
+ random.seed(static_cast<unsigned int>(time(nullptr)));
unsigned long long initialRID = boost::variate_generator<boost::mt19937&, boost::uniform_int<unsigned long long> >(random, dist)();
connectionPool = new BOSHConnectionPool(boshURL, resolver, connectionFactory, xmlParserFactory, tlsContextFactory, timerFactory, eventLoop, to, initialRID, boshHTTPConnectProxyURL, boshHTTPConnectProxyAuthID, boshHTTPConnectProxyAuthPassword, tlsOptions, trafficFilter);
@@ -74,13 +74,13 @@ BOSHSessionStream::~BOSHSessionStream() {
connectionPool->onBOSHDataRead.disconnect(boost::bind(&BOSHSessionStream::handlePoolBOSHDataRead, this, _1));
connectionPool->onBOSHDataWritten.disconnect(boost::bind(&BOSHSessionStream::handlePoolBOSHDataWritten, this, _1));
delete connectionPool;
- connectionPool = NULL;
+ connectionPool = nullptr;
xmppLayer->onStreamStart.disconnect(boost::bind(&BOSHSessionStream::handleStreamStartReceived, this, _1));
xmppLayer->onElement.disconnect(boost::bind(&BOSHSessionStream::handleElementReceived, this, _1));
xmppLayer->onError.disconnect(boost::bind(&BOSHSessionStream::handleXMPPError, this));
xmppLayer->onWriteData.disconnect(boost::bind(&BOSHSessionStream::handleXMPPLayerDataWritten, this, _1));
delete xmppLayer;
- xmppLayer = NULL;
+ xmppLayer = nullptr;
}
void BOSHSessionStream::open() {
diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp
index 697115a..a6f1421 100644
--- a/Swiften/Session/BasicSessionStream.cpp
+++ b/Swiften/Session/BasicSessionStream.cpp
@@ -33,9 +33,9 @@ BasicSessionStream::BasicSessionStream(
connection(connection),
tlsContextFactory(tlsContextFactory),
timerFactory(timerFactory),
- compressionLayer(NULL),
- tlsLayer(NULL),
- whitespacePingLayer(NULL),
+ compressionLayer(nullptr),
+ tlsLayer(nullptr),
+ whitespacePingLayer(nullptr),
tlsOptions_(tlsOptions) {
xmppLayer = new XMPPLayer(payloadParserFactories, payloadSerializers, xmlParserFactory, streamType);
xmppLayer->onStreamStart.connect(boost::bind(&BasicSessionStream::handleStreamStartReceived, this, _1));
diff --git a/Swiften/Session/Session.cpp b/Swiften/Session/Session.cpp
index 7f13cd7..82514c1 100644
--- a/Swiften/Session/Session.cpp
+++ b/Swiften/Session/Session.cpp
@@ -22,9 +22,9 @@ Session::Session(
payloadParserFactories(payloadParserFactories),
payloadSerializers(payloadSerializers),
xmlParserFactory(xmlParserFactory),
- xmppLayer(NULL),
- connectionLayer(NULL),
- streamStack(0),
+ xmppLayer(nullptr),
+ connectionLayer(nullptr),
+ streamStack(nullptr),
finishing(false) {
}
diff --git a/Swiften/StreamStack/HighLayer.cpp b/Swiften/StreamStack/HighLayer.cpp
index fcfdacf..8e7ba02 100644
--- a/Swiften/StreamStack/HighLayer.cpp
+++ b/Swiften/StreamStack/HighLayer.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 {
-HighLayer::HighLayer() : childLayer(NULL) {
+HighLayer::HighLayer() : childLayer(nullptr) {
}
HighLayer::~HighLayer() {
diff --git a/Swiften/StreamStack/LowLayer.cpp b/Swiften/StreamStack/LowLayer.cpp
index 07b0f43..c94dafe 100644
--- a/Swiften/StreamStack/LowLayer.cpp
+++ b/Swiften/StreamStack/LowLayer.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 {
-LowLayer::LowLayer() : parentLayer(NULL) {
+LowLayer::LowLayer() : parentLayer(nullptr) {
}
LowLayer::~LowLayer() {
diff --git a/Swiften/StreamStack/StreamStack.h b/Swiften/StreamStack/StreamStack.h
index 2a0b1f1..74b92d7 100644
--- a/Swiften/StreamStack/StreamStack.h
+++ b/Swiften/StreamStack/StreamStack.h
@@ -37,7 +37,7 @@ namespace Swift {
return layer;
}
}
- return NULL;
+ return nullptr;
}
private:
diff --git a/Swiften/TLS/PlatformTLSFactories.cpp b/Swiften/TLS/PlatformTLSFactories.cpp
index c1c0868..81f560b 100644
--- a/Swiften/TLS/PlatformTLSFactories.cpp
+++ b/Swiften/TLS/PlatformTLSFactories.cpp
@@ -24,7 +24,7 @@
namespace Swift {
-PlatformTLSFactories::PlatformTLSFactories() : contextFactory(NULL), certificateFactory(NULL) {
+PlatformTLSFactories::PlatformTLSFactories() : contextFactory(nullptr), certificateFactory(nullptr) {
#ifdef HAVE_OPENSSL
contextFactory = new OpenSSLContextFactory();
certificateFactory = new OpenSSLCertificateFactory();
diff --git a/Swiften/TLS/SecureTransport/SecureTransportCertificate.mm b/Swiften/TLS/SecureTransport/SecureTransportCertificate.mm
index 398829c..ed47f56 100644
--- a/Swiften/TLS/SecureTransport/SecureTransportCertificate.mm
+++ b/Swiften/TLS/SecureTransport/SecureTransportCertificate.mm
@@ -49,9 +49,9 @@ SecureTransportCertificate::SecureTransportCertificate(SecCertificateRef certifi
SecureTransportCertificate::SecureTransportCertificate(const ByteArray& der) {
- CFDataRef derData = CFDataCreateWithBytesNoCopy(NULL, der.data(), static_cast<CFIndex>(der.size()), NULL);
+ CFDataRef derData = CFDataCreateWithBytesNoCopy(nullptr, der.data(), static_cast<CFIndex>(der.size()), nullptr);
// certificate will take ownership of derData and free it on its release.
- SecCertificateRef certificate = SecCertificateCreateWithData(NULL, derData);
+ SecCertificateRef certificate = SecCertificateCreateWithData(nullptr, derData);
if (certificate) {
certificateHandle_ = boost::shared_ptr<SecCertificate>(certificate, CFRelease);
parse();
@@ -64,10 +64,10 @@ SecureTransportCertificate::~SecureTransportCertificate() {
void SecureTransportCertificate::parse() {
assert(certificateHandle_);
- CFErrorRef error = NULL;
+ CFErrorRef error = nullptr;
// The SecCertificateCopyValues function is not part of the iOS Secure Transport API.
- CFDictionaryRef valueDict = SecCertificateCopyValues(certificateHandle_.get(), 0, &error);
+ CFDictionaryRef valueDict = SecCertificateCopyValues(certificateHandle_.get(), nullptr, &error);
if (valueDict) {
// Handle subject.
CFStringRef subject = SecCertificateCopySubjectSummary(certificateHandle_.get());
@@ -78,7 +78,7 @@ void SecureTransportCertificate::parse() {
}
// Handle a single Common Name.
- CFStringRef commonName = NULL;
+ CFStringRef commonName = nullptr;
OSStatus error = SecCertificateCopyCommonName(certificateHandle_.get(), &commonName);
if (!error && commonName) {
NSString* commonNameStr = bridge_cast<NSString*>(commonName);
diff --git a/Swiften/TLS/SecureTransport/SecureTransportContext.mm b/Swiften/TLS/SecureTransport/SecureTransportContext.mm
index 62889fd..1c5e3ab 100644
--- a/Swiften/TLS/SecureTransport/SecureTransportContext.mm
+++ b/Swiften/TLS/SecureTransport/SecureTransportContext.mm
@@ -41,7 +41,7 @@ namespace {
CFArrayRef CreateClientCertificateChainAsCFArrayRef(CertificateWithKey::ref key) {
boost::shared_ptr<PKCS12Certificate> pkcs12 = boost::dynamic_pointer_cast<PKCS12Certificate>(key);
if (!key) {
- return NULL;
+ return nullptr;
}
SafeByteArray safePassword = pkcs12->getPassword();
@@ -49,19 +49,19 @@ CFArrayRef CreateClientCertificateChainAsCFArrayRef(CertificateWithKey::ref key)
try {
passwordSize = boost::numeric_cast<CFIndex>(safePassword.size());
} catch (...) {
- return NULL;
+ return nullptr;
}
- CFMutableArrayRef certChain = CFArrayCreateMutable(NULL, 0, 0);
+ CFMutableArrayRef certChain = CFArrayCreateMutable(nullptr, 0, nullptr);
OSStatus securityError = errSecSuccess;
CFStringRef password = CFStringCreateWithBytes(kCFAllocatorDefault, safePassword.data(), passwordSize, kCFStringEncodingUTF8, false);
const void* keys[] = { kSecImportExportPassphrase };
const void* values[] = { password };
- CFDictionaryRef options = CFDictionaryCreate(NULL, keys, values, 1, NULL, NULL);
+ CFDictionaryRef options = CFDictionaryCreate(nullptr, keys, values, 1, nullptr, nullptr);
- CFArrayRef items = NULL;
+ CFArrayRef items = nullptr;
CFDataRef pkcs12Data = bridge_cast<CFDataRef>([NSData dataWithBytes: static_cast<const void *>(pkcs12->getData().data()) length:pkcs12->getData().size()]);
securityError = SecPKCS12Import(pkcs12Data, options, &items);
CFRelease(options);
@@ -85,10 +85,10 @@ CFArrayRef CreateClientCertificateChainAsCFArrayRef(CertificateWithKey::ref key)
if (securityError != errSecSuccess) {
if (items) {
CFRelease(items);
- items = NULL;
+ items = nullptr;
}
CFRelease(certChain);
- certChain = NULL;
+ certChain = nullptr;
}
if (certChain) {
@@ -104,7 +104,7 @@ CFArrayRef CreateClientCertificateChainAsCFArrayRef(CertificateWithKey::ref key)
}
SecureTransportContext::SecureTransportContext(bool checkCertificateRevocation) : state_(None), checkCertificateRevocation_(checkCertificateRevocation) {
- sslContext_ = boost::shared_ptr<SSLContext>(SSLCreateContext(NULL, kSSLClientSide, kSSLStreamType), CFRelease);
+ sslContext_ = boost::shared_ptr<SSLContext>(SSLCreateContext(nullptr, kSSLClientSide, kSSLStreamType), CFRelease);
OSStatus error = noErr;
// set IO callbacks
@@ -200,7 +200,7 @@ void SecureTransportContext::processHandshake() {
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
void SecureTransportContext::verifyServerCertificate() {
- SecTrustRef trust = NULL;
+ SecTrustRef trust = nullptr;
OSStatus error = SSLCopyPeerTrust(sslContext_.get(), &trust);
if (error != noErr) {
fatalError(boost::make_shared<TLSError>(), boost::make_shared<CertificateVerificationError>());
@@ -364,7 +364,7 @@ std::vector<Certificate::ref> SecureTransportContext::getPeerCertificateChain()
typedef boost::remove_pointer<SecTrustRef>::type SecTrust;
boost::shared_ptr<SecTrust> securityTrust;
- SecTrustRef secTrust = NULL;;
+ SecTrustRef secTrust = nullptr;;
OSStatus error = SSLCopyPeerTrust(sslContext_.get(), &secTrust);
if (error == noErr) {
securityTrust = boost::shared_ptr<SecTrust>(secTrust, CFRelease);
diff --git a/Swiften/TLS/ServerIdentityVerifier.cpp b/Swiften/TLS/ServerIdentityVerifier.cpp
index b247585..872717b 100644
--- a/Swiften/TLS/ServerIdentityVerifier.cpp
+++ b/Swiften/TLS/ServerIdentityVerifier.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.
*/
@@ -25,7 +25,7 @@ ServerIdentityVerifier::ServerIdentityVerifier(const JID& jid, IDNConverter* idn
bool ServerIdentityVerifier::certificateVerifies(Certificate::ref certificate) {
bool hasSAN = false;
- if (certificate == NULL) {
+ if (certificate == nullptr) {
return false;
}
// DNS names
diff --git a/Swiften/Whiteboard/WhiteboardResponder.cpp b/Swiften/Whiteboard/WhiteboardResponder.cpp
index 5e35782..b0b3e6c 100644
--- a/Swiften/Whiteboard/WhiteboardResponder.cpp
+++ b/Swiften/Whiteboard/WhiteboardResponder.cpp
@@ -35,7 +35,7 @@ namespace Swift {
} else {
sendResponse(from, id, boost::shared_ptr<WhiteboardPayload>());
WhiteboardSession::ref session = sessionManager_->getSession(from);
- if (session != NULL) {
+ if (session != nullptr) {
session->handleIncomingAction(payload);
}
}