summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2018-07-27 13:39:18 (GMT)
committerKevin Smith <kevin.smith@isode.com>2018-07-27 13:53:55 (GMT)
commit48596613cfe0f45c0916beabbcc3a27e01752c4b (patch)
treef8137f72b599d02eb1bc4f6dbc833c416f4e0295 /Swiften/Network
parent1bcdcbd4c8e1c6c971087f049422d3bd52be2a6b (diff)
downloadswift-48596613cfe0f45c0916beabbcc3a27e01752c4b.zip
swift-48596613cfe0f45c0916beabbcc3a27e01752c4b.tar.bz2
Autofix boost-use-to-string clang-tidy warnings
Done by adding --fix --fix-errors to the clang-tidy args in the Makefile Test-Information: Unit tests pass (macOS) Change-Id: I3a4df955ac3553afeb9384f23f9d8b2ef01117e2
Diffstat (limited to 'Swiften/Network')
-rw-r--r--Swiften/Network/HostAddressPort.cpp2
-rw-r--r--Swiften/Network/MiniUPnPInterface.cpp12
-rw-r--r--Swiften/Network/StaticDomainNameResolver.cpp2
-rw-r--r--Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp8
-rw-r--r--Swiften/Network/UnitTest/BOSHConnectionTest.cpp2
5 files changed, 13 insertions, 13 deletions
diff --git a/Swiften/Network/HostAddressPort.cpp b/Swiften/Network/HostAddressPort.cpp
index 76c276e..401ddec 100644
--- a/Swiften/Network/HostAddressPort.cpp
+++ b/Swiften/Network/HostAddressPort.cpp
@@ -21,7 +21,7 @@ HostAddressPort::HostAddressPort(const boost::asio::ip::tcp::endpoint& endpoint)
std::string HostAddressPort::toString() const {
std::string portAsString;
try {
- portAsString = boost::lexical_cast<std::string>(getPort());
+ portAsString = std::to_string(getPort());
} catch (boost::bad_lexical_cast&) {
}
return getAddress().toString() + ":" + portAsString;
diff --git a/Swiften/Network/MiniUPnPInterface.cpp b/Swiften/Network/MiniUPnPInterface.cpp
index dbe8bcd..2c61ad3 100644
--- a/Swiften/Network/MiniUPnPInterface.cpp
+++ b/Swiften/Network/MiniUPnPInterface.cpp
@@ -80,9 +80,9 @@ boost::optional<NATPortMapping> MiniUPnPInterface::addPortForward(int actualLoca
NATPortMapping mapping(actualLocalPort, actualPublicPort, NATPortMapping::TCP);
- std::string publicPort = boost::lexical_cast<std::string>(mapping.getPublicPort());
- std::string localPort = boost::lexical_cast<std::string>(mapping.getLocalPort());
- std::string leaseSeconds = boost::lexical_cast<std::string>(mapping.getLeaseInSeconds());
+ std::string publicPort = std::to_string(mapping.getPublicPort());
+ std::string localPort = std::to_string(mapping.getLocalPort());
+ std::string leaseSeconds = std::to_string(mapping.getLeaseInSeconds());
int ret = UPNP_AddPortMapping(
p->urls.controlURL,
@@ -107,9 +107,9 @@ bool MiniUPnPInterface::removePortForward(const NATPortMapping& mapping) {
return false;
}
- std::string publicPort = boost::lexical_cast<std::string>(mapping.getPublicPort());
- std::string localPort = boost::lexical_cast<std::string>(mapping.getLocalPort());
- std::string leaseSeconds = boost::lexical_cast<std::string>(mapping.getLeaseInSeconds());
+ std::string publicPort = std::to_string(mapping.getPublicPort());
+ std::string localPort = std::to_string(mapping.getLocalPort());
+ std::string leaseSeconds = std::to_string(mapping.getLeaseInSeconds());
int ret = UPNP_DeletePortMapping(p->urls.controlURL, p->data.first.servicetype, publicPort.c_str(), mapping.getProtocol() == NATPortMapping::TCP ? "TCP" : "UDP", nullptr);
return ret == UPNPCOMMAND_SUCCESS;
diff --git a/Swiften/Network/StaticDomainNameResolver.cpp b/Swiften/Network/StaticDomainNameResolver.cpp
index b8f4c7a..5a38fc4 100644
--- a/Swiften/Network/StaticDomainNameResolver.cpp
+++ b/Swiften/Network/StaticDomainNameResolver.cpp
@@ -102,7 +102,7 @@ void StaticDomainNameResolver::addService(const std::string& service, const Doma
void StaticDomainNameResolver::addXMPPClientService(const std::string& domain, const HostAddressPort& address) {
static int hostid = 0;
- std::string hostname(std::string("host-") + boost::lexical_cast<std::string>(hostid));
+ std::string hostname(std::string("host-") + std::to_string(hostid));
hostid++;
addService("_xmpp-client._tcp." + domain, ServiceQuery::Result(hostname, address.getPort(), 0, 0));
diff --git a/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp b/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp
index 5d6fedd..4aeaf24 100644
--- a/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp
+++ b/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp
@@ -194,7 +194,7 @@ class BOSHConnectionPoolTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(st(2), connectionFactory->connections.size()); /* 0 was waiting for response, open and send on 1 */
CPPUNIT_ASSERT_EQUAL(st(4), boshDataWritten.size()); /* data */
c1 = connectionFactory->connections[1];
- std::string fullBody = "<body rid='" + boost::lexical_cast<std::string>(rid) + "' sid='" + sid + "' xmlns='http://jabber.org/protocol/httpbind'><blah/></body>"; /* check empty write */
+ std::string fullBody = "<body rid='" + std::to_string(rid) + "' sid='" + sid + "' xmlns='http://jabber.org/protocol/httpbind'><blah/></body>"; /* check empty write */
CPPUNIT_ASSERT_EQUAL(fullBody, lastBody());
CPPUNIT_ASSERT(c0->pending);
CPPUNIT_ASSERT(c1->pending);
@@ -310,7 +310,7 @@ class BOSHConnectionPoolTest : public CppUnit::TestFixture {
readResponse("<body></body>", c0);
eventLoop->processEvents();
CPPUNIT_ASSERT_EQUAL(st(3), boshDataWritten.size());
- std::string fullBody = "<body rid='" + boost::lexical_cast<std::string>(initialRID + 2) + "' sid='" + sid + "' xmlns='http://jabber.org/protocol/httpbind'></body>";
+ std::string fullBody = "<body rid='" + std::to_string(initialRID + 2) + "' sid='" + sid + "' xmlns='http://jabber.org/protocol/httpbind'></body>";
std::string response = boshDataWritten[2];
size_t bodyPosition = response.find("\r\n\r\n");
CPPUNIT_ASSERT_EQUAL(fullBody, response.substr(bodyPosition+4));
@@ -427,7 +427,7 @@ class BOSHConnectionPoolTest : public CppUnit::TestFixture {
"Access-Control-Allow-Headers: Content-Type\r\n"
"Content-Length: "));
connection->onDataRead(data1);
- std::shared_ptr<SafeByteArray> data2 = std::make_shared<SafeByteArray>(createSafeByteArray(boost::lexical_cast<std::string>(response.size())));
+ std::shared_ptr<SafeByteArray> data2 = std::make_shared<SafeByteArray>(createSafeByteArray(std::to_string(response.size())));
connection->onDataRead(data2);
std::shared_ptr<SafeByteArray> data3 = std::make_shared<SafeByteArray>(createSafeByteArray("\r\n\r\n"));
connection->onDataRead(data3);
@@ -440,7 +440,7 @@ class BOSHConnectionPoolTest : public CppUnit::TestFixture {
std::string result = "POST /" + path + " HTTP/1.1\r\n"
+ "Host: " + to + ":" + port + "\r\n"
+ "Content-Type: text/xml; charset=utf-8\r\n"
- + "Content-Length: " + boost::lexical_cast<std::string>(body.size()) + "\r\n\r\n"
+ + "Content-Length: " + std::to_string(body.size()) + "\r\n\r\n"
+ body;
return result;
}
diff --git a/Swiften/Network/UnitTest/BOSHConnectionTest.cpp b/Swiften/Network/UnitTest/BOSHConnectionTest.cpp
index e34cb96..17d8333 100644
--- a/Swiften/Network/UnitTest/BOSHConnectionTest.cpp
+++ b/Swiften/Network/UnitTest/BOSHConnectionTest.cpp
@@ -318,7 +318,7 @@ class BOSHConnectionTest : public CppUnit::TestFixture {
"Access-Control-Allow-Headers: Content-Type\r\n"
"Content-Length: "));
connection->onDataRead(data1);
- std::shared_ptr<SafeByteArray> data2 = std::make_shared<SafeByteArray>(createSafeByteArray(boost::lexical_cast<std::string>(response.size())));
+ std::shared_ptr<SafeByteArray> data2 = std::make_shared<SafeByteArray>(createSafeByteArray(std::to_string(response.size())));
connection->onDataRead(data2);
std::shared_ptr<SafeByteArray> data3 = std::make_shared<SafeByteArray>(createSafeByteArray("\r\n\r\n"));
connection->onDataRead(data3);