summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-11-23 07:09:39 (GMT)
committerTobias Markmann <tm@ayena.de>2016-11-23 11:30:02 (GMT)
commite405ff3561be3d3c0bd79d7d5173923a8828cf02 (patch)
tree9118ef838ebfaec1df90ec24761944b5d833774c /Swiften/FileTransfer
parent8a71b91be885652f37c5aab5e1ecf25af4599fbc (diff)
downloadswift-e405ff3561be3d3c0bd79d7d5173923a8828cf02.zip
swift-e405ff3561be3d3c0bd79d7d5173923a8828cf02.tar.bz2
Migrate remaining Swiften/Base/foreach.h use to range-based for loop
Test-Information: Build on macOS 10.12.1 and all tests pass. Change-Id: Iedaa3fa7e7672c77909fd0568bf30e9393cb87e0
Diffstat (limited to 'Swiften/FileTransfer')
-rw-r--r--Swiften/FileTransfer/DefaultFileTransferTransporter.cpp3
-rw-r--r--Swiften/FileTransfer/IncomingJingleFileTransfer.cpp5
-rw-r--r--Swiften/FileTransfer/JingleFileTransfer.cpp3
-rw-r--r--Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp3
-rw-r--r--Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp3
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp4
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp1
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServer.cpp5
8 files changed, 9 insertions, 18 deletions
diff --git a/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp b/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp
index aefafd9..c6987c0 100644
--- a/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp
+++ b/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp
@@ -11,7 +11,6 @@
#include <boost/bind.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Crypto/CryptoProvider.h>
#include <Swiften/FileTransfer/FailingTransportSession.h>
#include <Swiften/FileTransfer/FileTransferOptions.h>
@@ -295,7 +294,7 @@ void DefaultFileTransferTransporter::closeLocalSession() {
s5bRegistry->setHasBytestream(getSOCKS5DstAddr(), false);
if (s5bServerManager->getServer()) {
std::vector<std::shared_ptr<SOCKS5BytestreamServerSession> > serverSessions = s5bServerManager->getServer()->getSessions(getSOCKS5DstAddr());
- foreach(std::shared_ptr<SOCKS5BytestreamServerSession> session, serverSessions) {
+ for (auto&& session : serverSessions) {
session->stop();
}
}
diff --git a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
index f73cd38..d5de5e4 100644
--- a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
+++ b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
@@ -12,7 +12,6 @@
#include <boost/bind.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/JingleFileTransferDescription.h>
#include <Swiften/Elements/JingleFileTransferHash.h>
#include <Swiften/Elements/JingleIBBTransportPayload.h>
@@ -130,7 +129,7 @@ void IncomingJingleFileTransfer::handleLocalTransportCandidatesGenerated(
transport->setSessionID(s5bSessionID);
transport->setMode(JingleS5BTransportPayload::TCPMode);
transport->setDstAddr(dstAddr);
- foreach(JingleS5BTransportPayload::Candidate candidate, candidates) {
+ for (auto&& candidate : candidates) {
transport->addCandidate(candidate);
}
session->sendAccept(getContentID(), initialContent->getDescriptions()[0], transport);
@@ -197,7 +196,7 @@ void IncomingJingleFileTransfer::checkIfAllDataReceived() {
if (receivedBytes == getFileSizeInBytes()) {
SWIFT_LOG(debug) << "All data received." << std::endl;
bool hashInfoAvailable = false;
- foreach(const JingleFileTransferFileInfo::HashElementMap::value_type& hashElement, hashes) {
+ for (const auto& hashElement : hashes) {
hashInfoAvailable |= !hashElement.second.empty();
}
diff --git a/Swiften/FileTransfer/JingleFileTransfer.cpp b/Swiften/FileTransfer/JingleFileTransfer.cpp
index 36725de..62c3a53 100644
--- a/Swiften/FileTransfer/JingleFileTransfer.cpp
+++ b/Swiften/FileTransfer/JingleFileTransfer.cpp
@@ -9,7 +9,6 @@
#include <boost/typeof/typeof.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Crypto/CryptoProvider.h>
#include <Swiften/FileTransfer/FileTransferTransporter.h>
#include <Swiften/JID/JID.h>
@@ -39,7 +38,7 @@ JingleFileTransfer::~JingleFileTransfer() {
void JingleFileTransfer::fillCandidateMap(CandidateMap& map, const std::vector<JingleS5BTransportPayload::Candidate>& candidates) {
map.clear();
- foreach (JingleS5BTransportPayload::Candidate candidate, candidates) {
+ for (auto&& candidate : candidates) {
map[candidate.cid] = candidate;
}
}
diff --git a/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp b/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp
index fcc160a..367fc97 100644
--- a/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp
+++ b/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp
@@ -24,7 +24,6 @@
#include <Swiften/Base/IDGenerator.h>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Crypto/CryptoProvider.h>
#include <Swiften/Elements/JingleFileTransferDescription.h>
#include <Swiften/Elements/JingleFileTransferHash.h>
@@ -215,7 +214,7 @@ void OutgoingJingleFileTransfer::handleLocalTransportCandidatesGenerated(
s5bTransport->setSessionID(s5bSessionID);
s5bTransport->setMode(JingleS5BTransportPayload::TCPMode);
s5bTransport->setDstAddr(dstAddr);
- foreach(JingleS5BTransportPayload::Candidate candidate, candidates) {
+ for (auto&& candidate : candidates) {
s5bTransport->addCandidate(candidate);
SWIFT_LOG(debug) << "\t" << "S5B candidate: " << candidate.hostPort.toString() << std::endl;
}
diff --git a/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp b/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp
index a0e7a6f..56013ca 100644
--- a/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp
+++ b/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp
@@ -18,7 +18,6 @@
#include <boost/signals2.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/JingleS5BTransportPayload.h>
#include <Swiften/FileTransfer/SOCKS5BytestreamRegistry.h>
#include <Swiften/Network/ConnectionFactory.h>
@@ -39,7 +38,7 @@ RemoteJingleTransportCandidateSelector::~RemoteJingleTransportCandidateSelector(
void RemoteJingleTransportCandidateSelector::addCandidates(
const std::vector<JingleS5BTransportPayload::Candidate>& candidates) {
- foreach(JingleS5BTransportPayload::Candidate c, candidates) {
+ for (auto&& c : candidates) {
this->candidates.push(c);
}
}
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp b/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp
index 9624d4c..90c42dd 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp
@@ -17,7 +17,6 @@
#include <boost/bind.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/S5BProxyRequest.h>
#include <Swiften/Queries/GenericRequest.h>
#include <Swiften/Queries/IQRouter.h>
@@ -38,8 +37,7 @@ void SOCKS5BytestreamProxyFinder::start() {
}
void SOCKS5BytestreamProxyFinder::stop() {
- typedef std::shared_ptr<GenericRequest<S5BProxyRequest> > S5BProxyRequestGenericRequest;
- foreach (S5BProxyRequestGenericRequest requester, pendingRequests) {
+ for (auto&& requester : pendingRequests) {
requester->onResponse.disconnect(boost::bind(&SOCKS5BytestreamProxyFinder::handleProxyResponse, this, requester, _1, _2));
}
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp
index 1591e24..9e214fc 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp
@@ -10,7 +10,6 @@
#include <Swiften/Base/Algorithm.h>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
namespace Swift {
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp
index b68bd58..483ea18 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp
@@ -9,7 +9,6 @@
#include <boost/bind.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Crypto/CryptoProvider.h>
#include <Swiften/FileTransfer/SOCKS5BytestreamRegistry.h>
#include <Swiften/FileTransfer/SOCKS5BytestreamServerSession.h>
@@ -30,7 +29,7 @@ void SOCKS5BytestreamServer::start() {
void SOCKS5BytestreamServer::stop() {
connectionServer->onNewConnection.disconnect(boost::bind(&SOCKS5BytestreamServer::handleNewConnection, this, _1));
- foreach (std::shared_ptr<SOCKS5BytestreamServerSession> session, sessions) {
+ for (auto&& session : sessions) {
session->onFinished.disconnect(boost::bind(&SOCKS5BytestreamServer::handleSessionFinished, this, session));
session->stop();
}
@@ -52,7 +51,7 @@ HostAddressPort SOCKS5BytestreamServer::getAddressPort() const {
std::vector< std::shared_ptr<SOCKS5BytestreamServerSession> > SOCKS5BytestreamServer::getSessions(
const std::string& streamID) const {
std::vector< std::shared_ptr<SOCKS5BytestreamServerSession> > result;
- foreach (std::shared_ptr<SOCKS5BytestreamServerSession> session, sessions) {
+ for (auto&& session : sessions) {
if (session->getStreamID() == streamID) {
result.push_back(session);
}