From 3d6694b0c698fff63d11f8bb4aa995c1df882315 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Tue, 20 Mar 2012 01:05:55 +0100 Subject: boost::shared_ptr(new ?(...)) -> boost::make_shared(...) transformation where possible. License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php diff --git a/Limber/Server/ServerFromClientSession.cpp b/Limber/Server/ServerFromClientSession.cpp index fd361b7..71a8fef 100644 --- a/Limber/Server/ServerFromClientSession.cpp +++ b/Limber/Server/ServerFromClientSession.cpp @@ -6,6 +6,7 @@ #include "Limber/Server/ServerFromClientSession.h" +#include #include #include "Swiften/Elements/ProtocolHeader.h" @@ -47,14 +48,14 @@ void ServerFromClientSession::handleElement(boost::shared_ptr element) if (AuthRequest* authRequest = dynamic_cast(element.get())) { if (authRequest->getMechanism() == "PLAIN" || (allowSASLEXTERNAL && authRequest->getMechanism() == "EXTERNAL")) { if (authRequest->getMechanism() == "EXTERNAL") { - getXMPPLayer()->writeElement(boost::shared_ptr(new AuthSuccess())); + getXMPPLayer()->writeElement(boost::make_shared()); authenticated_ = true; getXMPPLayer()->resetParser(); } else { PLAINMessage plainMessage(authRequest->getMessage() ? *authRequest->getMessage() : createSafeByteArray("")); if (userRegistry_->isValidUserPassword(JID(plainMessage.getAuthenticationID(), getLocalJID().getDomain()), plainMessage.getPassword())) { - getXMPPLayer()->writeElement(boost::shared_ptr(new AuthSuccess())); + getXMPPLayer()->writeElement(boost::make_shared()); user_ = plainMessage.getAuthenticationID(); authenticated_ = true; getXMPPLayer()->resetParser(); diff --git a/Limber/main.cpp b/Limber/main.cpp index 350b357..3db3092 100644 --- a/Limber/main.cpp +++ b/Limber/main.cpp @@ -61,7 +61,7 @@ class Server { if (!stanza->getTo().isValid() || stanza->getTo() == session->getLocalJID() || stanza->getTo() == session->getRemoteJID().toBare()) { if (boost::shared_ptr iq = boost::dynamic_pointer_cast(stanza)) { if (iq->getPayload()) { - session->sendElement(IQ::createResult(iq->getFrom(), iq->getID(), boost::shared_ptr(new RosterPayload()))); + session->sendElement(IQ::createResult(iq->getFrom(), iq->getID(), boost::make_shared()))); } if (iq->getPayload()) { if (iq->getType() == IQ::Get) { diff --git a/Slimber/FileVCardCollection.cpp b/Slimber/FileVCardCollection.cpp index 97ade08..24249d4 100644 --- a/Slimber/FileVCardCollection.cpp +++ b/Slimber/FileVCardCollection.cpp @@ -6,6 +6,7 @@ #include "Slimber/FileVCardCollection.h" +#include #include #include @@ -30,7 +31,7 @@ boost::shared_ptr FileVCardCollection::getOwnVCard() const { return boost::dynamic_pointer_cast(parser.getPayload()); } else { - return boost::shared_ptr(new VCard()); + return boost::make_shared(); } } diff --git a/Slimber/Server.cpp b/Slimber/Server.cpp index 769217f..b63ca67 100644 --- a/Slimber/Server.cpp +++ b/Slimber/Server.cpp @@ -327,7 +327,7 @@ void Server::registerLinkLocalSession(boost::shared_ptr session) { session->onElementReceived.connect( boost::bind(&Server::handleLinkLocalElementReceived, this, _1, session)); linkLocalSessions.push_back(session); - //tracers.push_back(boost::shared_ptr(new SessionTracer(session))); + //tracers.push_back(boost::make_shared(session)); session->startSession(); } diff --git a/Slimber/UnitTest/LinkLocalPresenceManagerTest.cpp b/Slimber/UnitTest/LinkLocalPresenceManagerTest.cpp index e45861b..c138b2c 100644 --- a/Slimber/UnitTest/LinkLocalPresenceManagerTest.cpp +++ b/Slimber/UnitTest/LinkLocalPresenceManagerTest.cpp @@ -42,7 +42,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture { public: void setUp() { eventLoop = new DummyEventLoop(); - querier = boost::shared_ptr(new FakeDNSSDQuerier("wonderland.lit", eventLoop)); + querier = boost::make_shared("wonderland.lit", eventLoop); browser = new LinkLocalServiceBrowser(querier); browser->start(); } diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp index ea0e8ea..610c8e8 100644 --- a/Swift/Controllers/Chat/ChatController.cpp +++ b/Swift/Controllers/Chat/ChatController.cpp @@ -7,6 +7,7 @@ #include "Swift/Controllers/Chat/ChatController.h" #include +#include #include #include @@ -321,7 +322,7 @@ void ChatController::handlePresenceChange(boost::shared_ptr newPresenc return; } if (!newPresence) { - newPresence = boost::shared_ptr(new Presence()); + newPresence = boost::make_shared(); newPresence->setType(Presence::Unavailable); } lastShownStatus_ = newPresence->getShow(); diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp index db71397..f590ffd 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.cpp +++ b/Swift/Controllers/Chat/ChatControllerBase.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -120,7 +121,7 @@ void ChatControllerBase::handleSendMessageRequest(const std::string &body, bool preSendMessageRequest(message); if (useDelayForLatency_) { boost::posix_time::ptime now = boost::posix_time::microsec_clock::universal_time(); - message->addPayload(boost::shared_ptr(new Delay(now, selfJID_))); + message->addPayload(boost::make_shared(now, selfJID_)); } if (isCorrectionMessage) { message->addPayload(boost::shared_ptr (new Replace(lastSentMessageStanzaID_))); diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index 118f1e8..aea5ef4 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -89,7 +90,7 @@ ChatsManager::ChatsManager( nickResolver_ = nickResolver; presenceOracle_ = presenceOracle; avatarManager_ = NULL; - serverDiscoInfo_ = boost::shared_ptr(new DiscoInfo()); + serverDiscoInfo_ = boost::make_shared(); presenceSender_ = presenceSender; uiEventStream_ = uiEventStream; mucBookmarkManager_ = NULL; diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp index cd868e6..bbfb22f 100644 --- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp @@ -87,7 +87,7 @@ public: mucRegistry_ = new MUCRegistry(); nickResolver_ = new NickResolver(jid_.toBare(), xmppRoster_, NULL, mucRegistry_); presenceOracle_ = new PresenceOracle(stanzaChannel_); - serverDiscoInfo_ = boost::shared_ptr(new DiscoInfo()); + serverDiscoInfo_ = boost::make_shared(); presenceSender_ = new StanzaChannelPresenceSender(stanzaChannel_); directedPresenceSender_ = new DirectedPresenceSender(presenceSender_); mucManager_ = new MUCManager(stanzaChannel_, iqRouter_, directedPresenceSender_, mucRegistry_); @@ -257,7 +257,7 @@ public: JID muc("testling@test.com"); ChatWindow* mucWindow = new MockChatWindow(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(muc, uiEventStream_).Return(mucWindow); - uiEventStream_->send(boost::shared_ptr(new JoinMUCUIEvent(muc, std::string("nick")))); + uiEventStream_->send(boost::make_shared(muc, std::string("nick"))); std::string messageJIDString1("testling@test.com/1"); diff --git a/Swift/Controllers/Chat/UserSearchController.cpp b/Swift/Controllers/Chat/UserSearchController.cpp index d6a920d..af962e9 100644 --- a/Swift/Controllers/Chat/UserSearchController.cpp +++ b/Swift/Controllers/Chat/UserSearchController.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -104,7 +105,7 @@ void UserSearchController::handleDiscoServiceFound(const JID& jid, boost::shared if (/*isUserDirectory && */supports55) { //FIXME: once M-Link correctly advertises directoryness. /* Abort further searches.*/ endDiscoWalker(); - boost::shared_ptr > searchRequest(new GenericRequest(IQ::Get, jid, boost::shared_ptr(new SearchPayload()), iqRouter_)); + boost::shared_ptr > searchRequest(new GenericRequest(IQ::Get, jid, boost::make_shared(), iqRouter_)); searchRequest->onResponse.connect(boost::bind(&UserSearchController::handleFormResponse, this, _1, _2)); searchRequest->send(); } diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index cd7e673..e923cff 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -381,7 +381,7 @@ void MainController::sendPresence(boost::shared_ptr presence) { // Add information and send if (!vCardPhotoHash_.empty()) { - presence->updatePayload(boost::shared_ptr(new VCardUpdate(vCardPhotoHash_))); + presence->updatePayload(boost::make_shared(vCardPhotoHash_)); } client_->getPresenceSender()->sendPresence(presence); if (presence->getType() == Presence::Unavailable) { @@ -582,7 +582,7 @@ void MainController::handleDisconnected(const boost::optional& erro } else { message = str(format(QT_TRANSLATE_NOOP("", "Disconnected from %1%: %2%.")) % jid_.getDomain() % message); } - lastDisconnectError_ = boost::shared_ptr(new ErrorEvent(JID(jid_.getDomain()), message)); + lastDisconnectError_ = boost::make_shared(JID(jid_.getDomain()), message); eventController_->handleIncomingEvent(lastDisconnectError_); } } @@ -675,7 +675,7 @@ void MainController::handleNotificationClicked(const JID& jid) { assert(chatsManager_); if (clientInitialized_) { if (client_->getMUCRegistry()->isMUC(jid)) { - uiEventStream_->send(boost::shared_ptr(new JoinMUCUIEvent(jid))); + uiEventStream_->send(boost::make_shared(jid)); } else { uiEventStream_->send(boost::shared_ptr(new RequestChatUIEvent(jid))); diff --git a/Swift/Controllers/Roster/UnitTest/RosterTest.cpp b/Swift/Controllers/Roster/UnitTest/RosterTest.cpp index 4444e8a..0c3e769 100644 --- a/Swift/Controllers/Roster/UnitTest/RosterTest.cpp +++ b/Swift/Controllers/Roster/UnitTest/RosterTest.cpp @@ -98,7 +98,7 @@ class RosterTest : public CppUnit::TestFixture { presence->setFrom(jid4c); roster_->applyOnItems(SetPresence(presence, JID::WithResource)); - presence = boost::shared_ptr(new Presence()); + presence = boost::make_shared(); presence->setFrom(jid4b); presence->setShow(StatusShow::Online); roster_->applyOnItems(SetPresence(presence, JID::WithResource)); @@ -110,7 +110,7 @@ class RosterTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(std::string("Bert"), children[1]->getDisplayName()); CPPUNIT_ASSERT_EQUAL(std::string("Bird"), children[2]->getDisplayName()); - presence = boost::shared_ptr(new Presence()); + presence = boost::make_shared(); presence->setFrom(jid4c); presence->setType(Presence::Unavailable); roster_->removeContact(jid4c); diff --git a/Swift/Controllers/StatusTracker.cpp b/Swift/Controllers/StatusTracker.cpp index 8f67b9f..0c88f4d 100644 --- a/Swift/Controllers/StatusTracker.cpp +++ b/Swift/Controllers/StatusTracker.cpp @@ -6,17 +6,19 @@ #include "Swift/Controllers/StatusTracker.h" +#include + namespace Swift { StatusTracker::StatusTracker() { isAutoAway_ = false; - queuedPresence_ = boost::shared_ptr(new Presence()); + queuedPresence_ = boost::make_shared(); } boost::shared_ptr StatusTracker::getNextPresence() { boost::shared_ptr presence; if (isAutoAway_) { - presence = boost::shared_ptr(new Presence()); + presence = boost::make_shared(); presence->setShow(StatusShow::Away); presence->setStatus(queuedPresence_->getStatus()); } else { @@ -29,7 +31,7 @@ void StatusTracker::setRequestedPresence(boost::shared_ptr presence) { isAutoAway_ = false; queuedPresence_ = presence; // if (presence->getType() == Presence::Unavailable) { -// queuedPresence_ = boost::shared_ptr(new Presence()); +// queuedPresence_ = boost::make_shared(); // } } diff --git a/Swift/QtUI/EventViewer/main.cpp b/Swift/QtUI/EventViewer/main.cpp index afdb442..07a437c 100644 --- a/Swift/QtUI/EventViewer/main.cpp +++ b/Swift/QtUI/EventViewer/main.cpp @@ -26,6 +26,6 @@ int main(int argc, char *argv[]) for (int i = 0; i < 100; i++) { viewer->addEvent(boost::dynamic_pointer_cast(event1), false); } - viewer->addEvent(boost::dynamic_pointer_cast(boost::shared_ptr(new Swift::ErrorEvent(Swift::JID("me@example.com"), "Something bad did happen to you."))), true); + viewer->addEvent(boost::dynamic_pointer_cast(boost::make_shared(Swift::JID("me@example.com"), "Something bad did happen to you.")), true); return app.exec(); } diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index a3b7837..dc6001b 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -405,7 +405,7 @@ void QtLoginWindow::handleAbout() { } void QtLoginWindow::handleShowXMLConsole() { - uiEventStream_->send(boost::shared_ptr(new RequestXMLConsoleUIEvent())); + uiEventStream_->send(boost::make_shared()); } void QtLoginWindow::handleShowFileTransferOverview() { diff --git a/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp b/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp index 821412b..60e76f8 100644 --- a/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp +++ b/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp @@ -158,7 +158,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { boost::shared_ptr createPresenceWithPhotoHash(const JID& jid, const std::string& hash) { boost::shared_ptr presence(new Presence()); presence->setFrom(jid); - presence->addPayload(boost::shared_ptr(new VCardUpdate(hash))); + presence->addPayload(boost::make_shared(hash)); return presence; } diff --git a/Swiften/Client/UnitTest/ClientSessionTest.cpp b/Swiften/Client/UnitTest/ClientSessionTest.cpp index 22db8fc..a6d5a3a 100644 --- a/Swiften/Client/UnitTest/ClientSessionTest.cpp +++ b/Swiften/Client/UnitTest/ClientSessionTest.cpp @@ -66,7 +66,7 @@ class ClientSessionTest : public CppUnit::TestFixture { public: void setUp() { - server = boost::shared_ptr(new MockSessionStream()); + server = boost::make_shared(); sessionFinishedReceived = false; needCredentials = false; blindCertificateTrustChecker = new BlindCertificateTrustChecker(); @@ -420,11 +420,11 @@ class ClientSessionTest : public CppUnit::TestFixture { } void breakConnection() { - onClosed(boost::shared_ptr(new SessionStream::Error(SessionStream::Error::ConnectionReadError))); + onClosed(boost::make_shared(SessionStream::Error::ConnectionReadError)); } void breakTLS() { - onClosed(boost::shared_ptr(new SessionStream::Error(SessionStream::Error::TLSError))); + onClosed(boost::make_shared(SessionStream::Error::TLSError)); } @@ -445,11 +445,11 @@ class ClientSessionTest : public CppUnit::TestFixture { } void sendTLSProceed() { - onElementReceived(boost::shared_ptr(new TLSProceed())); + onElementReceived(boost::make_shared()); } void sendTLSFailure() { - onElementReceived(boost::shared_ptr(new StartTLSFailure())); + onElementReceived(boost::make_shared()); } void sendStreamFeaturesWithMultipleAuthentication() { @@ -484,19 +484,19 @@ class ClientSessionTest : public CppUnit::TestFixture { } void sendAuthSuccess() { - onElementReceived(boost::shared_ptr(new AuthSuccess())); + onElementReceived(boost::make_shared()); } void sendAuthFailure() { - onElementReceived(boost::shared_ptr(new AuthFailure())); + onElementReceived(boost::make_shared()); } void sendStreamManagementEnabled() { - onElementReceived(boost::shared_ptr(new StreamManagementEnabled())); + onElementReceived(boost::make_shared()); } void sendStreamManagementFailed() { - onElementReceived(boost::shared_ptr(new StreamManagementFailed())); + onElementReceived(boost::make_shared()); } void sendBindResult() { @@ -755,7 +755,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest); processEvents(); getMockServer()->expectMessage(); - session->sendElement(boost::shared_ptr(new Message())); + session->sendElement(boost::make_shared())); } void testSendElement() { diff --git a/Swiften/Component/ComponentSession.cpp b/Swiften/Component/ComponentSession.cpp index af11146..51d9d15 100644 --- a/Swiften/Component/ComponentSession.cpp +++ b/Swiften/Component/ComponentSession.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -101,7 +102,7 @@ void ComponentSession::finish() { } void ComponentSession::finishSession(Error::Type error) { - finishSession(boost::shared_ptr(new Swift::ComponentSession::Error(error))); + finishSession(boost::make_shared(error)); } void ComponentSession::finishSession(boost::shared_ptr finishError) { diff --git a/Swiften/Component/UnitTest/ComponentSessionTest.cpp b/Swiften/Component/UnitTest/ComponentSessionTest.cpp index 1541cce..9763c7f 100644 --- a/Swiften/Component/UnitTest/ComponentSessionTest.cpp +++ b/Swiften/Component/UnitTest/ComponentSessionTest.cpp @@ -26,7 +26,7 @@ class ComponentSessionTest : public CppUnit::TestFixture { public: void setUp() { - server = boost::shared_ptr(new MockSessionStream()); + server = boost::make_shared(); sessionFinishedReceived = false; } @@ -159,7 +159,7 @@ class ComponentSessionTest : public CppUnit::TestFixture { } void breakConnection() { - onClosed(boost::shared_ptr(new SessionStream::Error(SessionStream::Error::ConnectionReadError))); + onClosed(boost::make_shared(SessionStream::Error::ConnectionReadError)); } void sendStreamStart() { diff --git a/Swiften/Disco/DiscoInfoResponder.cpp b/Swiften/Disco/DiscoInfoResponder.cpp index a8dd9f0..9e58bff 100644 --- a/Swiften/Disco/DiscoInfoResponder.cpp +++ b/Swiften/Disco/DiscoInfoResponder.cpp @@ -4,6 +4,8 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ +#include + #include #include #include @@ -30,12 +32,12 @@ void DiscoInfoResponder::setDiscoInfo(const std::string& node, const DiscoInfo& bool DiscoInfoResponder::handleGetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr info) { if (info->getNode().empty()) { - sendResponse(from, id, boost::shared_ptr(new DiscoInfo(info_))); + sendResponse(from, id, boost::make_shared(info_)); } else { std::map::const_iterator i = nodeInfo_.find(info->getNode()); if (i != nodeInfo_.end()) { - sendResponse(from, id, boost::shared_ptr(new DiscoInfo((*i).second))); + sendResponse(from, id, boost::make_shared((*i).second)); } else { sendError(from, id, ErrorPayload::ItemNotFound, ErrorPayload::Cancel); diff --git a/Swiften/Disco/GetDiscoInfoRequest.h b/Swiften/Disco/GetDiscoInfoRequest.h index e211632..c9a4c97 100644 --- a/Swiften/Disco/GetDiscoInfoRequest.h +++ b/Swiften/Disco/GetDiscoInfoRequest.h @@ -6,6 +6,8 @@ #pragma once +#include + #include #include @@ -24,11 +26,11 @@ namespace Swift { private: GetDiscoInfoRequest(const JID& jid, IQRouter* router) : - GenericRequest(IQ::Get, jid, boost::shared_ptr(new DiscoInfo()), router) { + GenericRequest(IQ::Get, jid, boost::make_shared(), router) { } GetDiscoInfoRequest(const JID& jid, const std::string& node, IQRouter* router) : - GenericRequest(IQ::Get, jid, boost::shared_ptr(new DiscoInfo()), router) { + GenericRequest(IQ::Get, jid, boost::make_shared(), router) { getPayloadGeneric()->setNode(node); } }; diff --git a/Swiften/Disco/GetDiscoItemsRequest.h b/Swiften/Disco/GetDiscoItemsRequest.h index 20d18f8..c4ed579 100644 --- a/Swiften/Disco/GetDiscoItemsRequest.h +++ b/Swiften/Disco/GetDiscoItemsRequest.h @@ -6,6 +6,8 @@ #pragma once +#include + #include #include @@ -24,11 +26,11 @@ namespace Swift { private: GetDiscoItemsRequest(const JID& jid, IQRouter* router) : - GenericRequest(IQ::Get, jid, boost::shared_ptr(new DiscoItems()), router) { + GenericRequest(IQ::Get, jid, boost::make_shared(), router) { } GetDiscoItemsRequest(const JID& jid, const std::string& node, IQRouter* router) : - GenericRequest(IQ::Get, jid, boost::shared_ptr(new DiscoItems()), router) { + GenericRequest(IQ::Get, jid, boost::make_shared(), router) { getPayloadGeneric()->setNode(node); } }; diff --git a/Swiften/Disco/JIDDiscoInfoResponder.cpp b/Swiften/Disco/JIDDiscoInfoResponder.cpp index 0a25bef..4aed254 100644 --- a/Swiften/Disco/JIDDiscoInfoResponder.cpp +++ b/Swiften/Disco/JIDDiscoInfoResponder.cpp @@ -4,6 +4,8 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ +#include + #include #include #include @@ -33,12 +35,12 @@ bool JIDDiscoInfoResponder::handleGetRequest(const JID& from, const JID& to, con JIDDiscoInfoMap::const_iterator i = info.find(to); if (i != info.end()) { if (discoInfo->getNode().empty()) { - sendResponse(from, to, id, boost::shared_ptr(new DiscoInfo(i->second.discoInfo))); + sendResponse(from, to, id, boost::make_shared(i->second.discoInfo)); } else { std::map::const_iterator j = i->second.nodeDiscoInfo.find(discoInfo->getNode()); if (j != i->second.nodeDiscoInfo.end()) { - sendResponse(from, to, id, boost::shared_ptr(new DiscoInfo(j->second))); + sendResponse(from, to, id, boost::make_shared(j->second)); } else { sendError(from, to, id, ErrorPayload::ItemNotFound, ErrorPayload::Cancel); diff --git a/Swiften/Disco/UnitTest/CapsManagerTest.cpp b/Swiften/Disco/UnitTest/CapsManagerTest.cpp index 0681569..ca55c48 100644 --- a/Swiften/Disco/UnitTest/CapsManagerTest.cpp +++ b/Swiften/Disco/UnitTest/CapsManagerTest.cpp @@ -45,16 +45,16 @@ class CapsManagerTest : public CppUnit::TestFixture { iqRouter = new IQRouter(stanzaChannel); storage = new CapsMemoryStorage(); user1 = JID("user1@bar.com/bla"); - discoInfo1 = boost::shared_ptr(new DiscoInfo()); + discoInfo1 = boost::make_shared(); discoInfo1->addFeature("http://swift.im/feature1"); - capsInfo1 = boost::shared_ptr(new CapsInfo(CapsInfoGenerator("http://node1.im").generateCapsInfo(*discoInfo1.get()))); - capsInfo1alt = boost::shared_ptr(new CapsInfo(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo1.get()))); + capsInfo1 = boost::make_shared(CapsInfoGenerator("http://node1.im").generateCapsInfo(*discoInfo1.get())); + capsInfo1alt = boost::make_shared(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo1.get())); user2 = JID("user2@foo.com/baz"); - discoInfo2 = boost::shared_ptr(new DiscoInfo()); + discoInfo2 = boost::make_shared(); discoInfo2->addFeature("http://swift.im/feature2"); - capsInfo2 = boost::shared_ptr(new CapsInfo(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo2.get()))); + capsInfo2 = boost::make_shared(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo2.get())); user3 = JID("user3@foo.com/baz"); - legacyCapsInfo = boost::shared_ptr(new CapsInfo("http://swift.im", "ver1", "")); + legacyCapsInfo = boost::make_shared("http://swift.im", "ver1", ""); } void tearDown() { diff --git a/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp b/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp index 7b61cb5..0fd966d 100644 --- a/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp +++ b/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp @@ -34,16 +34,16 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { capsProvider = new DummyCapsProvider(); user1 = JID("user1@bar.com/bla"); - discoInfo1 = boost::shared_ptr(new DiscoInfo()); + discoInfo1 = boost::make_shared(); discoInfo1->addFeature("http://swift.im/feature1"); - capsInfo1 = boost::shared_ptr(new CapsInfo(CapsInfoGenerator("http://node1.im").generateCapsInfo(*discoInfo1.get()))); - capsInfo1alt = boost::shared_ptr(new CapsInfo(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo1.get()))); + capsInfo1 = boost::make_shared(CapsInfoGenerator("http://node1.im").generateCapsInfo(*discoInfo1.get())); + capsInfo1alt = boost::make_shared(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo1.get())); user2 = JID("user2@foo.com/baz"); - discoInfo2 = boost::shared_ptr(new DiscoInfo()); + discoInfo2 = boost::make_shared(); discoInfo2->addFeature("http://swift.im/feature2"); - capsInfo2 = boost::shared_ptr(new CapsInfo(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo2.get()))); + capsInfo2 = boost::make_shared(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo2.get())); user3 = JID("user3@foo.com/baz"); - legacyCapsInfo = boost::shared_ptr(new CapsInfo("http://swift.im", "ver1", "")); + legacyCapsInfo = boost::make_shared("http://swift.im", "ver1", ""); } void tearDown() { diff --git a/Swiften/Elements/UnitTest/StanzaTest.cpp b/Swiften/Elements/UnitTest/StanzaTest.cpp index 0319b52..4bb59b1 100644 --- a/Swiften/Elements/UnitTest/StanzaTest.cpp +++ b/Swiften/Elements/UnitTest/StanzaTest.cpp @@ -69,8 +69,8 @@ class StanzaTest : public CppUnit::TestFixture void testConstructor_Copy() { Message m; - m.addPayload(boost::shared_ptr(new MyPayload1())); - m.addPayload(boost::shared_ptr(new MyPayload2())); + m.addPayload(boost::make_shared()); + m.addPayload(boost::make_shared()); Message copy(m); CPPUNIT_ASSERT(copy.getPayload()); @@ -81,7 +81,7 @@ class StanzaTest : public CppUnit::TestFixture bool payloadAlive = true; { Message m; - m.addPayload(boost::shared_ptr(new DestroyingPayload(&payloadAlive))); + m.addPayload(boost::make_shared(&payloadAlive)); } CPPUNIT_ASSERT(!payloadAlive); @@ -90,7 +90,7 @@ class StanzaTest : public CppUnit::TestFixture void testDestructor_Copy() { bool payloadAlive = true; Message* m1 = new Message(); - m1->addPayload(boost::shared_ptr(new DestroyingPayload(&payloadAlive))); + m1->addPayload(boost::make_shared(&payloadAlive)); Message* m2 = new Message(*m1); delete m1; @@ -102,9 +102,9 @@ class StanzaTest : public CppUnit::TestFixture void testGetPayload() { Message m; - m.addPayload(boost::shared_ptr(new MyPayload1())); - m.addPayload(boost::shared_ptr(new MyPayload2())); - m.addPayload(boost::shared_ptr(new MyPayload3())); + m.addPayload(boost::make_shared()); + m.addPayload(boost::make_shared()); + m.addPayload(boost::make_shared()); boost::shared_ptr p(m.getPayload()); CPPUNIT_ASSERT(p); @@ -112,8 +112,8 @@ class StanzaTest : public CppUnit::TestFixture void testGetPayload_NoSuchPayload() { Message m; - m.addPayload(boost::shared_ptr(new MyPayload1())); - m.addPayload(boost::shared_ptr(new MyPayload3())); + m.addPayload(boost::make_shared()); + m.addPayload(boost::make_shared()); boost::shared_ptr p(m.getPayload()); CPPUNIT_ASSERT(!p); @@ -123,9 +123,9 @@ class StanzaTest : public CppUnit::TestFixture Message m; boost::shared_ptr payload1(new MyPayload2()); boost::shared_ptr payload2(new MyPayload2()); - m.addPayload(boost::shared_ptr(new MyPayload1())); + m.addPayload(boost::make_shared()); m.addPayload(payload1); - m.addPayload(boost::shared_ptr(new MyPayload3())); + m.addPayload(boost::make_shared()); m.addPayload(payload2); CPPUNIT_ASSERT_EQUAL(static_cast(2), m.getPayloads().size()); @@ -136,11 +136,11 @@ class StanzaTest : public CppUnit::TestFixture void testUpdatePayload_ExistingPayload() { Message m; - m.addPayload(boost::shared_ptr(new MyPayload1())); - m.addPayload(boost::shared_ptr(new MyPayload2("foo"))); - m.addPayload(boost::shared_ptr(new MyPayload3())); + m.addPayload(boost::make_shared()); + m.addPayload(boost::make_shared("foo")); + m.addPayload(boost::make_shared()); - m.updatePayload(boost::shared_ptr(new MyPayload2("bar"))); + m.updatePayload(boost::make_shared("bar")); CPPUNIT_ASSERT_EQUAL(static_cast(3), m.getPayloads().size()); boost::shared_ptr p(m.getPayload()); @@ -149,10 +149,10 @@ class StanzaTest : public CppUnit::TestFixture void testUpdatePayload_NewPayload() { Message m; - m.addPayload(boost::shared_ptr(new MyPayload1())); - m.addPayload(boost::shared_ptr(new MyPayload3())); + m.addPayload(boost::make_shared()); + m.addPayload(boost::make_shared()); - m.updatePayload(boost::shared_ptr(new MyPayload2("bar"))); + m.updatePayload(boost::make_shared("bar")); CPPUNIT_ASSERT_EQUAL(static_cast(3), m.getPayloads().size()); boost::shared_ptr p(m.getPayload()); @@ -161,26 +161,26 @@ class StanzaTest : public CppUnit::TestFixture void testGetPayloadOfSameType() { Message m; - m.addPayload(boost::shared_ptr(new MyPayload1())); - m.addPayload(boost::shared_ptr(new MyPayload2("foo"))); - m.addPayload(boost::shared_ptr(new MyPayload3())); + m.addPayload(boost::make_shared()); + m.addPayload(boost::make_shared("foo")); + m.addPayload(boost::make_shared()); - boost::shared_ptr payload(boost::dynamic_pointer_cast(m.getPayloadOfSameType(boost::shared_ptr(new MyPayload2("bar"))))); + boost::shared_ptr payload(boost::dynamic_pointer_cast(m.getPayloadOfSameType(boost::make_shared("bar")))); CPPUNIT_ASSERT(payload); CPPUNIT_ASSERT_EQUAL(std::string("foo"), payload->text_); } void testGetPayloadOfSameType_NoSuchPayload() { Message m; - m.addPayload(boost::shared_ptr(new MyPayload1())); - m.addPayload(boost::shared_ptr(new MyPayload3())); + m.addPayload(boost::make_shared()); + m.addPayload(boost::make_shared()); - CPPUNIT_ASSERT(!m.getPayloadOfSameType(boost::shared_ptr(new MyPayload2("bar")))); + CPPUNIT_ASSERT(!m.getPayloadOfSameType(boost::make_shared("bar"))); } void testGetTimestamp() { Message m; - m.addPayload(boost::shared_ptr(new Delay(boost::posix_time::from_time_t(1)))); + m.addPayload(boost::make_shared(boost::posix_time::from_time_t(1))); boost::optional timestamp = m.getTimestamp(); @@ -190,7 +190,7 @@ class StanzaTest : public CppUnit::TestFixture void testGetTimestamp_TimestampWithFrom() { Message m; - m.addPayload(boost::shared_ptr(new Delay(boost::posix_time::from_time_t(1), JID("foo@bar.com")))); + m.addPayload(boost::make_shared(boost::posix_time::from_time_t(1), JID("foo@bar.com"))); boost::optional timestamp = m.getTimestamp(); @@ -205,10 +205,10 @@ class StanzaTest : public CppUnit::TestFixture void testGetTimestampFrom() { Message m; - m.addPayload(boost::shared_ptr(new Delay(boost::posix_time::from_time_t(0)))); - m.addPayload(boost::shared_ptr(new Delay(boost::posix_time::from_time_t(1), JID("foo1@bar.com")))); - m.addPayload(boost::shared_ptr(new Delay(boost::posix_time::from_time_t(2), JID("foo2@bar.com")))); - m.addPayload(boost::shared_ptr(new Delay(boost::posix_time::from_time_t(3), JID("foo3@bar.com")))); + m.addPayload(boost::make_shared(boost::posix_time::from_time_t(0))); + m.addPayload(boost::make_shared(boost::posix_time::from_time_t(1), JID("foo1@bar.com"))); + m.addPayload(boost::make_shared(boost::posix_time::from_time_t(2), JID("foo2@bar.com"))); + m.addPayload(boost::make_shared(boost::posix_time::from_time_t(3), JID("foo3@bar.com"))); boost::optional timestamp = m.getTimestampFrom(JID("foo2@bar.com")); @@ -218,8 +218,8 @@ class StanzaTest : public CppUnit::TestFixture void testGetTimestampFrom_Fallsback() { Message m; - m.addPayload(boost::shared_ptr(new Delay(boost::posix_time::from_time_t(1), JID("foo1@bar.com")))); - m.addPayload(boost::shared_ptr(new Delay(boost::posix_time::from_time_t(3), JID("foo3@bar.com")))); + m.addPayload(boost::make_shared(boost::posix_time::from_time_t(1), JID("foo1@bar.com"))); + m.addPayload(boost::make_shared(boost::posix_time::from_time_t(3), JID("foo3@bar.com"))); boost::optional timestamp = m.getTimestampFrom(JID("foo2@bar.com")); diff --git a/Swiften/Examples/SendFile/SendFile.cpp b/Swiften/Examples/SendFile/SendFile.cpp index 9b2105b..df3cea4 100644 --- a/Swiften/Examples/SendFile/SendFile.cpp +++ b/Swiften/Examples/SendFile/SendFile.cpp @@ -79,7 +79,7 @@ class FileSender { fileInfo.setDate(boost::posix_time::from_time_t(boost::filesystem::last_write_time(file)));*/ //fileInfo.setHash(Hexify::hexify(MD5::getHash(fileData))); /* - transfer = new OutgoingSIFileTransfer("myid", client->getJID(), recipient, file.filename(), boost::filesystem::file_size(file), "A file", boost::shared_ptr(new FileReadBytestream(file)), client->getIQRouter(), socksBytestreamServer); + transfer = new OutgoingSIFileTransfer("myid", client->getJID(), recipient, file.filename(), boost::filesystem::file_size(file), "A file", boost::make_shared(file)), client->getIQRouter(), socksBytestreamServer); transfer->onFinished.connect(boost::bind(&FileSender::handleFileTransferFinished, this, _1)); transfer->start(); */ diff --git a/Swiften/FileTransfer/OutgoingSIFileTransfer.cpp b/Swiften/FileTransfer/OutgoingSIFileTransfer.cpp index 8a8237a..fc0a551 100644 --- a/Swiften/FileTransfer/OutgoingSIFileTransfer.cpp +++ b/Swiften/FileTransfer/OutgoingSIFileTransfer.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -48,7 +49,7 @@ void OutgoingSIFileTransfer::handleStreamInitiationRequestResponse(StreamInitiat request->send(); } else if (response->getRequestedMethod() == "http://jabber.org/protocol/ibb") { - ibbSession = boost::shared_ptr(new IBBSendSession(id, from, to, bytestream, iqRouter)); + ibbSession = boost::make_shared(id, from, to, bytestream, iqRouter); ibbSession->onFinished.connect(boost::bind(&OutgoingSIFileTransfer::handleIBBSessionFinished, this, _1)); ibbSession->start(); } diff --git a/Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp b/Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp index d12f99e..13b73bb 100644 --- a/Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp +++ b/Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp @@ -37,7 +37,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { void setUp() { stanzaChannel = new DummyStanzaChannel(); iqRouter = new IQRouter(stanzaChannel); - bytestream = boost::shared_ptr(new ByteArrayReadBytestream(createByteArray("abcdefg"))); + bytestream = boost::make_shared(createByteArray("abcdefg")); finished = false; } diff --git a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp index 527e0ca..bb0d9b6 100644 --- a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp +++ b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp @@ -57,7 +57,7 @@ public: timerFactory = new DummyTimerFactory(); connection = boost::make_shared(failingPorts, true, eventLoop); //connection->onDataSent.connect(boost::bind(&SOCKS5BytestreamServerSessionTest::handleDataWritten, this, _1)); - //stream1 = boost::shared_ptr(new ByteArrayReadBytestream(createByteArray("abcdefg"))); + //stream1 = boost::make_shared(createByteArray("abcdefg"))); // connection->onDataRead.connect(boost::bind(&SOCKS5BytestreamClientSessionTest::handleDataRead, this, _1)); } diff --git a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp index 4fe72c0..e6df862 100644 --- a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp +++ b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp @@ -35,9 +35,9 @@ class SOCKS5BytestreamServerSessionTest : public CppUnit::TestFixture { receivedDataChunks = 0; eventLoop = new DummyEventLoop(); bytestreams = new SOCKS5BytestreamRegistry(); - connection = boost::shared_ptr(new DummyConnection(eventLoop)); + connection = boost::make_shared(eventLoop); connection->onDataSent.connect(boost::bind(&SOCKS5BytestreamServerSessionTest::handleDataWritten, this, _1)); - stream1 = boost::shared_ptr(new ByteArrayReadBytestream(createByteArray("abcdefg"))); + stream1 = boost::make_shared(createByteArray("abcdefg")); } void tearDown() { diff --git a/Swiften/LinkLocal/IncomingLinkLocalSession.cpp b/Swiften/LinkLocal/IncomingLinkLocalSession.cpp index b89de81..610b28b 100644 --- a/Swiften/LinkLocal/IncomingLinkLocalSession.cpp +++ b/Swiften/LinkLocal/IncomingLinkLocalSession.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -41,7 +42,7 @@ void IncomingLinkLocalSession::handleStreamStart(const ProtocolHeader& incomingH getXMPPLayer()->writeHeader(header); if (incomingHeader.getVersion() == "1.0") { - getXMPPLayer()->writeElement(boost::shared_ptr(new StreamFeatures())); + getXMPPLayer()->writeElement(boost::make_shared()); } else { setInitialized(); diff --git a/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp b/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp index 474c772..dd5e884 100644 --- a/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp +++ b/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp @@ -31,9 +31,8 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { public: void setUp() { eventLoop = new DummyEventLoop(); - querier = boost::shared_ptr( - new FakeDNSSDQuerier("rabbithole.local", eventLoop)); - connection = boost::shared_ptr(new FakeConnection(eventLoop)); + querier = boost::make_shared("rabbithole.local", eventLoop); + connection = boost::make_shared(eventLoop); connectFinished = false; } diff --git a/Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp b/Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp index c0fd248..93deea5 100644 --- a/Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp +++ b/Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -42,7 +43,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { public: void setUp() { eventLoop = new DummyEventLoop(); - querier = boost::shared_ptr(new FakeDNSSDQuerier("wonderland.lit", eventLoop)); + querier = boost::make_shared("wonderland.lit", eventLoop); aliceServiceID = new DNSSDServiceID("alice", "wonderland.lit"); aliceServiceInfo = new DNSSDResolveServiceQuery::Result("_presence._tcp.wonderland.lit", "xmpp.wonderland.lit", 1234, LinkLocalServiceInfo().toTXTRecord()); testServiceID = new DNSSDServiceID("foo", "bar.local"); diff --git a/Swiften/MUC/MUCBookmarkManager.cpp b/Swiften/MUC/MUCBookmarkManager.cpp index 643a8c4..8a63745 100644 --- a/Swiften/MUC/MUCBookmarkManager.cpp +++ b/Swiften/MUC/MUCBookmarkManager.cpp @@ -7,6 +7,7 @@ #include "MUCBookmarkManager.h" #include +#include #include #include @@ -98,7 +99,7 @@ void MUCBookmarkManager::removeBookmark(const MUCBookmark& bookmark) { void MUCBookmarkManager::flush() { if (!storage) { - storage = boost::shared_ptr(new Storage()); + storage = boost::make_shared(); } // Update the storage element storage->clearRooms(); diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp index e90573f..922a00e 100644 --- a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp +++ b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp @@ -4,6 +4,8 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ +#include + #include #include #include @@ -26,7 +28,7 @@ void SecurityLabelsCatalogParser::handleStartElement(const std::string& element, getPayloadInternal()->setDescription(attributes.getAttribute("desc")); } else if (level_ == ItemLevel && element == "item" && ns == "urn:xmpp:sec-label:catalog:2") { - currentItem_ = boost::shared_ptr(new SecurityLabelsCatalog::Item()); + currentItem_ = boost::make_shared(); currentItem_->setSelector(attributes.getAttribute("selector")); currentItem_->setIsDefault(attributes.getBoolAttribute("default", false)); } diff --git a/Swiften/Parser/UnitTest/StanzaParserTest.cpp b/Swiften/Parser/UnitTest/StanzaParserTest.cpp index b2ddb39..88e6dec 100644 --- a/Swiften/Parser/UnitTest/StanzaParserTest.cpp +++ b/Swiften/Parser/UnitTest/StanzaParserTest.cpp @@ -193,7 +193,7 @@ class StanzaParserTest : public CppUnit::TestFixture { public: MyStanzaParser(PayloadParserFactoryCollection* collection) : StanzaParser(collection) { - stanza_ = boost::shared_ptr(new MyStanza()); + stanza_ = boost::make_shared(); } virtual boost::shared_ptr getElement() const { diff --git a/Swiften/Presence/UnitTest/DirectedPresenceSenderTest.cpp b/Swiften/Presence/UnitTest/DirectedPresenceSenderTest.cpp index 5b385c2..0da78e6 100644 --- a/Swiften/Presence/UnitTest/DirectedPresenceSenderTest.cpp +++ b/Swiften/Presence/UnitTest/DirectedPresenceSenderTest.cpp @@ -28,9 +28,9 @@ class DirectedPresenceSenderTest : public CppUnit::TestFixture { public: void setUp() { channel = new DummyStanzaChannel(); - testPresence = boost::shared_ptr(new Presence()); + testPresence = boost::make_shared(); testPresence->setStatus("Foo"); - secondTestPresence = boost::shared_ptr(new Presence()); + secondTestPresence = boost::make_shared(); secondTestPresence->setStatus("Bar"); stanzaChannelPresenceSender = new StanzaChannelPresenceSender(channel); } diff --git a/Swiften/Queries/Requests/GetPrivateStorageRequest.h b/Swiften/Queries/Requests/GetPrivateStorageRequest.h index b0eefb2..b5fd97f 100644 --- a/Swiften/Queries/Requests/GetPrivateStorageRequest.h +++ b/Swiften/Queries/Requests/GetPrivateStorageRequest.h @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -24,7 +25,7 @@ namespace Swift { } private: - GetPrivateStorageRequest(IQRouter* router) : Request(IQ::Get, JID(), boost::shared_ptr(new PrivateStorage(boost::shared_ptr(new PAYLOAD_TYPE()))), router) { + GetPrivateStorageRequest(IQRouter* router) : Request(IQ::Get, JID(), boost::make_shared(boost::shared_ptr(new PAYLOAD_TYPE())), router) { } virtual void handleResponse(boost::shared_ptr payload, ErrorPayload::ref error) { diff --git a/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h b/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h index a6f782b..943adef 100644 --- a/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h +++ b/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h @@ -6,6 +6,8 @@ #pragma once +#include + #include #include @@ -24,7 +26,7 @@ namespace Swift { const JID& recipient, IQRouter* router) : GenericRequest( - IQ::Get, JID(), boost::shared_ptr(new SecurityLabelsCatalog(recipient)), router) { + IQ::Get, JID(), boost::make_shared(recipient), router) { } }; } diff --git a/Swiften/Queries/Requests/SetPrivateStorageRequest.h b/Swiften/Queries/Requests/SetPrivateStorageRequest.h index f795742..f65f819 100644 --- a/Swiften/Queries/Requests/SetPrivateStorageRequest.h +++ b/Swiften/Queries/Requests/SetPrivateStorageRequest.h @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -24,7 +25,7 @@ namespace Swift { } private: - SetPrivateStorageRequest(boost::shared_ptr payload, IQRouter* router) : Request(IQ::Set, JID(), boost::shared_ptr(new PrivateStorage(payload)), router) { + SetPrivateStorageRequest(boost::shared_ptr payload, IQRouter* router) : Request(IQ::Set, JID(), boost::make_shared(payload), router) { } virtual void handleResponse(boost::shared_ptr, ErrorPayload::ref error) { diff --git a/Swiften/Queries/Responders/SoftwareVersionResponder.cpp b/Swiften/Queries/Responders/SoftwareVersionResponder.cpp index 3f9616a..55328fb 100644 --- a/Swiften/Queries/Responders/SoftwareVersionResponder.cpp +++ b/Swiften/Queries/Responders/SoftwareVersionResponder.cpp @@ -4,6 +4,8 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ +#include + #include #include @@ -19,7 +21,7 @@ void SoftwareVersionResponder::setVersion(const std::string& client, const std:: } bool SoftwareVersionResponder::handleGetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr) { - sendResponse(from, id, boost::shared_ptr(new SoftwareVersion(client, version, os))); + sendResponse(from, id, boost::make_shared(client, version, os)); return true; } diff --git a/Swiften/Queries/UnitTest/IQRouterTest.cpp b/Swiften/Queries/UnitTest/IQRouterTest.cpp index f06b967..ee27a67 100644 --- a/Swiften/Queries/UnitTest/IQRouterTest.cpp +++ b/Swiften/Queries/UnitTest/IQRouterTest.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -43,7 +44,7 @@ class IQRouterTest : public CppUnit::TestFixture { DummyIQHandler handler2(true, &testling); testling.removeHandler(&handler1); - channel_->onIQReceived(boost::shared_ptr(new IQ())); + channel_->onIQReceived(boost::make_shared()); CPPUNIT_ASSERT_EQUAL(0, handler1.called); CPPUNIT_ASSERT_EQUAL(1, handler2.called); @@ -54,9 +55,9 @@ class IQRouterTest : public CppUnit::TestFixture { DummyIQHandler handler2(true, &testling); DummyIQHandler handler1(true, &testling); - channel_->onIQReceived(boost::shared_ptr(new IQ())); + channel_->onIQReceived(boost::make_shared()); testling.removeHandler(&handler1); - channel_->onIQReceived(boost::shared_ptr(new IQ())); + channel_->onIQReceived(boost::make_shared()); CPPUNIT_ASSERT_EQUAL(1, handler1.called); CPPUNIT_ASSERT_EQUAL(1, handler2.called); @@ -67,7 +68,7 @@ class IQRouterTest : public CppUnit::TestFixture { DummyIQHandler handler2(false, &testling); DummyIQHandler handler1(true, &testling); - channel_->onIQReceived(boost::shared_ptr(new IQ())); + channel_->onIQReceived(boost::make_shared()); CPPUNIT_ASSERT_EQUAL(1, handler1.called); CPPUNIT_ASSERT_EQUAL(0, handler2.called); @@ -79,7 +80,7 @@ class IQRouterTest : public CppUnit::TestFixture { DummyIQHandler handler2(true, &testling); DummyIQHandler handler1(false, &testling); - channel_->onIQReceived(boost::shared_ptr(new IQ())); + channel_->onIQReceived(boost::make_shared()); CPPUNIT_ASSERT_EQUAL(1, handler1.called); CPPUNIT_ASSERT_EQUAL(1, handler2.called); @@ -90,7 +91,7 @@ class IQRouterTest : public CppUnit::TestFixture { IQRouter testling(channel_); DummyIQHandler handler(false, &testling); - channel_->onIQReceived(boost::shared_ptr(new IQ())); + channel_->onIQReceived(boost::make_shared()); CPPUNIT_ASSERT_EQUAL(1, static_cast(channel_->iqs_.size())); CPPUNIT_ASSERT(channel_->iqs_[0]->getPayload()); @@ -102,8 +103,8 @@ class IQRouterTest : public CppUnit::TestFixture { DummyIQHandler handler2(true, &testling); RemovingIQHandler handler1(&testling); - channel_->onIQReceived(boost::shared_ptr(new IQ())); - channel_->onIQReceived(boost::shared_ptr(new IQ())); + channel_->onIQReceived(boost::make_shared()); + channel_->onIQReceived(boost::make_shared()); CPPUNIT_ASSERT_EQUAL(1, handler1.called); CPPUNIT_ASSERT_EQUAL(2, handler2.called); @@ -113,7 +114,7 @@ class IQRouterTest : public CppUnit::TestFixture { IQRouter testling(channel_); testling.setFrom(JID("foo@bar.com/baz")); - testling.sendIQ(boost::shared_ptr(new IQ())); + testling.sendIQ(boost::make_shared()); CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/baz"), channel_->iqs_[0]->getFrom()); } @@ -121,7 +122,7 @@ class IQRouterTest : public CppUnit::TestFixture { void testSendIQ_WithoutFrom() { IQRouter testling(channel_); - testling.sendIQ(boost::shared_ptr(new IQ())); + testling.sendIQ(boost::make_shared()); CPPUNIT_ASSERT_EQUAL(JID(), channel_->iqs_[0]->getFrom()); } @@ -131,7 +132,7 @@ class IQRouterTest : public CppUnit::TestFixture { testling.setFrom(JID("foo@bar.com/baz")); DummyIQHandler handler(false, &testling); - channel_->onIQReceived(boost::shared_ptr(new IQ())); + channel_->onIQReceived(boost::make_shared()); CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/baz"), channel_->iqs_[0]->getFrom()); } diff --git a/Swiften/Queries/UnitTest/RequestTest.cpp b/Swiften/Queries/UnitTest/RequestTest.cpp index 52d62fb..cf9b381 100644 --- a/Swiften/Queries/UnitTest/RequestTest.cpp +++ b/Swiften/Queries/UnitTest/RequestTest.cpp @@ -130,7 +130,7 @@ class RequestTest : public CppUnit::TestFixture { testling.send(); boost::shared_ptr error = createError(JID("foo@bar.com/baz"),"test-id"); - boost::shared_ptr errorPayload = boost::shared_ptr(new ErrorPayload(ErrorPayload::InternalServerError)); + boost::shared_ptr errorPayload = boost::make_shared(ErrorPayload::InternalServerError); error->addPayload(errorPayload); channel_->onIQReceived(error); diff --git a/Swiften/Queries/UnitTest/ResponderTest.cpp b/Swiften/Queries/UnitTest/ResponderTest.cpp index a256346..6d40b6c 100644 --- a/Swiften/Queries/UnitTest/ResponderTest.cpp +++ b/Swiften/Queries/UnitTest/ResponderTest.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -32,7 +33,7 @@ class ResponderTest : public CppUnit::TestFixture { void setUp() { channel_ = new DummyIQChannel(); router_ = new IQRouter(channel_); - payload_ = boost::shared_ptr(new SoftwareVersion("foo")); + payload_ = boost::make_shared("foo"); } void tearDown() { @@ -108,7 +109,7 @@ class ResponderTest : public CppUnit::TestFixture { void testHandleIQ_NoPayload() { MyResponder testling(router_); - CPPUNIT_ASSERT(!dynamic_cast(&testling)->handleIQ(boost::shared_ptr(new IQ(IQ::Get)))); + CPPUNIT_ASSERT(!dynamic_cast(&testling)->handleIQ(boost::make_shared(IQ::Get))); CPPUNIT_ASSERT_EQUAL(0, static_cast(testling.getPayloads_.size())); CPPUNIT_ASSERT_EQUAL(0, static_cast(testling.setPayloads_.size())); diff --git a/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp index 2fb86b0..40acd8e 100644 --- a/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -54,7 +55,7 @@ std::string CommandSerializer::serializePayload(boost::shared_ptr comma actions += "<" + actionToString(action) + "/>"; } actions += ""; - commandElement.addNode(boost::shared_ptr(new XMLRawTextNode(actions))); + commandElement.addNode(boost::make_shared(actions)); } foreach (Command::Note note, command->getNotes()) { @@ -68,13 +69,13 @@ std::string CommandSerializer::serializePayload(boost::shared_ptr comma if (!type.empty()) { noteElement->setAttribute("type", type); } - noteElement->addNode(boost::shared_ptr(new XMLTextNode(note.note))); + noteElement->addNode(boost::make_shared(note.note)); commandElement.addNode(noteElement); } Form::ref form = command->getForm(); if (form) { - commandElement.addNode(boost::shared_ptr(new XMLRawTextNode(FormSerializer().serialize(form)))); + commandElement.addNode(boost::make_shared(FormSerializer().serialize(form))); } return commandElement.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp index e2c6f59..03b3eb2 100644 --- a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -39,7 +40,7 @@ std::string DiscoInfoSerializer::serializePayload(boost::shared_ptr d queryElement.addNode(featureElement); } foreach(const Form::ref extension, discoInfo->getExtensions()) { - queryElement.addNode(boost::shared_ptr(new XMLRawTextNode(FormSerializer().serialize(extension)))); + queryElement.addNode(boost::make_shared(FormSerializer().serialize(extension))); } return queryElement.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp index 15c4f32..ba658e3 100644 --- a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -81,11 +82,11 @@ boost::shared_ptr FormSerializer::fieldToXML(boost::shared_ptrsetAttribute("label", field->getLabel()); } if (field->getRequired()) { - fieldElement->addNode(boost::shared_ptr(new XMLElement("required"))); + fieldElement->addNode(boost::make_shared("required")); } if (!field->getDescription().empty()) { boost::shared_ptr descriptionElement(new XMLElement("desc")); - descriptionElement->addNode(boost::shared_ptr(new XMLTextNode(field->getDescription()))); + descriptionElement->addNode(boost::make_shared(field->getDescription())); fieldElement->addNode(descriptionElement); } @@ -174,7 +175,7 @@ void FormSerializer::multiLineify(const std::string& text, const std::string& el std::vector lines = String::split(unRdText, '\n'); foreach (std::string line, lines) { boost::shared_ptr lineElement(new XMLElement(elementName)); - lineElement->addNode(boost::shared_ptr(new XMLTextNode(line))); + lineElement->addNode(boost::make_shared(line)); element->addNode(lineElement); } } diff --git a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp index f3dad80..e78cdb4 100644 --- a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -27,7 +28,7 @@ std::string IBBSerializer::serializePayload(boost::shared_ptr ibb) const { if (ibb->getSequenceNumber() >= 0) { ibbElement.setAttribute("seq", boost::lexical_cast(ibb->getSequenceNumber())); } - ibbElement.addNode(boost::shared_ptr(new XMLTextNode(Base64::encode(ibb->getData())))); + ibbElement.addNode(boost::make_shared(Base64::encode(ibb->getData()))); return ibbElement.serialize(); } case IBB::Open: { diff --git a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp index 12b1bb5..0db546e 100644 --- a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -103,7 +104,7 @@ std::string InBandRegistrationPayloadSerializer::serializePayload(boost::shared_ } if (Form::ref form = registration->getForm()) { - registerElement.addNode(boost::shared_ptr(new XMLRawTextNode(FormSerializer().serialize(form)))); + registerElement.addNode(boost::make_shared(FormSerializer().serialize(form))); } return registerElement.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp index c16a2e4..a04687b 100644 --- a/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp @@ -43,7 +43,7 @@ std::string JinglePayloadSerializer::serializePayload(boost::shared_ptr subPayload, payloads) { PayloadSerializer* serializer = serializers->getPayloadSerializer(subPayload); if (serializer) { - jinglePayload.addNode(boost::shared_ptr(new XMLRawTextNode(serializer->serialize(subPayload)))); + jinglePayload.addNode(boost::make_shared(serializer->serialize(subPayload))); } } } diff --git a/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp index f86b59e..3cb8cf6 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp @@ -6,6 +6,8 @@ #include +#include + #include #include #include @@ -21,7 +23,7 @@ std::string MUCOwnerPayloadSerializer::serializePayload(boost::shared_ptrgetPayloadSerializer(payload); if (serializer) { - mucElement.addNode(boost::shared_ptr(new XMLRawTextNode(serializer->serialize(payload)))); + mucElement.addNode(boost::make_shared(serializer->serialize(payload))); } } return mucElement.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp index 66ca5d0..2e60654 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -60,7 +61,7 @@ std::string MUCUserPayloadSerializer::serializePayload(boost::shared_ptrgetPayloadSerializer(childPayload); if (serializer) { - mucElement.addNode(boost::shared_ptr(new XMLRawTextNode(serializer->serialize(childPayload)))); + mucElement.addNode(boost::make_shared(serializer->serialize(childPayload))); } } return mucElement.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp index 38a5db5..33385b0 100644 --- a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -18,7 +19,7 @@ NicknameSerializer::NicknameSerializer() : GenericPayloadSerializer() std::string NicknameSerializer::serializePayload(boost::shared_ptr nick) const { XMLElement nickElement("nick", "http://jabber.org/protocol/nick"); - nickElement.addNode(boost::shared_ptr(new XMLTextNode(nick->getNickname()))); + nickElement.addNode(boost::make_shared(nick->getNickname())); return nickElement.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp index 6cb226c..cfba552 100644 --- a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -25,7 +26,7 @@ std::string PrivateStorageSerializer::serializePayload(boost::shared_ptrgetPayloadSerializer(payload); if (serializer) { - storageElement.addNode(boost::shared_ptr(new XMLRawTextNode(serializer->serialize(payload)))); + storageElement.addNode(boost::make_shared(serializer->serialize(payload))); } } return storageElement.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp index af0c609..c72734b 100644 --- a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -20,12 +21,12 @@ std::string ResourceBindSerializer::serializePayload(boost::shared_ptrgetJID().isValid()) { boost::shared_ptr jidNode(new XMLElement("jid")); - jidNode->addNode(boost::shared_ptr(new XMLTextNode(resourceBind->getJID().toString()))); + jidNode->addNode(boost::make_shared(resourceBind->getJID().toString())); bindElement.addNode(jidNode); } else if (!resourceBind->getResource().empty()) { boost::shared_ptr resourceNode(new XMLElement("resource")); - resourceNode->addNode(boost::shared_ptr(new XMLTextNode(resourceBind->getResource()))); + resourceNode->addNode(boost::make_shared(resourceBind->getResource())); bindElement.addNode(resourceNode); } return bindElement.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp index b60db12..39eaf7d 100644 --- a/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -33,7 +34,7 @@ std::string RosterItemExchangeSerializer::serializePayload(boost::shared_ptr groupElement(new XMLElement("group")); - groupElement->addNode(boost::shared_ptr(new XMLTextNode(group))); + groupElement->addNode(boost::make_shared(group)); itemElement->addNode(groupElement); } diff --git a/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp b/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp index 84f36d2..d2d143d 100644 --- a/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -42,12 +43,12 @@ std::string RosterSerializer::serializePayload(boost::shared_ptr foreach(const std::string& group, item.getGroups()) { boost::shared_ptr groupElement(new XMLElement("group")); - groupElement->addNode(boost::shared_ptr(new XMLTextNode(group))); + groupElement->addNode(boost::make_shared(group)); itemElement->addNode(groupElement); } if (!item.getUnknownContent().empty()) { - itemElement->addNode(boost::shared_ptr(new XMLRawTextNode(item.getUnknownContent()))); + itemElement->addNode(boost::make_shared(item.getUnknownContent())); } diff --git a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp index a5cd634..07dd8de 100644 --- a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -53,7 +54,7 @@ std::string SearchPayloadSerializer::serializePayload(boost::shared_ptrgetForm()) { - searchElement.addNode(boost::shared_ptr(new XMLRawTextNode(FormSerializer().serialize(form)))); + searchElement.addNode(boost::make_shared(FormSerializer().serialize(form))); } return searchElement.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp index 51079ee..7a0b513 100644 --- a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp @@ -4,6 +4,8 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ +#include + #include #include #include @@ -25,17 +27,17 @@ std::string SecurityLabelSerializer::serializePayload(boost::shared_ptrgetBackgroundColor().empty()) { displayMarking->setAttribute("bgcolor", label->getBackgroundColor()); } - displayMarking->addNode(boost::shared_ptr(new XMLTextNode(label->getDisplayMarking()))); + displayMarking->addNode(boost::make_shared(label->getDisplayMarking())); element.addNode(displayMarking); } boost::shared_ptr labelElement(new XMLElement("label")); - labelElement->addNode(boost::shared_ptr(new XMLRawTextNode(label->getLabel()))); + labelElement->addNode(boost::make_shared(label->getLabel())); element.addNode(labelElement); foreach(const std::string& equivalentLabel, label->getEquivalentLabels()) { boost::shared_ptr equivalentLabelElement(new XMLElement("equivalentlabel")); - equivalentLabelElement->addNode(boost::shared_ptr(new XMLRawTextNode(equivalentLabel))); + equivalentLabelElement->addNode(boost::make_shared(equivalentLabel)); element.addNode(equivalentLabelElement); } return element.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp index 1078292..8871eff 100644 --- a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp @@ -4,6 +4,8 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ +#include + #include #include #include @@ -34,7 +36,7 @@ std::string SecurityLabelsCatalogSerializer::serializePayload(boost::shared_ptr< } if (item.getLabel()) { std::string serializedLabel = SecurityLabelSerializer().serialize(item.getLabel()); - itemElement->addNode(boost::shared_ptr(new XMLRawTextNode(serializedLabel))); + itemElement->addNode(boost::make_shared(serializedLabel)); } element.addNode(itemElement); } diff --git a/Swiften/Serializer/PayloadSerializers/StatusSerializer.h b/Swiften/Serializer/PayloadSerializers/StatusSerializer.h index a8de26f..bd076ae 100644 --- a/Swiften/Serializer/PayloadSerializers/StatusSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/StatusSerializer.h @@ -6,6 +6,8 @@ #pragma once +#include + #include #include #include @@ -18,7 +20,7 @@ namespace Swift { virtual std::string serializePayload(boost::shared_ptr status) const { XMLElement element("status"); - element.addNode(boost::shared_ptr(new XMLTextNode(status->getText()))); + element.addNode(boost::make_shared(status->getText())); return element.serialize(); } }; diff --git a/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp index 77fb3c0..296d5dd 100644 --- a/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -27,12 +28,12 @@ std::string StorageSerializer::serializePayload(boost::shared_ptr stora conferenceElement->setAttribute("autojoin", room.autoJoin ? "1" : "0"); if (!room.nick.empty()) { boost::shared_ptr nickElement(new XMLElement("nick")); - nickElement->addNode(boost::shared_ptr(new XMLTextNode(room.nick))); + nickElement->addNode(boost::make_shared(room.nick)); conferenceElement->addNode(nickElement); } if (room.password) { boost::shared_ptr passwordElement(new XMLElement("password")); - passwordElement->addNode(boost::shared_ptr(new XMLTextNode(*room.password))); + passwordElement->addNode(boost::make_shared(*room.password)); conferenceElement->addNode(passwordElement); } storageElement.addNode(conferenceElement); diff --git a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp index 9ccfab2..030b024 100644 --- a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -42,7 +43,7 @@ std::string StreamInitiationSerializer::serializePayload(boost::shared_ptr descElement(new XMLElement("desc")); - descElement->addNode(boost::shared_ptr(new XMLTextNode(file.getDescription()))); + descElement->addNode(boost::make_shared(file.getDescription())); fileElement->addNode(descElement); } siElement.addNode(fileElement); @@ -57,14 +58,14 @@ std::string StreamInitiationSerializer::serializePayload(boost::shared_ptraddOption(FormField::Option("", method)); } form->addField(field); - featureElement->addNode(boost::shared_ptr(new XMLRawTextNode(FormSerializer().serialize(form)))); + featureElement->addNode(boost::make_shared(FormSerializer().serialize(form))); } else if (!streamInitiation->getRequestedMethod().empty()) { Form::ref form(new Form(Form::SubmitType)); ListSingleFormField::ref field = ListSingleFormField::create(streamInitiation->getRequestedMethod()); field->setName("stream-method"); form->addField(field); - featureElement->addNode(boost::shared_ptr(new XMLRawTextNode(FormSerializer().serialize(form)))); + featureElement->addNode(boost::make_shared(FormSerializer().serialize(form))); } siElement.addNode(featureElement); return siElement.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp index 17a6b49..1512c6c 100644 --- a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -23,39 +24,39 @@ std::string VCardSerializer::serializePayload(boost::shared_ptr vcard) c XMLElement queryElement("vCard", "vcard-temp"); if (!vcard->getVersion().empty()) { boost::shared_ptr versionElement(new XMLElement("VERSION")); - versionElement->addNode(boost::shared_ptr(new XMLTextNode(vcard->getVersion()))); + versionElement->addNode(boost::make_shared(vcard->getVersion())); queryElement.addNode(versionElement); } if (!vcard->getFullName().empty()) { boost::shared_ptr fullNameElement(new XMLElement("FN")); - fullNameElement->addNode(boost::shared_ptr(new XMLTextNode(vcard->getFullName()))); + fullNameElement->addNode(boost::make_shared(vcard->getFullName())); queryElement.addNode(fullNameElement); } if (!vcard->getGivenName().empty() || !vcard->getFamilyName().empty() || !vcard->getMiddleName().empty() || !vcard->getPrefix().empty() || !vcard->getSuffix().empty()) { boost::shared_ptr nameElement(new XMLElement("N")); if (!vcard->getFamilyName().empty()) { boost::shared_ptr familyNameElement(new XMLElement("FAMILY")); - familyNameElement->addNode(boost::shared_ptr(new XMLTextNode(vcard->getFamilyName()))); + familyNameElement->addNode(boost::make_shared(vcard->getFamilyName())); nameElement->addNode(familyNameElement); } if (!vcard->getGivenName().empty()) { boost::shared_ptr givenNameElement(new XMLElement("GIVEN")); - givenNameElement->addNode(boost::shared_ptr(new XMLTextNode(vcard->getGivenName()))); + givenNameElement->addNode(boost::make_shared(vcard->getGivenName())); nameElement->addNode(givenNameElement); } if (!vcard->getMiddleName().empty()) { boost::shared_ptr middleNameElement(new XMLElement("MIDDLE")); - middleNameElement->addNode(boost::shared_ptr(new XMLTextNode(vcard->getMiddleName()))); + middleNameElement->addNode(boost::make_shared(vcard->getMiddleName())); nameElement->addNode(middleNameElement); } if (!vcard->getPrefix().empty()) { boost::shared_ptr prefixElement(new XMLElement("PREFIX")); - prefixElement->addNode(boost::shared_ptr(new XMLTextNode(vcard->getPrefix()))); + prefixElement->addNode(boost::make_shared(vcard->getPrefix())); nameElement->addNode(prefixElement); } if (!vcard->getSuffix().empty()) { boost::shared_ptr suffixElement(new XMLElement("SUFFIX")); - suffixElement->addNode(boost::shared_ptr(new XMLTextNode(vcard->getSuffix()))); + suffixElement->addNode(boost::make_shared(vcard->getSuffix())); nameElement->addNode(suffixElement); } queryElement.addNode(nameElement); @@ -63,28 +64,28 @@ std::string VCardSerializer::serializePayload(boost::shared_ptr vcard) c foreach(const VCard::EMailAddress& emailAddress, vcard->getEMailAddresses()) { boost::shared_ptr emailElement(new XMLElement("EMAIL")); boost::shared_ptr userIDElement(new XMLElement("USERID")); - userIDElement->addNode(boost::shared_ptr(new XMLTextNode(emailAddress.address))); + userIDElement->addNode(boost::make_shared(emailAddress.address)); emailElement->addNode(userIDElement); if (emailAddress.isHome) { - emailElement->addNode(boost::shared_ptr(new XMLElement("HOME"))); + emailElement->addNode(boost::make_shared("HOME")); } if (emailAddress.isWork) { - emailElement->addNode(boost::shared_ptr(new XMLElement("WORK"))); + emailElement->addNode(boost::make_shared("WORK")); } if (emailAddress.isInternet) { - emailElement->addNode(boost::shared_ptr(new XMLElement("INTERNET"))); + emailElement->addNode(boost::make_shared("INTERNET")); } if (emailAddress.isPreferred) { - emailElement->addNode(boost::shared_ptr(new XMLElement("PREF"))); + emailElement->addNode(boost::make_shared("PREF")); } if (emailAddress.isX400) { - emailElement->addNode(boost::shared_ptr(new XMLElement("X400"))); + emailElement->addNode(boost::make_shared("X400")); } queryElement.addNode(emailElement); } if (!vcard->getNickname().empty()) { boost::shared_ptr nickElement(new XMLElement("NICKNAME")); - nickElement->addNode(boost::shared_ptr(new XMLTextNode(vcard->getNickname()))); + nickElement->addNode(boost::make_shared(vcard->getNickname())); queryElement.addNode(nickElement); } if (!vcard->getPhoto().empty() || !vcard->getPhotoType().empty()) { @@ -102,7 +103,7 @@ std::string VCardSerializer::serializePayload(boost::shared_ptr vcard) c queryElement.addNode(photoElement); } if (!vcard->getUnknownContent().empty()) { - queryElement.addNode(boost::shared_ptr(new XMLRawTextNode(vcard->getUnknownContent()))); + queryElement.addNode(boost::make_shared(vcard->getUnknownContent())); } return queryElement.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp index c06262f..78c700b 100644 --- a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -19,7 +20,7 @@ VCardUpdateSerializer::VCardUpdateSerializer() : GenericPayloadSerializer vcardUpdate) const { XMLElement updateElement("x", "vcard-temp:x:update"); boost::shared_ptr photoElement(new XMLElement("photo")); - photoElement->addNode(boost::shared_ptr(new XMLTextNode(vcardUpdate->getPhotoHash()))); + photoElement->addNode(boost::make_shared(vcardUpdate->getPhotoHash())); updateElement.addNode(photoElement); return updateElement.serialize(); } diff --git a/Swiften/Serializer/StreamFeaturesSerializer.cpp b/Swiften/Serializer/StreamFeaturesSerializer.cpp index fb7bb8c..2344349 100644 --- a/Swiften/Serializer/StreamFeaturesSerializer.cpp +++ b/Swiften/Serializer/StreamFeaturesSerializer.cpp @@ -22,13 +22,13 @@ SafeByteArray StreamFeaturesSerializer::serialize(boost::shared_ptr ele XMLElement streamFeaturesElement("stream:features"); if (streamFeatures->hasStartTLS()) { - streamFeaturesElement.addNode(boost::shared_ptr(new XMLElement("starttls", "urn:ietf:params:xml:ns:xmpp-tls"))); + streamFeaturesElement.addNode(boost::make_shared("starttls", "urn:ietf:params:xml:ns:xmpp-tls")); } if (!streamFeatures->getCompressionMethods().empty()) { boost::shared_ptr compressionElement(new XMLElement("compression", "http://jabber.org/features/compress")); foreach(const std::string& method, streamFeatures->getCompressionMethods()) { boost::shared_ptr methodElement(new XMLElement("method")); - methodElement->addNode(boost::shared_ptr(new XMLTextNode(method))); + methodElement->addNode(boost::make_shared(method)); compressionElement->addNode(methodElement); } streamFeaturesElement.addNode(compressionElement); @@ -37,19 +37,19 @@ SafeByteArray StreamFeaturesSerializer::serialize(boost::shared_ptr ele boost::shared_ptr mechanismsElement(new XMLElement("mechanisms", "urn:ietf:params:xml:ns:xmpp-sasl")); foreach(const std::string& mechanism, streamFeatures->getAuthenticationMechanisms()) { boost::shared_ptr mechanismElement(new XMLElement("mechanism")); - mechanismElement->addNode(boost::shared_ptr(new XMLTextNode(mechanism))); + mechanismElement->addNode(boost::make_shared(mechanism)); mechanismsElement->addNode(mechanismElement); } streamFeaturesElement.addNode(mechanismsElement); } if (streamFeatures->hasResourceBind()) { - streamFeaturesElement.addNode(boost::shared_ptr(new XMLElement("bind", "urn:ietf:params:xml:ns:xmpp-bind"))); + streamFeaturesElement.addNode(boost::make_shared("bind", "urn:ietf:params:xml:ns:xmpp-bind")); } if (streamFeatures->hasSession()) { - streamFeaturesElement.addNode(boost::shared_ptr(new XMLElement("session", "urn:ietf:params:xml:ns:xmpp-session"))); + streamFeaturesElement.addNode(boost::make_shared("session", "urn:ietf:params:xml:ns:xmpp-session")); } if (streamFeatures->hasStreamManagement()) { - streamFeaturesElement.addNode(boost::shared_ptr(new XMLElement("sm", "urn:xmpp:sm:2"))); + streamFeaturesElement.addNode(boost::make_shared("sm", "urn:xmpp:sm:2")); } if (streamFeatures->hasRosterVersioning()) { streamFeaturesElement.addNode(boost::make_shared("ver", "urn:xmpp:features:rosterver")); diff --git a/Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp b/Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp index b70128b..a2197b0 100644 --- a/Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp +++ b/Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp @@ -7,6 +7,8 @@ #include #include +#include + #include #include @@ -28,10 +30,10 @@ class XMLElementTest : public CppUnit::TestFixture XMLElement testling("foo", "http://example.com"); testling.setAttribute("myatt", "myval"); boost::shared_ptr barElement(new XMLElement("bar")); - barElement->addNode(boost::shared_ptr(new XMLTextNode("Blo"))); + barElement->addNode(boost::make_shared("Blo")); testling.addNode(barElement); boost::shared_ptr bazElement(new XMLElement("baz")); - bazElement->addNode(boost::shared_ptr(new XMLTextNode("Bli&"))); + bazElement->addNode(boost::make_shared("Bli&")); testling.addNode(bazElement); std::string result = testling.serialize(); diff --git a/Swiften/Session/BOSHSessionStream.cpp b/Swiften/Session/BOSHSessionStream.cpp index d706d43..ce5df35 100644 --- a/Swiften/Session/BOSHSessionStream.cpp +++ b/Swiften/Session/BOSHSessionStream.cpp @@ -163,7 +163,7 @@ void BOSHSessionStream::handleElementReceived(boost::shared_ptr element void BOSHSessionStream::handleXMPPError() { available = false; - onClosed(boost::shared_ptr(new Error(Error::ParseError))); + onClosed(boost::make_shared(Error::ParseError)); } void BOSHSessionStream::handlePoolSessionStarted() { diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp index 70bbeea..f50c5d5 100644 --- a/Swiften/Session/BasicSessionStream.cpp +++ b/Swiften/Session/BasicSessionStream.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -110,7 +111,7 @@ void BasicSessionStream::addTLSEncryption() { assert(available); tlsLayer = new TLSLayer(tlsContextFactory); if (hasTLSCertificate() && !tlsLayer->setClientCertificate(getTLSCertificate())) { - onClosed(boost::shared_ptr(new Error(Error::InvalidTLSCertificateError))); + onClosed(boost::make_shared(Error::InvalidTLSCertificateError)); } else { streamStack->addLayer(tlsLayer); @@ -172,7 +173,7 @@ void BasicSessionStream::handleElementReceived(boost::shared_ptr elemen void BasicSessionStream::handleXMPPError() { available = false; - onClosed(boost::shared_ptr(new Error(Error::ParseError))); + onClosed(boost::make_shared(Error::ParseError)); } void BasicSessionStream::handleTLSConnected() { @@ -181,16 +182,16 @@ void BasicSessionStream::handleTLSConnected() { void BasicSessionStream::handleTLSError() { available = false; - onClosed(boost::shared_ptr(new Error(Error::TLSError))); + onClosed(boost::make_shared(Error::TLSError)); } void BasicSessionStream::handleConnectionFinished(const boost::optional& error) { available = false; if (error == Connection::ReadError) { - onClosed(boost::shared_ptr(new Error(Error::ConnectionReadError))); + onClosed(boost::make_shared(Error::ConnectionReadError)); } else if (error) { - onClosed(boost::shared_ptr(new Error(Error::ConnectionWriteError))); + onClosed(boost::make_shared(Error::ConnectionWriteError)); } else { onClosed(boost::shared_ptr()); diff --git a/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp b/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp index 8123c00..a6098f1 100644 --- a/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp +++ b/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp @@ -83,7 +83,7 @@ class XMPPLayerTest : public CppUnit::TestFixture { } void testWriteElement() { - testling_->writeElement(boost::shared_ptr(new Presence())); + testling_->writeElement(boost::make_shared()); CPPUNIT_ASSERT_EQUAL(std::string(""), lowLayer_->writtenData); } -- cgit v0.10.2-6-g49f6