removed .str().c_str() (#1090)

This commit is contained in:
maliakal_d 2025-02-11 09:14:56 +01:00 committed by GitHub
parent 6e826d2840
commit c43a4030a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -149,12 +149,12 @@ void Listener::CreateUDPSocket(int &actualSize) {
packetSize = generalData->vetoPacketSize; packetSize = generalData->vetoPacketSize;
} }
std::string ip = std::string ip;
(eth.length() ? InterfaceNameToIp(eth).str().c_str() : ""); if (eth.length() > 0)
ip = InterfaceNameToIp(eth).str();
udpSocket = nullptr; udpSocket = nullptr;
udpSocket = make_unique<UdpRxSocket>( udpSocket = make_unique<UdpRxSocket>(
udpPortNumber, packetSize, (ip.length() ? ip.c_str() : nullptr), udpPortNumber, packetSize, (ip.empty() ? nullptr : ip.c_str()),
generalData->udpSocketBufferSize); generalData->udpSocketBufferSize);
LOG(logINFO) << index << ": UDP port opened at port " << udpPortNumber LOG(logINFO) << index << ": UDP port opened at port " << udpPortNumber
<< " (" << (ip.length() ? ip : "any") << ')'; << " (" << (ip.length() ? ip : "any") << ')';
@ -213,9 +213,12 @@ void Listener::CreateDummySocketForUDPSocketBufferSize(int s, int &actualSize) {
try { try {
// to allowe ports to be bound from udpsocket // to allowe ports to be bound from udpsocket
udpSocket.reset(); udpSocket.reset();
UdpRxSocket g(
udpPortNumber, packetSize, std::string ip;
(eth.length() ? InterfaceNameToIp(eth).str().c_str() : nullptr), if (eth.length() > 0)
ip = InterfaceNameToIp(eth).str();
UdpRxSocket g(udpPortNumber, packetSize,
(ip.empty() ? nullptr : ip.c_str()),
generalData->udpSocketBufferSize); generalData->udpSocketBufferSize);
// doubled due to kernel bookkeeping (could also be less due to // doubled due to kernel bookkeeping (could also be less due to