diff options
71 files changed, 241 insertions, 184 deletions
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 <boost/smart_ptr/make_shared.hpp>  #include <boost/bind.hpp>  #include "Swiften/Elements/ProtocolHeader.h" @@ -47,14 +48,14 @@ void ServerFromClientSession::handleElement(boost::shared_ptr<Element> element)  		if (AuthRequest* authRequest = dynamic_cast<AuthRequest*>(element.get())) {  			if (authRequest->getMechanism() == "PLAIN" || (allowSASLEXTERNAL && authRequest->getMechanism() == "EXTERNAL")) {  				if (authRequest->getMechanism() == "EXTERNAL") { -						getXMPPLayer()->writeElement(boost::shared_ptr<AuthSuccess>(new AuthSuccess())); +						getXMPPLayer()->writeElement(boost::make_shared<AuthSuccess>());  						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<AuthSuccess>(new AuthSuccess())); +						getXMPPLayer()->writeElement(boost::make_shared<AuthSuccess>());  						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> iq = boost::dynamic_pointer_cast<IQ>(stanza)) {  					if (iq->getPayload<RosterPayload>()) { -						session->sendElement(IQ::createResult(iq->getFrom(), iq->getID(), boost::shared_ptr<RosterPayload>(new RosterPayload()))); +						session->sendElement(IQ::createResult(iq->getFrom(), iq->getID(), boost::make_shared<RosterPayload>())));  					}  					if (iq->getPayload<VCard>()) {  						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 <boost/smart_ptr/make_shared.hpp>  #include <boost/filesystem/fstream.hpp>  #include <Swiften/Base/ByteArray.h> @@ -30,7 +31,7 @@ boost::shared_ptr<VCard> FileVCardCollection::getOwnVCard() const {  		return boost::dynamic_pointer_cast<VCard>(parser.getPayload());  	}  	else { -		return boost::shared_ptr<VCard>(new VCard()); +		return boost::make_shared<VCard>();  	}  } 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) {  	session->onElementReceived.connect(  			boost::bind(&Server::handleLinkLocalElementReceived, this, _1, session));  	linkLocalSessions.push_back(session); -	//tracers.push_back(boost::shared_ptr<SessionTracer>(new SessionTracer(session))); +	//tracers.push_back(boost::make_shared<SessionTracer>(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<FakeDNSSDQuerier>(new FakeDNSSDQuerier("wonderland.lit", eventLoop)); +			querier = boost::make_shared<FakeDNSSDQuerier>("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 <boost/bind.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <stdio.h>  #include <Swift/Controllers/Intl.h> @@ -321,7 +322,7 @@ void ChatController::handlePresenceChange(boost::shared_ptr<Presence> newPresenc  		return;  	}  	if (!newPresence) { -		newPresence = boost::shared_ptr<Presence>(new Presence()); +		newPresence = boost::make_shared<Presence>();  		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 <boost/bind.hpp>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <boost/date_time/posix_time/posix_time.hpp>  #include <boost/algorithm/string.hpp> @@ -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<Delay>(new Delay(now, selfJID_))); +		message->addPayload(boost::make_shared<Delay>(now, selfJID_));  	}  	if (isCorrectionMessage) {  		message->addPayload(boost::shared_ptr<Replace> (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 <boost/bind.hpp>  #include <boost/algorithm/string.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Base/foreach.h>  #include <Swift/Controllers/Chat/ChatController.h> @@ -89,7 +90,7 @@ ChatsManager::ChatsManager(  	nickResolver_ = nickResolver;  	presenceOracle_ = presenceOracle;  	avatarManager_ = NULL; -	serverDiscoInfo_ = boost::shared_ptr<DiscoInfo>(new DiscoInfo()); +	serverDiscoInfo_ = boost::make_shared<DiscoInfo>();  	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<DiscoInfo>(new DiscoInfo()); +		serverDiscoInfo_ = boost::make_shared<DiscoInfo>();  		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<JoinMUCUIEvent>(new JoinMUCUIEvent(muc, std::string("nick")))); +		uiEventStream_->send(boost::make_shared<JoinMUCUIEvent>(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 <boost/bind.hpp>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Base/foreach.h>  #include <Swiften/Disco/GetDiscoInfoRequest.h> @@ -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<GenericRequest<SearchPayload> > searchRequest(new GenericRequest<SearchPayload>(IQ::Get, jid, boost::shared_ptr<SearchPayload>(new SearchPayload()), iqRouter_)); +		boost::shared_ptr<GenericRequest<SearchPayload> > searchRequest(new GenericRequest<SearchPayload>(IQ::Get, jid, boost::make_shared<SearchPayload>(), 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> presence) {  	// Add information and send  	if (!vCardPhotoHash_.empty()) { -		presence->updatePayload(boost::shared_ptr<VCardUpdate>(new VCardUpdate(vCardPhotoHash_))); +		presence->updatePayload(boost::make_shared<VCardUpdate>(vCardPhotoHash_));  	}  	client_->getPresenceSender()->sendPresence(presence);  	if (presence->getType() == Presence::Unavailable) { @@ -582,7 +582,7 @@ void MainController::handleDisconnected(const boost::optional<ClientError>& erro  				} else {  					message = str(format(QT_TRANSLATE_NOOP("", "Disconnected from %1%: %2%.")) % jid_.getDomain() % message);  				} -				lastDisconnectError_ = boost::shared_ptr<ErrorEvent>(new ErrorEvent(JID(jid_.getDomain()), message)); +				lastDisconnectError_ = boost::make_shared<ErrorEvent>(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<JoinMUCUIEvent>(new JoinMUCUIEvent(jid))); +			uiEventStream_->send(boost::make_shared<JoinMUCUIEvent>(jid));  		}  		else {  			uiEventStream_->send(boost::shared_ptr<UIEvent>(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<Presence>(new Presence()); +			presence = boost::make_shared<Presence>();  			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<Presence>(new Presence()); +			presence = boost::make_shared<Presence>();  			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 <boost/smart_ptr/make_shared.hpp> +  namespace Swift {  StatusTracker::StatusTracker() {  	isAutoAway_ = false; -	queuedPresence_ = boost::shared_ptr<Presence>(new Presence()); +	queuedPresence_ = boost::make_shared<Presence>();  }  boost::shared_ptr<Presence> StatusTracker::getNextPresence() {  	boost::shared_ptr<Presence> presence;  	if (isAutoAway_) { -		presence = boost::shared_ptr<Presence>(new Presence()); +		presence = boost::make_shared<Presence>();  		presence->setShow(StatusShow::Away);  		presence->setStatus(queuedPresence_->getStatus());  	} else { @@ -29,7 +31,7 @@ void StatusTracker::setRequestedPresence(boost::shared_ptr<Presence> presence) {  	isAutoAway_ = false;  	queuedPresence_ = presence;  //	if (presence->getType() == Presence::Unavailable) { -//		queuedPresence_ = boost::shared_ptr<Presence>(new Presence()); +//		queuedPresence_ = boost::make_shared<Presence>();  //	}  } 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<Swift::StanzaEvent>(event1), false);  		} -		viewer->addEvent(boost::dynamic_pointer_cast<Swift::StanzaEvent>(boost::shared_ptr<Swift::ErrorEvent>(new Swift::ErrorEvent(Swift::JID("me@example.com"), "Something bad did happen to you."))), true); +		viewer->addEvent(boost::dynamic_pointer_cast<Swift::StanzaEvent>(boost::make_shared<Swift::ErrorEvent>(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<RequestXMLConsoleUIEvent>(new RequestXMLConsoleUIEvent())); +	uiEventStream_->send(boost::make_shared<RequestXMLConsoleUIEvent>());  }  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<Presence> createPresenceWithPhotoHash(const JID& jid, const std::string& hash) {  			boost::shared_ptr<Presence> presence(new Presence());  			presence->setFrom(jid); -			presence->addPayload(boost::shared_ptr<VCardUpdate>(new VCardUpdate(hash))); +			presence->addPayload(boost::make_shared<VCardUpdate>(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<MockSessionStream>(new MockSessionStream()); +			server = boost::make_shared<MockSessionStream>();  			sessionFinishedReceived = false;  			needCredentials = false;  			blindCertificateTrustChecker = new BlindCertificateTrustChecker(); @@ -420,11 +420,11 @@ class ClientSessionTest : public CppUnit::TestFixture {  				}  				void breakConnection() { -					onClosed(boost::shared_ptr<SessionStream::Error>(new SessionStream::Error(SessionStream::Error::ConnectionReadError))); +					onClosed(boost::make_shared<SessionStream::Error>(SessionStream::Error::ConnectionReadError));  				}  				void breakTLS() { -					onClosed(boost::shared_ptr<SessionStream::Error>(new SessionStream::Error(SessionStream::Error::TLSError))); +					onClosed(boost::make_shared<SessionStream::Error>(SessionStream::Error::TLSError));  				} @@ -445,11 +445,11 @@ class ClientSessionTest : public CppUnit::TestFixture {  				}  				void sendTLSProceed() { -					onElementReceived(boost::shared_ptr<TLSProceed>(new TLSProceed())); +					onElementReceived(boost::make_shared<TLSProceed>());  				}  				void sendTLSFailure() { -					onElementReceived(boost::shared_ptr<StartTLSFailure>(new StartTLSFailure())); +					onElementReceived(boost::make_shared<StartTLSFailure>());  				}  				void sendStreamFeaturesWithMultipleAuthentication() { @@ -484,19 +484,19 @@ class ClientSessionTest : public CppUnit::TestFixture {  				}  				void sendAuthSuccess() { -					onElementReceived(boost::shared_ptr<AuthSuccess>(new AuthSuccess())); +					onElementReceived(boost::make_shared<AuthSuccess>());  				}  				void sendAuthFailure() { -					onElementReceived(boost::shared_ptr<AuthFailure>(new AuthFailure())); +					onElementReceived(boost::make_shared<AuthFailure>());  				}  				void sendStreamManagementEnabled() { -					onElementReceived(boost::shared_ptr<StreamManagementEnabled>(new StreamManagementEnabled())); +					onElementReceived(boost::make_shared<StreamManagementEnabled>());  				}  				void sendStreamManagementFailed() { -					onElementReceived(boost::shared_ptr<StreamManagementFailed>(new StreamManagementFailed())); +					onElementReceived(boost::make_shared<StreamManagementFailed>());  				}  				void sendBindResult() { @@ -755,7 +755,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest);  			processEvents();  			getMockServer()->expectMessage(); -			session->sendElement(boost::shared_ptr<Message>(new Message())); +			session->sendElement(boost::make_shared<Message>()));  		}  		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 <Swiften/Component/ComponentSession.h>  #include <boost/bind.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Elements/ProtocolHeader.h>  #include <Swiften/Elements/ComponentHandshake.h> @@ -101,7 +102,7 @@ void ComponentSession::finish() {  }  void ComponentSession::finishSession(Error::Type error) { -	finishSession(boost::shared_ptr<Swift::ComponentSession::Error>(new Swift::ComponentSession::Error(error))); +	finishSession(boost::make_shared<Swift::ComponentSession::Error>(error));  }  void ComponentSession::finishSession(boost::shared_ptr<Swift::Error> 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<MockSessionStream>(new MockSessionStream()); +			server = boost::make_shared<MockSessionStream>();  			sessionFinishedReceived = false;  		} @@ -159,7 +159,7 @@ class ComponentSessionTest : public CppUnit::TestFixture {  				}  				void breakConnection() { -					onClosed(boost::shared_ptr<SessionStream::Error>(new SessionStream::Error(SessionStream::Error::ConnectionReadError))); +					onClosed(boost::make_shared<SessionStream::Error>(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 <boost/smart_ptr/make_shared.hpp> +  #include <Swiften/Disco/DiscoInfoResponder.h>  #include <Swiften/Queries/IQRouter.h>  #include <Swiften/Elements/DiscoInfo.h> @@ -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<DiscoInfo> info) {  	if (info->getNode().empty()) { -		sendResponse(from, id, boost::shared_ptr<DiscoInfo>(new DiscoInfo(info_))); +		sendResponse(from, id, boost::make_shared<DiscoInfo>(info_));  	}  	else {  		std::map<std::string,DiscoInfo>::const_iterator i = nodeInfo_.find(info->getNode());  		if (i != nodeInfo_.end()) { -			sendResponse(from, id, boost::shared_ptr<DiscoInfo>(new DiscoInfo((*i).second))); +			sendResponse(from, id, boost::make_shared<DiscoInfo>((*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 <boost/smart_ptr/make_shared.hpp> +  #include <Swiften/Queries/GenericRequest.h>  #include <Swiften/Elements/DiscoInfo.h> @@ -24,11 +26,11 @@ namespace Swift {  		private:  			GetDiscoInfoRequest(const JID& jid, IQRouter* router) : -					GenericRequest<DiscoInfo>(IQ::Get, jid, boost::shared_ptr<DiscoInfo>(new DiscoInfo()), router) { +					GenericRequest<DiscoInfo>(IQ::Get, jid, boost::make_shared<DiscoInfo>(), router) {  			}  			GetDiscoInfoRequest(const JID& jid, const std::string& node, IQRouter* router) : -					GenericRequest<DiscoInfo>(IQ::Get, jid, boost::shared_ptr<DiscoInfo>(new DiscoInfo()), router) { +					GenericRequest<DiscoInfo>(IQ::Get, jid, boost::make_shared<DiscoInfo>(), 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 <boost/smart_ptr/make_shared.hpp> +  #include <Swiften/Queries/GenericRequest.h>  #include <Swiften/Elements/DiscoItems.h> @@ -24,11 +26,11 @@ namespace Swift {  		private:  			GetDiscoItemsRequest(const JID& jid, IQRouter* router) : -					GenericRequest<DiscoItems>(IQ::Get, jid, boost::shared_ptr<DiscoItems>(new DiscoItems()), router) { +					GenericRequest<DiscoItems>(IQ::Get, jid, boost::make_shared<DiscoItems>(), router) {  			}  			GetDiscoItemsRequest(const JID& jid, const std::string& node, IQRouter* router) : -				GenericRequest<DiscoItems>(IQ::Get, jid, boost::shared_ptr<DiscoItems>(new DiscoItems()), router) { +				GenericRequest<DiscoItems>(IQ::Get, jid, boost::make_shared<DiscoItems>(), 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 <boost/smart_ptr/make_shared.hpp> +  #include <Swiften/Disco/JIDDiscoInfoResponder.h>  #include <Swiften/Queries/IQRouter.h>  #include <Swiften/Elements/DiscoInfo.h> @@ -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<DiscoInfo>(new DiscoInfo(i->second.discoInfo))); +			sendResponse(from, to, id, boost::make_shared<DiscoInfo>(i->second.discoInfo));  		}  		else {  			std::map<std::string,DiscoInfo>::const_iterator j = i->second.nodeDiscoInfo.find(discoInfo->getNode());  			if (j != i->second.nodeDiscoInfo.end()) { -				sendResponse(from, to, id, boost::shared_ptr<DiscoInfo>(new DiscoInfo(j->second))); +				sendResponse(from, to, id, boost::make_shared<DiscoInfo>(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<DiscoInfo>(new DiscoInfo()); +			discoInfo1 = boost::make_shared<DiscoInfo>();  			discoInfo1->addFeature("http://swift.im/feature1"); -			capsInfo1 = boost::shared_ptr<CapsInfo>(new CapsInfo(CapsInfoGenerator("http://node1.im").generateCapsInfo(*discoInfo1.get()))); -			capsInfo1alt = boost::shared_ptr<CapsInfo>(new CapsInfo(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo1.get()))); +			capsInfo1 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node1.im").generateCapsInfo(*discoInfo1.get())); +			capsInfo1alt = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo1.get()));  			user2 = JID("user2@foo.com/baz"); -			discoInfo2 = boost::shared_ptr<DiscoInfo>(new DiscoInfo()); +			discoInfo2 = boost::make_shared<DiscoInfo>();  			discoInfo2->addFeature("http://swift.im/feature2"); -			capsInfo2 = boost::shared_ptr<CapsInfo>(new CapsInfo(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo2.get()))); +			capsInfo2 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo2.get()));  			user3 = JID("user3@foo.com/baz"); -			legacyCapsInfo = boost::shared_ptr<CapsInfo>(new CapsInfo("http://swift.im", "ver1", "")); +			legacyCapsInfo = boost::make_shared<CapsInfo>("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<DiscoInfo>(new DiscoInfo()); +			discoInfo1 = boost::make_shared<DiscoInfo>();  			discoInfo1->addFeature("http://swift.im/feature1"); -			capsInfo1 = boost::shared_ptr<CapsInfo>(new CapsInfo(CapsInfoGenerator("http://node1.im").generateCapsInfo(*discoInfo1.get()))); -			capsInfo1alt = boost::shared_ptr<CapsInfo>(new CapsInfo(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo1.get()))); +			capsInfo1 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node1.im").generateCapsInfo(*discoInfo1.get())); +			capsInfo1alt = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo1.get()));  			user2 = JID("user2@foo.com/baz"); -			discoInfo2 = boost::shared_ptr<DiscoInfo>(new DiscoInfo()); +			discoInfo2 = boost::make_shared<DiscoInfo>();  			discoInfo2->addFeature("http://swift.im/feature2"); -			capsInfo2 = boost::shared_ptr<CapsInfo>(new CapsInfo(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo2.get()))); +			capsInfo2 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo2.get()));  			user3 = JID("user3@foo.com/baz"); -			legacyCapsInfo = boost::shared_ptr<CapsInfo>(new CapsInfo("http://swift.im", "ver1", "")); +			legacyCapsInfo = boost::make_shared<CapsInfo>("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<MyPayload1>(new MyPayload1())); -			m.addPayload(boost::shared_ptr<MyPayload2>(new MyPayload2())); +			m.addPayload(boost::make_shared<MyPayload1>()); +			m.addPayload(boost::make_shared<MyPayload2>());  			Message copy(m);  			CPPUNIT_ASSERT(copy.getPayload<MyPayload1>()); @@ -81,7 +81,7 @@ class StanzaTest : public CppUnit::TestFixture  			bool payloadAlive = true;  			{  				Message m; -				m.addPayload(boost::shared_ptr<DestroyingPayload>(new DestroyingPayload(&payloadAlive))); +				m.addPayload(boost::make_shared<DestroyingPayload>(&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<DestroyingPayload>(new DestroyingPayload(&payloadAlive))); +			m1->addPayload(boost::make_shared<DestroyingPayload>(&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<MyPayload1>(new MyPayload1())); -			m.addPayload(boost::shared_ptr<MyPayload2>(new MyPayload2())); -			m.addPayload(boost::shared_ptr<MyPayload3>(new MyPayload3())); +			m.addPayload(boost::make_shared<MyPayload1>()); +			m.addPayload(boost::make_shared<MyPayload2>()); +			m.addPayload(boost::make_shared<MyPayload3>());  			boost::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>());  			CPPUNIT_ASSERT(p); @@ -112,8 +112,8 @@ class StanzaTest : public CppUnit::TestFixture  		void testGetPayload_NoSuchPayload() {  			Message m; -			m.addPayload(boost::shared_ptr<MyPayload1>(new MyPayload1())); -			m.addPayload(boost::shared_ptr<MyPayload3>(new MyPayload3())); +			m.addPayload(boost::make_shared<MyPayload1>()); +			m.addPayload(boost::make_shared<MyPayload3>());  			boost::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>());  			CPPUNIT_ASSERT(!p); @@ -123,9 +123,9 @@ class StanzaTest : public CppUnit::TestFixture  			Message m;  			boost::shared_ptr<MyPayload2> payload1(new MyPayload2());  			boost::shared_ptr<MyPayload2> payload2(new MyPayload2()); -			m.addPayload(boost::shared_ptr<MyPayload1>(new MyPayload1())); +			m.addPayload(boost::make_shared<MyPayload1>());  			m.addPayload(payload1); -			m.addPayload(boost::shared_ptr<MyPayload3>(new MyPayload3())); +			m.addPayload(boost::make_shared<MyPayload3>());  			m.addPayload(payload2);  			CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), m.getPayloads<MyPayload2>().size()); @@ -136,11 +136,11 @@ class StanzaTest : public CppUnit::TestFixture  		void testUpdatePayload_ExistingPayload() {  			Message m; -			m.addPayload(boost::shared_ptr<MyPayload1>(new MyPayload1())); -			m.addPayload(boost::shared_ptr<MyPayload2>(new MyPayload2("foo"))); -			m.addPayload(boost::shared_ptr<MyPayload3>(new MyPayload3())); +			m.addPayload(boost::make_shared<MyPayload1>()); +			m.addPayload(boost::make_shared<MyPayload2>("foo")); +			m.addPayload(boost::make_shared<MyPayload3>()); -			m.updatePayload(boost::shared_ptr<MyPayload2>(new MyPayload2("bar"))); +			m.updatePayload(boost::make_shared<MyPayload2>("bar"));  			CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), m.getPayloads().size());  			boost::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); @@ -149,10 +149,10 @@ class StanzaTest : public CppUnit::TestFixture  		void testUpdatePayload_NewPayload() {  			Message m; -			m.addPayload(boost::shared_ptr<MyPayload1>(new MyPayload1())); -			m.addPayload(boost::shared_ptr<MyPayload3>(new MyPayload3())); +			m.addPayload(boost::make_shared<MyPayload1>()); +			m.addPayload(boost::make_shared<MyPayload3>()); -			m.updatePayload(boost::shared_ptr<MyPayload2>(new MyPayload2("bar"))); +			m.updatePayload(boost::make_shared<MyPayload2>("bar"));  			CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), m.getPayloads().size());  			boost::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); @@ -161,26 +161,26 @@ class StanzaTest : public CppUnit::TestFixture  		void testGetPayloadOfSameType() {  			Message m; -			m.addPayload(boost::shared_ptr<MyPayload1>(new MyPayload1())); -			m.addPayload(boost::shared_ptr<MyPayload2>(new MyPayload2("foo"))); -			m.addPayload(boost::shared_ptr<MyPayload3>(new MyPayload3())); +			m.addPayload(boost::make_shared<MyPayload1>()); +			m.addPayload(boost::make_shared<MyPayload2>("foo")); +			m.addPayload(boost::make_shared<MyPayload3>()); -			boost::shared_ptr<MyPayload2> payload(boost::dynamic_pointer_cast<MyPayload2>(m.getPayloadOfSameType(boost::shared_ptr<MyPayload2>(new MyPayload2("bar"))))); +			boost::shared_ptr<MyPayload2> payload(boost::dynamic_pointer_cast<MyPayload2>(m.getPayloadOfSameType(boost::make_shared<MyPayload2>("bar"))));  			CPPUNIT_ASSERT(payload);  			CPPUNIT_ASSERT_EQUAL(std::string("foo"), payload->text_);  		}  		void testGetPayloadOfSameType_NoSuchPayload() {  			Message m; -			m.addPayload(boost::shared_ptr<MyPayload1>(new MyPayload1())); -			m.addPayload(boost::shared_ptr<MyPayload3>(new MyPayload3())); +			m.addPayload(boost::make_shared<MyPayload1>()); +			m.addPayload(boost::make_shared<MyPayload3>()); -			CPPUNIT_ASSERT(!m.getPayloadOfSameType(boost::shared_ptr<MyPayload2>(new MyPayload2("bar")))); +			CPPUNIT_ASSERT(!m.getPayloadOfSameType(boost::make_shared<MyPayload2>("bar")));  		}  		void testGetTimestamp() {  			Message m; -			m.addPayload(boost::shared_ptr<Delay>(new Delay(boost::posix_time::from_time_t(1)))); +			m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(1)));  			boost::optional<boost::posix_time::ptime> timestamp = m.getTimestamp(); @@ -190,7 +190,7 @@ class StanzaTest : public CppUnit::TestFixture  		void testGetTimestamp_TimestampWithFrom() {  			Message m; -			m.addPayload(boost::shared_ptr<Delay>(new Delay(boost::posix_time::from_time_t(1), JID("foo@bar.com")))); +			m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(1), JID("foo@bar.com")));  			boost::optional<boost::posix_time::ptime> timestamp = m.getTimestamp(); @@ -205,10 +205,10 @@ class StanzaTest : public CppUnit::TestFixture  		void testGetTimestampFrom() {  			Message m; -			m.addPayload(boost::shared_ptr<Delay>(new Delay(boost::posix_time::from_time_t(0)))); -			m.addPayload(boost::shared_ptr<Delay>(new Delay(boost::posix_time::from_time_t(1), JID("foo1@bar.com")))); -			m.addPayload(boost::shared_ptr<Delay>(new Delay(boost::posix_time::from_time_t(2), JID("foo2@bar.com")))); -			m.addPayload(boost::shared_ptr<Delay>(new Delay(boost::posix_time::from_time_t(3), JID("foo3@bar.com")))); +			m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(0))); +			m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(1), JID("foo1@bar.com"))); +			m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(2), JID("foo2@bar.com"))); +			m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(3), JID("foo3@bar.com")));  			boost::optional<boost::posix_time::ptime> 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<Delay>(new Delay(boost::posix_time::from_time_t(1), JID("foo1@bar.com")))); -			m.addPayload(boost::shared_ptr<Delay>(new Delay(boost::posix_time::from_time_t(3), JID("foo3@bar.com")))); +			m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(1), JID("foo1@bar.com"))); +			m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(3), JID("foo3@bar.com")));  			boost::optional<boost::posix_time::ptime> 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<FileReadBytestream>(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<FileReadBytestream>(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 <Swiften/FileTransfer/OutgoingSIFileTransfer.h>  #include <boost/bind.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/FileTransfer/StreamInitiationRequest.h>  #include <Swiften/FileTransfer/BytestreamsRequest.h> @@ -48,7 +49,7 @@ void OutgoingSIFileTransfer::handleStreamInitiationRequestResponse(StreamInitiat  			request->send();  		}  		else if (response->getRequestedMethod() == "http://jabber.org/protocol/ibb") { -			ibbSession = boost::shared_ptr<IBBSendSession>(new IBBSendSession(id, from, to, bytestream, iqRouter)); +			ibbSession = boost::make_shared<IBBSendSession>(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<ByteArrayReadBytestream>(new ByteArrayReadBytestream(createByteArray("abcdefg"))); +			bytestream = boost::make_shared<ByteArrayReadBytestream>(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<MockeryConnection>(failingPorts, true, eventLoop);  		//connection->onDataSent.connect(boost::bind(&SOCKS5BytestreamServerSessionTest::handleDataWritten, this, _1)); -		//stream1 = boost::shared_ptr<ByteArrayReadBytestream>(new ByteArrayReadBytestream(createByteArray("abcdefg"))); +		//stream1 = boost::make_shared<ByteArrayReadBytestream>(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<DummyConnection>(new DummyConnection(eventLoop)); +			connection = boost::make_shared<DummyConnection>(eventLoop);  			connection->onDataSent.connect(boost::bind(&SOCKS5BytestreamServerSessionTest::handleDataWritten, this, _1)); -			stream1 = boost::shared_ptr<ByteArrayReadBytestream>(new ByteArrayReadBytestream(createByteArray("abcdefg"))); +			stream1 = boost::make_shared<ByteArrayReadBytestream>(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 <Swiften/LinkLocal/IncomingLinkLocalSession.h>  #include <boost/bind.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Elements/ProtocolHeader.h>  #include <Swiften/Network/Connection.h> @@ -41,7 +42,7 @@ void IncomingLinkLocalSession::handleStreamStart(const ProtocolHeader& incomingH  	getXMPPLayer()->writeHeader(header);  	if (incomingHeader.getVersion() == "1.0") { -		getXMPPLayer()->writeElement(boost::shared_ptr<StreamFeatures>(new StreamFeatures())); +		getXMPPLayer()->writeElement(boost::make_shared<StreamFeatures>());  	}  	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<FakeDNSSDQuerier>( -					new FakeDNSSDQuerier("rabbithole.local", eventLoop)); -			connection = boost::shared_ptr<FakeConnection>(new FakeConnection(eventLoop)); +			querier = boost::make_shared<FakeDNSSDQuerier>("rabbithole.local", eventLoop); +			connection = boost::make_shared<FakeConnection>(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 <cppunit/extensions/HelperMacros.h>  #include <cppunit/extensions/TestFactoryRegistry.h>  #include <boost/bind.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <map>  #include <Swiften/LinkLocal/LinkLocalServiceBrowser.h> @@ -42,7 +43,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture {  	public:  		void setUp() {  			eventLoop = new DummyEventLoop(); -			querier = boost::shared_ptr<FakeDNSSDQuerier>(new FakeDNSSDQuerier("wonderland.lit", eventLoop)); +			querier = boost::make_shared<FakeDNSSDQuerier>("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 <boost/bind.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <iostream>  #include <Swiften/Base/foreach.h> @@ -98,7 +99,7 @@ void MUCBookmarkManager::removeBookmark(const MUCBookmark& bookmark) {  void MUCBookmarkManager::flush() {  	if (!storage) { -		storage = boost::shared_ptr<Storage>(new Storage()); +		storage = boost::make_shared<Storage>();  	}  	// 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 <boost/smart_ptr/make_shared.hpp> +  #include <Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h>  #include <Swiften/Parser/PayloadParsers/SecurityLabelParserFactory.h>  #include <Swiften/Parser/PayloadParsers/SecurityLabelParser.h> @@ -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<SecurityLabelsCatalog::Item>(new SecurityLabelsCatalog::Item()); +		currentItem_ = boost::make_shared<SecurityLabelsCatalog::Item>();  		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<MyStanza>(new MyStanza()); +					stanza_ = boost::make_shared<MyStanza>();  				}  				virtual boost::shared_ptr<Element> 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<Presence>(new Presence()); +			testPresence = boost::make_shared<Presence>();  			testPresence->setStatus("Foo"); -			secondTestPresence = boost::shared_ptr<Presence>(new Presence()); +			secondTestPresence = boost::make_shared<Presence>();  			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 <Swiften/Base/boost_bsignals.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Queries/Request.h>  #include <Swiften/Elements/PrivateStorage.h> @@ -24,7 +25,7 @@ namespace Swift {  			}  		private: -			GetPrivateStorageRequest(IQRouter* router) : Request(IQ::Get, JID(), boost::shared_ptr<PrivateStorage>(new PrivateStorage(boost::shared_ptr<Payload>(new PAYLOAD_TYPE()))), router) { +			GetPrivateStorageRequest(IQRouter* router) : Request(IQ::Get, JID(), boost::make_shared<PrivateStorage>(boost::shared_ptr<Payload>(new PAYLOAD_TYPE())), router) {  			}  			virtual void handleResponse(boost::shared_ptr<Payload> 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 <boost/smart_ptr/make_shared.hpp> +  #include <Swiften/Queries/GenericRequest.h>  #include <Swiften/Elements/SecurityLabelsCatalog.h> @@ -24,7 +26,7 @@ namespace Swift {  					const JID& recipient,   					IQRouter* router) :  						GenericRequest<SecurityLabelsCatalog>( -							IQ::Get, JID(), boost::shared_ptr<SecurityLabelsCatalog>(new SecurityLabelsCatalog(recipient)), router) { +							IQ::Get, JID(), boost::make_shared<SecurityLabelsCatalog>(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 <Swiften/Base/boost_bsignals.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Queries/Request.h>  #include <Swiften/Elements/PrivateStorage.h> @@ -24,7 +25,7 @@ namespace Swift {  			}  		private: -			SetPrivateStorageRequest(boost::shared_ptr<PAYLOAD_TYPE> payload, IQRouter* router) : Request(IQ::Set, JID(), boost::shared_ptr<PrivateStorage>(new PrivateStorage(payload)), router) { +			SetPrivateStorageRequest(boost::shared_ptr<PAYLOAD_TYPE> payload, IQRouter* router) : Request(IQ::Set, JID(), boost::make_shared<PrivateStorage>(payload), router) {  			}  			virtual void handleResponse(boost::shared_ptr<Payload>, 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 <boost/smart_ptr/make_shared.hpp> +  #include <Swiften/Queries/Responders/SoftwareVersionResponder.h>  #include <Swiften/Queries/IQRouter.h> @@ -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<SoftwareVersion>) { -	sendResponse(from, id, boost::shared_ptr<SoftwareVersion>(new SoftwareVersion(client, version, os))); +	sendResponse(from, id, boost::make_shared<SoftwareVersion>(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 <cppunit/extensions/HelperMacros.h>  #include <cppunit/extensions/TestFactoryRegistry.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <boost/bind.hpp>  #include <Swiften/Queries/IQHandler.h> @@ -43,7 +44,7 @@ class IQRouterTest : public CppUnit::TestFixture {  			DummyIQHandler handler2(true, &testling);  			testling.removeHandler(&handler1); -			channel_->onIQReceived(boost::shared_ptr<IQ>(new IQ())); +			channel_->onIQReceived(boost::make_shared<IQ>());  			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<IQ>(new IQ())); +			channel_->onIQReceived(boost::make_shared<IQ>());  			testling.removeHandler(&handler1); -			channel_->onIQReceived(boost::shared_ptr<IQ>(new IQ())); +			channel_->onIQReceived(boost::make_shared<IQ>());  			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<IQ>(new IQ())); +			channel_->onIQReceived(boost::make_shared<IQ>());  			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<IQ>(new IQ())); +			channel_->onIQReceived(boost::make_shared<IQ>());  			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<IQ>(new IQ())); +			channel_->onIQReceived(boost::make_shared<IQ>());  			CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size()));  			CPPUNIT_ASSERT(channel_->iqs_[0]->getPayload<ErrorPayload>()); @@ -102,8 +103,8 @@ class IQRouterTest : public CppUnit::TestFixture {  			DummyIQHandler handler2(true, &testling);  			RemovingIQHandler handler1(&testling); -			channel_->onIQReceived(boost::shared_ptr<IQ>(new IQ())); -			channel_->onIQReceived(boost::shared_ptr<IQ>(new IQ())); +			channel_->onIQReceived(boost::make_shared<IQ>()); +			channel_->onIQReceived(boost::make_shared<IQ>());  			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<IQ>(new IQ())); +			testling.sendIQ(boost::make_shared<IQ>());  			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<IQ>(new IQ())); +			testling.sendIQ(boost::make_shared<IQ>());  			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<IQ>(new IQ())); +			channel_->onIQReceived(boost::make_shared<IQ>());  			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<IQ> error = createError(JID("foo@bar.com/baz"),"test-id"); -			boost::shared_ptr<Payload> errorPayload = boost::shared_ptr<ErrorPayload>(new ErrorPayload(ErrorPayload::InternalServerError)); +			boost::shared_ptr<Payload> errorPayload = boost::make_shared<ErrorPayload>(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 <cppunit/extensions/HelperMacros.h>  #include <cppunit/extensions/TestFactoryRegistry.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <boost/bind.hpp>  #include <Swiften/Queries/Responder.h> @@ -32,7 +33,7 @@ class ResponderTest : public CppUnit::TestFixture {  		void setUp() {  			channel_ = new DummyIQChannel();  			router_ = new IQRouter(channel_); -			payload_ = boost::shared_ptr<SoftwareVersion>(new SoftwareVersion("foo")); +			payload_ = boost::make_shared<SoftwareVersion>("foo");  		}  		void tearDown() { @@ -108,7 +109,7 @@ class ResponderTest : public CppUnit::TestFixture {  		void testHandleIQ_NoPayload() {  			MyResponder testling(router_); -			CPPUNIT_ASSERT(!dynamic_cast<IQHandler*>(&testling)->handleIQ(boost::shared_ptr<IQ>(new IQ(IQ::Get)))); +			CPPUNIT_ASSERT(!dynamic_cast<IQHandler*>(&testling)->handleIQ(boost::make_shared<IQ>(IQ::Get)));  			CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(testling.getPayloads_.size()));  			CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(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 <Swiften/Serializer/PayloadSerializers/CommandSerializer.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Base/foreach.h>  #include <Swiften/Serializer/XML/XMLElement.h> @@ -54,7 +55,7 @@ std::string CommandSerializer::serializePayload(boost::shared_ptr<Command> comma  			actions += "<" + actionToString(action) + "/>";  		}  		actions += "</actions>"; -		commandElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(actions))); +		commandElement.addNode(boost::make_shared<XMLRawTextNode>(actions));  	}  	foreach (Command::Note note, command->getNotes()) { @@ -68,13 +69,13 @@ std::string CommandSerializer::serializePayload(boost::shared_ptr<Command> comma  		if (!type.empty()) {  			noteElement->setAttribute("type", type);  		} -		noteElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(note.note))); +		noteElement->addNode(boost::make_shared<XMLTextNode>(note.note));  		commandElement.addNode(noteElement);  	}  	Form::ref form = command->getForm();  	if (form) { -		commandElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(FormSerializer().serialize(form)))); +		commandElement.addNode(boost::make_shared<XMLRawTextNode>(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 <Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Base/foreach.h>  #include <Swiften/Serializer/XML/XMLElement.h> @@ -39,7 +40,7 @@ std::string DiscoInfoSerializer::serializePayload(boost::shared_ptr<DiscoInfo> d  		queryElement.addNode(featureElement);  	}  	foreach(const Form::ref extension, discoInfo->getExtensions()) { -		queryElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(FormSerializer().serialize(extension)))); +		queryElement.addNode(boost::make_shared<XMLRawTextNode>(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 <Swiften/Serializer/PayloadSerializers/FormSerializer.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <iostream>  #include <string> @@ -81,11 +82,11 @@ boost::shared_ptr<XMLElement> FormSerializer::fieldToXML(boost::shared_ptr<FormF  		fieldElement->setAttribute("label", field->getLabel());  	}  	if (field->getRequired()) { -		fieldElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("required"))); +		fieldElement->addNode(boost::make_shared<XMLElement>("required"));  	}  	if (!field->getDescription().empty()) {  		boost::shared_ptr<XMLElement> descriptionElement(new XMLElement("desc")); -		descriptionElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(field->getDescription()))); +		descriptionElement->addNode(boost::make_shared<XMLTextNode>(field->getDescription()));  		fieldElement->addNode(descriptionElement);  	} @@ -174,7 +175,7 @@ void FormSerializer::multiLineify(const std::string& text, const std::string& el  	std::vector<std::string> lines = String::split(unRdText, '\n');  	foreach (std::string line, lines) {  		boost::shared_ptr<XMLElement> lineElement(new XMLElement(elementName)); -		lineElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(line))); +		lineElement->addNode(boost::make_shared<XMLTextNode>(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 <Swiften/Serializer/PayloadSerializers/IBBSerializer.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <boost/lexical_cast.hpp>  #include <Swiften/Base/foreach.h> @@ -27,7 +28,7 @@ std::string IBBSerializer::serializePayload(boost::shared_ptr<IBB> ibb) const {  			if (ibb->getSequenceNumber() >= 0) {  				ibbElement.setAttribute("seq", boost::lexical_cast<std::string>(ibb->getSequenceNumber()));  			} -			ibbElement.addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(Base64::encode(ibb->getData())))); +			ibbElement.addNode(boost::make_shared<XMLTextNode>(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 <Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Base/foreach.h>  #include <Swiften/Serializer/XML/XMLElement.h> @@ -103,7 +104,7 @@ std::string InBandRegistrationPayloadSerializer::serializePayload(boost::shared_  	}  	if (Form::ref form = registration->getForm()) { -		registerElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(FormSerializer().serialize(form)))); +		registerElement.addNode(boost::make_shared<XMLRawTextNode>(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<JinglePa  		foreach(boost::shared_ptr<Payload> subPayload, payloads) {  			PayloadSerializer* serializer = serializers->getPayloadSerializer(subPayload);  			if (serializer) { -				jinglePayload.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(serializer->serialize(subPayload)))); +				jinglePayload.addNode(boost::make_shared<XMLRawTextNode>(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 <Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h> +#include <boost/smart_ptr/make_shared.hpp> +  #include <Swiften/Serializer/PayloadSerializerCollection.h>  #include <Swiften/Serializer/XML/XMLElement.h>  #include <Swiften/Serializer/XML/XMLRawTextNode.h> @@ -21,7 +23,7 @@ std::string MUCOwnerPayloadSerializer::serializePayload(boost::shared_ptr<MUCOwn  	if (payload) {  		PayloadSerializer* serializer = serializers->getPayloadSerializer(payload);  		if (serializer) { -			mucElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(serializer->serialize(payload)))); +			mucElement.addNode(boost::make_shared<XMLRawTextNode>(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 <sstream>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Base/foreach.h>  #include <Swiften/Serializer/XML/XMLElement.h> @@ -60,7 +61,7 @@ std::string MUCUserPayloadSerializer::serializePayload(boost::shared_ptr<MUCUser  	if (childPayload) {  		PayloadSerializer* serializer = serializers->getPayloadSerializer(childPayload);  		if (serializer) { -			mucElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(serializer->serialize(childPayload)))); +			mucElement.addNode(boost::make_shared<XMLRawTextNode>(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 <Swiften/Serializer/PayloadSerializers/NicknameSerializer.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Serializer/XML/XMLElement.h>  #include <Swiften/Serializer/XML/XMLTextNode.h> @@ -18,7 +19,7 @@ NicknameSerializer::NicknameSerializer() : GenericPayloadSerializer<Nickname>()  std::string NicknameSerializer::serializePayload(boost::shared_ptr<Nickname> nick)  const {  	XMLElement nickElement("nick", "http://jabber.org/protocol/nick"); -	nickElement.addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(nick->getNickname()))); +	nickElement.addNode(boost::make_shared<XMLTextNode>(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 <Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Base/foreach.h>  #include <Swiften/Serializer/XML/XMLElement.h> @@ -25,7 +26,7 @@ std::string PrivateStorageSerializer::serializePayload(boost::shared_ptr<Private  	if (payload) {  		PayloadSerializer* serializer = serializers->getPayloadSerializer(payload);  		if (serializer) { -			storageElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(serializer->serialize(payload)))); +			storageElement.addNode(boost::make_shared<XMLRawTextNode>(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 <Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Serializer/XML/XMLElement.h>  #include <Swiften/Serializer/XML/XMLTextNode.h> @@ -20,12 +21,12 @@ std::string ResourceBindSerializer::serializePayload(boost::shared_ptr<ResourceB  	XMLElement bindElement("bind", "urn:ietf:params:xml:ns:xmpp-bind");  	if (resourceBind->getJID().isValid()) {  		boost::shared_ptr<XMLElement> jidNode(new XMLElement("jid")); -		jidNode->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(resourceBind->getJID().toString()))); +		jidNode->addNode(boost::make_shared<XMLTextNode>(resourceBind->getJID().toString()));  		bindElement.addNode(jidNode);  	}  	else if (!resourceBind->getResource().empty()) {  		boost::shared_ptr<XMLElement> resourceNode(new XMLElement("resource")); -		resourceNode->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(resourceBind->getResource()))); +		resourceNode->addNode(boost::make_shared<XMLTextNode>(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 <Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Base/foreach.h>  #include <Swiften/Serializer/XML/XMLTextNode.h> @@ -33,7 +34,7 @@ std::string RosterItemExchangeSerializer::serializePayload(boost::shared_ptr<Ros  		foreach(const std::string& group, item.getGroups()) {  			boost::shared_ptr<XMLElement> groupElement(new XMLElement("group")); -			groupElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(group))); +			groupElement->addNode(boost::make_shared<XMLTextNode>(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 <Swiften/Serializer/PayloadSerializers/RosterSerializer.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Base/foreach.h>  #include <Swiften/Serializer/XML/XMLTextNode.h> @@ -42,12 +43,12 @@ std::string RosterSerializer::serializePayload(boost::shared_ptr<RosterPayload>  		foreach(const std::string& group, item.getGroups()) {  			boost::shared_ptr<XMLElement> groupElement(new XMLElement("group")); -			groupElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(group))); +			groupElement->addNode(boost::make_shared<XMLTextNode>(group));  			itemElement->addNode(groupElement);  		}  		if (!item.getUnknownContent().empty()) { -			itemElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(item.getUnknownContent()))); +			itemElement->addNode(boost::make_shared<XMLRawTextNode>(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 <Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Base/foreach.h>  #include <Swiften/Serializer/XML/XMLElement.h> @@ -53,7 +54,7 @@ std::string SearchPayloadSerializer::serializePayload(boost::shared_ptr<SearchPa  	}  	if (Form::ref form = searchPayload->getForm()) { -		searchElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(FormSerializer().serialize(form)))); +		searchElement.addNode(boost::make_shared<XMLRawTextNode>(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 <boost/smart_ptr/make_shared.hpp> +  #include <Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h>  #include <Swiften/Base/foreach.h>  #include <Swiften/Serializer/XML/XMLRawTextNode.h> @@ -25,17 +27,17 @@ std::string SecurityLabelSerializer::serializePayload(boost::shared_ptr<Security  		if (!label->getBackgroundColor().empty()) {  			displayMarking->setAttribute("bgcolor", label->getBackgroundColor());  		} -		displayMarking->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(label->getDisplayMarking()))); +		displayMarking->addNode(boost::make_shared<XMLTextNode>(label->getDisplayMarking()));  		element.addNode(displayMarking);  	}  	boost::shared_ptr<XMLElement> labelElement(new XMLElement("label")); -	labelElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(label->getLabel()))); +	labelElement->addNode(boost::make_shared<XMLRawTextNode>(label->getLabel()));  	element.addNode(labelElement);  	foreach(const std::string& equivalentLabel, label->getEquivalentLabels()) {  		boost::shared_ptr<XMLElement> equivalentLabelElement(new XMLElement("equivalentlabel")); -		equivalentLabelElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(equivalentLabel))); +		equivalentLabelElement->addNode(boost::make_shared<XMLRawTextNode>(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 <boost/smart_ptr/make_shared.hpp> +  #include <Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h>  #include <Swiften/Base/foreach.h>  #include <Swiften/Serializer/XML/XMLElement.h> @@ -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<XMLRawTextNode>(new XMLRawTextNode(serializedLabel))); +			itemElement->addNode(boost::make_shared<XMLRawTextNode>(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 <boost/smart_ptr/make_shared.hpp> +  #include <Swiften/Serializer/GenericPayloadSerializer.h>  #include <Swiften/Serializer/XML/XMLElement.h>  #include <Swiften/Serializer/XML/XMLTextNode.h> @@ -18,7 +20,7 @@ namespace Swift {  			virtual std::string serializePayload(boost::shared_ptr<Status> status)  const {  				XMLElement element("status"); -				element.addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(status->getText()))); +				element.addNode(boost::make_shared<XMLTextNode>(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 <Swiften/Serializer/PayloadSerializers/StorageSerializer.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Base/foreach.h>  #include <Swiften/Serializer/XML/XMLElement.h> @@ -27,12 +28,12 @@ std::string StorageSerializer::serializePayload(boost::shared_ptr<Storage> stora  		conferenceElement->setAttribute("autojoin", room.autoJoin ? "1" : "0");  		if (!room.nick.empty()) {  			boost::shared_ptr<XMLElement> nickElement(new XMLElement("nick")); -			nickElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(room.nick))); +			nickElement->addNode(boost::make_shared<XMLTextNode>(room.nick));  			conferenceElement->addNode(nickElement);  		}  		if (room.password) {  			boost::shared_ptr<XMLElement> passwordElement(new XMLElement("password")); -			passwordElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(*room.password))); +			passwordElement->addNode(boost::make_shared<XMLTextNode>(*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 <Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <boost/lexical_cast.hpp>  #include <Swiften/Base/foreach.h> @@ -42,7 +43,7 @@ std::string StreamInitiationSerializer::serializePayload(boost::shared_ptr<Strea  		}  		if (!file.getDescription().empty()) {  			boost::shared_ptr<XMLElement> descElement(new XMLElement("desc")); -			descElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(file.getDescription()))); +			descElement->addNode(boost::make_shared<XMLTextNode>(file.getDescription()));  			fileElement->addNode(descElement);  		}  		siElement.addNode(fileElement); @@ -57,14 +58,14 @@ std::string StreamInitiationSerializer::serializePayload(boost::shared_ptr<Strea  			field->addOption(FormField::Option("", method));  		}  		form->addField(field); -		featureElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(FormSerializer().serialize(form)))); +		featureElement->addNode(boost::make_shared<XMLRawTextNode>(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<XMLRawTextNode>(new XMLRawTextNode(FormSerializer().serialize(form)))); +		featureElement->addNode(boost::make_shared<XMLRawTextNode>(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 <Swiften/Serializer/PayloadSerializers/VCardSerializer.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Serializer/XML/XMLElement.h>  #include <Swiften/Serializer/XML/XMLTextNode.h> @@ -23,39 +24,39 @@ std::string VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard)  c  	XMLElement queryElement("vCard", "vcard-temp");  	if (!vcard->getVersion().empty()) {  		boost::shared_ptr<XMLElement> versionElement(new XMLElement("VERSION")); -		versionElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getVersion()))); +		versionElement->addNode(boost::make_shared<XMLTextNode>(vcard->getVersion()));  		queryElement.addNode(versionElement);  	}  	if (!vcard->getFullName().empty()) {  		boost::shared_ptr<XMLElement> fullNameElement(new XMLElement("FN")); -		fullNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getFullName()))); +		fullNameElement->addNode(boost::make_shared<XMLTextNode>(vcard->getFullName()));  		queryElement.addNode(fullNameElement);  	}  	if (!vcard->getGivenName().empty() || !vcard->getFamilyName().empty() || !vcard->getMiddleName().empty() || !vcard->getPrefix().empty() || !vcard->getSuffix().empty()) {  		boost::shared_ptr<XMLElement> nameElement(new XMLElement("N"));  		if (!vcard->getFamilyName().empty()) {  			boost::shared_ptr<XMLElement> familyNameElement(new XMLElement("FAMILY")); -			familyNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getFamilyName()))); +			familyNameElement->addNode(boost::make_shared<XMLTextNode>(vcard->getFamilyName()));  			nameElement->addNode(familyNameElement);  		}  		if (!vcard->getGivenName().empty()) {  			boost::shared_ptr<XMLElement> givenNameElement(new XMLElement("GIVEN")); -			givenNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getGivenName()))); +			givenNameElement->addNode(boost::make_shared<XMLTextNode>(vcard->getGivenName()));  			nameElement->addNode(givenNameElement);  		}  		if (!vcard->getMiddleName().empty()) {  			boost::shared_ptr<XMLElement> middleNameElement(new XMLElement("MIDDLE")); -			middleNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getMiddleName()))); +			middleNameElement->addNode(boost::make_shared<XMLTextNode>(vcard->getMiddleName()));  			nameElement->addNode(middleNameElement);  		}  		if (!vcard->getPrefix().empty()) {  			boost::shared_ptr<XMLElement> prefixElement(new XMLElement("PREFIX")); -			prefixElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getPrefix()))); +			prefixElement->addNode(boost::make_shared<XMLTextNode>(vcard->getPrefix()));  			nameElement->addNode(prefixElement);  		}  		if (!vcard->getSuffix().empty()) {  			boost::shared_ptr<XMLElement> suffixElement(new XMLElement("SUFFIX")); -			suffixElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getSuffix()))); +			suffixElement->addNode(boost::make_shared<XMLTextNode>(vcard->getSuffix()));  			nameElement->addNode(suffixElement);  		}  		queryElement.addNode(nameElement); @@ -63,28 +64,28 @@ std::string VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard)  c  	foreach(const VCard::EMailAddress& emailAddress, vcard->getEMailAddresses()) {  		boost::shared_ptr<XMLElement> emailElement(new XMLElement("EMAIL"));  		boost::shared_ptr<XMLElement> userIDElement(new XMLElement("USERID")); -		userIDElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(emailAddress.address))); +		userIDElement->addNode(boost::make_shared<XMLTextNode>(emailAddress.address));  		emailElement->addNode(userIDElement);  		if (emailAddress.isHome) { -			emailElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("HOME"))); +			emailElement->addNode(boost::make_shared<XMLElement>("HOME"));  		}  		if (emailAddress.isWork) { -			emailElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("WORK"))); +			emailElement->addNode(boost::make_shared<XMLElement>("WORK"));  		}  		if (emailAddress.isInternet) { -			emailElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("INTERNET"))); +			emailElement->addNode(boost::make_shared<XMLElement>("INTERNET"));  		}  		if (emailAddress.isPreferred) { -			emailElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("PREF"))); +			emailElement->addNode(boost::make_shared<XMLElement>("PREF"));  		}  		if (emailAddress.isX400) { -			emailElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("X400"))); +			emailElement->addNode(boost::make_shared<XMLElement>("X400"));  		}  		queryElement.addNode(emailElement);  	}  	if (!vcard->getNickname().empty()) {  		boost::shared_ptr<XMLElement> nickElement(new XMLElement("NICKNAME")); -		nickElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getNickname()))); +		nickElement->addNode(boost::make_shared<XMLTextNode>(vcard->getNickname()));  		queryElement.addNode(nickElement);  	}  	if (!vcard->getPhoto().empty() || !vcard->getPhotoType().empty()) { @@ -102,7 +103,7 @@ std::string VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard)  c  		queryElement.addNode(photoElement);  	}  	if (!vcard->getUnknownContent().empty()) { -		queryElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(vcard->getUnknownContent()))); +		queryElement.addNode(boost::make_shared<XMLRawTextNode>(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 <Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Serializer/XML/XMLElement.h>  #include <Swiften/Serializer/XML/XMLTextNode.h> @@ -19,7 +20,7 @@ VCardUpdateSerializer::VCardUpdateSerializer() : GenericPayloadSerializer<VCardU  std::string VCardUpdateSerializer::serializePayload(boost::shared_ptr<VCardUpdate> vcardUpdate)	const {  	XMLElement updateElement("x", "vcard-temp:x:update");  	boost::shared_ptr<XMLElement> photoElement(new XMLElement("photo")); -	photoElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcardUpdate->getPhotoHash()))); +	photoElement->addNode(boost::make_shared<XMLTextNode>(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<Element> ele  	XMLElement streamFeaturesElement("stream:features");  	if (streamFeatures->hasStartTLS()) { -		streamFeaturesElement.addNode(boost::shared_ptr<XMLElement>(new XMLElement("starttls", "urn:ietf:params:xml:ns:xmpp-tls"))); +		streamFeaturesElement.addNode(boost::make_shared<XMLElement>("starttls", "urn:ietf:params:xml:ns:xmpp-tls"));  	}  	if (!streamFeatures->getCompressionMethods().empty()) {  		boost::shared_ptr<XMLElement> compressionElement(new XMLElement("compression", "http://jabber.org/features/compress"));  		foreach(const std::string& method, streamFeatures->getCompressionMethods()) {  			boost::shared_ptr<XMLElement> methodElement(new XMLElement("method")); -			methodElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(method))); +			methodElement->addNode(boost::make_shared<XMLTextNode>(method));  			compressionElement->addNode(methodElement);  		}  		streamFeaturesElement.addNode(compressionElement); @@ -37,19 +37,19 @@ SafeByteArray StreamFeaturesSerializer::serialize(boost::shared_ptr<Element> ele  		boost::shared_ptr<XMLElement> mechanismsElement(new XMLElement("mechanisms", "urn:ietf:params:xml:ns:xmpp-sasl"));  		foreach(const std::string& mechanism, streamFeatures->getAuthenticationMechanisms()) {  			boost::shared_ptr<XMLElement> mechanismElement(new XMLElement("mechanism")); -			mechanismElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(mechanism))); +			mechanismElement->addNode(boost::make_shared<XMLTextNode>(mechanism));  			mechanismsElement->addNode(mechanismElement);  		}  		streamFeaturesElement.addNode(mechanismsElement);  	}  	if (streamFeatures->hasResourceBind()) { -		streamFeaturesElement.addNode(boost::shared_ptr<XMLElement>(new XMLElement("bind", "urn:ietf:params:xml:ns:xmpp-bind"))); +		streamFeaturesElement.addNode(boost::make_shared<XMLElement>("bind", "urn:ietf:params:xml:ns:xmpp-bind"));  	}  	if (streamFeatures->hasSession()) { -		streamFeaturesElement.addNode(boost::shared_ptr<XMLElement>(new XMLElement("session", "urn:ietf:params:xml:ns:xmpp-session"))); +		streamFeaturesElement.addNode(boost::make_shared<XMLElement>("session", "urn:ietf:params:xml:ns:xmpp-session"));  	}  	if (streamFeatures->hasStreamManagement()) { -		streamFeaturesElement.addNode(boost::shared_ptr<XMLElement>(new XMLElement("sm", "urn:xmpp:sm:2"))); +		streamFeaturesElement.addNode(boost::make_shared<XMLElement>("sm", "urn:xmpp:sm:2"));  	}  	if (streamFeatures->hasRosterVersioning()) {  		streamFeaturesElement.addNode(boost::make_shared<XMLElement>("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 <cppunit/extensions/HelperMacros.h>  #include <cppunit/extensions/TestFactoryRegistry.h> +#include <boost/smart_ptr/make_shared.hpp> +  #include <Swiften/Serializer/XML/XMLElement.h>  #include <Swiften/Serializer/XML/XMLTextNode.h> @@ -28,10 +30,10 @@ class XMLElementTest : public CppUnit::TestFixture  			XMLElement testling("foo", "http://example.com");  			testling.setAttribute("myatt", "myval");  			boost::shared_ptr<XMLElement> barElement(new XMLElement("bar")); -			barElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode("Blo"))); +			barElement->addNode(boost::make_shared<XMLTextNode>("Blo"));  			testling.addNode(barElement);  			boost::shared_ptr<XMLElement> bazElement(new XMLElement("baz")); -			bazElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode("Bli&</stream>"))); +			bazElement->addNode(boost::make_shared<XMLTextNode>("Bli&</stream>"));  			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> element  void BOSHSessionStream::handleXMPPError() {  	available = false; -	onClosed(boost::shared_ptr<Error>(new Error(Error::ParseError))); +	onClosed(boost::make_shared<Error>(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 <Swiften/Session/BasicSessionStream.h>  #include <boost/bind.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/StreamStack/XMPPLayer.h>  #include <Swiften/StreamStack/StreamStack.h> @@ -110,7 +111,7 @@ void BasicSessionStream::addTLSEncryption() {  	assert(available);  	tlsLayer = new TLSLayer(tlsContextFactory);  	if (hasTLSCertificate() && !tlsLayer->setClientCertificate(getTLSCertificate())) { -		onClosed(boost::shared_ptr<Error>(new Error(Error::InvalidTLSCertificateError))); +		onClosed(boost::make_shared<Error>(Error::InvalidTLSCertificateError));  	}  	else {  		streamStack->addLayer(tlsLayer); @@ -172,7 +173,7 @@ void BasicSessionStream::handleElementReceived(boost::shared_ptr<Element> elemen  void BasicSessionStream::handleXMPPError() {  	available = false; -	onClosed(boost::shared_ptr<Error>(new Error(Error::ParseError))); +	onClosed(boost::make_shared<Error>(Error::ParseError));  }  void BasicSessionStream::handleTLSConnected() { @@ -181,16 +182,16 @@ void BasicSessionStream::handleTLSConnected() {  void BasicSessionStream::handleTLSError() {  	available = false; -	onClosed(boost::shared_ptr<Error>(new Error(Error::TLSError))); +	onClosed(boost::make_shared<Error>(Error::TLSError));  }  void BasicSessionStream::handleConnectionFinished(const boost::optional<Connection::Error>& error) {  	available = false;  	if (error == Connection::ReadError) { -		onClosed(boost::shared_ptr<Error>(new Error(Error::ConnectionReadError))); +		onClosed(boost::make_shared<Error>(Error::ConnectionReadError));  	}  	else if (error) { -		onClosed(boost::shared_ptr<Error>(new Error(Error::ConnectionWriteError))); +		onClosed(boost::make_shared<Error>(Error::ConnectionWriteError));  	}  	else {  		onClosed(boost::shared_ptr<Error>()); 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<Presence>(new Presence())); +			testling_->writeElement(boost::make_shared<Presence>());  			CPPUNIT_ASSERT_EQUAL(std::string("<presence/>"), lowLayer_->writtenData);  		}  | 
 Swift