diff options
author | Tobias Markmann <tm@ayena.de> | 2016-04-01 17:23:49 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-04-04 08:28:23 (GMT) |
commit | 741c45b74d5f634622eb5f757c49323274fb8937 (patch) | |
tree | b9cfa6c2fe2e79e03cc8cb7c1ca1e9cf45aa5328 /Swiften/QA | |
parent | eddd92ed76ae68cb1e202602fd3ebd11b69191a2 (diff) | |
download | swift-741c45b74d5f634622eb5f757c49323274fb8937.zip swift-741c45b74d5f634622eb5f757c49323274fb8937.tar.bz2 |
Modernize code to use C++11 shared_ptr instead of Boost's
This change was done by applying the following 'gsed'
replacement calls to all source files:
's/\#include <boost\/shared_ptr\.hpp>/\#include <memory>/g'
's/\#include <boost\/enable_shared_from_this\.hpp>/\#include <memory>/g'
's/\#include <boost\/smart_ptr\/make_shared\.hpp>/\#include <memory>/g'
's/\#include <boost\/make_shared\.hpp>/\#include <memory>/g'
's/\#include <boost\/weak_ptr\.hpp>/\#include <memory>/g'
's/boost::make_shared/std::make_shared/g'
's/boost::dynamic_pointer_cast/std::dynamic_pointer_cast/g'
's/boost::shared_ptr/std::shared_ptr/g'
's/boost::weak_ptr/std::weak_ptr/g'
's/boost::enable_shared_from_this/std::enable_shared_from_this/g'
The remaining issues have been fixed manually.
Test-Information:
Code builds on OS X 10.11.4 and unit tests pass.
Change-Id: Ia7ae34eab869fb9ad6387a1348426b71ae4acd5f
Diffstat (limited to 'Swiften/QA')
-rw-r--r-- | Swiften/QA/ClientTest/ClientTest.cpp | 2 | ||||
-rw-r--r-- | Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp | 8 | ||||
-rw-r--r-- | Swiften/QA/DNSSDTest/DNSSDTest.cpp | 12 | ||||
-rw-r--r-- | Swiften/QA/FileTransferTest/FileTransferTest.cpp | 24 | ||||
-rw-r--r-- | Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp | 7 | ||||
-rwxr-xr-x | Swiften/QA/NetworkTest/BoostConnectionTest.cpp | 9 | ||||
-rw-r--r-- | Swiften/QA/NetworkTest/DomainNameResolverTest.cpp | 28 | ||||
-rw-r--r-- | Swiften/QA/ReconnectTest/ReconnectTest.cpp | 6 | ||||
-rw-r--r-- | Swiften/QA/StorageTest/FileReadBytestreamTest.cpp | 12 | ||||
-rw-r--r-- | Swiften/QA/StorageTest/FileWriteBytestreamTest.cpp | 4 | ||||
-rw-r--r-- | Swiften/QA/StorageTest/VCardFileStorageTest.cpp | 6 | ||||
-rw-r--r-- | Swiften/QA/TLSTest/CertificateErrorTest.cpp | 22 |
12 files changed, 69 insertions, 71 deletions
diff --git a/Swiften/QA/ClientTest/ClientTest.cpp b/Swiften/QA/ClientTest/ClientTest.cpp index f34a501..9684234 100644 --- a/Swiften/QA/ClientTest/ClientTest.cpp +++ b/Swiften/QA/ClientTest/ClientTest.cpp @@ -42,7 +42,7 @@ static void handleDisconnected(boost::optional<ClientError> e) { } } -static void handleRosterReceived(boost::shared_ptr<Payload>) { +static void handleRosterReceived(std::shared_ptr<Payload>) { rosterReceived = true; std::cout << "Disconnecting" << std::endl; client->disconnect(); diff --git a/Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp b/Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp index b9ec7b8..8122c63 100644 --- a/Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp +++ b/Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp @@ -36,8 +36,8 @@ using namespace Swift; static const std::string CLIENT_NAME = "Swiften FT Test"; static const std::string CLIENT_NODE = "http://swift.im"; -static boost::shared_ptr<SimpleEventLoop> eventLoop; -static boost::shared_ptr<BoostNetworkFactories> networkFactories; +static std::shared_ptr<SimpleEventLoop> eventLoop; +static std::shared_ptr<BoostNetworkFactories> networkFactories; BoostRandomGenerator randGen; @@ -56,12 +56,12 @@ class ConcurrentFileTransferTest { private: int clientACandidates_; - boost::shared_ptr<Client> clientA_; + std::shared_ptr<Client> clientA_; std::map<std::string, ByteArray> clientASendFiles_; int clientBCandidates_; - boost::shared_ptr<Client> clientB_; + std::shared_ptr<Client> clientB_; }; /** diff --git a/Swiften/QA/DNSSDTest/DNSSDTest.cpp b/Swiften/QA/DNSSDTest/DNSSDTest.cpp index 3b7191d..ae2fafd 100644 --- a/Swiften/QA/DNSSDTest/DNSSDTest.cpp +++ b/Swiften/QA/DNSSDTest/DNSSDTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -35,7 +35,7 @@ class DNSSDTest : public CppUnit::TestFixture { public: void setUp() { eventLoop = new DummyEventLoop(); - querier = boost::shared_ptr<DNSSDQuerier>(new DNSSDQuerierType()); + querier = std::make_shared<DNSSDQuerier>(); querier->start(); } @@ -46,7 +46,7 @@ class DNSSDTest : public CppUnit::TestFixture { } void testPublish() { - boost::shared_ptr<DNSSDBrowseQuery> browseQuery = querier->createBrowseQuery(); + std::shared_ptr<DNSSDBrowseQuery> browseQuery = querier->createBrowseQuery(); browseQuery->onServiceAdded.connect(boost::bind(&DNSSDTest::handleServiceAdded, this, _1)); browseQuery->onServiceRemoved.connect(boost::bind(&DNSSDTest::handleServiceRemoved, this, _1)); browseQuery->onError.connect(boost::bind(&DNSSDTest::handleBrowseError, this)); @@ -55,7 +55,7 @@ class DNSSDTest : public CppUnit::TestFixture { // Publish the service LinkLocalServiceInfo info; - boost::shared_ptr<DNSSDRegisterQuery> registerQuery = querier->createRegisterQuery("DNSSDTest", 1234, info.toTXTRecord()); + std::shared_ptr<DNSSDRegisterQuery> registerQuery = querier->createRegisterQuery("DNSSDTest", 1234, info.toTXTRecord()); registerQuery->onRegisterFinished.connect(boost::bind(&DNSSDTest::handleRegisterFinished, this, _1)); registerQuery->registerService(); @@ -82,7 +82,7 @@ class DNSSDTest : public CppUnit::TestFixture { // Resolve all added services for (size_t i = 0; i < added.size(); ++i) { resolvedServices.clear(); - boost::shared_ptr<DNSSDResolveServiceQuery> resolveServiceQuery = querier->createResolveServiceQuery(added[i]); + std::shared_ptr<DNSSDResolveServiceQuery> resolveServiceQuery = querier->createResolveServiceQuery(added[i]); resolveServiceQuery->onServiceResolved.connect(boost::bind(&DNSSDTest::handleResolveFinished, this, _1)); resolveServiceQuery->start(); wait(); @@ -137,7 +137,7 @@ class DNSSDTest : public CppUnit::TestFixture { private: DummyEventLoop* eventLoop; - boost::shared_ptr<DNSSDQuerier> querier; + std::shared_ptr<DNSSDQuerier> querier; std::vector<DNSSDServiceID> added; std::vector<DNSSDServiceID> registered; std::vector<DNSSDServiceID> toRemove; diff --git a/Swiften/QA/FileTransferTest/FileTransferTest.cpp b/Swiften/QA/FileTransferTest/FileTransferTest.cpp index 8017927..dd8c139 100644 --- a/Swiften/QA/FileTransferTest/FileTransferTest.cpp +++ b/Swiften/QA/FileTransferTest/FileTransferTest.cpp @@ -35,8 +35,8 @@ using namespace Swift; static const std::string CLIENT_NAME = "Swiften FT Test"; static const std::string CLIENT_NODE = "http://swift.im"; -static boost::shared_ptr<SimpleEventLoop> eventLoop; -static boost::shared_ptr<BoostNetworkFactories> networkFactories; +static std::shared_ptr<SimpleEventLoop> eventLoop; +static std::shared_ptr<BoostNetworkFactories> networkFactories; BoostRandomGenerator randGen; @@ -50,12 +50,12 @@ enum Candidate { class FileTransferTest { public: FileTransferTest(int senderCandidates, int receiverCandidates) : senderCandidates_(senderCandidates), senderError_(FileTransferError::UnknownError), senderIsDone_(false), receiverCandidates_(receiverCandidates), receiverError_(FileTransferError::UnknownError), receiverIsDone_(false) { - sender_ = boost::make_shared<Client>(JID(getenv("SWIFT_FILETRANSFERTEST_JID")), getenv("SWIFT_FILETRANSFERTEST_PASS"), networkFactories.get()); + sender_ = std::make_shared<Client>(JID(getenv("SWIFT_FILETRANSFERTEST_JID")), getenv("SWIFT_FILETRANSFERTEST_PASS"), networkFactories.get()); sender_->onDisconnected.connect(boost::bind(&FileTransferTest::handleSenderDisconnected, this, _1)); sender_->onConnected.connect(boost::bind(&FileTransferTest::handleSenderConnected, this)); sender_->getEntityCapsProvider()->onCapsChanged.connect(boost::bind(&FileTransferTest::handleSenderCapsChanged, this, _1)); - receiver_ = boost::make_shared<Client>(JID(getenv("SWIFT_FILETRANSFERTEST2_JID")), getenv("SWIFT_FILETRANSFERTEST2_PASS"), networkFactories.get()); + receiver_ = std::make_shared<Client>(JID(getenv("SWIFT_FILETRANSFERTEST2_JID")), getenv("SWIFT_FILETRANSFERTEST2_PASS"), networkFactories.get()); receiver_->onConnected.connect(boost::bind(&FileTransferTest::handleReceiverConnected, this)); receiver_->onDisconnected.connect(boost::bind(&FileTransferTest::handleReceiverDisconnected, this, _1)); @@ -145,7 +145,7 @@ class FileTransferTest { void handleReceiverIncomingFileTransfer(IncomingFileTransfer::ref transfer) { incomingFileTransfers_.push_back(transfer); - boost::shared_ptr<FileWriteBytestream> out = boost::make_shared<FileWriteBytestream>(receiveFilePath_.native()); + std::shared_ptr<FileWriteBytestream> out = std::make_shared<FileWriteBytestream>(receiveFilePath_.native()); transfer->onFinished.connect(boost::bind(&FileTransferTest::handleReceiverFileTransferFinished, this, _1, out)); FileTransferOptions options; @@ -164,7 +164,7 @@ class FileTransferTest { void handleSenderCapsChanged(const JID &jid) { if (receiver_ && (receiver_->getJID().toBare() == jid.toBare())) { - boost::shared_ptr<FileReadBytestream> fileStream = boost::make_shared<FileReadBytestream>(sendFilePath_); + std::shared_ptr<FileReadBytestream> fileStream = std::make_shared<FileReadBytestream>(sendFilePath_); FileTransferOptions options; options = options.withInBandAllowed(senderCandidates_ & InBandBytestream); @@ -191,7 +191,7 @@ class FileTransferTest { } } - void handleReceiverFileTransferFinished(const boost::optional<FileTransferError>& error, boost::shared_ptr<FileWriteBytestream> out) { + void handleReceiverFileTransferFinished(const boost::optional<FileTransferError>& error, std::shared_ptr<FileWriteBytestream> out) { out->close(); receiverError_ = error; receiverIsDone_ = true; @@ -276,7 +276,7 @@ class FileTransferTest { private: int senderCandidates_; - boost::shared_ptr<Client> sender_; + std::shared_ptr<Client> sender_; ClientXMLTracer* senderTracer_; ByteArray sendData_; OutgoingFileTransfer::ref outgoingFileTransfer_; @@ -285,7 +285,7 @@ class FileTransferTest { bool senderIsDone_; int receiverCandidates_; - boost::shared_ptr<Client> receiver_; + std::shared_ptr<Client> receiver_; ClientXMLTracer* receiverTracer_; ByteArray receiveData_; std::vector<IncomingFileTransfer::ref> incomingFileTransfers_; @@ -302,10 +302,10 @@ static bool runTest(int senderCandidates, int receiverCandidates) { std::cout << "senderCandidates: " << senderCandidates << ", receiverCandidates: " << receiverCandidates << std::endl; bool expectSuccess = (senderCandidates & receiverCandidates) > 0; - eventLoop = boost::make_shared<SimpleEventLoop>(); - networkFactories = boost::make_shared<BoostNetworkFactories>(eventLoop.get()); + eventLoop = std::make_shared<SimpleEventLoop>(); + networkFactories = std::make_shared<BoostNetworkFactories>(eventLoop.get()); - boost::shared_ptr<FileTransferTest> testRun = boost::make_shared<FileTransferTest>(senderCandidates, receiverCandidates); + std::shared_ptr<FileTransferTest> testRun = std::make_shared<FileTransferTest>(senderCandidates, receiverCandidates); testRun->run(); diff --git a/Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp b/Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp index a415a0f..11b0eb5 100644 --- a/Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp +++ b/Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp @@ -1,13 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -194,7 +193,7 @@ class BoostConnectionServerTest : public CppUnit::TestFixture { stoppedError_ = e; } - void handleNewConnection(boost::shared_ptr<Connection> connection) { + void handleNewConnection(std::shared_ptr<Connection> connection) { receivedNewConnection_ = true; remoteAddress_ = connection->getRemoteAddress(); } diff --git a/Swiften/QA/NetworkTest/BoostConnectionTest.cpp b/Swiften/QA/NetworkTest/BoostConnectionTest.cpp index f09e1a7..12c4a77 100755 --- a/Swiften/QA/NetworkTest/BoostConnectionTest.cpp +++ b/Swiften/QA/NetworkTest/BoostConnectionTest.cpp @@ -4,11 +4,10 @@ * See the COPYING file for more information. */ +#include <memory> #include <string> #include <boost/date_time/posix_time/posix_time_types.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -38,7 +37,7 @@ class BoostConnectionTest : public CppUnit::TestFixture { void setUp() { eventLoop_ = new DummyEventLoop(); boostIOServiceThread_ = new BoostIOServiceThread(); - boostIOService_ = boost::make_shared<boost::asio::io_service>(); + boostIOService_ = std::make_shared<boost::asio::io_service>(); disconnected_ = false; connectFinished_ = false; } @@ -145,7 +144,7 @@ class BoostConnectionTest : public CppUnit::TestFixture { connection->write(createSafeByteArray("\r\n\r\n")); // Temporarily, while we don't have an xmpp server running on ipv6 } - void handleDataRead(boost::shared_ptr<SafeByteArray> data) { + void handleDataRead(std::shared_ptr<SafeByteArray> data) { append(receivedData_, *data); } @@ -159,7 +158,7 @@ class BoostConnectionTest : public CppUnit::TestFixture { private: BoostIOServiceThread* boostIOServiceThread_; - boost::shared_ptr<boost::asio::io_service> boostIOService_; + std::shared_ptr<boost::asio::io_service> boostIOService_; DummyEventLoop* eventLoop_; ByteArray receivedData_; bool disconnected_; diff --git a/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp b/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp index 05dd3a1..d45d118 100644 --- a/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp +++ b/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp @@ -67,7 +67,7 @@ class DomainNameResolverTest : public CppUnit::TestFixture { void setUp() { ioServiceThread = new BoostIOServiceThread(); eventLoop = new DummyEventLoop(); - idnConverter = boost::shared_ptr<IDNConverter>(PlatformIDNConverter::create()); + idnConverter = std::shared_ptr<IDNConverter>(PlatformIDNConverter::create()); #ifdef USE_UNBOUND resolver = new UnboundDomainNameResolver(idnConverter.get(), ioServiceThread->getIOService(), eventLoop); #else @@ -83,7 +83,7 @@ class DomainNameResolverTest : public CppUnit::TestFixture { } void testResolveAddress() { - boost::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("xmpp.test.swift.im")); + std::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("xmpp.test.swift.im")); query->run(); waitForResults(); @@ -94,7 +94,7 @@ class DomainNameResolverTest : public CppUnit::TestFixture { } void testResolveAddress_Error() { - boost::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("invalid.test.swift.im")); + std::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("invalid.test.swift.im")); query->run(); waitForResults(); @@ -103,7 +103,7 @@ class DomainNameResolverTest : public CppUnit::TestFixture { } void testResolveAddress_IPv6() { - boost::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("xmpp-ipv6.test.swift.im")); + std::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("xmpp-ipv6.test.swift.im")); query->run(); waitForResults(); @@ -113,7 +113,7 @@ class DomainNameResolverTest : public CppUnit::TestFixture { } void testResolveAddress_IPv4and6() { - boost::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("xmpp-ipv46.test.swift.im")); + std::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("xmpp-ipv46.test.swift.im")); query->run(); waitForResults(); @@ -125,7 +125,7 @@ class DomainNameResolverTest : public CppUnit::TestFixture { } void testResolveAddress_International() { - boost::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("tron\xc3\xa7on.test.swift.im")); + std::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("tron\xc3\xa7on.test.swift.im")); query->run(); waitForResults(); @@ -136,7 +136,7 @@ class DomainNameResolverTest : public CppUnit::TestFixture { } void testResolveAddress_Localhost() { - boost::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("localhost")); + std::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("localhost")); query->run(); waitForResults(); @@ -172,7 +172,7 @@ class DomainNameResolverTest : public CppUnit::TestFixture { } void testResolveService() { - boost::shared_ptr<DomainNameServiceQuery> query(createServiceQuery("_xmpp-client._tcp.", "xmpp-srv.test.swift.im")); + std::shared_ptr<DomainNameServiceQuery> query(createServiceQuery("_xmpp-client._tcp.", "xmpp-srv.test.swift.im")); query->run(); waitForResults(); @@ -200,8 +200,8 @@ class DomainNameResolverTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& domain) { - boost::shared_ptr<DomainNameAddressQuery> result = resolver->createAddressQuery(domain); + std::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& domain) { + std::shared_ptr<DomainNameAddressQuery> result = resolver->createAddressQuery(domain); result->onResult.connect(boost::bind(&DomainNameResolverTest::handleAddressQueryResult, this, _1, _2)); return result; } @@ -214,8 +214,8 @@ class DomainNameResolverTest : public CppUnit::TestFixture { resultsAvailable = true; } - boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) { - boost::shared_ptr<DomainNameServiceQuery> result = resolver->createServiceQuery(serviceLookupPrefix, domain); + std::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) { + std::shared_ptr<DomainNameServiceQuery> result = resolver->createServiceQuery(serviceLookupPrefix, domain); result->onResult.connect(boost::bind(&DomainNameResolverTest::handleServiceQueryResult, this, _1)); return result; } @@ -241,8 +241,8 @@ class DomainNameResolverTest : public CppUnit::TestFixture { private: BoostIOServiceThread* ioServiceThread; DummyEventLoop* eventLoop; - boost::shared_ptr<IDNConverter> idnConverter; - boost::shared_ptr<TimerFactory> timerFactory; + std::shared_ptr<IDNConverter> idnConverter; + std::shared_ptr<TimerFactory> timerFactory; bool resultsAvailable; std::vector<HostAddress> addressQueryResult; std::vector<HostAddress> allAddressQueryResults; diff --git a/Swiften/QA/ReconnectTest/ReconnectTest.cpp b/Swiften/QA/ReconnectTest/ReconnectTest.cpp index 611c846..27c7e23 100644 --- a/Swiften/QA/ReconnectTest/ReconnectTest.cpp +++ b/Swiften/QA/ReconnectTest/ReconnectTest.cpp @@ -25,7 +25,7 @@ Client* client_; SimpleEventLoop eventLoop_; int count = 0; -void handleTick(boost::shared_ptr<BoostTimer> timer) { +void handleTick(std::shared_ptr<BoostTimer> timer) { std::cout << "Count " << count++ << std::endl; if (timer) { timer->stop(); @@ -43,7 +43,7 @@ void handleTick(boost::shared_ptr<BoostTimer> timer) { int delay = 500; // int delay = 0; - boost::shared_ptr<BoostTimer> newTimer(BoostTimer::create(delay, &MainBoostIOServiceThread::getInstance().getIOService())); + std::shared_ptr<BoostTimer> newTimer(BoostTimer::create(delay, &MainBoostIOServiceThread::getInstance().getIOService())); newTimer->onTick.connect(boost::bind(&handleTick, timer)); newTimer->start(); } @@ -64,7 +64,7 @@ int main(int, char**) { std::string pass(passChars); client_ = new Swift::Client(jid, pass); - handleTick(boost::shared_ptr<BoostTimer>()); + handleTick(std::shared_ptr<BoostTimer>()); eventLoop_.run(); delete client_; diff --git a/Swiften/QA/StorageTest/FileReadBytestreamTest.cpp b/Swiften/QA/StorageTest/FileReadBytestreamTest.cpp index 5b3867c..e601de9 100644 --- a/Swiften/QA/StorageTest/FileReadBytestreamTest.cpp +++ b/Swiften/QA/StorageTest/FileReadBytestreamTest.cpp @@ -32,24 +32,24 @@ class FileReadBytestreamTest : public CppUnit::TestFixture { } void testRead() { - boost::shared_ptr<FileReadBytestream> testling(createTestling()); + std::shared_ptr<FileReadBytestream> testling(createTestling()); - boost::shared_ptr< std::vector<unsigned char> > result = testling->read(10); + std::shared_ptr< std::vector<unsigned char> > result = testling->read(10); CPPUNIT_ASSERT(createByteArray("/*\n * Copy") == *result.get()); } void testRead_Twice() { - boost::shared_ptr<FileReadBytestream> testling(createTestling()); + std::shared_ptr<FileReadBytestream> testling(createTestling()); testling->read(10); - boost::shared_ptr< std::vector<unsigned char> > result = testling->read(10); + std::shared_ptr< std::vector<unsigned char> > result = testling->read(10); CPPUNIT_ASSERT_EQUAL(std::string("right (c) "), byteArrayToString(*result)); } void testIsFinished_NotFinished() { - boost::shared_ptr<FileReadBytestream> testling(createTestling()); + std::shared_ptr<FileReadBytestream> testling(createTestling()); testling->read(10); @@ -57,7 +57,7 @@ class FileReadBytestreamTest : public CppUnit::TestFixture { } void testIsFinished_IsFinished() { - boost::shared_ptr<FileReadBytestream> testling(createTestling()); + std::shared_ptr<FileReadBytestream> testling(createTestling()); testling->read(4096); diff --git a/Swiften/QA/StorageTest/FileWriteBytestreamTest.cpp b/Swiften/QA/StorageTest/FileWriteBytestreamTest.cpp index e847c28..d6963a4 100644 --- a/Swiften/QA/StorageTest/FileWriteBytestreamTest.cpp +++ b/Swiften/QA/StorageTest/FileWriteBytestreamTest.cpp @@ -29,7 +29,7 @@ class FileWriteBytestreamTest : public CppUnit::TestFixture { void testSuccessfulWrite() { boost::filesystem::path filename = boost::filesystem::unique_path("write_file_bytestream_test_%%%%%%%%%%%%%%%%.bin"); - boost::shared_ptr<WriteBytestream> writeBytestream = boost::make_shared<FileWriteBytestream>(filename.string()); + std::shared_ptr<WriteBytestream> writeBytestream = std::make_shared<FileWriteBytestream>(filename.string()); writeBytestream->onWrite.connect(boost::bind(&FileWriteBytestreamTest::handleOnWrite, this, _1)); CPPUNIT_ASSERT_EQUAL(true, writeBytestream->write(createByteArray("Some data."))); @@ -39,7 +39,7 @@ class FileWriteBytestreamTest : public CppUnit::TestFixture { } void testFailingWrite() { - boost::shared_ptr<WriteBytestream> writeBytestream = boost::make_shared<FileWriteBytestream>(""); + std::shared_ptr<WriteBytestream> writeBytestream = std::make_shared<FileWriteBytestream>(""); writeBytestream->onWrite.connect(boost::bind(&FileWriteBytestreamTest::handleOnWrite, this, _1)); CPPUNIT_ASSERT_EQUAL(false, writeBytestream->write(createByteArray("Some data."))); diff --git a/Swiften/QA/StorageTest/VCardFileStorageTest.cpp b/Swiften/QA/StorageTest/VCardFileStorageTest.cpp index 69e5917..0dae2f3 100644 --- a/Swiften/QA/StorageTest/VCardFileStorageTest.cpp +++ b/Swiften/QA/StorageTest/VCardFileStorageTest.cpp @@ -43,7 +43,7 @@ class VCardFileStorageTest : public CppUnit::TestFixture { } void testSetVCard() { - boost::shared_ptr<VCardFileStorage> testling(createTestling()); + std::shared_ptr<VCardFileStorage> testling(createTestling()); VCard::ref vcard(new VCard()); vcard->setFullName("Alice In Wonderland"); @@ -73,7 +73,7 @@ class VCardFileStorageTest : public CppUnit::TestFixture { } void testGetVCard() { - boost::shared_ptr<VCardFileStorage> testling(createTestling()); + std::shared_ptr<VCardFileStorage> testling(createTestling()); VCard::ref vcard(new VCard()); vcard->setFullName("Alice In Wonderland"); testling->setVCard(JID("alice@wonderland.lit"), vcard); @@ -99,7 +99,7 @@ class VCardFileStorageTest : public CppUnit::TestFixture { } void testGetVCard_FileDoesNotExist() { - boost::shared_ptr<VCardFileStorage> testling(createTestling()); + std::shared_ptr<VCardFileStorage> testling(createTestling()); VCard::ref result = testling->getVCard(JID("alice@wonderland.lit")); CPPUNIT_ASSERT(!result); } diff --git a/Swiften/QA/TLSTest/CertificateErrorTest.cpp b/Swiften/QA/TLSTest/CertificateErrorTest.cpp index b928a3f..abd004e 100644 --- a/Swiften/QA/TLSTest/CertificateErrorTest.cpp +++ b/Swiften/QA/TLSTest/CertificateErrorTest.cpp @@ -50,7 +50,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { void setUp() { eventLoop_ = new DummyEventLoop(); boostIOServiceThread_ = new BoostIOServiceThread(); - boostIOService_ = boost::make_shared<boost::asio::io_service>(); + boostIOService_ = std::make_shared<boost::asio::io_service>(); connectionFactory_ = new BoostConnectionFactory(boostIOServiceThread_->getIOService(), eventLoop_); idnConverter_ = PlatformIDNConverter::create(); domainNameResolver_ = new PlatformDomainNameResolver(idnConverter_, eventLoop_); @@ -81,7 +81,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { } HostAddress resolveName(const std::string& name) { - boost::shared_ptr<DomainNameAddressQuery> query = domainNameResolver_->createAddressQuery(name); + std::shared_ptr<DomainNameAddressQuery> query = domainNameResolver_->createAddressQuery(name); query->onResult.connect(boost::bind(&CertificateErrorTest::handleAddressQueryResult, this, _1, _2)); lastResoverResult_ = HostAddress(); resolvingDone_ = false; @@ -94,7 +94,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { return lastResoverResult_; } - void connectToServer(boost::shared_ptr<TLSConnection> connection, const std::string& hostname, int port) { + void connectToServer(std::shared_ptr<TLSConnection> connection, const std::string& hostname, int port) { connection->onConnectFinished.connect(boost::bind(&CertificateErrorTest::handleConnectFinished, this, _1)); HostAddress address = resolveName(hostname); @@ -107,7 +107,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { } void testTLS_O_MaticTrusted() { - boost::shared_ptr<TLSConnection> connection = boost::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); + std::shared_ptr<TLSConnection> connection = std::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); TLSContext* context = connection->getTLSContext(); connectToServer(connection, "test1.tls-o-matic.com", 443); @@ -117,7 +117,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { } void testTLS_O_MaticCertificateFromTheFuture() { - boost::shared_ptr<TLSConnection> connection = boost::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); + std::shared_ptr<TLSConnection> connection = std::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); TLSContext* context = connection->getTLSContext(); connectToServer(connection, "test5.tls-o-matic.com", 405); @@ -133,7 +133,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { } void testTLS_O_MaticCertificateFromThePast() { - boost::shared_ptr<TLSConnection> connection = boost::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); + std::shared_ptr<TLSConnection> connection = std::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); TLSContext* context = connection->getTLSContext(); connectToServer(connection, "test6.tls-o-matic.com", 406); @@ -144,7 +144,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { } void testTLS_O_MaticCertificateFromUnknownCA() { - boost::shared_ptr<TLSConnection> connection = boost::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); + std::shared_ptr<TLSConnection> connection = std::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); TLSContext* context = connection->getTLSContext(); connectToServer(connection, "test7.tls-o-matic.com", 407); @@ -156,7 +156,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { // test14.tls-o-matic.com:414 void testTLS_O_MaticCertificateWrongPurpose() { - boost::shared_ptr<TLSConnection> connection = boost::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); + std::shared_ptr<TLSConnection> connection = std::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); TLSContext* context = connection->getTLSContext(); connectToServer(connection, "test14.tls-o-matic.com", 414); @@ -168,7 +168,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { void testRevokedCertificateRevocationDisabled() { tlsContextFactory_->setCheckCertificateRevocation(false); - boost::shared_ptr<TLSConnection> connection = boost::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); + std::shared_ptr<TLSConnection> connection = std::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); TLSContext* context = connection->getTLSContext(); connectToServer(connection, "revoked.grc.com", 443); @@ -179,7 +179,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { void testRevokedCertificateRevocationEnabled() { tlsContextFactory_->setCheckCertificateRevocation(true); - boost::shared_ptr<TLSConnection> connection = boost::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); + std::shared_ptr<TLSConnection> connection = std::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); TLSContext* context = connection->getTLSContext(); connectToServer(connection, "revoked.grc.com", 443); @@ -204,7 +204,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { private: BoostIOServiceThread* boostIOServiceThread_; - boost::shared_ptr<boost::asio::io_service> boostIOService_; + std::shared_ptr<boost::asio::io_service> boostIOService_; DummyEventLoop* eventLoop_; ConnectionFactory* connectionFactory_; PlatformTLSFactories* tlsFactories_; |