Remove Nz::String and Nz::StringStream
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <Nazara/Network/AbstractSocket.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <Nazara/Network/Algorithm.hpp>
|
||||
|
||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
||||
@@ -177,7 +178,7 @@ namespace Nz
|
||||
{
|
||||
SocketError errorCode;
|
||||
if (!SocketImpl::SetBlocking(m_handle, m_isBlockingEnabled, &errorCode))
|
||||
NazaraWarning("Failed to set socket blocking mode (0x" + String::Number(errorCode, 16) + ')');
|
||||
NazaraWarning("Failed to set socket blocking mode (0x" + NumberToString(errorCode, 16) + ')');
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -199,7 +200,7 @@ namespace Nz
|
||||
{
|
||||
SocketImpl::Close(handle);
|
||||
|
||||
NazaraError("Failed to open a dual-stack socket: " + Nz::String(ErrorToString(m_lastError)));
|
||||
NazaraError("Failed to open a dual-stack socket: " + std::string(ErrorToString(m_lastError)));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace Nz
|
||||
|
||||
if (peerCount > ENetConstants::ENetProtocol_MaximumPeerId)
|
||||
{
|
||||
NazaraError("Peer count exceeds maximum peer count supported by protocol (" + String::Number(ENetConstants::ENetProtocol_MaximumPeerId) + ")");
|
||||
NazaraError("Peer count exceeds maximum peer count supported by protocol (" + NumberToString(ENetConstants::ENetProtocol_MaximumPeerId) + ")");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <Nazara/Network/IpAddress.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <Nazara/Network/Algorithm.hpp>
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
@@ -88,7 +89,7 @@ namespace Nz
|
||||
return m_ipv6 == LoopbackIpV6.m_ipv6; // Only compare the ip value
|
||||
}
|
||||
|
||||
NazaraInternalError("Invalid protocol for IpAddress (0x" + String::Number(m_protocol) + ')');
|
||||
NazaraInternalError("Invalid protocol for IpAddress (0x" + NumberToString(m_protocol) + ')');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -164,7 +165,7 @@ namespace Nz
|
||||
else if (i != 0)
|
||||
stream << ':';
|
||||
|
||||
stream << String::Number(m_ipv6[i], 16).ToLower();
|
||||
stream << ToLower(NumberToString(m_ipv6[i], 16));
|
||||
}
|
||||
|
||||
if (m_port != 0)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <Nazara/Network/Linux/SocketPollerImpl.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <Nazara/Network/Posix/SocketImpl.hpp>
|
||||
#include <cstring>
|
||||
#include <unistd.h>
|
||||
@@ -60,7 +61,7 @@ namespace Nz
|
||||
|
||||
if (epoll_ctl(m_handle, EPOLL_CTL_ADD, socket, &entry) != 0)
|
||||
{
|
||||
NazaraError("Failed to add socket to epoll structure (errno " + String::Number(errno) + ": " + Error::GetLastSystemError() + ')');
|
||||
NazaraError("Failed to add socket to epoll structure (errno " + NumberToString(errno) + ": " + Error::GetLastSystemError() + ')');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -78,7 +79,7 @@ namespace Nz
|
||||
m_sockets.erase(socket);
|
||||
|
||||
if (epoll_ctl(m_handle, EPOLL_CTL_DEL, socket, nullptr) != 0)
|
||||
NazaraWarning("An error occured while removing socket from epoll structure (errno " + String::Number(errno) + ": " + Error::GetLastSystemError() + ')');
|
||||
NazaraWarning("An error occured while removing socket from epoll structure (errno " + NumberToString(errno) + ": " + Error::GetLastSystemError() + ')');
|
||||
}
|
||||
|
||||
unsigned int SocketPollerImpl::Wait(int msTimeout, SocketError* error)
|
||||
@@ -115,7 +116,7 @@ namespace Nz
|
||||
}
|
||||
else
|
||||
{
|
||||
NazaraWarning("Descriptor " + String::Number(m_events[i].data.fd) + " was returned by epoll without EPOLLIN nor EPOLLOUT flags (events: 0x" + String::Number(m_events[i].events, 16) + ')');
|
||||
NazaraWarning("Descriptor " + NumberToString(m_events[i].data.fd) + " was returned by epoll without EPOLLIN nor EPOLLOUT flags (events: 0x" + NumberToString(m_events[i].events, 16) + ')');
|
||||
activeSockets--;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <Nazara/Network/Posix/IpAddressImpl.hpp>
|
||||
#include <Nazara/Core/CallOnExit.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <Nazara/Network/Posix/SocketImpl.hpp>
|
||||
#include <cstring>
|
||||
#include <Nazara/Network/Debug.hpp>
|
||||
@@ -216,7 +217,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
default:
|
||||
NazaraInternalError("Unhandled ip protocol (0x" + String::Number(ipAddress.GetProtocol()) + ')');
|
||||
NazaraInternalError("Unhandled ip protocol (0x" + NumberToString(ipAddress.GetProtocol(), 16) + ')');
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -292,7 +293,7 @@ namespace Nz
|
||||
return ResolveError_TemporaryFailure;
|
||||
}
|
||||
|
||||
NazaraWarning("Unhandled EAI error: " + Error::GetLastSystemError(error) + " (" + String::Number(error) + ") as " + gai_strerror(error));
|
||||
NazaraWarning("Unhandled EAI error: " + Error::GetLastSystemError(error) + " (" + NumberToString(error) + ") as " + gai_strerror(error));
|
||||
return ResolveError_Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <Nazara/Network/Posix/SocketImpl.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/StackArray.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <Nazara/Network/NetBuffer.hpp>
|
||||
#include <Nazara/Network/Posix/IpAddressImpl.hpp>
|
||||
#include <netinet/tcp.h>
|
||||
@@ -955,7 +956,7 @@ namespace Nz
|
||||
case EALREADY:
|
||||
case EISCONN:
|
||||
case EWOULDBLOCK:
|
||||
NazaraWarning("Internal error occurred: " + Error::GetLastSystemError(error) + " (" + String::Number(error) + ')');
|
||||
NazaraWarning("Internal error occurred: " + Error::GetLastSystemError(error) + " (" + NumberToString(error)+')');
|
||||
return SocketError_Internal;
|
||||
|
||||
case EADDRNOTAVAIL:
|
||||
@@ -1001,7 +1002,7 @@ namespace Nz
|
||||
return SocketError_TimedOut;
|
||||
}
|
||||
|
||||
NazaraWarning("Unhandled POSIX error: " + Error::GetLastSystemError(error) + " (" + String::Number(error) + ')');
|
||||
NazaraWarning("Unhandled POSIX error: " + Error::GetLastSystemError(error) + " (" + NumberToString(error) + ')');
|
||||
return SocketError_Unknown;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Network/Posix/SocketPollerImpl.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <poll.h>
|
||||
#include <Nazara/Network/Debug.hpp>
|
||||
|
||||
@@ -103,7 +104,7 @@ namespace Nz
|
||||
}
|
||||
else
|
||||
{
|
||||
NazaraWarning("Socket " + String::Number(entry.fd) + " was returned by poll without POLLRDNORM nor POLLWRNORM events (events: 0x" + String::Number(entry.revents, 16) + ')');
|
||||
NazaraWarning("Socket " + NumberToString(entry.fd) + " was returned by poll without POLLRDNORM nor POLLWRNORM events (events: 0x" + NumberToString(entry.revents, 16) + ')');
|
||||
activeSockets--;
|
||||
}
|
||||
|
||||
|
||||
@@ -421,7 +421,7 @@ namespace Nz
|
||||
|
||||
void RUdpConnection::OnPacketLost(PeerData& peer, PendingAckPacket&& packet)
|
||||
{
|
||||
//NazaraNotice(m_socket.GetBoundAddress().ToString() + ": Lost packet " + String::Number(packet.sequenceId));
|
||||
//NazaraNotice(m_socket.GetBoundAddress().ToString() + ": Lost packet " + NumberToString(packet.sequenceId));
|
||||
|
||||
if (IsReliable(packet.reliability))
|
||||
EnqueuePacketInternal(peer, packet.priority, packet.reliability, std::move(packet.data));
|
||||
@@ -465,7 +465,7 @@ namespace Nz
|
||||
UInt64 token;
|
||||
packet >> token;
|
||||
|
||||
NazaraNotice(m_socket.GetBoundAddress().ToString() + ": Received NetCode_RequestConnection from " + peerIp.ToString() + ": " + String::Number(token));
|
||||
NazaraNotice(m_socket.GetBoundAddress().ToString() + ": Received NetCode_RequestConnection from " + peerIp.ToString() + ": " + NumberToString(token));
|
||||
if (!m_shouldAcceptConnections)
|
||||
return; //< Ignore
|
||||
|
||||
@@ -487,7 +487,7 @@ namespace Nz
|
||||
|
||||
if (m_isSimulationEnabled && m_packetLossProbability(s_randomGenerator))
|
||||
{
|
||||
NazaraNotice(m_socket.GetBoundAddress().ToString() + ": Lost packet " + String::Number(sequenceId) + " from " + peerIp.ToString() + " for simulation purpose");
|
||||
NazaraNotice(m_socket.GetBoundAddress().ToString() + ": Lost packet " + NumberToString(sequenceId) + " from " + peerIp.ToString() + " for simulation purpose");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -519,7 +519,7 @@ namespace Nz
|
||||
UInt64 token;
|
||||
packet /*>> externalAddress*/ >> token;
|
||||
|
||||
NazaraNotice(m_socket.GetBoundAddress().ToString() + ": Received NetCode_AcknowledgeConnection from " + peerIp.ToString() + ": " + String::Number(token));
|
||||
NazaraNotice(m_socket.GetBoundAddress().ToString() + ": Received NetCode_AcknowledgeConnection from " + peerIp.ToString() + ": " + NumberToString(token));
|
||||
if (token == ~peer.stateData1)
|
||||
{
|
||||
peer.state = PeerState_Connected;
|
||||
@@ -527,7 +527,7 @@ namespace Nz
|
||||
}
|
||||
else
|
||||
{
|
||||
NazaraNotice("Received wrong token (" + String::Number(token) + " instead of " + String::Number(~peer.stateData1) + ") from client " + peer.address.ToString());
|
||||
NazaraNotice("Received wrong token (" + NumberToString(token) + " instead of " + NumberToString(~peer.stateData1) + ") from client " + peer.address.ToString());
|
||||
return; //< Ignore
|
||||
}
|
||||
|
||||
@@ -553,7 +553,7 @@ namespace Nz
|
||||
|
||||
default:
|
||||
{
|
||||
NazaraNotice(m_socket.GetBoundAddress().ToString() + ": Received 0x" + String::Number(packet.GetNetCode(), 16) + " from " + peerIp.ToString());
|
||||
NazaraNotice(m_socket.GetBoundAddress().ToString() + ": Received 0x" + NumberToString(packet.GetNetCode(), 16) + " from " + peerIp.ToString());
|
||||
RUdpMessage receivedMessage;
|
||||
receivedMessage.from = peerIp;
|
||||
receivedMessage.data = std::move(packet);
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Network/SocketPoller.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <Nazara/Network/Algorithm.hpp>
|
||||
|
||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
||||
@@ -195,7 +197,7 @@ namespace Nz
|
||||
if (waitError != SocketError_NoError)
|
||||
{
|
||||
if (waitError != SocketError_Interrupted) //< Do not log interrupted error
|
||||
NazaraError("SocketPoller encountered an error (code: 0x" + String::Number(waitError, 16) + "): " + ErrorToString(waitError));
|
||||
NazaraError("SocketPoller encountered an error (code: 0x" + NumberToString(waitError, 16) + "): " + ErrorToString(waitError));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <Nazara/Network/TcpClient.hpp>
|
||||
#include <Nazara/Core/CallOnExit.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <limits>
|
||||
#include <Nazara/Network/NetPacket.hpp>
|
||||
|
||||
@@ -213,7 +214,7 @@ namespace Nz
|
||||
break;
|
||||
}
|
||||
|
||||
NazaraInternalError("Unexpected socket state (0x" + String::Number(m_state, 16) + ')');
|
||||
NazaraInternalError("Unexpected socket state (0x" + NumberToString(m_state, 16) + ')');
|
||||
return m_state;
|
||||
}
|
||||
|
||||
@@ -520,7 +521,7 @@ namespace Nz
|
||||
break;
|
||||
}
|
||||
|
||||
NazaraInternalError("Unhandled socket state (0x" + String::Number(m_state, 16) + ')');
|
||||
NazaraInternalError("Unhandled socket state (0x" + NumberToString(m_state, 16) + ')');
|
||||
return m_state;
|
||||
}
|
||||
|
||||
@@ -557,10 +558,10 @@ namespace Nz
|
||||
SocketError errorCode;
|
||||
|
||||
if (!SocketImpl::SetNoDelay(m_handle, m_isLowDelayEnabled, &errorCode))
|
||||
NazaraWarning("Failed to set socket no delay mode (0x" + String::Number(errorCode, 16) + ')');
|
||||
NazaraWarning("Failed to set socket no delay mode (0x" + NumberToString(errorCode, 16) + ')');
|
||||
|
||||
if (!SocketImpl::SetKeepAlive(m_handle, m_isKeepAliveEnabled, m_keepAliveTime, m_keepAliveInterval, &errorCode))
|
||||
NazaraWarning("Failed to set socket keep alive mode (0x" + String::Number(errorCode, 16) + ')');
|
||||
NazaraWarning("Failed to set socket keep alive mode (0x" + NumberToString(errorCode, 16) + ')');
|
||||
|
||||
m_peerAddress = IpAddress::Invalid;
|
||||
m_openMode = OpenMode_ReadWrite;
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Network/UdpSocket.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <Nazara/Network/NetPacket.hpp>
|
||||
|
||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
||||
@@ -193,7 +195,7 @@ namespace Nz
|
||||
if (packetSize != received)
|
||||
{
|
||||
m_lastError = SocketError_Packet;
|
||||
NazaraWarning("Invalid packet size (packet size is " + String::Number(packetSize) + " bytes, received " + Nz::String::Number(received) + " bytes)");
|
||||
NazaraWarning("Invalid packet size (packet size is " + NumberToString(packetSize) + " bytes, received " + NumberToString(received) + " bytes)");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
default:
|
||||
NazaraInternalError("Unhandled ip protocol (0x" + String::Number(ipAddress.GetProtocol()) + ')');
|
||||
NazaraInternalError("Unhandled ip protocol (0x" + NumberToString(ipAddress.GetProtocol()) + ')');
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -346,7 +346,7 @@ namespace Nz
|
||||
return ResolveError_TemporaryFailure;
|
||||
}
|
||||
|
||||
NazaraWarning("Unhandled WinSock error: " + Error::GetLastSystemError(error) + " (" + String::Number(error) + ')');
|
||||
NazaraWarning("Unhandled WinSock error: " + Error::GetLastSystemError(error) + " (" + NumberToString(error) + ')');
|
||||
return ResolveError_Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/Log.hpp>
|
||||
#include <Nazara/Core/StackArray.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <Nazara/Network/Win32/IpAddressImpl.hpp>
|
||||
|
||||
// Some compilers (older versions of MinGW) lack Mstcpip.h which defines some structs/defines
|
||||
@@ -163,7 +164,7 @@ namespace Nz
|
||||
return false;
|
||||
}
|
||||
|
||||
NazaraDebug("Initialized Windows Socket " + String::Number(LOBYTE(s_WSA.wVersion)) + '.' + String::Number(HIBYTE(s_WSA.wVersion)) + " (" + String(s_WSA.szDescription) + ')');
|
||||
NazaraDebug("Initialized Windows Socket " + NumberToString(LOBYTE(s_WSA.wVersion)) + '.' + NumberToString(HIBYTE(s_WSA.wVersion)) + " (" + std::string(s_WSA.szDescription) + ')');
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -955,7 +956,7 @@ namespace Nz
|
||||
case WSAEALREADY:
|
||||
case WSAEISCONN:
|
||||
case WSAEWOULDBLOCK:
|
||||
NazaraWarning("Internal error occurred: " + Error::GetLastSystemError(error) + " (" + String::Number(error) + ')');
|
||||
NazaraWarning("Internal error occurred: " + Error::GetLastSystemError(error) + " (" + NumberToString(error) + ')');
|
||||
return SocketError_Internal;
|
||||
|
||||
case WSAEADDRNOTAVAIL:
|
||||
@@ -1000,7 +1001,7 @@ namespace Nz
|
||||
return SocketError_TimedOut;
|
||||
}
|
||||
|
||||
NazaraWarning("Unhandled WinSock error: " + Error::GetLastSystemError(error) + " (" + String::Number(error) + ')');
|
||||
NazaraWarning("Unhandled WinSock error: " + Error::GetLastSystemError(error) + " (" + NumberToString(error) + ')');
|
||||
return SocketError_Unknown;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Network/Win32/SocketPollerImpl.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <Nazara/Network/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -89,7 +91,7 @@ namespace Nz
|
||||
fd_set& targetSet = (i == 0) ? m_readSockets : m_writeSockets;
|
||||
if (targetSet.fd_count > FD_SETSIZE)
|
||||
{
|
||||
NazaraError("Socket count exceeding hard-coded FD_SETSIZE (" + String::Number(FD_SETSIZE) + ")");
|
||||
NazaraError("Socket count exceeding hard-coded FD_SETSIZE (" + NumberToString(FD_SETSIZE) + ")");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -157,7 +159,7 @@ namespace Nz
|
||||
}
|
||||
else
|
||||
{
|
||||
NazaraWarning("Socket " + String::Number(entry.fd) + " was returned by WSAPoll without POLLRDNORM nor POLLWRNORM events (events: 0x" + String::Number(entry.revents, 16) + ')');
|
||||
NazaraWarning("Socket " + NumberToString(entry.fd) + " was returned by WSAPoll without POLLRDNORM nor POLLWRNORM events (events: 0x" + NumberToString(entry.revents, 16) + ')');
|
||||
activeSockets--;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user