From 332983c97b7a729c4dc5f19aa9ee4a22c420f7d8 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Tue, 27 Jun 2023 20:23:44 +1000 Subject: The Formatting String Catastrophe --- source/game/StarNetPacketSocket.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source/game/StarNetPacketSocket.cpp') diff --git a/source/game/StarNetPacketSocket.cpp b/source/game/StarNetPacketSocket.cpp index 392f2d9..f6ebce0 100644 --- a/source/game/StarNetPacketSocket.cpp +++ b/source/game/StarNetPacketSocket.cpp @@ -194,7 +194,7 @@ List TcpPacketSocket::receivePackets() { } if (packetSize > PacketSizeLimit) - throw IOException::format("Packet size %s exceeds maximum allowed packet size!", packetSize); + throw IOException::format("Packet size {} exceeds maximum allowed packet size!", packetSize); if (packetSize > ds.size() - ds.pos()) break; @@ -215,7 +215,7 @@ List TcpPacketSocket::receivePackets() { m_inputBuffer = ds.readBytes(ds.size() - ds.pos()); } } catch (IOException const& e) { - Logger::warn("I/O error in TcpPacketSocket::readPackets, closing: %s", outputException(e, false)); + Logger::warn("I/O error in TcpPacketSocket::readPackets, closing: {}", outputException(e, false)); m_inputBuffer.clear(); m_socket->shutdown(); } @@ -243,9 +243,9 @@ bool TcpPacketSocket::writeData() { m_outputBuffer.trimLeft(writtenAmount); } } catch (SocketClosedException const& e) { - Logger::debug("TcpPacketSocket socket closed: %s", outputException(e, false)); + Logger::debug("TcpPacketSocket socket closed: {}", outputException(e, false)); } catch (IOException const& e) { - Logger::warn("I/O error in TcpPacketSocket::sendData: %s", outputException(e, false)); + Logger::warn("I/O error in TcpPacketSocket::sendData: {}", outputException(e, false)); m_socket->shutdown(); } return dataSent; @@ -263,9 +263,9 @@ bool TcpPacketSocket::readData() { m_inputBuffer.append(readBuffer, readAmount); } } catch (SocketClosedException const& e) { - Logger::debug("TcpPacketSocket socket closed: %s", outputException(e, false)); + Logger::debug("TcpPacketSocket socket closed: {}", outputException(e, false)); } catch (IOException const& e) { - Logger::warn("I/O error in TcpPacketSocket::receiveData: %s", outputException(e, false)); + Logger::warn("I/O error in TcpPacketSocket::receiveData: {}", outputException(e, false)); m_socket->shutdown(); } return dataReceived; @@ -352,7 +352,7 @@ List P2PPacketSocket::receivePackets() { } while (!packetStream.atEnd()); } } catch (IOException const& e) { - Logger::warn("I/O error in P2PPacketSocket::readPackets, closing: %s", outputException(e, false)); + Logger::warn("I/O error in P2PPacketSocket::readPackets, closing: {}", outputException(e, false)); m_socket.reset(); } return packets; -- cgit v1.2.3