From 39de0f7f5ef708706d472731962fcdb61a33116c Mon Sep 17 00:00:00 2001 From: yomnes0 Date: Fri, 19 Jul 2024 10:45:41 +0200 Subject: [PATCH] [tests] Fix warnings when compiling with g++ 11.4.0 on ubuntu 22.04 --- examples/recvlive.cpp | 2 +- examples/sendmsg.cpp | 10 +++++----- test/test_reuseaddr.cpp | 2 +- testing/srt-test-relay.cpp | 6 +++--- testing/testmedia.cpp | 10 +++++----- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/examples/recvlive.cpp b/examples/recvlive.cpp index 81c2b1ef7..e14420a66 100644 --- a/examples/recvlive.cpp +++ b/examples/recvlive.cpp @@ -147,7 +147,7 @@ int main(int argc, char* argv[]) clientservice, sizeof(clientservice), NI_NUMERICHOST|NI_NUMERICSERV); cout << "new connection: " << clienthost << ":" << clientservice << endl; - int events = SRT_EPOLL_IN | SRT_EPOLL_ERR; + events = SRT_EPOLL_IN | SRT_EPOLL_ERR; if (SRT_ERROR == srt_epoll_add_usock(epid, fhandle, &events)) { cout << "srt_epoll_add_usock: " << srt_getlasterror_str() << endl; diff --git a/examples/sendmsg.cpp b/examples/sendmsg.cpp index 53a0f66a5..af551849b 100644 --- a/examples/sendmsg.cpp +++ b/examples/sendmsg.cpp @@ -150,25 +150,25 @@ int main(int argc, char* argv[]) } else { - int lpos = 0; + int lpos2 = 0; int nparsed = 0; if (line[0] == '+') { - nparsed = sscanf(line.c_str(), "+%d %d %n%*s", &ttl, &id, &lpos); + nparsed = sscanf(line.c_str(), "+%d %d %n%*s", &ttl, &id, &lpos2); if (nparsed != 2) { - cout << "ERROR: syntax error in input (" << nparsed << " parsed pos=" << lpos << ")\n"; + cout << "ERROR: syntax error in input (" << nparsed << " parsed pos=" << lpos2 << ")\n"; status = SRT_ERROR; break; } } else { - nparsed = sscanf(line.c_str(), "%d %n%*s", &id, &lpos); + nparsed = sscanf(line.c_str(), "%d %n%*s", &id, &lpos2); if (nparsed != 1) { - cout << "ERROR: syntax error in input (" << nparsed << " parsed pos=" << lpos << ")\n"; + cout << "ERROR: syntax error in input (" << nparsed << " parsed pos=" << lpos2 << ")\n"; status = SRT_ERROR; break; } diff --git a/test/test_reuseaddr.cpp b/test/test_reuseaddr.cpp index d00628e63..df4aec487 100644 --- a/test/test_reuseaddr.cpp +++ b/test/test_reuseaddr.cpp @@ -355,7 +355,7 @@ class ReuseAddr : public srt::Test sockaddr_any showacp = (sockaddr*)&scl; std::cout << "[T/S] Accepted from: " << showacp.str() << std::endl; - int epoll_in = SRT_EPOLL_IN; + epoll_in = SRT_EPOLL_IN; srt_epoll_add_usock(server_pollid, accepted_sock, &epoll_in); // wait for input char buffer[1316]; diff --git a/testing/srt-test-relay.cpp b/testing/srt-test-relay.cpp index 45d657128..e7e5ae574 100755 --- a/testing/srt-test-relay.cpp +++ b/testing/srt-test-relay.cpp @@ -367,9 +367,9 @@ SrtMainLoop::SrtMainLoop(const string& srt_uri, bool input_echoback, const strin Verb() << "SRT set up as input source and the first output target"; // Add SRT medium to output targets, and keep input medium empty. - unique_ptr m { new TargetMedium }; - m->Setup(m_srt_relay.get()); - m_output_media.push_back(move(m)); + unique_ptr med { new TargetMedium }; + med->Setup(m_srt_relay.get()); + m_output_media.push_back(move(med)); } else { diff --git a/testing/testmedia.cpp b/testing/testmedia.cpp index 2d6635288..d82212bad 100755 --- a/testing/testmedia.cpp +++ b/testing/testmedia.cpp @@ -1130,15 +1130,15 @@ void SrtCommon::OpenGroupClient() // spread the setting on all sockets. ConfigurePost(m_sock); - for (size_t i = 0; i < targets.size(); ++i) + for (size_t j = 0; j < targets.size(); ++j) { // As m_group_nodes is simply transformed into 'targets', // one index can be used to index them all. You don't // have to check if they have equal addresses because they // are equal by definition. - if (targets[i].id != -1 && targets[i].errorcode == SRT_SUCCESS) + if (targets[j].id != -1 && targets[j].errorcode == SRT_SUCCESS) { - m_group_nodes[i].socket = targets[i].id; + m_group_nodes[j].socket = targets[j].id; } } @@ -1159,9 +1159,9 @@ void SrtCommon::OpenGroupClient() } m_group_data.resize(size); - for (size_t i = 0; i < m_group_nodes.size(); ++i) + for (size_t j = 0; j < m_group_nodes.size(); ++j) { - SRTSOCKET insock = m_group_nodes[i].socket; + SRTSOCKET insock = m_group_nodes[j].socket; if (insock == -1) { Verb() << "TARGET '" << sockaddr_any(targets[i].peeraddr).str() << "' connection failed.";