From eddd92ed76ae68cb1e202602fd3ebd11b69191a2 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Fri, 1 Apr 2016 14:36:16 +0200 Subject: 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 diff --git a/Slimber/Cocoa/CocoaMenulet.mm b/Slimber/Cocoa/CocoaMenulet.mm index 98042d7..a05843e 100644 --- a/Slimber/Cocoa/CocoaMenulet.mm +++ b/Slimber/Cocoa/CocoaMenulet.mm @@ -44,7 +44,7 @@ void CocoaMenulet::clear() { void CocoaMenulet::addItem(const std::string& name, const std::string& icon) { NSMenuItem* item = [[NSMenuItem alloc] initWithTitle: std2NSString(name) - action: NULL keyEquivalent: @""]; + action: nullptr keyEquivalent: @""]; if (!icon.empty()) { NSString* path = [[NSBundle mainBundle] pathForResource: std2NSString(icon) ofType:@"png"]; NSImage* image = [[NSImage alloc] initWithContentsOfFile: path]; diff --git a/Slimber/Server.cpp b/Slimber/Server.cpp index c69c75d..d1afc23 100644 --- a/Slimber/Server.cpp +++ b/Slimber/Server.cpp @@ -51,7 +51,7 @@ Server::Server( linkLocalServiceBrowser(linkLocalServiceBrowser), vCardCollection(vCardCollection), eventLoop(eventLoop), - presenceManager(NULL), + presenceManager(nullptr), stopping(false) { linkLocalServiceBrowser->onServiceRegistered.connect( boost::bind(&Server::handleServiceRegistered, this, _1)); @@ -105,7 +105,7 @@ void Server::stop(boost::optional e) { stopping = true; delete presenceManager; - presenceManager = NULL; + presenceManager = nullptr; if (serverFromClientSession) { serverFromClientSession->finishSession(); diff --git a/Sluift/EditlineTerminal.cpp b/Sluift/EditlineTerminal.cpp index fc62142..206ced6 100644 --- a/Sluift/EditlineTerminal.cpp +++ b/Sluift/EditlineTerminal.cpp @@ -22,7 +22,7 @@ using namespace Swift; -static EditlineTerminal* globalInstance = NULL; +static EditlineTerminal* globalInstance = nullptr; static int completionStart = -1; static int completionEnd = -1; @@ -50,7 +50,7 @@ static char* getCompletions(const char*, int state) { } } if (boost::numeric_cast(state) >= completions.size()) { - return 0; + return nullptr; } return strdup(completions[boost::numeric_cast(state)].c_str()); } diff --git a/Sluift/Lua/Check.cpp b/Sluift/Lua/Check.cpp index 74c44be..74a247a 100644 --- a/Sluift/Lua/Check.cpp +++ b/Sluift/Lua/Check.cpp @@ -40,7 +40,7 @@ int Lua::checkIntNumber(lua_State* L, int arg) { } std::string Lua::checkString(lua_State* L, int arg) { - const char *s = lua_tolstring(L, arg, NULL); + const char *s = lua_tolstring(L, arg, nullptr); if (!s) { throw Lua::Exception(getArgTypeError(L, arg, LUA_TSTRING)); } diff --git a/Sluift/SluiftClient.cpp b/Sluift/SluiftClient.cpp index fea3291..8bbb530 100644 --- a/Sluift/SluiftClient.cpp +++ b/Sluift/SluiftClient.cpp @@ -29,7 +29,7 @@ SluiftClient::SluiftClient( SimpleEventLoop* eventLoop) : networkFactories(networkFactories), eventLoop(eventLoop), - tracer(NULL) { + tracer(nullptr) { client = new Client(jid, password, networkFactories); client->setAlwaysTrustCertificates(); client->onDisconnected.connect(boost::bind(&SluiftClient::handleDisconnected, this, _1)); @@ -64,7 +64,7 @@ void SluiftClient::setTraceEnabled(bool b) { } else if (!b && tracer) { delete tracer; - tracer = NULL; + tracer = nullptr; } } diff --git a/Sluift/SluiftComponent.cpp b/Sluift/SluiftComponent.cpp index c0dcd3c..6abe800 100644 --- a/Sluift/SluiftComponent.cpp +++ b/Sluift/SluiftComponent.cpp @@ -28,7 +28,7 @@ SluiftComponent::SluiftComponent( SimpleEventLoop* eventLoop): networkFactories(networkFactories), eventLoop(eventLoop), - tracer(NULL) { + tracer(nullptr) { component = new Component(jid, password, networkFactories); component->onError.connect(boost::bind(&SluiftComponent::handleError, this, _1)); component->onMessageReceived.connect(boost::bind(&SluiftComponent::handleIncomingMessage, this, _1)); @@ -51,7 +51,7 @@ void SluiftComponent::setTraceEnabled(bool b) { } else if (!b && tracer) { delete tracer; - tracer = NULL; + tracer = nullptr; } } diff --git a/Sluift/Terminal.cpp b/Sluift/Terminal.cpp index db1332a..4b54a87 100644 --- a/Sluift/Terminal.cpp +++ b/Sluift/Terminal.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. */ @@ -8,7 +8,7 @@ using namespace Swift; -Terminal::Terminal() : completer(NULL) { +Terminal::Terminal() : completer(nullptr) { } Terminal::~Terminal() { diff --git a/Sluift/main.cpp b/Sluift/main.cpp index 6953ca6..85fa17d 100644 --- a/Sluift/main.cpp +++ b/Sluift/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2014 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -46,7 +46,7 @@ static const luaL_Reg defaultLibraries[] = { {LUA_MATHLIBNAME, luaopen_math}, {LUA_DBLIBNAME, luaopen_debug}, {"sluift", luaopen_sluift}, - {NULL, NULL} + {nullptr, nullptr} }; static void handleInterruptSignal(int) { diff --git a/Sluift/sluift.cpp b/Sluift/sluift.cpp index aff4533..549ae01 100644 --- a/Sluift/sluift.cpp +++ b/Sluift/sluift.cpp @@ -419,7 +419,7 @@ SLUIFT_LUA_FUNCTION(iTunes, get_current_track) { * Module registration ******************************************************************************/ -static const luaL_Reg sluift_functions[] = { {NULL, NULL} }; +static const luaL_Reg sluift_functions[] = { {nullptr, nullptr} }; SLUIFT_API int luaopen_sluift(lua_State* L) { // Initialize & store the module table diff --git a/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.cpp b/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.cpp index f693224..9ae8c09 100644 --- a/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.cpp +++ b/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.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. */ @@ -27,7 +27,7 @@ AutoUpdater* PlatformAutoUpdaterFactory::createAutoUpdater(const std::string& ap return new SparkleAutoUpdater(appcastURL); #else (void) appcastURL; - return NULL; + return nullptr; #endif } diff --git a/SwifTools/Idle/PlatformIdleQuerier.cpp b/SwifTools/Idle/PlatformIdleQuerier.cpp index 5855749..8b62df8 100644 --- a/SwifTools/Idle/PlatformIdleQuerier.cpp +++ b/SwifTools/Idle/PlatformIdleQuerier.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. */ @@ -21,7 +21,7 @@ namespace Swift { -PlatformIdleQuerier::PlatformIdleQuerier() : querier(NULL) { +PlatformIdleQuerier::PlatformIdleQuerier() : querier(nullptr) { #if defined(SWIFTEN_PLATFORM_MACOSX) #if defined(HAVE_IOKIT) && !defined(SWIFTEN_PLATFORM_IPHONE) querier = new MacOSXIdleQuerier(); diff --git a/Swift/Controllers/BlockListController.cpp b/Swift/Controllers/BlockListController.cpp index 6fbf6b3..9ed98a8 100644 --- a/Swift/Controllers/BlockListController.cpp +++ b/Swift/Controllers/BlockListController.cpp @@ -27,7 +27,7 @@ namespace Swift { -BlockListController::BlockListController(ClientBlockListManager* blockListManager, UIEventStream* uiEventStream, BlockListEditorWidgetFactory* blockListEditorWidgetFactory, EventController* eventController) : blockListManager_(blockListManager), blockListEditorWidgetFactory_(blockListEditorWidgetFactory), blockListEditorWidget_(0), eventController_(eventController), remainingRequests_(0), uiEventStream_(uiEventStream) { +BlockListController::BlockListController(ClientBlockListManager* blockListManager, UIEventStream* uiEventStream, BlockListEditorWidgetFactory* blockListEditorWidgetFactory, EventController* eventController) : blockListManager_(blockListManager), blockListEditorWidgetFactory_(blockListEditorWidgetFactory), blockListEditorWidget_(nullptr), eventController_(eventController), remainingRequests_(0), uiEventStream_(uiEventStream) { uiEventStream->onUIEvent.connect(boost::bind(&BlockListController::handleUIEvent, this, _1)); blockListManager_->getBlockList()->onItemAdded.connect(boost::bind(&BlockListController::handleBlockListChanged, this)); blockListManager_->getBlockList()->onItemRemoved.connect(boost::bind(&BlockListController::handleBlockListChanged, this)); @@ -56,8 +56,8 @@ void BlockListController::blockListDifferences(const std::vector &newBlockL void BlockListController::handleUIEvent(boost::shared_ptr rawEvent) { // handle UI dialog boost::shared_ptr requestDialogEvent = boost::dynamic_pointer_cast(rawEvent); - if (requestDialogEvent != NULL) { - if (blockListEditorWidget_ == NULL) { + if (requestDialogEvent != nullptr) { + if (blockListEditorWidget_ == nullptr) { blockListEditorWidget_ = blockListEditorWidgetFactory_->createBlockListEditorWidget(); blockListEditorWidget_->onSetNewBlockList.connect(boost::bind(&BlockListController::handleSetNewBlockList, this, _1)); } @@ -70,7 +70,7 @@ void BlockListController::handleUIEvent(boost::shared_ptr rawEvent) { // handle block state change boost::shared_ptr changeStateEvent = boost::dynamic_pointer_cast(rawEvent); - if (changeStateEvent != NULL) { + if (changeStateEvent != nullptr) { if (changeStateEvent->getBlockState() == RequestChangeBlockStateUIEvent::Blocked) { GenericRequest::ref blockRequest = blockListManager_->createBlockJIDRequest(changeStateEvent->getContact()); blockRequest->onResponse.connect(boost::bind(&BlockListController::handleBlockResponse, this, blockRequest, _1, _2, std::vector(1, changeStateEvent->getContact()), false)); diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp index d478e2a..7a3db1e 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.cpp +++ b/Swift/Controllers/Chat/ChatControllerBase.cpp @@ -69,7 +69,7 @@ void ChatControllerBase::handleLogCleared() { ChatWindow* ChatControllerBase::detachChatWindow() { ChatWindow* chatWindow = chatWindow_; - chatWindow_ = NULL; + chatWindow_ = nullptr; return chatWindow; } diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index 32da58a..7a52d9b 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -154,11 +154,11 @@ ChatsManager::ChatsManager( chatWindowFactory_ = chatWindowFactory; nickResolver_ = nickResolver; presenceOracle_ = presenceOracle; - avatarManager_ = NULL; + avatarManager_ = nullptr; serverDiscoInfo_ = boost::make_shared(); presenceSender_ = presenceSender; uiEventStream_ = uiEventStream; - mucBookmarkManager_ = NULL; + mucBookmarkManager_ = nullptr; profileSettings_ = profileSettings; presenceOracle_->onPresenceChange.connect(boost::bind(&ChatsManager::handlePresenceChange, this, _1)); uiEventConnection_ = uiEventStream_->onUIEvent.connect(boost::bind(&ChatsManager::handleUIEvent, this, _1)); @@ -168,7 +168,7 @@ ChatsManager::ChatsManager( chatListWindow_->onRecentActivated.connect(boost::bind(&ChatsManager::handleRecentActivated, this, _1)); chatListWindow_->onClearRecentsRequested.connect(boost::bind(&ChatsManager::handleClearRecentsRequested, this)); - joinMUCWindow_ = NULL; + joinMUCWindow_ = nullptr; mucSearchController_ = new MUCSearchController(jid_, mucSearchWindowFactory, iqRouter, profileSettings_); mucSearchController_->onMUCSelected.connect(boost::bind(&ChatsManager::handleMUCSelectedAfterSearch, this, _1)); ftOverview_->onNewFileTransferController.connect(boost::bind(&ChatsManager::handleNewFileTransferController, this, _1)); @@ -239,7 +239,7 @@ void ChatsManager::saveRecents() { void ChatsManager::handleClearRecentsRequested() { recentChats_.clear(); saveRecents(); - handleUnreadCountChanged(NULL); + handleUnreadCountChanged(nullptr); } void ChatsManager::handleJIDAddedToRoster(const JID &jid) { @@ -340,7 +340,7 @@ void ChatsManager::loadRecents() { prependRecent(chat); } } - handleUnreadCountChanged(NULL); + handleUnreadCountChanged(nullptr); } void ChatsManager::setupBookmarks() { @@ -419,7 +419,7 @@ void ChatsManager::handleChatActivity(const JID& jid, const std::string& activit ChatListWindow::Chat chat = createChatListChatItem(jid, activity, privateMessage); /* FIXME: handle nick changes */ appendRecent(chat); - handleUnreadCountChanged(NULL); + handleUnreadCountChanged(nullptr); saveRecents(); } @@ -744,7 +744,7 @@ ChatController* ChatsManager::getChatControllerOrCreate(const JID &contact) { ChatController* ChatsManager::getChatControllerIfExists(const JID &contact, bool rebindIfNeeded) { if (chatControllers_.find(contact) == chatControllers_.end()) { if (mucRegistry_->isMUC(contact.toBare())) { - return NULL; + return nullptr; } //Need to look for an unbound window to bind first JID bare(contact.toBare()); @@ -766,7 +766,7 @@ ChatController* ChatsManager::getChatControllerIfExists(const JID &contact, bool } } } - return NULL; + return nullptr; } } return chatControllers_[contact]; @@ -807,8 +807,8 @@ MUC::ref ChatsManager::handleJoinMUCRequest(const JID &mucJID, const boost::opti muc->setCreateAsReservedIfNew(); } - MUCController* controller = NULL; - SingleChatWindowFactoryAdapter* chatWindowFactoryAdapter = NULL; + MUCController* controller = nullptr; + SingleChatWindowFactoryAdapter* chatWindowFactoryAdapter = nullptr; if (reuseChatwindow) { chatWindowFactoryAdapter = new SingleChatWindowFactoryAdapter(reuseChatwindow); } diff --git a/Swift/Controllers/Chat/ChatsManager.h b/Swift/Controllers/Chat/ChatsManager.h index 7bba219..fa6ab3a 100644 --- a/Swift/Controllers/Chat/ChatsManager.h +++ b/Swift/Controllers/Chat/ChatsManager.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. */ @@ -89,7 +89,7 @@ namespace Swift { ChatListWindow::Chat createChatListChatItem(const JID& jid, const std::string& activity, bool privateMessage); void handleChatRequest(const std::string& contact); void finalizeImpromptuJoin(MUC::ref muc, const std::vector& jidsToInvite, const std::string& reason, const boost::optional& reuseChatJID = boost::optional()); - MUC::ref handleJoinMUCRequest(const JID& muc, const boost::optional& password, const boost::optional& nick, bool addAutoJoin, bool createAsReservedIfNew, bool isImpromptu, ChatWindow* reuseChatwindow = 0); + MUC::ref handleJoinMUCRequest(const JID& muc, const boost::optional& password, const boost::optional& nick, bool addAutoJoin, bool createAsReservedIfNew, bool isImpromptu, ChatWindow* reuseChatwindow = nullptr); void handleSearchMUCRequest(); void handleMUCSelectedAfterSearch(const JID&); void rebindControllerJID(const JID& from, const JID& to); diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index 1e2b7ad..66a655c 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -154,7 +154,7 @@ MUCController::MUCController ( if (stanzaChannel->isAvailable()) { MUCController::setOnline(true); } - if (avatarManager_ != NULL) { + if (avatarManager_ != nullptr) { avatarChangedConnection_ = (avatarManager_->onAvatarChanged.connect(boost::bind(&MUCController::handleAvatarChanged, this, _1))); } MUCController::handleBareJIDCapsChanged(muc->getJID()); @@ -177,13 +177,13 @@ MUCController::MUCController ( MUCController::~MUCController() { eventStream_->onUIEvent.disconnect(boost::bind(&MUCController::handleUIEvent, this, _1)); - chatWindow_->setRosterModel(NULL); + chatWindow_->setRosterModel(nullptr); delete rosterVCardProvider_; delete roster_; if (loginCheckTimer_) { loginCheckTimer_->stop(); } - chatWindow_->setTabComplete(NULL); + chatWindow_->setTabComplete(nullptr); delete completer_; } @@ -465,7 +465,7 @@ void MUCController::handleOccupantJoined(const MUCOccupant& occupant) { onActivity(""); } } - if (avatarManager_ != NULL) { + if (avatarManager_ != nullptr) { handleAvatarChanged(jid); } } @@ -780,7 +780,7 @@ void MUCController::handleOccupantNicknameChanged(const std::string& oldNickname std::string groupName(roleToGroupName(role)); roster_->addContact(newJID, realJID, newNickname, groupName, avatarManager_->getAvatarPath(newJID)); roster_->applyOnItems(SetMUC(newJID, role, affiliation)); - if (avatarManager_ != NULL) { + if (avatarManager_ != nullptr) { handleAvatarChanged(newJID); } diff --git a/Swift/Controllers/Chat/MUCSearchController.cpp b/Swift/Controllers/Chat/MUCSearchController.cpp index 884978c..4f28058 100644 --- a/Swift/Controllers/Chat/MUCSearchController.cpp +++ b/Swift/Controllers/Chat/MUCSearchController.cpp @@ -25,7 +25,7 @@ namespace Swift { static const std::string SEARCHED_SERVICES = "searchedServices"; -MUCSearchController::MUCSearchController(const JID& jid, MUCSearchWindowFactory* factory, IQRouter* iqRouter, ProfileSettingsProvider* settings) : jid_(jid), factory_(factory), iqRouter_(iqRouter), settings_(settings), window_(NULL), walker_(NULL) { +MUCSearchController::MUCSearchController(const JID& jid, MUCSearchWindowFactory* factory, IQRouter* iqRouter, ProfileSettingsProvider* settings) : jid_(jid), factory_(factory), iqRouter_(iqRouter), settings_(settings), window_(nullptr), walker_(nullptr) { itemsInProgress_ = 0; loadSavedServices(); } diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp index 7445c4b..92a8ca0 100644 --- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp @@ -95,7 +95,7 @@ public: joinMUCWindowFactory_ = mocks_->InterfaceMock(); xmppRoster_ = new XMPPRosterImpl(); mucRegistry_ = new MUCRegistry(); - nickResolver_ = new NickResolver(jid_.toBare(), xmppRoster_, NULL, mucRegistry_); + nickResolver_ = new NickResolver(jid_.toBare(), xmppRoster_, nullptr, mucRegistry_); presenceOracle_ = new PresenceOracle(stanzaChannel_, xmppRoster_); serverDiscoInfo_ = boost::make_shared(); presenceSender_ = new StanzaChannelPresenceSender(stanzaChannel_); @@ -124,7 +124,7 @@ public: vcardManager_ = new VCardManager(jid_, iqRouter_, vcardStorage_); mocks_->ExpectCall(chatListWindowFactory_, ChatListWindowFactory::createChatListWindow).With(uiEventStream_).Return(chatListWindow_); clientBlockListManager_ = new ClientBlockListManager(iqRouter_); - manager_ = new ChatsManager(jid_, stanzaChannel_, iqRouter_, eventController_, chatWindowFactory_, joinMUCWindowFactory_, nickResolver_, presenceOracle_, directedPresenceSender_, uiEventStream_, chatListWindowFactory_, true, NULL, mucRegistry_, entityCapsProvider_, mucManager_, mucSearchWindowFactory_, profileSettings_, ftOverview_, xmppRoster_, false, settings_, NULL, wbManager_, highlightManager_, clientBlockListManager_, emoticons_, vcardManager_); + manager_ = new ChatsManager(jid_, stanzaChannel_, iqRouter_, eventController_, chatWindowFactory_, joinMUCWindowFactory_, nickResolver_, presenceOracle_, directedPresenceSender_, uiEventStream_, chatListWindowFactory_, true, nullptr, mucRegistry_, entityCapsProvider_, mucManager_, mucSearchWindowFactory_, profileSettings_, ftOverview_, xmppRoster_, false, settings_, nullptr, wbManager_, highlightManager_, clientBlockListManager_, emoticons_, vcardManager_); manager_->setAvatarManager(avatarManager_); } @@ -386,7 +386,7 @@ public: manager_->handleIncomingMessage(message); Stanza::ref stanzaContactOnRoster = stanzaChannel_->getStanzaAtIndex(0); CPPUNIT_ASSERT_EQUAL(st(1), stanzaChannel_->sentStanzas.size()); - CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload() != 0); + CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload() != nullptr); xmppRoster_->removeContact(messageJID); @@ -416,7 +416,7 @@ public: CPPUNIT_ASSERT_EQUAL(st(1), stanzaChannel_->sentStanzas.size()); Stanza::ref stanzaContactOnRoster = stanzaChannel_->getStanzaAtIndex(0); - CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload() != 0); + CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload() != nullptr); } /** @@ -729,7 +729,7 @@ public: CPPUNIT_ASSERT_EQUAL(st(1), stanzaChannel_->sentStanzas.size()); Stanza::ref stanzaContactOnRoster = stanzaChannel_->getStanzaAtIndex(0); - CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload() != 0); + CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload() != nullptr); } void testChatControllerHighlightingNotificationTesting() { diff --git a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp index db9bcdc..80dbc32 100644 --- a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp @@ -84,7 +84,7 @@ public: directedPresenceSender_ = new DirectedPresenceSender(presenceSender_); uiEventStream_ = new UIEventStream(); avatarManager_ = new NullAvatarManager(); - TimerFactory* timerFactory = NULL; + TimerFactory* timerFactory = nullptr; window_ = new MockChatWindow(); mucRegistry_ = new MUCRegistry(); entityCapsProvider_ = new DummyEntityCapsProvider(); @@ -97,7 +97,7 @@ public: vcardManager_ = new VCardManager(self_, iqRouter_, vcardStorage_); clientBlockListManager_ = new ClientBlockListManager(iqRouter_); mucBookmarkManager_ = new MUCBookmarkManager(iqRouter_); - controller_ = new MUCController (self_, muc_, boost::optional(), nick_, stanzaChannel_, iqRouter_, chatWindowFactory_, presenceOracle_, avatarManager_, uiEventStream_, false, timerFactory, eventController_, entityCapsProvider_, NULL, NULL, mucRegistry_, highlightManager_, clientBlockListManager_, chatMessageParser_, false, NULL, vcardManager_, mucBookmarkManager_); + controller_ = new MUCController (self_, muc_, boost::optional(), nick_, stanzaChannel_, iqRouter_, chatWindowFactory_, presenceOracle_, avatarManager_, uiEventStream_, false, timerFactory, eventController_, entityCapsProvider_, nullptr, nullptr, mucRegistry_, highlightManager_, clientBlockListManager_, chatMessageParser_, false, nullptr, vcardManager_, mucBookmarkManager_); } void tearDown() { diff --git a/Swift/Controllers/Chat/UserSearchController.cpp b/Swift/Controllers/Chat/UserSearchController.cpp index 216488a..c1040f0 100644 --- a/Swift/Controllers/Chat/UserSearchController.cpp +++ b/Swift/Controllers/Chat/UserSearchController.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. */ @@ -40,8 +40,8 @@ UserSearchController::UserSearchController(Type type, const JID& jid, UIEventStr vcardManager_->onVCardChanged.connect(boost::bind(&UserSearchController::handleVCardChanged, this, _1, _2)); avatarManager_->onAvatarChanged.connect(boost::bind(&UserSearchController::handleAvatarChanged, this, _1)); presenceOracle_->onPresenceChange.connect(boost::bind(&UserSearchController::handlePresenceChanged, this, _1)); - window_ = NULL; - discoWalker_ = NULL; + window_ = nullptr; + discoWalker_ = nullptr; loadSavedDirectories(); } diff --git a/Swift/Controllers/ContactEditController.cpp b/Swift/Controllers/ContactEditController.cpp index 734ef79..d3106ed 100644 --- a/Swift/Controllers/ContactEditController.cpp +++ b/Swift/Controllers/ContactEditController.cpp @@ -20,7 +20,7 @@ namespace Swift { -ContactEditController::ContactEditController(RosterController* rosterController, VCardManager* vcardManager, ContactEditWindowFactory* contactEditWindowFactory, UIEventStream* uiEventStream) : rosterController(rosterController), vcardManager(vcardManager), contactEditWindowFactory(contactEditWindowFactory), uiEventStream(uiEventStream), contactEditWindow(NULL) { +ContactEditController::ContactEditController(RosterController* rosterController, VCardManager* vcardManager, ContactEditWindowFactory* contactEditWindowFactory, UIEventStream* uiEventStream) : rosterController(rosterController), vcardManager(vcardManager), contactEditWindowFactory(contactEditWindowFactory), uiEventStream(uiEventStream), contactEditWindow(nullptr) { uiEventStream->onUIEvent.connect(boost::bind(&ContactEditController::handleUIEvent, this, _1)); vcardManager->onVCardChanged.connect(boost::bind(&ContactEditController::handleVCardChanged, this, _1, _2)); } diff --git a/Swift/Controllers/FileTransfer/FileTransferController.cpp b/Swift/Controllers/FileTransfer/FileTransferController.cpp index fd13d99..c005705 100644 --- a/Swift/Controllers/FileTransfer/FileTransferController.cpp +++ b/Swift/Controllers/FileTransfer/FileTransferController.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. */ @@ -28,12 +28,12 @@ namespace Swift { FileTransferController::FileTransferController(const JID& receipient, const std::string& filename, FileTransferManager* fileTransferManager) : - sending(true), otherParty(receipient), filename(filename), ftManager(fileTransferManager), ftProgressInfo(0), chatWindow(0), currentState(FileTransfer::State::WaitingForStart) { + sending(true), otherParty(receipient), filename(filename), ftManager(fileTransferManager), ftProgressInfo(nullptr), chatWindow(nullptr), currentState(FileTransfer::State::WaitingForStart) { } FileTransferController::FileTransferController(IncomingFileTransfer::ref transfer) : - sending(false), otherParty(transfer->getSender()), filename(transfer->getFileName()), transfer(transfer), ftManager(0), ftProgressInfo(0), chatWindow(0), currentState(FileTransfer::State::WaitingForStart) { + sending(false), otherParty(transfer->getSender()), filename(transfer->getFileName()), transfer(transfer), ftManager(nullptr), ftProgressInfo(nullptr), chatWindow(nullptr), currentState(FileTransfer::State::WaitingForStart) { transfer->onStateChanged.connect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1)); } diff --git a/Swift/Controllers/FileTransferListController.cpp b/Swift/Controllers/FileTransferListController.cpp index a383ae5..8400e52 100644 --- a/Swift/Controllers/FileTransferListController.cpp +++ b/Swift/Controllers/FileTransferListController.cpp @@ -19,7 +19,7 @@ namespace Swift { -FileTransferListController::FileTransferListController(UIEventStream* uiEventStream, FileTransferListWidgetFactory* fileTransferListWidgetFactory) : fileTransferListWidgetFactory(fileTransferListWidgetFactory), fileTransferListWidget(NULL), fileTransferOverview(0) { +FileTransferListController::FileTransferListController(UIEventStream* uiEventStream, FileTransferListWidgetFactory* fileTransferListWidgetFactory) : fileTransferListWidgetFactory(fileTransferListWidgetFactory), fileTransferListWidget(nullptr), fileTransferOverview(nullptr) { uiEventStream->onUIEvent.connect(boost::bind(&FileTransferListController::handleUIEvent, this, _1)); } @@ -36,8 +36,8 @@ void FileTransferListController::setFileTransferOverview(FileTransferOverview *o void FileTransferListController::handleUIEvent(boost::shared_ptr rawEvent) { boost::shared_ptr event = boost::dynamic_pointer_cast(rawEvent); - if (event != NULL) { - if (fileTransferListWidget == NULL) { + if (event != nullptr) { + if (fileTransferListWidget == nullptr) { fileTransferListWidget = fileTransferListWidgetFactory->createFileTransferListWidget(); if (fileTransferOverview) { fileTransferListWidget->setFileTransferOverview(fileTransferOverview); diff --git a/Swift/Controllers/HighlightEditorController.cpp b/Swift/Controllers/HighlightEditorController.cpp index bf5dbc4..2c71e1d 100644 --- a/Swift/Controllers/HighlightEditorController.cpp +++ b/Swift/Controllers/HighlightEditorController.cpp @@ -23,7 +23,7 @@ namespace Swift { HighlightEditorController::HighlightEditorController(UIEventStream* uiEventStream, HighlightEditorWindowFactory* highlightEditorWindowFactory, HighlightManager* highlightManager) -: highlightEditorWindowFactory_(highlightEditorWindowFactory), highlightEditorWindow_(NULL), highlightManager_(highlightManager), contactSuggester_(0) +: highlightEditorWindowFactory_(highlightEditorWindowFactory), highlightEditorWindow_(nullptr), highlightManager_(highlightManager), contactSuggester_(nullptr) { uiEventStream->onUIEvent.connect(boost::bind(&HighlightEditorController::handleUIEvent, this, _1)); } @@ -31,7 +31,7 @@ HighlightEditorController::HighlightEditorController(UIEventStream* uiEventStrea HighlightEditorController::~HighlightEditorController() { delete highlightEditorWindow_; - highlightEditorWindow_ = NULL; + highlightEditorWindow_ = nullptr; } void HighlightEditorController::handleUIEvent(boost::shared_ptr rawEvent) diff --git a/Swift/Controllers/HistoryViewController.cpp b/Swift/Controllers/HistoryViewController.cpp index d0ccc66..827d7d6 100644 --- a/Swift/Controllers/HistoryViewController.cpp +++ b/Swift/Controllers/HistoryViewController.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * Licensed under the GNU General Public License. * See the COPYING file for more information. */ @@ -42,8 +42,8 @@ HistoryViewController::HistoryViewController( avatarManager_(avatarManager), presenceOracle_(presenceOracle), historyWindowFactory_(historyWindowFactory), - historyWindow_(NULL), - selectedItem_(NULL), + historyWindow_(nullptr), + selectedItem_(nullptr), currentResultDate_(boost::gregorian::not_a_date_time) { uiEventStream_->onUIEvent.connect(boost::bind(&HistoryViewController::handleUIEvent, this, _1)); @@ -72,8 +72,8 @@ HistoryViewController::~HistoryViewController() { void HistoryViewController::handleUIEvent(boost::shared_ptr rawEvent) { boost::shared_ptr event = boost::dynamic_pointer_cast(rawEvent); - if (event != NULL) { - if (historyWindow_ == NULL) { + if (event != nullptr) { + if (historyWindow_ == nullptr) { historyWindow_ = historyWindowFactory_->createHistoryWindow(uiEventStream_); historyWindow_->onSelectedContactChanged.connect(boost::bind(&HistoryViewController::handleSelectedContactChanged, this, _1)); historyWindow_->onReturnPressed.connect(boost::bind(&HistoryViewController::handleReturnPressed, this, _1)); @@ -266,7 +266,7 @@ void HistoryViewController::handlePreviousButtonClicked() { void HistoryViewController::reset() { roster_->removeAll(); contacts_.clear(); - selectedItem_ = NULL; + selectedItem_ = nullptr; historyWindow_->resetConversationView(); } diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index b48059c..e8cd012 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.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. */ @@ -121,33 +121,33 @@ MainController::MainController( settings_(settings), uriHandler_(uriHandler), idleDetector_(idleDetector), - loginWindow_(NULL) , + loginWindow_(nullptr) , useDelayForLatency_(useDelayForLatency), - ftOverview_(NULL), + ftOverview_(nullptr), emoticons_(emoticons) { - storages_ = NULL; - certificateStorage_ = NULL; - certificateTrustChecker_ = NULL; - statusTracker_ = NULL; - presenceNotifier_ = NULL; - eventNotifier_ = NULL; - rosterController_ = NULL; - chatsManager_ = NULL; - historyController_ = NULL; - historyViewController_ = NULL; - eventWindowController_ = NULL; - profileController_ = NULL; - blockListController_ = NULL; - showProfileController_ = NULL; - contactEditController_ = NULL; - userSearchControllerChat_ = NULL; - userSearchControllerAdd_ = NULL; - userSearchControllerInvite_ = NULL; - contactsFromRosterProvider_ = NULL; - contactSuggesterWithoutRoster_ = NULL; - contactSuggesterWithRoster_ = NULL; - whiteboardManager_ = NULL; - adHocManager_ = NULL; + storages_ = nullptr; + certificateStorage_ = nullptr; + certificateTrustChecker_ = nullptr; + statusTracker_ = nullptr; + presenceNotifier_ = nullptr; + eventNotifier_ = nullptr; + rosterController_ = nullptr; + chatsManager_ = nullptr; + historyController_ = nullptr; + historyViewController_ = nullptr; + eventWindowController_ = nullptr; + profileController_ = nullptr; + blockListController_ = nullptr; + showProfileController_ = nullptr; + contactEditController_ = nullptr; + userSearchControllerChat_ = nullptr; + userSearchControllerAdd_ = nullptr; + userSearchControllerInvite_ = nullptr; + contactsFromRosterProvider_ = nullptr; + contactSuggesterWithoutRoster_ = nullptr; + contactSuggesterWithRoster_ = nullptr; + whiteboardManager_ = nullptr; + adHocManager_ = nullptr; quitRequested_ = false; clientInitialized_ = false; offlineRequested_ = false; @@ -221,7 +221,7 @@ MainController::MainController( /* FIXME: deal with autologin with a cert*/ handleLoginRequest(selectedLoginJID, cachedPassword, cachedCertificate, CertificateWithKey::ref(), cachedOptions, true, true); } else { - profileSettings_ = NULL; + profileSettings_ = nullptr; } } @@ -255,58 +255,58 @@ void MainController::resetClient() { resetPendingReconnects(); vCardPhotoHash_.clear(); delete contactEditController_; - contactEditController_ = NULL; + contactEditController_ = nullptr; delete profileController_; - profileController_ = NULL; + profileController_ = nullptr; delete showProfileController_; - showProfileController_ = NULL; + showProfileController_ = nullptr; delete eventWindowController_; - eventWindowController_ = NULL; + eventWindowController_ = nullptr; delete chatsManager_; - chatsManager_ = NULL; + chatsManager_ = nullptr; #ifdef SWIFT_EXPERIMENTAL_HISTORY delete historyViewController_; - historyViewController_ = NULL; + historyViewController_ = nullptr; delete historyController_; - historyController_ = NULL; + historyController_ = nullptr; #endif - fileTransferListController_->setFileTransferOverview(NULL); + fileTransferListController_->setFileTransferOverview(nullptr); delete ftOverview_; - ftOverview_ = NULL; + ftOverview_ = nullptr; delete blockListController_; - blockListController_ = NULL; + blockListController_ = nullptr; delete rosterController_; - rosterController_ = NULL; + rosterController_ = nullptr; delete eventNotifier_; - eventNotifier_ = NULL; + eventNotifier_ = nullptr; delete presenceNotifier_; - presenceNotifier_ = NULL; + presenceNotifier_ = nullptr; delete certificateTrustChecker_; - certificateTrustChecker_ = NULL; + certificateTrustChecker_ = nullptr; delete certificateStorage_; - certificateStorage_ = NULL; + certificateStorage_ = nullptr; delete storages_; - storages_ = NULL; + storages_ = nullptr; delete statusTracker_; - statusTracker_ = NULL; + statusTracker_ = nullptr; delete profileSettings_; - profileSettings_ = NULL; + profileSettings_ = nullptr; delete userSearchControllerChat_; - userSearchControllerChat_ = NULL; + userSearchControllerChat_ = nullptr; delete userSearchControllerAdd_; - userSearchControllerAdd_ = NULL; + userSearchControllerAdd_ = nullptr; delete userSearchControllerInvite_; - userSearchControllerInvite_ = NULL; + userSearchControllerInvite_ = nullptr; delete contactSuggesterWithoutRoster_; - contactSuggesterWithoutRoster_ = NULL; + contactSuggesterWithoutRoster_ = nullptr; delete contactSuggesterWithRoster_; - contactSuggesterWithRoster_ = NULL; + contactSuggesterWithRoster_ = nullptr; delete contactsFromRosterProvider_; - contactsFromRosterProvider_ = NULL; + contactsFromRosterProvider_ = nullptr; delete adHocManager_; - adHocManager_ = NULL; + adHocManager_ = nullptr; delete whiteboardManager_; - whiteboardManager_ = NULL; + whiteboardManager_ = nullptr; clientInitialized_ = false; } @@ -341,7 +341,7 @@ void MainController::handleConnected() { purgeCachedCredentials(); } - bool freshLogin = rosterController_ == NULL; + bool freshLogin = rosterController_ == nullptr; myStatusLooksOnline_ = true; if (freshLogin) { profileController_ = new ProfileController(client_->getVCardManager(), uiFactory_, uiEventStream_); @@ -372,7 +372,7 @@ void MainController::handleConnected() { historyViewController_ = new HistoryViewController(jid_, uiEventStream_, historyController_, client_->getNickResolver(), client_->getAvatarManager(), client_->getPresenceOracle(), uiFactory_); chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, uiFactory_, uiFactory_, client_->getNickResolver(), client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, uiFactory_, useDelayForLatency_, networkFactories_->getTimerFactory(), client_->getMUCRegistry(), client_->getEntityCapsProvider(), client_->getMUCManager(), uiFactory_, profileSettings_, ftOverview_, client_->getRoster(), !settings_->getSetting(SettingConstants::REMEMBER_RECENT_CHATS), settings_, historyController_, whiteboardManager_, highlightManager_, client_->getClientBlockListManager(), emoticons_, client_->getVCardManager()); #else - chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, uiFactory_, uiFactory_, client_->getNickResolver(), client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, uiFactory_, useDelayForLatency_, networkFactories_->getTimerFactory(), client_->getMUCRegistry(), client_->getEntityCapsProvider(), client_->getMUCManager(), uiFactory_, profileSettings_, ftOverview_, client_->getRoster(), !settings_->getSetting(SettingConstants::REMEMBER_RECENT_CHATS), settings_, NULL, whiteboardManager_, highlightManager_, client_->getClientBlockListManager(), emoticons_, client_->getVCardManager()); + chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, uiFactory_, uiFactory_, client_->getNickResolver(), client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, uiFactory_, useDelayForLatency_, networkFactories_->getTimerFactory(), client_->getMUCRegistry(), client_->getEntityCapsProvider(), client_->getMUCManager(), uiFactory_, profileSettings_, ftOverview_, client_->getRoster(), !settings_->getSetting(SettingConstants::REMEMBER_RECENT_CHATS), settings_, nullptr, whiteboardManager_, highlightManager_, client_->getClientBlockListManager(), emoticons_, client_->getVCardManager()); #endif contactsFromRosterProvider_ = new ContactsFromXMPPRoster(client_->getRoster(), client_->getAvatarManager(), client_->getPresenceOracle()); contactSuggesterWithoutRoster_->addContactProvider(chatsManager_); diff --git a/Swift/Controllers/ProfileController.cpp b/Swift/Controllers/ProfileController.cpp index 756aaff..48a4c93 100644 --- a/Swift/Controllers/ProfileController.cpp +++ b/Swift/Controllers/ProfileController.cpp @@ -17,7 +17,7 @@ namespace Swift { -ProfileController::ProfileController(VCardManager* vcardManager, ProfileWindowFactory* profileWindowFactory, UIEventStream* uiEventStream) : vcardManager(vcardManager), profileWindowFactory(profileWindowFactory), uiEventStream(uiEventStream), available(true), profileWindow(NULL), gettingVCard(false) { +ProfileController::ProfileController(VCardManager* vcardManager, ProfileWindowFactory* profileWindowFactory, UIEventStream* uiEventStream) : vcardManager(vcardManager), profileWindowFactory(profileWindowFactory), uiEventStream(uiEventStream), available(true), profileWindow(nullptr), gettingVCard(false) { uiEventStream->onUIEvent.connect(boost::bind(&ProfileController::handleUIEvent, this, _1)); } @@ -92,7 +92,7 @@ void ProfileController::handleOwnVCardChanged(VCard::ref vcard) { } void ProfileController::handleProfileWindowAboutToBeClosed(const JID&) { - profileWindow = NULL; + profileWindow = nullptr; } void ProfileController::setAvailable(bool b) { diff --git a/Swift/Controllers/Roster/GroupRosterItem.cpp b/Swift/Controllers/Roster/GroupRosterItem.cpp index 82e43df..5aa3a5e 100644 --- a/Swift/Controllers/Roster/GroupRosterItem.cpp +++ b/Swift/Controllers/Roster/GroupRosterItem.cpp @@ -99,7 +99,7 @@ void GroupRosterItem::removeAll() { */ ContactRosterItem* GroupRosterItem::removeChild(const JID& jid) { std::vector::iterator it = children_.begin(); - ContactRosterItem* removed = NULL; + ContactRosterItem* removed = nullptr; while (it != children_.end()) { ContactRosterItem* contact = dynamic_cast(*it); if (contact && contact->getJID() == jid) { @@ -125,7 +125,7 @@ ContactRosterItem* GroupRosterItem::removeChild(const JID& jid) { GroupRosterItem* GroupRosterItem::removeGroupChild(const std::string& groupName) { std::vector::iterator it = children_.begin(); - GroupRosterItem* removed = NULL; + GroupRosterItem* removed = nullptr; while (it != children_.end()) { GroupRosterItem* group = dynamic_cast(*it); if (group && group->getDisplayName() == groupName) { diff --git a/Swift/Controllers/Roster/Roster.cpp b/Swift/Controllers/Roster/Roster.cpp index 2e68fd4..a5be13c 100644 --- a/Swift/Controllers/Roster/Roster.cpp +++ b/Swift/Controllers/Roster/Roster.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. */ @@ -25,7 +25,7 @@ namespace Swift { Roster::Roster(bool sortByStatus, bool fullJIDMapping) : blockingSupported_(false) { sortByStatus_ = sortByStatus; fullJIDMapping_ = fullJIDMapping; - root_ = new GroupRosterItem("Dummy-Root", NULL, sortByStatus_); + root_ = new GroupRosterItem("Dummy-Root", nullptr, sortByStatus_); root_->onChildrenChanged.connect(boost::bind(&Roster::handleChildrenChanged, this, root_)); } diff --git a/Swift/Controllers/Roster/RosterController.cpp b/Swift/Controllers/Roster/RosterController.cpp index e391f41..f863ed7 100644 --- a/Swift/Controllers/Roster/RosterController.cpp +++ b/Swift/Controllers/Roster/RosterController.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. */ @@ -96,7 +96,7 @@ RosterController::RosterController(const JID& jid, XMPPRoster* xmppRoster, Avata handleShowOfflineToggled(settings_->getSetting(SettingConstants::SHOW_OFFLINE)); - ownContact_ = boost::make_shared(myJID_.toBare(), myJID_.toBare(), nickManager_->getOwnNick(), static_cast(0)); + ownContact_ = boost::make_shared(myJID_.toBare(), myJID_.toBare(), nickManager_->getOwnNick(), static_cast(nullptr)); ownContact_->setVCard(vcardManager_->getVCard(myJID_.toBare())); ownContact_->setAvatarPath(pathToString(avatarManager_->getAvatarPath(myJID_.toBare()))); mainWindow_->setMyContactRosterItem(ownContact_); @@ -110,7 +110,7 @@ RosterController::~RosterController() { delete offlineFilter_; delete expandiness_; - mainWindow_->setRosterModel(NULL); + mainWindow_->setRosterModel(nullptr); if (mainWindow_->canDelete()) { delete mainWindow_; } diff --git a/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp b/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp index 551bd6b..91cc764 100644 --- a/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp +++ b/Swift/Controllers/Roster/UnitTest/RosterControllerTest.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. */ @@ -70,7 +70,7 @@ class RosterControllerTest : public CppUnit::TestFixture { avatarManager_ = new NullAvatarManager(); mainWindowFactory_ = new MockMainWindowFactory(); mucRegistry_ = new MUCRegistry(); - nickResolver_ = new NickResolver(jid_.toBare(), xmppRoster_, NULL, mucRegistry_); + nickResolver_ = new NickResolver(jid_.toBare(), xmppRoster_, nullptr, mucRegistry_); channel_ = new DummyIQChannel(); router_ = new IQRouter(channel_); stanzaChannel_ = new DummyStanzaChannel(); diff --git a/Swift/Controllers/Storages/FileStorages.cpp b/Swift/Controllers/Storages/FileStorages.cpp index 7ba2b0f..49f9ecf 100644 --- a/Swift/Controllers/Storages/FileStorages.cpp +++ b/Swift/Controllers/Storages/FileStorages.cpp @@ -25,7 +25,7 @@ FileStorages::FileStorages(const boost::filesystem::path& baseDir, const JID& ji #ifdef SWIFT_EXPERIMENTAL_HISTORY historyStorage = new SQLiteHistoryStorage(baseDir / "history.db"); #else - historyStorage = NULL; + historyStorage = nullptr; #endif } @@ -57,7 +57,7 @@ HistoryStorage* FileStorages::getHistoryStorage() const { #ifdef SWIFT_EXPERIMENTAL_HISTORY return historyStorage; #else - return NULL; + return nullptr; #endif } diff --git a/Swift/Controllers/UnitTest/MockChatWindow.h b/Swift/Controllers/UnitTest/MockChatWindow.h index b4588e7..e535eca 100644 --- a/Swift/Controllers/UnitTest/MockChatWindow.h +++ b/Swift/Controllers/UnitTest/MockChatWindow.h @@ -43,7 +43,7 @@ namespace Swift { virtual void replaceSystemMessage(const ChatMessage& /*message*/, const std::string& /*id*/, const TimestampBehaviour /*timestampBehaviour*/) {} // File transfer related stuff - virtual std::string addFileTransfer(const std::string& /*senderName*/, bool /*senderIsSelf*/,const std::string& /*filename*/, const boost::uintmax_t /*sizeInBytes*/, const std::string& /*description*/) { return 0; } + virtual std::string addFileTransfer(const std::string& /*senderName*/, bool /*senderIsSelf*/,const std::string& /*filename*/, const boost::uintmax_t /*sizeInBytes*/, const std::string& /*description*/) { return nullptr; } virtual void setFileTransferProgress(std::string /*id*/, const int /*alreadyTransferedBytes*/) { } virtual void setFileTransferStatus(std::string /*id*/, const FileTransferState /*state*/, const std::string& /*msg*/) { } diff --git a/Swift/Controllers/UnitTest/MockMainWindow.h b/Swift/Controllers/UnitTest/MockMainWindow.h index 9177bdc..43522ce 100644 --- a/Swift/Controllers/UnitTest/MockMainWindow.h +++ b/Swift/Controllers/UnitTest/MockMainWindow.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. */ @@ -12,7 +12,7 @@ namespace Swift { class Roster; class MockMainWindow : public MainWindow { public: - MockMainWindow() : roster(NULL) {} + MockMainWindow() : roster(nullptr) {} virtual ~MockMainWindow() {} virtual void setRosterModel(Roster* roster) {this->roster = roster;} virtual void setMyNick(const std::string& /*name*/) {} diff --git a/Swift/Controllers/UnitTest/MockMainWindowFactory.h b/Swift/Controllers/UnitTest/MockMainWindowFactory.h index 4af0c79..adf4fdf 100644 --- a/Swift/Controllers/UnitTest/MockMainWindowFactory.h +++ b/Swift/Controllers/UnitTest/MockMainWindowFactory.h @@ -13,7 +13,7 @@ namespace Swift { class MockMainWindowFactory : public MainWindowFactory { public: - MockMainWindowFactory() : last(NULL) {} + MockMainWindowFactory() : last(nullptr) {} virtual ~MockMainWindowFactory() {} diff --git a/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp b/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp index e1284fd..b3b364f 100644 --- a/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp +++ b/Swift/Controllers/UnitTest/PresenceNotifierTest.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. */ @@ -57,7 +57,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { user2 = JID("user2@foo.com/baz"); avatarManager = new DummyAvatarManager(); roster = new XMPPRosterImpl(); - nickResolver = new NickResolver(JID("foo@bar.com"), roster, NULL, mucRegistry); + nickResolver = new NickResolver(JID("foo@bar.com"), roster, nullptr, mucRegistry); presenceOracle = new PresenceOracle(stanzaChannel, roster); timerFactory = new DummyTimerFactory(); } diff --git a/Swift/Controllers/WhiteboardManager.cpp b/Swift/Controllers/WhiteboardManager.cpp index 91f01c8..9594be4 100644 --- a/Swift/Controllers/WhiteboardManager.cpp +++ b/Swift/Controllers/WhiteboardManager.cpp @@ -50,7 +50,7 @@ namespace Swift { WhiteboardWindow* WhiteboardManager::findWhiteboardWindow(const JID& contact) { if (whiteboardWindows_.find(contact.toBare()) == whiteboardWindows_.end()) { - return NULL; + return nullptr; } return whiteboardWindows_[contact.toBare()]; } @@ -71,7 +71,7 @@ namespace Swift { boost::shared_ptr showWindowEvent = boost::dynamic_pointer_cast(event); if (showWindowEvent) { WhiteboardWindow* window = findWhiteboardWindow(showWindowEvent->getContact()); - if (window != NULL) { + if (window != nullptr) { window->activateWindow(); } } @@ -93,7 +93,7 @@ namespace Swift { session->onRequestRejected.connect(boost::bind(&WhiteboardManager::handleRequestReject, this, _1)); WhiteboardWindow* window = findWhiteboardWindow(contact); - if (window == NULL) { + if (window == nullptr) { createNewWhiteboardWindow(contact, session); } else { window->setSession(session); @@ -113,7 +113,7 @@ namespace Swift { session->onRequestAccepted.connect(boost::bind(&WhiteboardManager::handleSessionAccept, this, _1)); WhiteboardWindow* window = findWhiteboardWindow(session->getTo()); - if (window == NULL) { + if (window == nullptr) { createNewWhiteboardWindow(session->getTo(), session); } else { window->setSession(session); @@ -132,7 +132,7 @@ namespace Swift { void WhiteboardManager::handleSessionAccept(const JID& contact) { WhiteboardWindow* window = findWhiteboardWindow(contact); - if (window != NULL) { + if (window != nullptr) { window->show(); } onRequestAccepted(contact); diff --git a/Swift/Controllers/XMLConsoleController.cpp b/Swift/Controllers/XMLConsoleController.cpp index 175a4eb..2d4ca0a 100644 --- a/Swift/Controllers/XMLConsoleController.cpp +++ b/Swift/Controllers/XMLConsoleController.cpp @@ -11,7 +11,7 @@ namespace Swift { -XMLConsoleController::XMLConsoleController(UIEventStream* uiEventStream, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory) : xmlConsoleWidgetFactory(xmlConsoleWidgetFactory), xmlConsoleWidget(NULL) { +XMLConsoleController::XMLConsoleController(UIEventStream* uiEventStream, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory) : xmlConsoleWidgetFactory(xmlConsoleWidgetFactory), xmlConsoleWidget(nullptr) { uiEventStream->onUIEvent.connect(boost::bind(&XMLConsoleController::handleUIEvent, this, _1)); } @@ -21,8 +21,8 @@ XMLConsoleController::~XMLConsoleController() { void XMLConsoleController::handleUIEvent(boost::shared_ptr rawEvent) { boost::shared_ptr event = boost::dynamic_pointer_cast(rawEvent); - if (event != NULL) { - if (xmlConsoleWidget == NULL) { + if (event != nullptr) { + if (xmlConsoleWidget == nullptr) { xmlConsoleWidget = xmlConsoleWidgetFactory->createXMLConsoleWidget(); } xmlConsoleWidget->show(); diff --git a/Swift/QtUI/ChatList/ChatListModel.cpp b/Swift/QtUI/ChatList/ChatListModel.cpp index 307cdea..e5e8963 100644 --- a/Swift/QtUI/ChatList/ChatListModel.cpp +++ b/Swift/QtUI/ChatList/ChatListModel.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,8 +16,8 @@ namespace Swift { -ChatListModel::ChatListModel() : whiteboards_(NULL) { - root_ = new ChatListGroupItem("", NULL, false); +ChatListModel::ChatListModel() : whiteboards_(nullptr) { + root_ = new ChatListGroupItem("", nullptr, false); mucBookmarks_ = new ChatListGroupItem(tr("Bookmarked Rooms"), root_); recents_ = new ChatListGroupItem(tr("Recent Chats"), root_, false); #ifdef SWIFT_EXPERIMENTAL_WB @@ -106,7 +106,7 @@ void ChatListModel::setRecents(const std::list& recents) { QMimeData* ChatListModel::mimeData(const QModelIndexList& indexes) const { QMimeData* data = QAbstractItemModel::mimeData(indexes); ChatListRecentItem *item = dynamic_cast(getItemForIndex(indexes.first())); - if (item == NULL) { + if (item == nullptr) { return data; } @@ -132,7 +132,7 @@ QMimeData* ChatListModel::mimeData(const QModelIndexList& indexes) const { } const ChatListMUCItem* ChatListModel::getChatListMUCItem(const JID& roomJID) const { - const ChatListMUCItem* mucItem = NULL; + const ChatListMUCItem* mucItem = nullptr; for (int i = 0; i < mucBookmarks_->rowCount(); i++) { ChatListMUCItem* item = dynamic_cast(mucBookmarks_->item(i)); if (item->getBookmark().getRoom() == roomJID) { @@ -148,7 +148,7 @@ int ChatListModel::columnCount(const QModelIndex& /*parent*/) const { } ChatListItem* ChatListModel::getItemForIndex(const QModelIndex& index) const { - return index.isValid() ? static_cast(index.internalPointer()) : NULL; + return index.isValid() ? static_cast(index.internalPointer()) : nullptr; } QVariant ChatListModel::data(const QModelIndex& index, int role) const { @@ -175,7 +175,7 @@ QModelIndex ChatListModel::parent(const QModelIndex& index) const { } int ChatListModel::rowCount(const QModelIndex& parentIndex) const { - ChatListGroupItem* parent = NULL; + ChatListGroupItem* parent = nullptr; if (parentIndex.isValid()) { parent = dynamic_cast(static_cast(parentIndex.internalPointer())); } else { diff --git a/Swift/QtUI/ChatList/QtChatListWindow.cpp b/Swift/QtUI/ChatList/QtChatListWindow.cpp index eddd0cd..1a121aa 100644 --- a/Swift/QtUI/ChatList/QtChatListWindow.cpp +++ b/Swift/QtUI/ChatList/QtChatListWindow.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. */ @@ -177,7 +177,7 @@ void QtChatListWindow::dragEnterEvent(QDragEnterEvent *event) { void QtChatListWindow::contextMenuEvent(QContextMenuEvent* event) { QModelIndex index = indexAt(event->pos()); - ChatListItem* baseItem = index.isValid() ? static_cast(index.internalPointer()) : NULL; + ChatListItem* baseItem = index.isValid() ? static_cast(index.internalPointer()) : nullptr; contextMenuItem_ = baseItem; foreach(QAction* action, onlineOnlyActions_) { @@ -203,7 +203,7 @@ void QtChatListWindow::contextMenuEvent(QContextMenuEvent* event) { const ChatListWindow::Chat& chat = recentItem->getChat(); if (chat.isMUC) { QMenu mucRecentsMenu; - QAction* bookmarkAction = NULL; + QAction* bookmarkAction = nullptr; const ChatListMUCItem* mucItem = model_->getChatListMUCItem(chat.jid); if (mucItem) { contextMenuItem_ = mucItem; diff --git a/Swift/QtUI/ChatList/QtChatListWindow.h b/Swift/QtUI/ChatList/QtChatListWindow.h index 61f8391..834e318 100644 --- a/Swift/QtUI/ChatList/QtChatListWindow.h +++ b/Swift/QtUI/ChatList/QtChatListWindow.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. */ @@ -19,7 +19,7 @@ namespace Swift { class QtChatListWindow : public QTreeView, public ChatListWindow { Q_OBJECT public: - QtChatListWindow(UIEventStream *uiEventStream, SettingsProvider* settings, QWidget* parent = NULL); + QtChatListWindow(UIEventStream *uiEventStream, SettingsProvider* settings, QWidget* parent = nullptr); virtual ~QtChatListWindow(); void addMUCBookmark(const MUCBookmark& bookmark); void removeMUCBookmark(const MUCBookmark& bookmark); diff --git a/Swift/QtUI/CocoaUIHelpers.mm b/Swift/QtUI/CocoaUIHelpers.mm index 16fe2ce..06a74aa 100644 --- a/Swift/QtUI/CocoaUIHelpers.mm +++ b/Swift/QtUI/CocoaUIHelpers.mm @@ -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 "CocoaUIHelpers.h" #include @@ -26,8 +32,8 @@ void CocoaUIHelpers::displayCertificateChainAsSheet(QWidget* parent, const std:: foreach(Certificate::ref cert, chain) { // convert chain to SecCertificateRef ByteArray certAsDER = cert->toDER(); - boost::shared_ptr::type> certData(CFDataCreate(NULL, certAsDER.data(), certAsDER.size()), CFRelease); - boost::shared_ptr macCert(SecCertificateCreateWithData(NULL, certData.get()), CFRelease); + boost::shared_ptr::type> certData(CFDataCreate(nullptr, certAsDER.data(), certAsDER.size()), CFRelease); + boost::shared_ptr macCert(SecCertificateCreateWithData(nullptr, certData.get()), CFRelease); // add to NSMutable array [certificates addObject: (id)macCert.get()]; @@ -36,7 +42,7 @@ void CocoaUIHelpers::displayCertificateChainAsSheet(QWidget* parent, const std:: SFCertificatePanel* panel = [[SFCertificatePanel alloc] init]; //[panel setPolicies:(id)policies.get()]; - [panel beginSheetForWindow:parentWindow modalDelegate:nil didEndSelector:NULL contextInfo:NULL certificates:certificates showGroup:YES]; + [panel beginSheetForWindow:parentWindow modalDelegate:nil didEndSelector:nullptr contextInfo:nullptr certificates:certificates showGroup:YES]; [certificates release]; } diff --git a/Swift/QtUI/EventViewer/EventModel.cpp b/Swift/QtUI/EventViewer/EventModel.cpp index 1568ec7..d830db9 100644 --- a/Swift/QtUI/EventViewer/EventModel.cpp +++ b/Swift/QtUI/EventViewer/EventModel.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. */ @@ -28,7 +28,7 @@ EventModel::~EventModel() { } QtEvent* EventModel::getItem(int row) const { - QtEvent* event = NULL; + QtEvent* event = nullptr; if (row < activeEvents_.size()) { event = activeEvents_[row]; } diff --git a/Swift/QtUI/MUCSearch/MUCSearchModel.cpp b/Swift/QtUI/MUCSearch/MUCSearchModel.cpp index af6f17f..2dbfc37 100644 --- a/Swift/QtUI/MUCSearch/MUCSearchModel.cpp +++ b/Swift/QtUI/MUCSearch/MUCSearchModel.cpp @@ -60,7 +60,7 @@ QModelIndex MUCSearchModel::parent(const QModelIndex& index) const { return QModelIndex(); } - MUCSearchServiceItem* parent = NULL; + MUCSearchServiceItem* parent = nullptr; if (MUCSearchRoomItem* roomItem = dynamic_cast(item)) { parent = roomItem->getParent(); } diff --git a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp index 03fa582..8bef7e4 100644 --- a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp +++ b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp @@ -187,7 +187,7 @@ MUCSearchRoomItem* QtMUCSearchWindow::getSelectedRoom() const { } } if (lstIndex.isEmpty()) { - return NULL; + return nullptr; } else { return dynamic_cast(static_cast(lstIndex.first().internalPointer())); diff --git a/Swift/QtUI/QtAdHocCommandWindow.cpp b/Swift/QtUI/QtAdHocCommandWindow.cpp index 87b1585..e638523 100644 --- a/Swift/QtUI/QtAdHocCommandWindow.cpp +++ b/Swift/QtUI/QtAdHocCommandWindow.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. */ @@ -20,7 +20,7 @@ const int FormLayoutIndex = 1; namespace Swift { QtAdHocCommandWindow::QtAdHocCommandWindow(boost::shared_ptr command) : command_(command) { - formWidget_ = NULL; + formWidget_ = nullptr; setAttribute(Qt::WA_DeleteOnClose); command->onNextStageReceived.connect(boost::bind(&QtAdHocCommandWindow::handleNextStageReceived, this, _1)); @@ -142,7 +142,7 @@ void QtAdHocCommandWindow::setForm(Form::ref form) { void QtAdHocCommandWindow::setNoForm(bool andHide) { form_.reset(); delete formWidget_; - formWidget_ = NULL; + formWidget_ = nullptr; resize(minimumSize()); setVisible(!andHide); } diff --git a/Swift/QtUI/QtAffiliationEditor.h b/Swift/QtUI/QtAffiliationEditor.h index 3b7e548..58e2497 100644 --- a/Swift/QtUI/QtAffiliationEditor.h +++ b/Swift/QtUI/QtAffiliationEditor.h @@ -20,7 +20,7 @@ namespace Swift { class QtAffiliationEditor : public QDialog { Q_OBJECT public: - QtAffiliationEditor(QWidget* parent = NULL); + QtAffiliationEditor(QWidget* parent = nullptr); ~QtAffiliationEditor(); void setAffiliations(MUCOccupant::Affiliation, const std::vector& jids); const std::vector >& getChanges() const; diff --git a/Swift/QtUI/QtBlockListEditorWindow.cpp b/Swift/QtUI/QtBlockListEditorWindow.cpp index 5b04b49..9e13943 100644 --- a/Swift/QtUI/QtBlockListEditorWindow.cpp +++ b/Swift/QtUI/QtBlockListEditorWindow.cpp @@ -73,7 +73,7 @@ class QtJIDValidatedItemDelegate : public QItemDelegate { } }; -QtBlockListEditorWindow::QtBlockListEditorWindow() : QWidget(), ui(new Ui::QtBlockListEditorWindow), removeItemDelegate(0), editItemDelegate(0) { +QtBlockListEditorWindow::QtBlockListEditorWindow() : QWidget(), ui(new Ui::QtBlockListEditorWindow), removeItemDelegate(nullptr), editItemDelegate(nullptr) { ui->setupUi(this); freshBlockListTemplate = tr("Double-click to add contact"); @@ -163,7 +163,7 @@ void QtBlockListEditorWindow::setCurrentBlockList(const std::vector &blocke item->setFlags(item->flags() | Qt::ItemIsEditable); ui->blockListTreeWidget->addTopLevelItem(item); } - handleItemChanged(0,0); + handleItemChanged(nullptr,0); } void QtBlockListEditorWindow::setBusy(bool isBusy) { diff --git a/Swift/QtUI/QtBookmarkDetailWindow.h b/Swift/QtUI/QtBookmarkDetailWindow.h index 19c6462..82e757d 100644 --- a/Swift/QtUI/QtBookmarkDetailWindow.h +++ b/Swift/QtUI/QtBookmarkDetailWindow.h @@ -18,7 +18,7 @@ namespace Swift { class QtBookmarkDetailWindow : public QDialog, protected Ui::QtBookmarkDetailWindow { Q_OBJECT public: - QtBookmarkDetailWindow(QWidget* parent = NULL); + QtBookmarkDetailWindow(QWidget* parent = nullptr); virtual bool commit() = 0; boost::optional createBookmarkFromForm(); diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp index 4a77ffd..3609cc9 100644 --- a/Swift/QtUI/QtChatTabs.cpp +++ b/Swift/QtUI/QtChatTabs.cpp @@ -33,7 +33,7 @@ #include namespace Swift { -QtChatTabs::QtChatTabs(bool singleWindow, SettingsProvider* settingsProvider, bool trellisMode) : QWidget(), singleWindow_(singleWindow), settingsProvider_(settingsProvider), trellisMode_(trellisMode), dynamicGrid_(NULL), gridSelectionDialog_(NULL) { +QtChatTabs::QtChatTabs(bool singleWindow, SettingsProvider* settingsProvider, bool trellisMode) : QWidget(), singleWindow_(singleWindow), settingsProvider_(settingsProvider), trellisMode_(trellisMode), dynamicGrid_(nullptr), gridSelectionDialog_(nullptr) { #ifndef Q_OS_MAC setWindowIcon(QIcon(":/logo-chat-16.png")); #else diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index 95d643c..6cb2292 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -65,11 +65,11 @@ QtChatWindow::QtChatWindow(const QString& contact, QtChatTheme* theme, UIEventSt settings_ = settings; unreadCount_ = 0; isOnline_ = true; - completer_ = NULL; - affiliationEditor_ = NULL; + completer_ = nullptr; + affiliationEditor_ = nullptr; theme_ = theme; isCorrection_ = false; - labelModel_ = NULL; + labelModel_ = nullptr; correctionEnabled_ = Maybe; fileTransferEnabled_ = Maybe; updateTitleWithUnreadCount(); @@ -559,7 +559,7 @@ void QtChatWindow::handleCursorPositionChanged() { } void QtChatWindow::show() { - if (parentWidget() == NULL) { + if (parentWidget() == nullptr) { QWidget::show(); } emit windowOpening(); @@ -685,14 +685,14 @@ void QtChatWindow::handleTextInputLostFocus() { void QtChatWindow::handleActionButtonClicked() { QMenu contextMenu; - QAction* changeSubject = NULL; - QAction* configure = NULL; - QAction* affiliations = NULL; - QAction* destroy = NULL; - QAction* invite = NULL; + QAction* changeSubject = nullptr; + QAction* configure = nullptr; + QAction* affiliations = nullptr; + QAction* destroy = nullptr; + QAction* invite = nullptr; - QAction* block = NULL; - QAction* unblock = NULL; + QAction* block = nullptr; + QAction* unblock = nullptr; if (availableRoomActions_.empty()) { if (blockingState_ == IsBlocked) { @@ -748,7 +748,7 @@ void QtChatWindow::handleActionButtonClicked() { } } - QAction* bookmark = NULL; + QAction* bookmark = nullptr; if (isMUC_) { if (roomBookmarkState_ == RoomNotBookmarked) { bookmark = contextMenu.addAction(tr("Bookmark this room...")); @@ -760,7 +760,7 @@ void QtChatWindow::handleActionButtonClicked() { } QAction* result = contextMenu.exec(QCursor::pos()); - if (result == NULL) { + if (result == nullptr) { /* Skip processing. Note that otherwise, because the actions could be null they could match */ } else if (result == changeSubject) { diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h index 2a23f5f..00693d2 100644 --- a/Swift/QtUI/QtChatWindow.h +++ b/Swift/QtUI/QtChatWindow.h @@ -45,7 +45,7 @@ namespace Swift { class LabelModel : public QAbstractListModel { Q_OBJECT public: - LabelModel(QObject* parent = NULL) : QAbstractListModel(parent) {} + LabelModel(QObject* parent = nullptr) : QAbstractListModel(parent) {} virtual int rowCount(const QModelIndex& /*index*/) const { return static_cast(availableLabels_.size()); diff --git a/Swift/QtUI/QtChatWindowFactory.cpp b/Swift/QtUI/QtChatWindowFactory.cpp index a97fd7c..9c59e9a 100644 --- a/Swift/QtUI/QtChatWindowFactory.cpp +++ b/Swift/QtUI/QtChatWindowFactory.cpp @@ -26,7 +26,7 @@ QtChatWindowFactory::QtChatWindowFactory(QtSingleWindow* splitter, SettingsProvi qtOnlySettings_ = qtSettings; settings_ = settings; tabs_ = tabs; - theme_ = NULL; + theme_ = nullptr; QtChatTabs* fullTabs = dynamic_cast(tabs_); if (splitter) { assert(fullTabs && "Netbook mode and no-tabs interface is not supported!"); diff --git a/Swift/QtUI/QtClosableLineEdit.h b/Swift/QtUI/QtClosableLineEdit.h index 206851b..0b195dd 100644 --- a/Swift/QtUI/QtClosableLineEdit.h +++ b/Swift/QtUI/QtClosableLineEdit.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -26,7 +26,7 @@ class QtClosableLineEdit : public QLineEdit { Q_OBJECT public: - QtClosableLineEdit(QWidget *parent = 0); + QtClosableLineEdit(QWidget *parent = nullptr); protected: void resizeEvent(QResizeEvent *); diff --git a/Swift/QtUI/QtColorToolButton.h b/Swift/QtUI/QtColorToolButton.h index 5260048..babafc5 100644 --- a/Swift/QtUI/QtColorToolButton.h +++ b/Swift/QtUI/QtColorToolButton.h @@ -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. + */ + #pragma once #include @@ -14,7 +20,7 @@ namespace Swift { Q_OBJECT Q_PROPERTY(QColor color READ getColor WRITE setColor NOTIFY colorChanged) public: - explicit QtColorToolButton(QWidget* parent = NULL); + explicit QtColorToolButton(QWidget* parent = nullptr); void setColor(const QColor& color); const QColor& getColor() const { return color_; } diff --git a/Swift/QtUI/QtContactEditWidget.cpp b/Swift/QtUI/QtContactEditWidget.cpp index ced9157..4e9a7fe 100644 --- a/Swift/QtUI/QtContactEditWidget.cpp +++ b/Swift/QtUI/QtContactEditWidget.cpp @@ -20,7 +20,7 @@ namespace Swift { -QtContactEditWidget::QtContactEditWidget(const std::set& allGroups, QWidget* parent) : QWidget(parent), nameRadioButton_(NULL), groups_(NULL) { +QtContactEditWidget::QtContactEditWidget(const std::set& allGroups, QWidget* parent) : QWidget(parent), nameRadioButton_(nullptr), groups_(nullptr) { QBoxLayout* layout = new QVBoxLayout(this); setContentsMargins(0,0,0,0); layout->setContentsMargins(0,0,0,0); @@ -116,7 +116,7 @@ void QtContactEditWidget::setNameSuggestions(const std::vector& sug throbberLabel_->hide(); // remove old suggestions except for the user input text field - QLayoutItem* suggestionItem = NULL; + QLayoutItem* suggestionItem = nullptr; while ((suggestionItem = suggestionsLayout_->itemAt(0)) && suggestionItem->widget() != name_) { QWidget* suggestionWidget = suggestionItem->widget(); suggestionsLayout_->removeWidget(suggestionWidget); @@ -131,7 +131,7 @@ void QtContactEditWidget::setNameSuggestions(const std::vector& sug nameRadioButton_ = new QRadioButton(tr("Name:"), this); suggestionsLayout_->insertWidget(nameLayout_->count(), nameRadioButton_); - QRadioButton* suggestedRadioButton = 0; + QRadioButton* suggestedRadioButton = nullptr; QList radioButtons = findChildren(); foreach (QRadioButton* candidate, radioButtons) { if (candidate->text() == name_->text()) { @@ -169,7 +169,7 @@ void QtContactEditWidget::clear() { delete layoutItem->widget(); delete layoutItem; } - nameRadioButton_ = NULL; + nameRadioButton_ = nullptr; } } diff --git a/Swift/QtUI/QtContactEditWindow.cpp b/Swift/QtUI/QtContactEditWindow.cpp index 214f256..138a356 100644 --- a/Swift/QtUI/QtContactEditWindow.cpp +++ b/Swift/QtUI/QtContactEditWindow.cpp @@ -23,7 +23,7 @@ namespace Swift { -QtContactEditWindow::QtContactEditWindow() : contactEditWidget_(NULL) { +QtContactEditWindow::QtContactEditWindow() : contactEditWidget_(nullptr) { resize(400,300); setWindowTitle(tr("Edit contact")); setContentsMargins(0,0,0,0); diff --git a/Swift/QtUI/QtElidingLabel.h b/Swift/QtUI/QtElidingLabel.h index 9f590a8..e10c39c 100644 --- a/Swift/QtUI/QtElidingLabel.h +++ b/Swift/QtUI/QtElidingLabel.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. */ @@ -12,8 +12,8 @@ namespace Swift { class QtElidingLabel : public QLabel { Q_OBJECT public: - QtElidingLabel(QWidget* parent = NULL, Qt::WindowFlags f = 0); - QtElidingLabel(const QString &text, QWidget* parent = NULL, Qt::WindowFlags f = 0); + QtElidingLabel(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::Widget); + QtElidingLabel(const QString &text, QWidget* parent = nullptr, Qt::WindowFlags f = Qt::Widget); void setText(const QString& text); virtual ~QtElidingLabel(); diff --git a/Swift/QtUI/QtEmoticonCell.h b/Swift/QtUI/QtEmoticonCell.h index e408a83..669d1ed 100644 --- a/Swift/QtUI/QtEmoticonCell.h +++ b/Swift/QtUI/QtEmoticonCell.h @@ -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. + */ + #pragma once #include @@ -21,7 +27,7 @@ namespace Swift { class QtEmoticonCell : public QLabel { Q_OBJECT public: - QtEmoticonCell(const QString emoticonAsText, QString filePath, QWidget* parent = 0); + QtEmoticonCell(const QString emoticonAsText, QString filePath, QWidget* parent = nullptr); ~QtEmoticonCell(); virtual void mousePressEvent(QMouseEvent* event); diff --git a/Swift/QtUI/QtEmoticonsGrid.h b/Swift/QtUI/QtEmoticonsGrid.h index 0cae9ab..b3b8ac3 100644 --- a/Swift/QtUI/QtEmoticonsGrid.h +++ b/Swift/QtUI/QtEmoticonsGrid.h @@ -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. + */ + #pragma once #include @@ -23,7 +29,7 @@ namespace Swift { class QtEmoticonsGrid : public QGridLayout { Q_OBJECT public: - explicit QtEmoticonsGrid(const std::map& emoticons, QWidget* parent = 0); + explicit QtEmoticonsGrid(const std::map& emoticons, QWidget* parent = nullptr); virtual ~QtEmoticonsGrid(); signals: diff --git a/Swift/QtUI/QtFileTransferListItemModel.cpp b/Swift/QtUI/QtFileTransferListItemModel.cpp index d26733b..d070391 100644 --- a/Swift/QtUI/QtFileTransferListItemModel.cpp +++ b/Swift/QtUI/QtFileTransferListItemModel.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. */ @@ -25,7 +25,7 @@ namespace Swift { -QtFileTransferListItemModel::QtFileTransferListItemModel(QObject *parent) : QAbstractItemModel(parent), fileTransferOverview(0) { +QtFileTransferListItemModel::QtFileTransferListItemModel(QObject *parent) : QAbstractItemModel(parent), fileTransferOverview(nullptr) { } QtFileTransferListItemModel::~QtFileTransferListItemModel() { @@ -137,7 +137,7 @@ int QtFileTransferListItemModel::rowCount(const QModelIndex& /* parent */) const } QModelIndex QtFileTransferListItemModel::index(int row, int column, const QModelIndex& /* parent */) const { - return createIndex(row, column, static_cast(0)); + return createIndex(row, column, static_cast(nullptr)); } } diff --git a/Swift/QtUI/QtFileTransferListItemModel.h b/Swift/QtUI/QtFileTransferListItemModel.h index d0e0e42..4d1e48b 100644 --- a/Swift/QtUI/QtFileTransferListItemModel.h +++ b/Swift/QtUI/QtFileTransferListItemModel.h @@ -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. */ @@ -22,7 +22,7 @@ class FileTransferOverview; class QtFileTransferListItemModel : public QAbstractItemModel { Q_OBJECT public: - explicit QtFileTransferListItemModel(QObject *parent = 0); + explicit QtFileTransferListItemModel(QObject *parent = nullptr); virtual ~QtFileTransferListItemModel(); void setFileTransferOverview(FileTransferOverview*); diff --git a/Swift/QtUI/QtFileTransferListWidget.cpp b/Swift/QtUI/QtFileTransferListWidget.cpp index f67b510..8b855b0 100644 --- a/Swift/QtUI/QtFileTransferListWidget.cpp +++ b/Swift/QtUI/QtFileTransferListWidget.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. */ @@ -25,7 +25,7 @@ namespace Swift { -QtFileTransferListWidget::QtFileTransferListWidget() : fileTransferOverview(0) { +QtFileTransferListWidget::QtFileTransferListWidget() : fileTransferOverview(nullptr) { QVBoxLayout* layout = new QVBoxLayout(this); layout->setSpacing(0); layout->setContentsMargins(0,0,0,0); @@ -58,7 +58,7 @@ QtFileTransferListWidget::QtFileTransferListWidget() : fileTransferOverview(0) { QtFileTransferListWidget::~QtFileTransferListWidget() { if (fileTransferOverview) { fileTransferOverview->onFileTransferListChanged.disconnect(boost::bind(&QtFileTransferListWidget::handleFileTransferListChanged, this)); - fileTransferOverview = NULL; + fileTransferOverview = nullptr; } delete itemModel; } @@ -89,7 +89,7 @@ void QtFileTransferListWidget::activate() { void QtFileTransferListWidget::setFileTransferOverview(FileTransferOverview *overview) { if (fileTransferOverview) { fileTransferOverview->onFileTransferListChanged.disconnect(boost::bind(&QtFileTransferListWidget::handleFileTransferListChanged, this)); - fileTransferOverview = NULL; + fileTransferOverview = nullptr; } if (overview) { fileTransferOverview = overview; diff --git a/Swift/QtUI/QtFormWidget.cpp b/Swift/QtUI/QtFormWidget.cpp index 13049ca..31f9a10 100644 --- a/Swift/QtUI/QtFormWidget.cpp +++ b/Swift/QtUI/QtFormWidget.cpp @@ -103,7 +103,7 @@ QListWidget* QtFormWidget::createList(FormField::ref field) { } QWidget* QtFormWidget::createWidget(FormField::ref field, const FormField::Type type, const size_t index) { - QWidget* widget = NULL; + QWidget* widget = nullptr; if (type == FormField::BooleanType) { QCheckBox* checkWidget = new QCheckBox(this); checkWidget->setCheckState(field->getBoolValue() ? Qt::Checked : Qt::Unchecked); @@ -226,7 +226,7 @@ void QtFormWidget::setEditable(bool editable) { return; } foreach (boost::shared_ptr field, form_->getFields()) { - QWidget* widget = NULL; + QWidget* widget = nullptr; if (field) { widget = fields_[field->getName()]; } diff --git a/Swift/QtUI/QtFormWidget.h b/Swift/QtUI/QtFormWidget.h index 1eec115..f228ccb 100644 --- a/Swift/QtUI/QtFormWidget.h +++ b/Swift/QtUI/QtFormWidget.h @@ -19,7 +19,7 @@ namespace Swift { class QtFormWidget : public QWidget { Q_OBJECT public: - QtFormWidget(Form::ref form, QWidget* parent = NULL); + QtFormWidget(Form::ref form, QWidget* parent = nullptr); virtual ~QtFormWidget(); Form::ref getCompletedForm(); void setEditable(bool editable); diff --git a/Swift/QtUI/QtHighlightEditor.h b/Swift/QtUI/QtHighlightEditor.h index 2a9f06b..845b11b 100644 --- a/Swift/QtUI/QtHighlightEditor.h +++ b/Swift/QtUI/QtHighlightEditor.h @@ -27,7 +27,7 @@ namespace Swift { Q_OBJECT public: - QtHighlightEditor(QtSettingsProvider* settings, QWidget* parent = NULL); + QtHighlightEditor(QtSettingsProvider* settings, QWidget* parent = nullptr); virtual ~QtHighlightEditor(); virtual void show(); diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp index 5ed8114..035e73f 100644 --- a/Swift/QtUI/QtHistoryWindow.cpp +++ b/Swift/QtUI/QtHistoryWindow.cpp @@ -50,7 +50,7 @@ QtHistoryWindow::QtHistoryWindow(SettingsProvider* settings, UIEventStream* even idCounter_ = 0; delete ui_.conversation_; - conversation_ = new QtWebKitChatView(NULL, NULL, theme_, this, true); // Horrible unsafe. Do not do this. FIXME + conversation_ = new QtWebKitChatView(nullptr, nullptr, theme_, this, true); // Horrible unsafe. Do not do this. FIXME QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); sizePolicy.setHorizontalStretch(80); sizePolicy.setVerticalStretch(0); diff --git a/Swift/QtUI/QtLineEdit.h b/Swift/QtUI/QtLineEdit.h index 557f025..851a2ff 100644 --- a/Swift/QtUI/QtLineEdit.h +++ b/Swift/QtUI/QtLineEdit.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. */ @@ -12,7 +12,7 @@ namespace Swift { class QtLineEdit : public QLineEdit { Q_OBJECT public: - QtLineEdit(QWidget* parent = NULL); + QtLineEdit(QWidget* parent = nullptr); signals: void escapePressed(); protected: diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index 5f15f4c..11458f0 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.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. */ @@ -176,7 +176,7 @@ QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream, SettingsProvider* set connect(loginButton_, SIGNAL(clicked()), SLOT(loginClicked())); stack_->addWidget(loginWidgetWrapper_); #ifdef SWIFTEN_PLATFORM_MACOSX - menuBar_ = new QMenuBar(NULL); + menuBar_ = new QMenuBar(nullptr); #else menuBar_ = menuBar(); #endif diff --git a/Swift/QtUI/QtMUCConfigurationWindow.cpp b/Swift/QtUI/QtMUCConfigurationWindow.cpp index 629e94f..e07b8c6 100644 --- a/Swift/QtUI/QtMUCConfigurationWindow.cpp +++ b/Swift/QtUI/QtMUCConfigurationWindow.cpp @@ -25,7 +25,7 @@ QtMUCConfigurationWindow::QtMUCConfigurationWindow(Form::ref form) : closed_(fal //label->setText(tr("Room configuration")); //layout->addWidget(label); - formWidget_ = NULL; + formWidget_ = nullptr; formWidget_ = new QtFormWidget(form, this); layout->addWidget(formWidget_); diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp index d61026a..e351bd3 100644 --- a/Swift/QtUI/QtMainWindow.cpp +++ b/Swift/QtUI/QtMainWindow.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. */ @@ -97,7 +97,7 @@ QtMainWindow::QtMainWindow(SettingsProvider* settings, UIEventStream* uiEventStr connect(tabs_, SIGNAL(currentChanged(int)), this, SLOT(handleTabChanged(int))); - tabBarCombo_ = NULL; + tabBarCombo_ = nullptr; if (settings_->getSetting(QtUISettingConstants::USE_SCREENREADER)) { tabs_->tabBar()->hide(); tabBarCombo_ = new QComboBox(this); diff --git a/Swift/QtUI/QtPlainChatView.cpp b/Swift/QtUI/QtPlainChatView.cpp index 9dc815a..fc53666 100644 --- a/Swift/QtUI/QtPlainChatView.cpp +++ b/Swift/QtUI/QtPlainChatView.cpp @@ -343,7 +343,7 @@ void QtPlainChatView::rejectMUCInvite() } QtPlainChatView::FileTransfer::FileTransfer(QtPlainChatView* parent, bool senderIsSelf, const std::string& ftId, const std::string& filename, const ChatWindow::FileTransferState state, const std::string &desc, const std::string& msg, bool initializing) -: PopupDialog(parent), bar_(0), senderIsSelf_(senderIsSelf), ftId_(ftId), filename_(filename), description_(desc), message_(msg), initializing_(initializing) +: PopupDialog(parent), bar_(nullptr), senderIsSelf_(senderIsSelf), ftId_(ftId), filename_(filename), description_(desc), message_(msg), initializing_(initializing) { QHBoxLayout* layout = new QHBoxLayout; QLabel* statusLabel = new QLabel; diff --git a/Swift/QtUI/QtRosterHeader.cpp b/Swift/QtUI/QtRosterHeader.cpp index f8a4cdb..56c3104 100644 --- a/Swift/QtUI/QtRosterHeader.cpp +++ b/Swift/QtUI/QtRosterHeader.cpp @@ -27,7 +27,7 @@ #include namespace Swift { -QtRosterHeader::QtRosterHeader(SettingsProvider* settings, StatusCache* statusCache, QWidget* parent) : QWidget(parent), statusEdit_(NULL) { +QtRosterHeader::QtRosterHeader(SettingsProvider* settings, StatusCache* statusCache, QWidget* parent) : QWidget(parent), statusEdit_(nullptr) { QHBoxLayout* topLayout = new QHBoxLayout(); topLayout->setSpacing(3); topLayout->setContentsMargins(4,4,4,4); diff --git a/Swift/QtUI/QtRosterHeader.h b/Swift/QtUI/QtRosterHeader.h index b556504..7447c88 100644 --- a/Swift/QtUI/QtRosterHeader.h +++ b/Swift/QtUI/QtRosterHeader.h @@ -33,7 +33,7 @@ namespace Swift { class QtRosterHeader : public QWidget { Q_OBJECT public: - QtRosterHeader(SettingsProvider* settings, StatusCache* statusCache, QWidget* parent = NULL); + QtRosterHeader(SettingsProvider* settings, StatusCache* statusCache, QWidget* parent = nullptr); void setAvatar(const QString& path); void setJID(const QString& jid); diff --git a/Swift/QtUI/QtSpellCheckerWindow.h b/Swift/QtUI/QtSpellCheckerWindow.h index 95e0725..846dcbb 100644 --- a/Swift/QtUI/QtSpellCheckerWindow.h +++ b/Swift/QtUI/QtSpellCheckerWindow.h @@ -21,7 +21,7 @@ namespace Swift { class QtSpellCheckerWindow : public QDialog, protected Ui::QtSpellCheckerWindow { Q_OBJECT public: - QtSpellCheckerWindow(SettingsProvider* settings, QWidget* parent = NULL); + QtSpellCheckerWindow(SettingsProvider* settings, QWidget* parent = nullptr); public slots: void handleChecker(bool state); void handleCancel(); diff --git a/Swift/QtUI/QtSubscriptionRequestWindow.h b/Swift/QtUI/QtSubscriptionRequestWindow.h index 1a36e19..83c6333 100644 --- a/Swift/QtUI/QtSubscriptionRequestWindow.h +++ b/Swift/QtUI/QtSubscriptionRequestWindow.h @@ -16,7 +16,7 @@ namespace Swift { class QtSubscriptionRequestWindow : public QDialog { Q_OBJECT public: - static QtSubscriptionRequestWindow* getWindow(boost::shared_ptr event, QWidget* parent = 0); + static QtSubscriptionRequestWindow* getWindow(boost::shared_ptr event, QWidget* parent = nullptr); ~QtSubscriptionRequestWindow(); boost::shared_ptr getEvent(); private slots: @@ -24,7 +24,7 @@ namespace Swift { void handleNo(); void handleDefer(); private: - QtSubscriptionRequestWindow(boost::shared_ptr event, QWidget* parent = 0); + QtSubscriptionRequestWindow(boost::shared_ptr event, QWidget* parent = nullptr); static QList windows_; boost::shared_ptr event_; /*QPushButton* yesButton_; diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index 5e8d61c..2fa2407 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.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. */ @@ -136,7 +136,7 @@ void QtSwift::loadEmoticonsFile(const QString& fileName, std::map 0; - tabs_ = NULL; + tabs_ = nullptr; if (options.count("no-tabs") && !splitter_) { tabs_ = new QtChatTabsShortcutOnlySubstitute(); } else { - tabs_ = new QtChatTabs(splitter_ != NULL, settingsHierachy_, options.count("trellis")); + tabs_ = new QtChatTabs(splitter_ != nullptr, settingsHierachy_, options.count("trellis")); } bool startMinimized = options.count("start-minimized") > 0; applicationPathProvider_ = new PlatformApplicationPathProvider(SWIFT_APPLICATION_NAME); diff --git a/Swift/QtUI/QtSystemTray.cpp b/Swift/QtUI/QtSystemTray.cpp index 55a7d43..d9bfbc3 100644 --- a/Swift/QtUI/QtSystemTray.cpp +++ b/Swift/QtUI/QtSystemTray.cpp @@ -19,7 +19,7 @@ #include namespace Swift { -QtSystemTray::QtSystemTray() : QObject(), statusType_(StatusShow::None), trayMenu_(0), onlineIcon_(":icons/online.png"), awayIcon_(":icons/away.png"), dndIcon_(":icons/dnd.png"), offlineIcon_(":icons/offline.png"), newMessageIcon_(":icons/new-chat.png"), throbberMovie_(":/icons/connecting.mng"), unreadMessages_(false), connecting_(false) { +QtSystemTray::QtSystemTray() : QObject(), statusType_(StatusShow::None), trayMenu_(nullptr), onlineIcon_(":icons/online.png"), awayIcon_(":icons/away.png"), dndIcon_(":icons/dnd.png"), offlineIcon_(":icons/offline.png"), newMessageIcon_(":icons/new-chat.png"), throbberMovie_(":/icons/connecting.mng"), unreadMessages_(false), connecting_(false) { trayIcon_ = new QSystemTrayIcon(offlineIcon_); trayIcon_->setToolTip("Swift"); connect(trayIcon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(handleIconActivated(QSystemTrayIcon::ActivationReason))); diff --git a/Swift/QtUI/QtTextEdit.cpp b/Swift/QtUI/QtTextEdit.cpp index d3ba914..e0ca619 100644 --- a/Swift/QtUI/QtTextEdit.cpp +++ b/Swift/QtUI/QtTextEdit.cpp @@ -29,7 +29,7 @@ namespace Swift { -QtTextEdit::QtTextEdit(SettingsProvider* settings, QWidget* parent) : QTextEdit(parent), checker_(NULL), highlighter_(NULL) { +QtTextEdit::QtTextEdit(SettingsProvider* settings, QWidget* parent) : QTextEdit(parent), checker_(nullptr), highlighter_(nullptr) { connect(this, SIGNAL(textChanged()), this, SLOT(handleTextChanged())); settings_ = settings; #ifdef HAVE_SPELLCHECKER @@ -182,9 +182,9 @@ void QtTextEdit::addSuggestions(QMenu* menu, QContextMenuEvent* event) void QtTextEdit::setUpSpellChecker() { delete highlighter_; - highlighter_ = NULL; + highlighter_ = nullptr; delete checker_; - checker_ = NULL; + checker_ = nullptr; if (settings_->getSetting(SettingConstants::SPELL_CHECKER)) { std::string dictPath = settings_->getSetting(SettingConstants::DICT_PATH); std::string dictFile = settings_->getSetting(SettingConstants::DICT_FILE); diff --git a/Swift/QtUI/QtTextEdit.h b/Swift/QtUI/QtTextEdit.h index f03699b..0c2b740 100644 --- a/Swift/QtUI/QtTextEdit.h +++ b/Swift/QtUI/QtTextEdit.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. */ @@ -23,7 +23,7 @@ namespace Swift { class QtTextEdit : public QTextEdit { Q_OBJECT public: - QtTextEdit(SettingsProvider* settings, QWidget* parent = 0); + QtTextEdit(SettingsProvider* settings, QWidget* parent = nullptr); virtual ~QtTextEdit(); virtual QSize sizeHint() const; diff --git a/Swift/QtUI/QtTranslator.h b/Swift/QtUI/QtTranslator.h index 4254324..cdb259f 100644 --- a/Swift/QtUI/QtTranslator.h +++ b/Swift/QtUI/QtTranslator.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -17,7 +17,7 @@ class QtTranslator : public Swift::Translator { virtual std::string translate(const std::string& text, const std::string& context) { #if QT_VERSION >= 0x050000 - return std::string(QCoreApplication::translate(context.c_str(), text.c_str(), 0).toUtf8()); + return std::string(QCoreApplication::translate(context.c_str(), text.c_str(), nullptr).toUtf8()); #else return std::string(QCoreApplication::translate(context.c_str(), text.c_str(), 0, QCoreApplication::UnicodeUTF8).toUtf8()); #endif diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp index a1321bd..3318c21 100644 --- a/Swift/QtUI/QtUIFactory.cpp +++ b/Swift/QtUI/QtUIFactory.cpp @@ -38,7 +38,7 @@ namespace Swift { -QtUIFactory::QtUIFactory(SettingsProviderHierachy* settings, QtSettingsProvider* qtOnlySettings, QtChatTabsBase* tabs, QtSingleWindow* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, TimerFactory* timerFactory, StatusCache* statusCache, bool startMinimized, bool emoticonsExist, bool enableAdHocCommandOnJID) : settings(settings), qtOnlySettings(qtOnlySettings), tabsBase(tabs), netbookSplitter(netbookSplitter), systemTray(systemTray), chatWindowFactory(chatWindowFactory), timerFactory_(timerFactory), lastMainWindow(NULL), loginWindow(NULL), statusCache(statusCache), startMinimized(startMinimized), emoticonsExist_(emoticonsExist), enableAdHocCommandOnJID_(enableAdHocCommandOnJID) { +QtUIFactory::QtUIFactory(SettingsProviderHierachy* settings, QtSettingsProvider* qtOnlySettings, QtChatTabsBase* tabs, QtSingleWindow* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, TimerFactory* timerFactory, StatusCache* statusCache, bool startMinimized, bool emoticonsExist, bool enableAdHocCommandOnJID) : settings(settings), qtOnlySettings(qtOnlySettings), tabsBase(tabs), netbookSplitter(netbookSplitter), systemTray(systemTray), chatWindowFactory(chatWindowFactory), timerFactory_(timerFactory), lastMainWindow(nullptr), loginWindow(nullptr), statusCache(statusCache), startMinimized(startMinimized), emoticonsExist_(emoticonsExist), enableAdHocCommandOnJID_(enableAdHocCommandOnJID) { chatFontSize = settings->getSetting(QtUISettingConstants::CHATWINDOW_FONT_SIZE); historyFontSize_ = settings->getSetting(QtUISettingConstants::HISTORYWINDOW_FONT_SIZE); this->tabs = dynamic_cast(tabsBase); diff --git a/Swift/QtUI/QtVCardWidget/QtCloseButton.cpp b/Swift/QtUI/QtVCardWidget/QtCloseButton.cpp index ec7941c..da4f22f 100644 --- a/Swift/QtUI/QtVCardWidget/QtCloseButton.cpp +++ b/Swift/QtUI/QtVCardWidget/QtCloseButton.cpp @@ -24,7 +24,7 @@ QtCloseButton::QtCloseButton(QWidget *parent) : QAbstractButton(parent) { } QSize QtCloseButton::sizeHint() const { - return QSize(style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, 0, 0), style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, 0, 0)); + return QSize(style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, nullptr, nullptr), style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, nullptr, nullptr)); } bool QtCloseButton::event(QEvent *e) { diff --git a/Swift/QtUI/QtVCardWidget/QtCloseButton.h b/Swift/QtUI/QtVCardWidget/QtCloseButton.h index 1ba31a0..0c6e192 100644 --- a/Swift/QtUI/QtVCardWidget/QtCloseButton.h +++ b/Swift/QtUI/QtVCardWidget/QtCloseButton.h @@ -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. + */ + #pragma once #include @@ -13,7 +19,7 @@ namespace Swift { class QtCloseButton : public QAbstractButton { Q_OBJECT public: - explicit QtCloseButton(QWidget *parent = 0); + explicit QtCloseButton(QWidget *parent = nullptr); virtual QSize sizeHint() const; protected: diff --git a/Swift/QtUI/QtVCardWidget/QtRemovableItemDelegate.cpp b/Swift/QtUI/QtVCardWidget/QtRemovableItemDelegate.cpp index 67c79a9..079f77d 100644 --- a/Swift/QtUI/QtVCardWidget/QtRemovableItemDelegate.cpp +++ b/Swift/QtUI/QtVCardWidget/QtRemovableItemDelegate.cpp @@ -36,7 +36,7 @@ void QtRemovableItemDelegate::paint(QPainter* painter, const QStyleOptionViewIte if (index.data().toString().isEmpty()) { #ifdef SWIFTEN_PLATFORM_MACOSX // workaround for Qt not painting relative to the cell we're in, on OS X - int height = style->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, 0, 0); + int height = style->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, nullptr, nullptr); painter->translate(option.rect.x(), option.rect.y() + (option.rect.height() - height)/2); #endif style->drawPrimitive(QStyle::PE_IndicatorTabClose, &opt, painter); @@ -45,7 +45,7 @@ void QtRemovableItemDelegate::paint(QPainter* painter, const QStyleOptionViewIte } QWidget* QtRemovableItemDelegate::createEditor(QWidget*, const QStyleOptionViewItem&, const QModelIndex&) const { - return NULL; + return nullptr; } bool QtRemovableItemDelegate::editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index) { @@ -58,7 +58,7 @@ bool QtRemovableItemDelegate::editorEvent(QEvent* event, QAbstractItemModel* mod } QSize QtRemovableItemDelegate::sizeHint(const QStyleOptionViewItem&, const QModelIndex&) const { - QSize size(style->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, 0, 0) + 2, style->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, 0, 0) + 2); + QSize size(style->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, nullptr, nullptr) + 2, style->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, nullptr, nullptr) + 2); return size; } diff --git a/Swift/QtUI/QtVCardWidget/QtResizableLineEdit.h b/Swift/QtUI/QtVCardWidget/QtResizableLineEdit.h index 47c6f3e..eab5b2b 100644 --- a/Swift/QtUI/QtVCardWidget/QtResizableLineEdit.h +++ b/Swift/QtUI/QtVCardWidget/QtResizableLineEdit.h @@ -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. + */ + #pragma once #include @@ -15,7 +21,7 @@ namespace Swift { Q_PROPERTY(bool editable READ isEditable WRITE setEditable) public: - explicit QtResizableLineEdit(QWidget* parent = 0); + explicit QtResizableLineEdit(QWidget* parent = nullptr); ~QtResizableLineEdit(); bool isEditable() const; diff --git a/Swift/QtUI/QtVCardWidget/QtTagComboBox.h b/Swift/QtUI/QtVCardWidget/QtTagComboBox.h index f08f136..e9dbbdd 100644 --- a/Swift/QtUI/QtVCardWidget/QtTagComboBox.h +++ b/Swift/QtUI/QtVCardWidget/QtTagComboBox.h @@ -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. + */ + #pragma once #include @@ -18,7 +24,7 @@ class QtTagComboBox : public QComboBox { Q_PROPERTY(bool editable READ isEditable WRITE setEditable) public: - explicit QtTagComboBox(QWidget* parent = 0); + explicit QtTagComboBox(QWidget* parent = nullptr); ~QtTagComboBox(); bool isEditable() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp index 57bb2cd..4043dbc 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.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. */ @@ -20,7 +20,7 @@ namespace Swift { QtVCardAddressField::QtVCardAddressField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Address")), streetLineEdit(NULL), poboxLineEdit(NULL), addressextLineEdit(NULL), cityLineEdit(NULL), pocodeLineEdit(NULL), regionLineEdit(NULL), countryLineEdit(NULL), textFieldGridLayout(NULL), textFieldGridLayoutItem(NULL), deliveryTypeLabel(NULL), domesticRadioButton(NULL), internationalRadioButton(NULL), buttonGroup(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Address")), streetLineEdit(nullptr), poboxLineEdit(nullptr), addressextLineEdit(nullptr), cityLineEdit(nullptr), pocodeLineEdit(nullptr), regionLineEdit(nullptr), countryLineEdit(nullptr), textFieldGridLayout(nullptr), textFieldGridLayoutItem(nullptr), deliveryTypeLabel(nullptr), domesticRadioButton(nullptr), internationalRadioButton(nullptr), buttonGroup(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } @@ -164,7 +164,7 @@ void QtVCardAddressField::handleEditibleChanged(bool isEditable) { regionLineEdit->setEditable(isEditable); countryLineEdit->setEditable(isEditable); - deliveryTypeLabel->setText(buttonGroup->checkedButton() == 0 ? "" : buttonGroup->checkedButton()->text()); + deliveryTypeLabel->setText(buttonGroup->checkedButton() == nullptr ? "" : buttonGroup->checkedButton()->text()); deliveryTypeLabel->setVisible(!isEditable); domesticRadioButton->setVisible(isEditable); diff --git a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.h b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.h index c90628a..aeebbff 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.h @@ -32,7 +32,7 @@ class QtVCardAddressField : public QtVCardGeneralField, public QtVCardHomeWork { public: GENERIC_QT_VCARD_FIELD_INFO(tr("Address"), UNLIMITED_INSTANCES, QtVCardAddressField) - QtVCardAddressField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardAddressField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardAddressField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.cpp index 7f270c5..e4a75cd 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.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. */ @@ -22,7 +22,7 @@ namespace Swift { QtVCardAddressLabelField::QtVCardAddressLabelField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Address Label")), addressLabelPlainTextEdit(NULL), deliveryTypeLabel(NULL), domesticRadioButton(NULL), internationalRadioButton(NULL), buttonGroup(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Address Label")), addressLabelPlainTextEdit(nullptr), deliveryTypeLabel(nullptr), domesticRadioButton(nullptr), internationalRadioButton(nullptr), buttonGroup(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } @@ -97,7 +97,7 @@ void QtVCardAddressLabelField::handleEditibleChanged(bool isEditable) { addressLabelPlainTextEdit->setReadOnly(!isEditable); addressLabelPlainTextEdit->setStyleSheet(isEditable ? "" : "QPlainTextEdit { background: transparent; }"); - deliveryTypeLabel->setText(buttonGroup->checkedButton() == 0 ? "" : buttonGroup->checkedButton()->text()); + deliveryTypeLabel->setText(buttonGroup->checkedButton() == nullptr ? "" : buttonGroup->checkedButton()->text()); deliveryTypeLabel->setVisible(!isEditable); domesticRadioButton->setVisible(isEditable); diff --git a/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h b/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h index 16910b3..ceca88a 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h @@ -32,7 +32,7 @@ class QtVCardAddressLabelField : public QtVCardGeneralField, public QtVCardHomeW public: GENERIC_QT_VCARD_FIELD_INFO(tr("Address Label"), UNLIMITED_INSTANCES, QtVCardAddressLabelField) - QtVCardAddressLabelField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardAddressLabelField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardAddressLabelField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.cpp index 53dfc7f..1111295 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.cpp @@ -22,7 +22,7 @@ namespace Swift { QtVCardBirthdayField::QtVCardBirthdayField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Birthday"), false, false), birthdayLabel(NULL), birthdayDateEdit(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Birthday"), false, false), birthdayLabel(nullptr), birthdayDateEdit(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.h b/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.h index 431751e..0383b6c 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.h @@ -28,7 +28,7 @@ class QtVCardBirthdayField : public QtVCardGeneralField { public: GENERIC_QT_VCARD_FIELD_INFO(tr("Birthday"), 1, QtVCardBirthdayField) - QtVCardBirthdayField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardBirthdayField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardBirthdayField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.cpp index 9926262..2a8e1c9 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.cpp @@ -22,7 +22,7 @@ namespace Swift { QtVCardDescriptionField::QtVCardDescriptionField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Description"), false, false), descriptionPlainTextEdit(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Description"), false, false), descriptionPlainTextEdit(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.h b/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.h index 489797a..c06dd97 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.h @@ -27,7 +27,7 @@ class QtVCardDescriptionField : public QtVCardGeneralField { public: GENERIC_QT_VCARD_FIELD_INFO(tr("Description"), 1, QtVCardDescriptionField) - QtVCardDescriptionField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardDescriptionField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardDescriptionField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp index 44d94d7..ab69cba 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp @@ -22,8 +22,8 @@ namespace Swift { QtVCardGeneralField::QtVCardGeneralField(QWidget* parent, QGridLayout* layout, bool editable, int row, QString label, bool preferrable, bool taggable) : - QWidget(parent), editable(editable), preferrable(preferrable), starVisible(false), taggable(taggable), layout(layout), row(row), preferredCheckBox(0), label(0), labelText(label), - tagComboBox(0), tagLabel(NULL), closeButton(0) { + QWidget(parent), editable(editable), preferrable(preferrable), starVisible(false), taggable(taggable), layout(layout), row(row), preferredCheckBox(nullptr), label(nullptr), labelText(label), + tagComboBox(nullptr), tagLabel(nullptr), closeButton(nullptr) { } QtVCardGeneralField::~QtVCardGeneralField() { diff --git a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h index d907196..48ecf9f 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -37,7 +37,7 @@ class QtVCardGeneralField : public QWidget { Q_PROPERTY(bool empty READ isEmpty) public: - explicit QtVCardGeneralField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false, int row = 0, QString label = QString(), + explicit QtVCardGeneralField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false, int row = 0, QString label = QString(), bool preferrable = true, bool taggable = true); virtual ~QtVCardGeneralField(); diff --git a/Swift/QtUI/QtVCardWidget/QtVCardHomeWork.cpp b/Swift/QtUI/QtVCardWidget/QtVCardHomeWork.cpp index c147c68..7f204ca 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardHomeWork.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardHomeWork.cpp @@ -14,7 +14,7 @@ namespace Swift { -QtVCardHomeWork::QtVCardHomeWork() : tagComboBox(0) { +QtVCardHomeWork::QtVCardHomeWork() : tagComboBox(nullptr) { } QtVCardHomeWork::~QtVCardHomeWork() { diff --git a/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.cpp index e563ca2..9deb7ba 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.cpp @@ -24,7 +24,7 @@ namespace Swift { QtVCardInternetEMailField::QtVCardInternetEMailField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("E-Mail")), emailLineEdit(NULL), emailLabel(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("E-Mail")), emailLineEdit(nullptr), emailLabel(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.h b/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.h index 63a83e2..07f4f8d 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.h @@ -27,7 +27,7 @@ class QtVCardInternetEMailField : public QtVCardGeneralField, public QtVCardHome public: GENERIC_QT_VCARD_FIELD_INFO(tr("E-Mail"), UNLIMITED_INSTANCES, QtVCardInternetEMailField) - QtVCardInternetEMailField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardInternetEMailField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardInternetEMailField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardJIDField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardJIDField.cpp index 705ad6b..f93ea06 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardJIDField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardJIDField.cpp @@ -23,7 +23,7 @@ namespace Swift { QtVCardJIDField::QtVCardJIDField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("JID"), false, false), jidLabel(NULL), jidLineEdit(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("JID"), false, false), jidLabel(nullptr), jidLineEdit(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardJIDField.h b/Swift/QtUI/QtVCardWidget/QtVCardJIDField.h index 2e9b4ef..f2df9f9 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardJIDField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardJIDField.h @@ -26,7 +26,7 @@ class QtVCardJIDField : public QtVCardGeneralField { public: GENERIC_QT_VCARD_FIELD_INFO(tr("JID"), UNLIMITED_INSTANCES, QtVCardJIDField) - QtVCardJIDField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardJIDField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardJIDField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.cpp index 8b94c42..9e303b7 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.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 #include @@ -17,7 +23,7 @@ namespace Swift { QtVCardOrganizationField::QtVCardOrganizationField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Organization"), false, false), organizationLabel(NULL), organizationLineEdit(NULL), unitsTreeWidget(NULL), itemDelegate(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Organization"), false, false), organizationLabel(nullptr), organizationLineEdit(nullptr), unitsTreeWidget(nullptr), itemDelegate(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.h b/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.h index 6de3167..23e89c0 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.h @@ -29,7 +29,7 @@ class QtVCardOrganizationField : public QtVCardGeneralField { public: GENERIC_QT_VCARD_FIELD_INFO(tr("Organization"), UNLIMITED_INSTANCES, QtVCardOrganizationField) - QtVCardOrganizationField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardOrganizationField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardOrganizationField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.h b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.h index a0bbb24..ca6a1f3 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.h @@ -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. + */ + #pragma once #include @@ -23,7 +29,7 @@ namespace Swift { Q_PROPERTY(bool editable READ isEditable WRITE setEditable) public: - explicit QtVCardPhotoAndNameFields(QWidget* parent = 0); + explicit QtVCardPhotoAndNameFields(QWidget* parent = nullptr); ~QtVCardPhotoAndNameFields(); bool isEditable() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardRoleField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardRoleField.cpp index 2881932..e9e29ad 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardRoleField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardRoleField.cpp @@ -21,7 +21,7 @@ namespace Swift { QtVCardRoleField::QtVCardRoleField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Role"), false, false), roleLineEdit(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Role"), false, false), roleLineEdit(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardRoleField.h b/Swift/QtUI/QtVCardWidget/QtVCardRoleField.h index 40b5d0b..a507fef 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardRoleField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardRoleField.h @@ -26,7 +26,7 @@ class QtVCardRoleField : public QtVCardGeneralField { public: GENERIC_QT_VCARD_FIELD_INFO(tr("Role"), UNLIMITED_INSTANCES, QtVCardRoleField) - QtVCardRoleField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardRoleField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardRoleField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.cpp index 4af2fa3..9421016 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.cpp @@ -19,7 +19,7 @@ namespace Swift { QtVCardTelephoneField::QtVCardTelephoneField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Telephone")), telephoneLineEdit(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Telephone")), telephoneLineEdit(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.h b/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.h index 1a08a5a..13bb232 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.h @@ -27,7 +27,7 @@ class QtVCardTelephoneField : public QtVCardGeneralField, public QtVCardHomeWork public: GENERIC_QT_VCARD_FIELD_INFO(tr("Telephone"), UNLIMITED_INSTANCES, QtVCardTelephoneField) - QtVCardTelephoneField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardTelephoneField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardTelephoneField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardTitleField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardTitleField.cpp index 5da5763..14c3813 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardTitleField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardTitleField.cpp @@ -21,7 +21,7 @@ namespace Swift { QtVCardTitleField::QtVCardTitleField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Title"), false, false), titleLineEdit(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Title"), false, false), titleLineEdit(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardTitleField.h b/Swift/QtUI/QtVCardWidget/QtVCardTitleField.h index ff2a04e..0ea3772 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardTitleField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardTitleField.h @@ -26,7 +26,7 @@ class QtVCardTitleField : public QtVCardGeneralField { public: GENERIC_QT_VCARD_FIELD_INFO(tr("Title"), UNLIMITED_INSTANCES, QtVCardTitleField) - QtVCardTitleField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardTitleField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardTitleField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardURLField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardURLField.cpp index 8abc46e..153b897 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardURLField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardURLField.cpp @@ -24,7 +24,7 @@ namespace Swift { QtVCardURLField::QtVCardURLField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("URL"), false, false), urlLabel(NULL), urlLineEdit(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("URL"), false, false), urlLabel(nullptr), urlLineEdit(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardURLField.h b/Swift/QtUI/QtVCardWidget/QtVCardURLField.h index a1ffacd..3830a7b 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardURLField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardURLField.h @@ -26,7 +26,7 @@ class QtVCardURLField : public QtVCardGeneralField { public: GENERIC_QT_VCARD_FIELD_INFO(tr("URL"), UNLIMITED_INSTANCES, QtVCardURLField) - QtVCardURLField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardURLField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardURLField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp b/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp index 712cedf..fffd4b3 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp @@ -227,8 +227,8 @@ VCard::ref QtVCardWidget::getVCard() { vcard->clearAddressLabels(); - QtVCardBirthdayField* bdayField = NULL; - QtVCardDescriptionField* descriptionField = NULL; + QtVCardBirthdayField* bdayField = nullptr; + QtVCardDescriptionField* descriptionField = nullptr; foreach(QtVCardGeneralField* field, fields) { QtVCardInternetEMailField* emailField; @@ -310,7 +310,7 @@ VCard::ref QtVCardWidget::getVCard() { } void QtVCardWidget::addField() { - QAction* action = NULL; + QAction* action = nullptr; if ((action = dynamic_cast(sender()))) { boost::shared_ptr fieldInfo = actionFieldInfo[action]; QWidget* newField = fieldInfo->createFieldInstance(this, ui->cardFields, true); @@ -325,7 +325,7 @@ void QtVCardWidget::addField() { void QtVCardWidget::removeField(QtVCardGeneralField *field) { int sameFields = 0; - QtVCardGeneralField* fieldToChange = NULL; + QtVCardGeneralField* fieldToChange = nullptr; foreach (QtVCardGeneralField* vcardField, fields) { if ((vcardField != field) && (typeid(*vcardField) == typeid(*field))) { sameFields++; @@ -361,7 +361,7 @@ int QtVCardWidget::fieldTypeInstances(boost::shared_ptr fieldT void layoutDeleteChildren(QLayout *layout) { while(layout->count() > 0) { QLayoutItem* child; - if ((child = layout->takeAt(0)) != 0) { + if ((child = layout->takeAt(0)) != nullptr) { if (child->layout()) { layoutDeleteChildren(child->layout()); } @@ -403,7 +403,7 @@ void QtVCardWidget::clearEmptyFields() { void QtVCardWidget::appendField(QtVCardGeneralField *field) { connect(field, SIGNAL(deleteField(QtVCardGeneralField*)), SLOT(removeField(QtVCardGeneralField*))); - QtVCardGeneralField* fieldToChange = NULL; + QtVCardGeneralField* fieldToChange = nullptr; foreach (QtVCardGeneralField* vcardField, fields) { if (typeid(*vcardField) == typeid(*field)) { fieldToChange = vcardField; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardWidget.h b/Swift/QtUI/QtVCardWidget/QtVCardWidget.h index 95283c5..76fc46c 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardWidget.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardWidget.h @@ -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. */ @@ -34,7 +34,7 @@ namespace Swift { Q_PROPERTY(bool editable READ isEditable WRITE setEditable) public : - explicit QtVCardWidget(QWidget* parent = 0); + explicit QtVCardWidget(QWidget* parent = nullptr); ~QtVCardWidget(); bool isEditable() const; diff --git a/Swift/QtUI/Roster/QtFilterWidget.cpp b/Swift/QtUI/Roster/QtFilterWidget.cpp index 60b87df..3ed23b6 100644 --- a/Swift/QtUI/Roster/QtFilterWidget.cpp +++ b/Swift/QtUI/Roster/QtFilterWidget.cpp @@ -26,7 +26,7 @@ namespace Swift { -QtFilterWidget::QtFilterWidget(QWidget* parent, QtTreeWidget* treeView, UIEventStream* eventStream, QBoxLayout* layout) : QWidget(parent), treeView_(treeView), eventStream_(eventStream), fuzzyRosterFilter_(0), isModifierSinglePressed_(false) { +QtFilterWidget::QtFilterWidget(QWidget* parent, QtTreeWidget* treeView, UIEventStream* eventStream, QBoxLayout* layout) : QWidget(parent), treeView_(treeView), eventStream_(eventStream), fuzzyRosterFilter_(nullptr), isModifierSinglePressed_(false) { int targetIndex = layout->indexOf(treeView); QVBoxLayout* vboxLayout = new QVBoxLayout(this); @@ -123,7 +123,7 @@ void QtFilterWidget::updateRosterFilters() { // remove currently installed search filter and put old filters back treeView_->getRoster()->removeFilter(fuzzyRosterFilter_); delete fuzzyRosterFilter_; - fuzzyRosterFilter_ = NULL; + fuzzyRosterFilter_ = nullptr; pushAllFilters(); } else { // remove currently intsalled search filter and put new search filter in place @@ -143,7 +143,7 @@ void QtFilterWidget::updateSearchFilter() { if (fuzzyRosterFilter_) { treeView_->getRoster()->removeFilter(fuzzyRosterFilter_); delete fuzzyRosterFilter_; - fuzzyRosterFilter_ = NULL; + fuzzyRosterFilter_ = nullptr; } fuzzyRosterFilter_ = new FuzzyRosterFilter(Q2PSTRING(filterLineEdit_->text())); treeView_->getRoster()->addFilter(fuzzyRosterFilter_); diff --git a/Swift/QtUI/Roster/QtFilterWidget.h b/Swift/QtUI/Roster/QtFilterWidget.h index 5edcc5b..ea3c325 100644 --- a/Swift/QtUI/Roster/QtFilterWidget.h +++ b/Swift/QtUI/Roster/QtFilterWidget.h @@ -28,7 +28,7 @@ class QtClosableLineEdit; class QtFilterWidget : public QWidget { Q_OBJECT public: - QtFilterWidget(QWidget* parent, QtTreeWidget* treeView, UIEventStream* eventStream, QBoxLayout* layout = 0); + QtFilterWidget(QWidget* parent, QtTreeWidget* treeView, UIEventStream* eventStream, QBoxLayout* layout = nullptr); virtual ~QtFilterWidget(); protected: diff --git a/Swift/QtUI/Roster/QtOccupantListWidget.h b/Swift/QtUI/Roster/QtOccupantListWidget.h index 4cff50f..78be276 100644 --- a/Swift/QtUI/Roster/QtOccupantListWidget.h +++ b/Swift/QtUI/Roster/QtOccupantListWidget.h @@ -18,7 +18,7 @@ class SettingsProvider; class QtOccupantListWidget : public QtTreeWidget { Q_OBJECT public: - QtOccupantListWidget(UIEventStream* eventStream, SettingsProvider* settings, MessageTarget privateMessageTarget, QWidget* parent = NULL); + QtOccupantListWidget(UIEventStream* eventStream, SettingsProvider* settings, MessageTarget privateMessageTarget, QWidget* parent = nullptr); virtual ~QtOccupantListWidget(); void setAvailableOccupantActions(const std::vector& actions); boost::signal onOccupantActionSelected; diff --git a/Swift/QtUI/Roster/QtRosterWidget.cpp b/Swift/QtUI/Roster/QtRosterWidget.cpp index 027ff00..92fed86 100644 --- a/Swift/QtUI/Roster/QtRosterWidget.cpp +++ b/Swift/QtUI/Roster/QtRosterWidget.cpp @@ -66,28 +66,28 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) { removeContact->setEnabled(isOnline()); QAction* showProfileForContact = contextMenu.addAction(tr("Show Profile")); - QAction* unblockContact = NULL; + QAction* unblockContact = nullptr; if (contact->blockState() == ContactRosterItem::IsBlocked || contact->blockState() == ContactRosterItem::IsDomainBlocked) { unblockContact = contextMenu.addAction(tr("Unblock")); unblockContact->setEnabled(isOnline()); } - QAction* blockContact = NULL; + QAction* blockContact = nullptr; if (contact->blockState() == ContactRosterItem::IsUnblocked) { blockContact = contextMenu.addAction(tr("Block")); blockContact->setEnabled(isOnline()); } #ifdef SWIFT_EXPERIMENTAL_FT - QAction* sendFile = NULL; + QAction* sendFile = nullptr; if (contact->supportsFeature(ContactRosterItem::FileTransferFeature)) { sendFile = contextMenu.addAction(tr("Send File")); sendFile->setEnabled(isOnline()); } #endif #ifdef SWIFT_EXPERIMENTAL_WB - QAction* startWhiteboardChat = NULL; + QAction* startWhiteboardChat = nullptr; if (contact->supportsFeature(ContactRosterItem::WhiteboardFeature)) { startWhiteboardChat = contextMenu.addAction(tr("Start Whiteboard Chat")); startWhiteboardChat->setEnabled(isOnline()); @@ -153,7 +153,7 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) { void QtRosterWidget::renameGroup(GroupRosterItem* group) { bool ok; - QString newName = QInputDialog::getText(NULL, tr("Rename group"), tr("Enter a new name for group '%1':").arg(P2QSTRING(group->getDisplayName())), QLineEdit::Normal, P2QSTRING(group->getDisplayName()), &ok); + QString newName = QInputDialog::getText(nullptr, tr("Rename group"), tr("Enter a new name for group '%1':").arg(P2QSTRING(group->getDisplayName())), QLineEdit::Normal, P2QSTRING(group->getDisplayName()), &ok); if (ok) { eventStream_->send(boost::make_shared(group->getDisplayName(), Q2PSTRING(newName))); } diff --git a/Swift/QtUI/Roster/QtRosterWidget.h b/Swift/QtUI/Roster/QtRosterWidget.h index 25f7f9d..2cf8315 100644 --- a/Swift/QtUI/Roster/QtRosterWidget.h +++ b/Swift/QtUI/Roster/QtRosterWidget.h @@ -14,7 +14,7 @@ class QtUIPreferences; class QtRosterWidget : public QtTreeWidget { Q_OBJECT public: - QtRosterWidget(UIEventStream* eventStream, SettingsProvider* settings, QWidget* parent = 0); + QtRosterWidget(UIEventStream* eventStream, SettingsProvider* settings, QWidget* parent = nullptr); virtual ~QtRosterWidget(); public slots: void handleEditUserActionTriggered(bool checked); diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp index a0b6e92..16a186e 100644 --- a/Swift/QtUI/Roster/QtTreeWidget.cpp +++ b/Swift/QtUI/Roster/QtTreeWidget.cpp @@ -124,7 +124,7 @@ QModelIndexList QtTreeWidget::getSelectedIndexes() const { } void QtTreeWidget::currentChanged(const QModelIndex& current, const QModelIndex& previous) { - RosterItem* item = NULL; + RosterItem* item = nullptr; QModelIndexList selectedIndexList = getSelectedIndexes(); if (selectedIndexList.empty() || !selectedIndexList[0].isValid()) { /* I didn't quite understand why using current didn't seem to work here.*/ @@ -180,7 +180,7 @@ void QtTreeWidget::dragMoveEvent(QDragMoveEvent* event) { } bool QtTreeWidget::event(QEvent* event) { - QChildEvent* childEvent = NULL; + QChildEvent* childEvent = nullptr; if ((childEvent = dynamic_cast(event))) { if (childEvent->polished()) { if (dynamic_cast(childEvent->child())) { diff --git a/Swift/QtUI/Roster/QtTreeWidget.h b/Swift/QtUI/Roster/QtTreeWidget.h index 9a94e8f..c3ed5a2 100644 --- a/Swift/QtUI/Roster/QtTreeWidget.h +++ b/Swift/QtUI/Roster/QtTreeWidget.h @@ -26,7 +26,7 @@ class QtTreeWidget : public QTreeView { public: enum MessageTarget {MessageDefaultJID, MessageDisplayJID}; - QtTreeWidget(UIEventStream* eventStream, SettingsProvider* settings, MessageTarget messageTarget, QWidget* parent = 0); + QtTreeWidget(UIEventStream* eventStream, SettingsProvider* settings, MessageTarget messageTarget, QWidget* parent = nullptr); ~QtTreeWidget(); void show(); QtTreeWidgetItem* getRoot(); diff --git a/Swift/QtUI/Roster/RosterModel.cpp b/Swift/QtUI/Roster/RosterModel.cpp index 2b3759d..22af6ec 100644 --- a/Swift/QtUI/Roster/RosterModel.cpp +++ b/Swift/QtUI/Roster/RosterModel.cpp @@ -28,7 +28,7 @@ namespace Swift { -RosterModel::RosterModel(QtTreeWidget* view, bool screenReaderMode) : roster_(NULL), view_(view), screenReader_(screenReaderMode) { +RosterModel::RosterModel(QtTreeWidget* view, bool screenReaderMode) : roster_(nullptr), view_(view), screenReader_(screenReaderMode) { const int tooltipAvatarSize = 96; // maximal suggested size according to XEP-0153 cachedImageScaler_ = new QtScaledAvatarCache(tooltipAvatarSize); } @@ -75,7 +75,7 @@ void RosterModel::handleDataChanged(RosterItem* item) { Qt::ItemFlags RosterModel::flags(const QModelIndex& index) const { Qt::ItemFlags flags = QAbstractItemModel::flags(index); - if (dynamic_cast(getItem(index)) == NULL) { + if (dynamic_cast(getItem(index)) == nullptr) { flags |= Qt::ItemIsDragEnabled; } return flags; @@ -86,7 +86,7 @@ int RosterModel::columnCount(const QModelIndex& /*parent*/) const { } RosterItem* RosterModel::getItem(const QModelIndex& index) const { - return index.isValid() ? static_cast(index.internalPointer()) : NULL; + return index.isValid() ? static_cast(index.internalPointer()) : nullptr; } QVariant RosterModel::data(const QModelIndex& index, int role) const { @@ -230,7 +230,7 @@ QModelIndex RosterModel::index(RosterItem* item) const { /* Recursive check that it's ok to create such an item Assuming there are more contacts in a group than groups in a group, this could save a decent chunk of search time at startup.*/ - if (parent == NULL || roster_ == NULL || (parent != roster_->getRoot() && !index(parent).isValid())) { + if (parent == nullptr || roster_ == nullptr || (parent != roster_->getRoot() && !index(parent).isValid())) { return QModelIndex(); } for (size_t i = 0; i < parent->getDisplayedChildren().size(); i++) { @@ -264,7 +264,7 @@ QMimeData* RosterModel::mimeData(const QModelIndexList& indexes) const { QMimeData* data = QAbstractItemModel::mimeData(indexes); ContactRosterItem *item = dynamic_cast(getItem(indexes.first())); - if (item == NULL) { + if (item == nullptr) { return data; } diff --git a/Swift/QtUI/Trellis/QtDNDTabBar.cpp b/Swift/QtUI/Trellis/QtDNDTabBar.cpp index fac2233..9a6c436 100644 --- a/Swift/QtUI/Trellis/QtDNDTabBar.cpp +++ b/Swift/QtUI/Trellis/QtDNDTabBar.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -118,7 +118,7 @@ bool QtDNDTabBar::event(QEvent* event) { QMouseEvent* finishMoveEvent = new QMouseEvent (QEvent::MouseMove, mouseEvent->pos (), Qt::NoButton, Qt::NoButton, Qt::NoModifier); QTabBar::event(finishMoveEvent); delete finishMoveEvent; - finishMoveEvent = NULL; + finishMoveEvent = nullptr; // start drag QDrag* drag = new QDrag(this); diff --git a/Swift/QtUI/Trellis/QtDNDTabBar.h b/Swift/QtUI/Trellis/QtDNDTabBar.h index 3677b73..40eb66d 100644 --- a/Swift/QtUI/Trellis/QtDNDTabBar.h +++ b/Swift/QtUI/Trellis/QtDNDTabBar.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,7 +13,7 @@ namespace Swift { class QtDNDTabBar : public QTabBar { Q_OBJECT public: - explicit QtDNDTabBar(QWidget* parent = 0); + explicit QtDNDTabBar(QWidget* parent = nullptr); virtual ~QtDNDTabBar(); int getDragIndex() const; diff --git a/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp b/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp index 7de2791..cafecf9 100644 --- a/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp +++ b/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -23,7 +23,7 @@ namespace Swift { -QtDynamicGridLayout::QtDynamicGridLayout(QWidget* parent, bool enableDND) : QWidget(parent), dndEnabled_(enableDND), movingTab_(NULL) { +QtDynamicGridLayout::QtDynamicGridLayout(QWidget* parent, bool enableDND) : QWidget(parent), dndEnabled_(enableDND), movingTab_(nullptr) { gridLayout_ = new QGridLayout(this); setContentsMargins(0,0,0,0); setDimensions(QSize(1,1)); @@ -44,7 +44,7 @@ int QtDynamicGridLayout::addTab(QtTabbable* tab, const QString& title) { lastPos = QPoint(qMin(lastPos.x(), gridLayout_->columnCount() - 1), qMin(lastPos.y(), gridLayout_->rowCount() - 1)); QLayoutItem* item = gridLayout_->itemAtPosition(lastPos.y(), lastPos.x()); - QtTabWidget* tabWidget = dynamic_cast(item ? item->widget() : 0); + QtTabWidget* tabWidget = dynamic_cast(item ? item->widget() : nullptr); if (tabWidget) { tabWidget->addTab(tab, title); } @@ -66,7 +66,7 @@ int QtDynamicGridLayout::count() const { } QWidget* QtDynamicGridLayout::widget(int index) const { - QWidget* widgetAtIndex = NULL; + QWidget* widgetAtIndex = nullptr; for (int y = 0; y < gridLayout_->rowCount(); y++) { for (int x = 0; x < gridLayout_->columnCount(); x++) { QLayoutItem* layoutItem = gridLayout_->itemAtPosition(y, x); @@ -171,13 +171,13 @@ bool QtDynamicGridLayout::eventFilter(QObject* object, QEvent* event) { } QWidget* QtDynamicGridLayout::currentWidget() const { - QWidget* current = NULL; + QWidget* current = nullptr; current = focusWidget(); while (current && !dynamic_cast(current)) { if (current->parentWidget()) { current = current->parentWidget(); } else { - current = NULL; + current = nullptr; break; } } @@ -218,14 +218,14 @@ QtTabWidget* QtDynamicGridLayout::indexToTabWidget(int index, int& tabIndex) { if (index < 0) { qWarning() << "Called QtDynamicGridLayout::setCurrentIndex with index out of bounds: index = " << index; tabIndex = -1; - return NULL; + return nullptr; } } } } } tabIndex = -1; - return NULL; + return nullptr; } bool QtDynamicGridLayout::isDNDEnabled() const { @@ -458,9 +458,9 @@ void QtDynamicGridLayout::updateTabPositions() { void QtDynamicGridLayout::moveTab(QtTabWidget* tabWidget, int oldIndex, int newIndex) { #if QT_VERSION >= 0x040500 - SWIFT_LOG_ASSERT(movingTab_ == NULL, error) << std::endl; + SWIFT_LOG_ASSERT(movingTab_ == nullptr, error) << std::endl; movingTab_ = qobject_cast(tabWidget->widget(oldIndex)); - SWIFT_LOG_ASSERT(movingTab_ != NULL, error) << std::endl; + SWIFT_LOG_ASSERT(movingTab_ != nullptr, error) << std::endl; if (movingTab_) { // Install event filter that filters out events issued during the internal movement of the @@ -472,7 +472,7 @@ void QtDynamicGridLayout::moveTab(QtTabWidget* tabWidget, int oldIndex, int newI qApp->removeEventFilter(this); SWIFT_LOG_ASSERT(movingTab_ == tabWidget->widget(newIndex), error) << std::endl; } - movingTab_ = NULL; + movingTab_ = nullptr; tabWidget->widget(newIndex)->setFocus(); #else #warning Qt 4.5 or later is needed. Trying anyway, some things will be disabled. diff --git a/Swift/QtUI/Trellis/QtDynamicGridLayout.h b/Swift/QtUI/Trellis/QtDynamicGridLayout.h index 2a6029c..dad0f7e 100644 --- a/Swift/QtUI/Trellis/QtDynamicGridLayout.h +++ b/Swift/QtUI/Trellis/QtDynamicGridLayout.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -20,7 +20,7 @@ namespace Swift { class QtDynamicGridLayout : public QWidget { Q_OBJECT public: - explicit QtDynamicGridLayout(QWidget* parent = 0, bool enableDND = false); + explicit QtDynamicGridLayout(QWidget* parent = nullptr, bool enableDND = false); virtual ~QtDynamicGridLayout(); QSize getDimension() const; diff --git a/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp b/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp index c7b7edb..8a69a3d 100644 --- a/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp +++ b/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -103,7 +103,7 @@ void QtGridSelectionDialog::paintEvent(QPaintEvent*) { int yPos = verticalMargin + (y * (frameSize.height() + padding)); option.menuRect.moveTo(QPoint(xPos, yPos)); option.rect = option.menuRect; - style()->drawControl(QStyle::CE_MenuItem, &option, &painter, 0); + style()->drawControl(QStyle::CE_MenuItem, &option, &painter, nullptr); } } diff --git a/Swift/QtUI/Trellis/QtGridSelectionDialog.h b/Swift/QtUI/Trellis/QtGridSelectionDialog.h index c763e68..56a575f 100644 --- a/Swift/QtUI/Trellis/QtGridSelectionDialog.h +++ b/Swift/QtUI/Trellis/QtGridSelectionDialog.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -18,7 +18,7 @@ namespace Swift { Q_PROPERTY(QSize minGridSize READ getMinGridSize WRITE setMinGridSize NOTIFY minGridSizeChanged) Q_PROPERTY(QSize maxGridSize READ getMaxGridSize WRITE setMaxGridSize NOTIFY maxGridSizeChanged) public: - explicit QtGridSelectionDialog(QWidget* parent = 0); + explicit QtGridSelectionDialog(QWidget* parent = nullptr); virtual QSize sizeHint() const; diff --git a/Swift/QtUI/UserSearch/QtUserSearchFieldsPage.cpp b/Swift/QtUI/UserSearch/QtUserSearchFieldsPage.cpp index 3a82a62..3a6028d 100644 --- a/Swift/QtUI/UserSearch/QtUserSearchFieldsPage.cpp +++ b/Swift/QtUI/UserSearch/QtUserSearchFieldsPage.cpp @@ -8,7 +8,7 @@ namespace Swift { -QtUserSearchFieldsPage::QtUserSearchFieldsPage() : formWidget_(0) { +QtUserSearchFieldsPage::QtUserSearchFieldsPage() : formWidget_(nullptr) { setupUi(this); } @@ -27,7 +27,7 @@ QtFormWidget* QtUserSearchFieldsPage::getFormWidget() { void QtUserSearchFieldsPage::setFormWidget(QtFormWidget *widget) { if (formWidget_) { delete formWidget_; - formWidget_ = NULL; + formWidget_ = nullptr; } if (widget) { formContainer_->layout()->addWidget(widget); diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp index 1140b6e..09943c5 100644 --- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp +++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.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. */ @@ -36,7 +36,7 @@ namespace Swift { -QtUserSearchWindow::QtUserSearchWindow(UIEventStream* eventStream, UserSearchWindow::Type type, const std::set& groups, SettingsProvider* settingsProvider) : eventStream_(eventStream), type_(type), model_(NULL), firstMultiJIDPage_(NULL), settings_(settingsProvider), searchNext_(false), supportsImpromptu_(false) { +QtUserSearchWindow::QtUserSearchWindow(UIEventStream* eventStream, UserSearchWindow::Type type, const std::set& groups, SettingsProvider* settingsProvider) : eventStream_(eventStream), type_(type), model_(nullptr), firstMultiJIDPage_(nullptr), settings_(settingsProvider), searchNext_(false), supportsImpromptu_(false) { setupUi(this); #ifndef Q_OS_MAC #ifdef Q_OS_WIN32 @@ -339,7 +339,7 @@ void QtUserSearchWindow::setSearchFields(boost::shared_ptr fields if (fields->getForm()) { fieldsPage_->setFormWidget(new QtFormWidget(fields->getForm(), fieldsPage_)); } else { - fieldsPage_->setFormWidget(NULL); + fieldsPage_->setFormWidget(nullptr); bool enabled[8] = {!!fields->getNick(), !!fields->getNick(), !!fields->getFirst(), !!fields->getFirst(), !!fields->getLast(), !!fields->getLast(), !!fields->getEMail(), !!fields->getEMail()}; QWidget* legacySearchWidgets[8] = {fieldsPage_->nickInputLabel_, fieldsPage_->nickInput_, fieldsPage_->firstInputLabel_, fieldsPage_->firstInput_, fieldsPage_->lastInputLabel_, fieldsPage_->lastInput_, fieldsPage_->emailInputLabel_, fieldsPage_->emailInput_}; for (int i = 0; i < 8; i++) { @@ -494,7 +494,7 @@ void QtUserSearchWindow::handleJIDEditingDone() { } void QtUserSearchWindow::setFirstPage(QString title) { - if (page(1) != 0) { + if (page(1) != nullptr) { removePage(1); } if (type_ == AddContact) { @@ -524,7 +524,7 @@ void QtUserSearchWindow::setFirstPage(QString title) { } void QtUserSearchWindow::setSecondPage() { - if (page(2) != 0) { + if (page(2) != nullptr) { removePage(2); } fieldsPage_ = new QtUserSearchFieldsPage(); @@ -534,7 +534,7 @@ void QtUserSearchWindow::setSecondPage() { } void QtUserSearchWindow::setThirdPage() { - if (page(3) != 0) { + if (page(3) != nullptr) { removePage(3); } resultsPage_ = new QtUserSearchResultsPage(); @@ -585,9 +585,9 @@ void QtUserSearchWindow::clear() { firstMultiJIDPage_->howLabel_->setText(howText); } clearForm(); - resultsPage_->results_->setModel(NULL); + resultsPage_->results_->setModel(nullptr); delete model_; - model_ = NULL; + model_ = nullptr; restart(); lastPage_ = 1; } diff --git a/Swift/QtUI/UserSearch/UserSearchDelegate.h b/Swift/QtUI/UserSearch/UserSearchDelegate.h index 8234689..a5639ec 100644 --- a/Swift/QtUI/UserSearch/UserSearchDelegate.h +++ b/Swift/QtUI/UserSearch/UserSearchDelegate.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. */ @@ -17,7 +17,7 @@ namespace Swift { Q_OBJECT public: - UserSearchDelegate(QObject* parent = 0); + UserSearchDelegate(QObject* parent = nullptr); virtual ~UserSearchDelegate(); void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; diff --git a/Swift/QtUI/Whiteboard/ColorWidget.h b/Swift/QtUI/Whiteboard/ColorWidget.h index 18dc73f..56ada0c 100644 --- a/Swift/QtUI/Whiteboard/ColorWidget.h +++ b/Swift/QtUI/Whiteboard/ColorWidget.h @@ -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. + */ + #pragma once #include @@ -12,7 +18,7 @@ namespace Swift { class ColorWidget : public QWidget { Q_OBJECT public: - ColorWidget(QWidget* parent = 0); + ColorWidget(QWidget* parent = nullptr); QSize sizeHint() const; public slots: diff --git a/Swift/QtUI/Whiteboard/FreehandLineItem.h b/Swift/QtUI/Whiteboard/FreehandLineItem.h index a2dab34..5b83d95 100644 --- a/Swift/QtUI/Whiteboard/FreehandLineItem.h +++ b/Swift/QtUI/Whiteboard/FreehandLineItem.h @@ -21,9 +21,9 @@ namespace Swift { class FreehandLineItem : public QGraphicsItem { public: enum {Type = UserType + 1}; - FreehandLineItem(QGraphicsItem* parent = 0); + FreehandLineItem(QGraphicsItem* parent = nullptr); QRectF boundingRect() const; - void paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*/, QWidget* /*widget*/ = 0); + void paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*/, QWidget* /*widget*/ = nullptr); void setStartPoint(QPointF point); void lineTo(QPointF point); bool collidesWithPath(const QPainterPath& path, Qt::ItemSelectionMode /*mode*/ = Qt::IntersectsItemShape) const; diff --git a/Swift/QtUI/Whiteboard/GView.cpp b/Swift/QtUI/Whiteboard/GView.cpp index 4deaaf6..80061fd 100644 --- a/Swift/QtUI/Whiteboard/GView.cpp +++ b/Swift/QtUI/Whiteboard/GView.cpp @@ -15,7 +15,7 @@ #include namespace Swift { - GView::GView(QGraphicsScene* scene, QWidget* parent) : QGraphicsView(scene, parent), zValue(0), mousePressed(false), brush(QColor(Qt::white)), defaultBrush(QColor(Qt::white)), mode(GView::Select), lastItem(NULL), selectionRect(NULL), textDialog(NULL) { + GView::GView(QGraphicsScene* scene, QWidget* parent) : QGraphicsView(scene, parent), zValue(0), mousePressed(false), brush(QColor(Qt::white)), defaultBrush(QColor(Qt::white)), mode(GView::Select), lastItem(nullptr), selectionRect(nullptr), textDialog(nullptr) { } void GView::setLineWidth(int i) { @@ -63,7 +63,7 @@ namespace Swift { void GView::setMode(Mode mode) { this->mode = mode; - lastItem = 0; + lastItem = nullptr; deselect(); } @@ -86,8 +86,8 @@ namespace Swift { scene()->clear(); items_.clear(); itemsMap_.clear(); - lastItem = 0; - selectionRect = 0; + lastItem = nullptr; + selectionRect = nullptr; brush = QBrush(QColor(Qt::white)); defaultBrush = QBrush(QColor(Qt::white)); pen = QPen(); @@ -123,7 +123,7 @@ namespace Swift { if (mode == Line) { QGraphicsLineItem* item = qgraphicsitem_cast(lastItem); - if(item != 0) { + if(item != nullptr) { QLineF line = item->line(); line.setP1(this->mapToScene(event->pos())); item->setLine(line); @@ -132,7 +132,7 @@ namespace Swift { } else if (mode == Rect) { QGraphicsRectItem* item = qgraphicsitem_cast(lastItem); - if (item != 0) { + if (item != nullptr) { QPointF beginPoint = item->data(0).toPointF(); QPointF newPoint = this->mapToScene(event->pos()); QRectF rect = item->rect(); @@ -182,7 +182,7 @@ namespace Swift { } else if (mode == HandLine) { FreehandLineItem* item = qgraphicsitem_cast(lastItem); - if (item != 0) { + if (item != nullptr) { QPointF newPoint = this->mapToScene(event->pos()); item->lineTo(newPoint); } @@ -197,7 +197,7 @@ namespace Swift { } else if (mode == Select) { QGraphicsItem* item = selectionRect->data(1).value(); - if (item != 0) { + if (item != nullptr) { QPainterPath path; QPointF beginPoint = selectionRect->data(0).toPointF(); QPointF newPoint = this->mapToScene(event->pos()); @@ -283,7 +283,7 @@ namespace Swift { else if (mode == Polygon) { QPointF point = this->mapToScene(event->pos()); QGraphicsPolygonItem* item = dynamic_cast(lastItem); - if (item == 0) { + if (item == nullptr) { QPolygonF polygon; polygon.append(point); polygon.append(point); @@ -376,7 +376,7 @@ namespace Swift { void GView::move(QGraphicsItem* item, int npos) { int pos = items_.indexOf(item); - QGraphicsItem* itemAfter = NULL; + QGraphicsItem* itemAfter = nullptr; if (npos-1 > pos) { if (npos == items_.size()) { item->setZValue(zValue++); @@ -473,12 +473,12 @@ namespace Swift { } void GView::deselect() { - if (selectionRect != 0) { + if (selectionRect != nullptr) { pen = defaultPen; brush = defaultBrush; scene()->removeItem(selectionRect); delete selectionRect; - selectionRect = 0; + selectionRect = nullptr; lineWidthChanged(pen.width()); lineColorChanged(pen.color()); brushColorChanged(brush.color()); @@ -486,14 +486,14 @@ namespace Swift { } void GView::deselect(QString id) { - if (selectionRect != 0) { + if (selectionRect != nullptr) { QGraphicsItem* item = getItem(id); if (item && selectionRect->data(1).value() == item) { pen = defaultPen; brush = defaultBrush; scene()->removeItem(selectionRect); delete selectionRect; - selectionRect = 0; + selectionRect = nullptr; lineWidthChanged(pen.width()); lineColorChanged(pen.color()); brushColorChanged(brush.color()); diff --git a/Swift/QtUI/Whiteboard/GView.h b/Swift/QtUI/Whiteboard/GView.h index 396e381..4af5a53 100644 --- a/Swift/QtUI/Whiteboard/GView.h +++ b/Swift/QtUI/Whiteboard/GView.h @@ -30,7 +30,7 @@ namespace Swift { public: enum Mode { Rubber, Line, Rect, Circle, HandLine, Text, Polygon, Select }; enum Type { New, Update, MoveUp, MoveDown }; - GView(QGraphicsScene* scene, QWidget* parent = 0); + GView(QGraphicsScene* scene, QWidget* parent = nullptr); void setLineWidth(int i); void setLineColor(QColor color); QColor getLineColor(); diff --git a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp index 26887e0..2eae84d 100644 --- a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp +++ b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp @@ -182,14 +182,14 @@ namespace Swift { void QtWhiteboardWindow::showColorDialog() { - QColor color = QColorDialog::getColor(graphicsView->getLineColor(), 0, "Select pen color", QColorDialog::ShowAlphaChannel); + QColor color = QColorDialog::getColor(graphicsView->getLineColor(), nullptr, "Select pen color", QColorDialog::ShowAlphaChannel); if(color.isValid()) graphicsView->setLineColor(color); } void QtWhiteboardWindow::showBrushColorDialog() { - QColor color = QColorDialog::getColor(graphicsView->getBrushColor(), 0, "Select brush color", QColorDialog::ShowAlphaChannel); + QColor color = QColorDialog::getColor(graphicsView->getBrushColor(), nullptr, "Select brush color", QColorDialog::ShowAlphaChannel); if(color.isValid()) graphicsView->setBrushColor(color); } @@ -258,7 +258,7 @@ namespace Swift { void QtWhiteboardWindow::handleLastItemChanged(QGraphicsItem* item, int pos, GView::Type type) { WhiteboardElement::ref el; QGraphicsLineItem* lineItem = qgraphicsitem_cast(item); - if (lineItem != 0) { + if (lineItem != nullptr) { QLine line = lineItem->line().toLine(); QColor color = lineItem->pen().color(); WhiteboardLineElement::ref element = boost::make_shared(line.x1()+lineItem->pos().x(), line.y1()+lineItem->pos().y(), line.x2()+lineItem->pos().x(), line.y2()+lineItem->pos().y()); @@ -270,7 +270,7 @@ namespace Swift { } FreehandLineItem* freehandLineItem = qgraphicsitem_cast(item); - if (freehandLineItem != 0) { + if (freehandLineItem != nullptr) { WhiteboardFreehandPathElement::ref element = boost::make_shared(); QColor color = freehandLineItem->pen().color(); std::vector > points; @@ -290,7 +290,7 @@ namespace Swift { } QGraphicsRectItem* rectItem = qgraphicsitem_cast(item); - if (rectItem != 0) { + if (rectItem != nullptr) { QRectF rect = rectItem->rect(); WhiteboardRectElement::ref element = boost::make_shared(rect.x()+item->pos().x(), rect.y()+item->pos().y(), rect.width(), rect.height()); QColor penColor = rectItem->pen().color(); @@ -305,7 +305,7 @@ namespace Swift { } QGraphicsTextItem* textItem = qgraphicsitem_cast(item); - if (textItem != 0) { + if (textItem != nullptr) { QPointF point = textItem->pos(); WhiteboardTextElement::ref element = boost::make_shared(point.x(), point.y()); element->setText(textItem->toPlainText().toStdString()); diff --git a/Swift/QtUI/Whiteboard/TextDialog.h b/Swift/QtUI/Whiteboard/TextDialog.h index 31bd096..513d381 100644 --- a/Swift/QtUI/Whiteboard/TextDialog.h +++ b/Swift/QtUI/Whiteboard/TextDialog.h @@ -27,7 +27,7 @@ namespace Swift { { Q_OBJECT public: - TextDialog(QGraphicsTextItem* item, QWidget* parent = 0); + TextDialog(QGraphicsTextItem* item, QWidget* parent = nullptr); private: QGraphicsTextItem* item; diff --git a/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h b/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h index 719725c..8182bcb 100644 --- a/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h +++ b/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h @@ -111,7 +111,7 @@ namespace Swift { void visit(WhiteboardPolygonElement& element) { QGraphicsPolygonItem* item = qgraphicsitem_cast(graphicsView_->getItem(P2QSTRING(element.getID()))); - if (item == 0 && type_ == GView::New) { + if (item == nullptr && type_ == GView::New) { item = new QGraphicsPolygonItem(); QString id = P2QSTRING(element.getID()); item->setData(100, id); diff --git a/Swift/QtUI/main.cpp b/Swift/QtUI/main.cpp index 86ba931..dde1487 100644 --- a/Swift/QtUI/main.cpp +++ b/Swift/QtUI/main.cpp @@ -98,7 +98,7 @@ int main(int argc, char* argv[]) { Swift::QtSwift swift(vm); int result = app.exec(); - Swift::Translator::setInstance(NULL); + Swift::Translator::setInstance(nullptr); return result; } 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 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 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(std::time(0))); + generator.seed(static_cast(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 static const T* vecptr(const std::vector& v) { - return v.empty() ? NULL : &v[0]; + return v.empty() ? nullptr : &v[0]; } template static T* vecptr(std::vector& 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 element) { else { state = WaitingForStreamStart; delete authenticator; - authenticator = NULL; + authenticator = nullptr; stream->resetXMPPParser(); sendStreamHeader(); } @@ -493,7 +493,7 @@ void ClientSession::finishSession(boost::shared_ptr 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::ref blockRequest = clientBlockListManager_->createBlockJIDRequest(JID("romeo@montague.net")); blockRequest->send(); IQ::ref request = stanzaChannel_->getStanzaAtIndex(2); - CPPUNIT_ASSERT(request.get() != NULL); + CPPUNIT_ASSERT(request.get() != nullptr); boost::shared_ptr blockPayload = request->getPayload(); - 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::ref unblockRequest = clientBlockListManager_->createUnblockJIDRequest(JID("romeo@montague.net")); unblockRequest->send(); IQ::ref request = stanzaChannel_->getStanzaAtIndex(2); - CPPUNIT_ASSERT(request.get() != NULL); + CPPUNIT_ASSERT(request.get() != nullptr); boost::shared_ptr unblockPayload = request->getPayload(); - 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::ref unblockRequest = clientBlockListManager_->createUnblockAllRequest(); unblockRequest->send(); IQ::ref request = stanzaChannel_->getStanzaAtIndex(2); - CPPUNIT_ASSERT(request.get() != NULL); + CPPUNIT_ASSERT(request.get() != nullptr); boost::shared_ptr unblockPayload = request->getPayload(); - 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(0); - CPPUNIT_ASSERT(request.get() != NULL); + CPPUNIT_ASSERT(request.get() != nullptr); boost::shared_ptr requestPayload = request->getPayload(); - 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 connec connection_ = connection; assert(!sessionStream_); - sessionStream_ = boost::shared_ptr(new BasicSessionStream(ComponentStreamType, connection_, getPayloadParserFactories(), getPayloadSerializers(), NULL, networkFactories->getTimerFactory(), networkFactories->getXMLParserFactory(), TLSOptions())); + sessionStream_ = boost::shared_ptr(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(); 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(PlatformCryptoProvider::create()); destination = "092a44d859d19c9eed676b551ee80025903351c2"; - randomGen.seed(static_cast(time(NULL))); + randomGen.seed(static_cast(time(nullptr))); eventLoop = new DummyEventLoop(); timerFactory = new DummyTimerFactory(); connection = boost::make_shared(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(secondsSinceEpoch) + ", " + boost::lexical_cast(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 SQLiteHistoryStorage::getMessagesFromDate(const JID& " AND time<" + boost::lexical_cast(upperBound) + ")"; } - int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast(selectQuery.size()), &selectStatement, NULL); + int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast(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 SQLiteHistoryStorage::getJIDFromID(long long id) const { boost::optional result; sqlite3_stmt* selectStatement; std::string selectQuery("SELECT jid FROM jids WHERE id=" + boost::lexical_cast(id)); - int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast(selectQuery.size()), &selectStatement, NULL); + int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast(selectQuery.size()), &selectStatement, nullptr); if (r != SQLITE_OK) { std::cout << "Error: " << sqlite3_errmsg(db_) << std::endl; } @@ -199,7 +199,7 @@ boost::optional SQLiteHistoryStorage::getIDFromJID(const JID& jid) co boost::optional 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(selectQuery.size()), &selectStatement, NULL); + long long r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast(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(query.size()), &selectStatement, NULL); + int r = sqlite3_prepare(db_, query.c_str(), boost::numeric_cast(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(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(selectQuery.size()), &selectStatement, NULL); + int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast(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(*selfID) + " AND fromBare=" + boost::lexical_cast(*mucID) + ") ORDER BY time DESC LIMIT 1"; - int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast(selectQuery.size()), &selectStatement, NULL); + int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast(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 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 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 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 q, EventLoop* eventLoop) : eventLoop(eventLoop), querier(q), sdRef(0) { +BonjourQuery::BonjourQuery(boost::shared_ptr 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 querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { DNSServiceErrorType result = DNSServiceRegister( - &sdRef, 0, 0, name.c_str(), "_presence._tcp", NULL, NULL, boost::numeric_cast(port), + &sdRef, 0, 0, name.c_str(), "_presence._tcp", nullptr, nullptr, boost::numeric_cast(port), boost::numeric_cast(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 lock(sdRefMutex); - DNSServiceUpdateRecord(sdRef, NULL, 0, boost::numeric_cast(txtRecord.size()), vecptr(txtRecord), 0); + DNSServiceUpdateRecord(sdRef, nullptr, 0, boost::numeric_cast(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 ioService, EventLoop* eventLoop) : port_(port), ioService_(ioService), eventLoop(eventLoop), acceptor_(NULL) { +BoostConnectionServer::BoostConnectionServer(int port, boost::shared_ptr ioService, EventLoop* eventLoop) : port_(port), ioService_(ioService), eventLoop(eventLoop), acceptor_(nullptr) { } -BoostConnectionServer::BoostConnectionServer(const HostAddress &address, int port, boost::shared_ptr ioService, EventLoop* eventLoop) : address_(address), port_(port), ioService_(ioService), eventLoop(eventLoop), acceptor_(NULL) { +BoostConnectionServer::BoostConnectionServer(const HostAddress &address, int port, boost::shared_ptr 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 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 ioService) { if (!!ioService) { ioService_ = ioService; - thread_ = NULL; + thread_ = nullptr; } else { ioService_ = boost::make_shared(); 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 (enabledKey), reinterpret_cast (&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 (CFDictionaryGetValue(dict, portKey)); - if(numberValue != NULL) { + if(numberValue != nullptr) { CFNumberGetValue(numberValue, kCFNumberIntType, &port); } CFStringRef stringValue = reinterpret_cast (CFDictionaryGetValue(dict, hostKey)); - if(stringValue != NULL) { + if(stringValue != nullptr) { std::vector 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()) { 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 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(mapping.getLocalPort()); std::string leaseSeconds = boost::lexical_cast(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 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 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 @@ -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(NULL), timerFactory, eventLoop, to, initialRID, URL(), SafeString(""), SafeString(""), TLSOptions())); + PoolRef pool = PoolRef(new BOSHConnectionPool(boshURL, resolver, connectionFactory, &parserFactory, static_cast(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 #include @@ -28,13 +34,13 @@ namespace Swift { std::vector UnixNetworkEnvironment::getNetworkInterfaces() const { std::map interfaces; #ifndef __ANDROID__ - ifaddrs* addrs = 0; + ifaddrs* addrs = nullptr; int ret = getifaddrs(&addrs); if (ret != 0) { return std::vector(); } - 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 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 #include #include @@ -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 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 element) const { - return boost::dynamic_pointer_cast(element) != 0; + return boost::dynamic_pointer_cast(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& explicitNS = boost::optional()) : StanzaSerializer(tag, payloadSerializers, explicitNS) {} virtual bool canSerialize(boost::shared_ptr element) const { - return dynamic_cast(element.get()) != 0; + return dynamic_cast(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::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 dist(0, (1LL<<53) - 1); - random.seed(static_cast(time(NULL))); + random.seed(static_cast(time(nullptr))); unsigned long long initialRID = boost::variate_generator >(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(der.size()), NULL); + CFDataRef derData = CFDataCreateWithBytesNoCopy(nullptr, der.data(), static_cast(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(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(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 pkcs12 = boost::dynamic_pointer_cast(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(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([NSData dataWithBytes: static_cast(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(SSLCreateContext(NULL, kSSLClientSide, kSSLStreamType), CFRelease); + sslContext_ = boost::shared_ptr(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(), boost::make_shared()); @@ -364,7 +364,7 @@ std::vector SecureTransportContext::getPeerCertificateChain() typedef boost::remove_pointer::type SecTrust; boost::shared_ptr securityTrust; - SecTrustRef secTrust = NULL;; + SecTrustRef secTrust = nullptr;; OSStatus error = SSLCopyPeerTrust(sslContext_.get(), &secTrust); if (error == noErr) { securityTrust = boost::shared_ptr(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()); WhiteboardSession::ref session = sessionManager_->getSession(from); - if (session != NULL) { + if (session != nullptr) { session->handleIncomingAction(payload); } } -- cgit v0.10.2-6-g49f6