Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests] Fix warnings when compiling with g++ 11.4.0 on ubuntu 24.04 #2992

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/recvlive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions examples/sendmsg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion test/test_reuseaddr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
6 changes: 3 additions & 3 deletions testing/srt-test-relay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<TargetMedium> m { new TargetMedium };
m->Setup(m_srt_relay.get());
m_output_media.push_back(move(m));
unique_ptr<TargetMedium> med { new TargetMedium };
med->Setup(m_srt_relay.get());
m_output_media.push_back(move(med));
}
else
{
Expand Down
10 changes: 5 additions & 5 deletions testing/testmedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand All @@ -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.";
Expand Down
Loading