Replace Warning string concatenation by WarningFmt
This commit is contained in:
parent
ad5336eff7
commit
67904abd29
|
|
@ -40,7 +40,7 @@ namespace Nz
|
|||
typeMask <<= 1;
|
||||
}
|
||||
|
||||
NazaraErrorFmt("failed to find a memory type suitable for typeBits: {0} and properties: 0x{1}", typeBits, NumberToString(properties, 16));
|
||||
NazaraErrorFmt("failed to find a memory type suitable for typeBits: {0} and properties: {1:#x}", typeBits, properties);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ aiReturn StreamSeek(aiFile* file, size_t offset, aiOrigin origin)
|
|||
break;
|
||||
}
|
||||
|
||||
NazaraWarning("Unhandled aiOrigin enum (value: 0x" + std::string(origin, 16) + ')');
|
||||
NazaraWarningFmt("Unhandled aiOrigin enum (value: {0:#x})", Nz::UnderlyingCast(origin));
|
||||
return aiReturn_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -719,7 +719,7 @@ std::shared_ptr<Nz::SubMesh> ProcessSubMesh(const std::filesystem::path& originP
|
|||
break;
|
||||
|
||||
default:
|
||||
NazaraWarning("Assimp texture map mode 0x" + Nz::NumberToString(mapMode[0], 16) + " not handled");
|
||||
NazaraWarningFmt("Assimp texture map mode {0:#x} not handled", Nz::UnderlyingCast(mapMode[0]));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -588,7 +588,7 @@ namespace Nz
|
|||
if (matIndex >= matCount)
|
||||
{
|
||||
data.subMesh->SetMaterialIndex(0); // To prevent a crash
|
||||
NazaraWarning("SubMesh " + PointerToString(data.subMesh.get()) + " material index is over mesh new material count (" + NumberToString(matIndex) + " >= " + NumberToString(matCount) + "), setting it to first material");
|
||||
NazaraWarningFmt("SubMesh {0} material index is over mesh new material count ({1} >= {2}), setting it to first material", fmt::ptr(data.subMesh.get()), matIndex, matCount);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ namespace Nz
|
|||
m_components.reserve(components.size());
|
||||
for (const ComponentEntry& entry : components)
|
||||
{
|
||||
NazaraAssert(IsTypeSupported(entry.type), "Component type 0x" + NumberToString(UnderlyingCast(entry.type), 16) + " is not supported by vertex declarations");
|
||||
NazaraAssert(entry.componentIndex == 0 || entry.component == VertexComponent::Userdata, "Only userdata components can have non-zero component indexes");
|
||||
NazaraAssertFmt(IsTypeSupported(entry.type), "Component type {0:#x} is not supported by vertex declarations", UnderlyingCast(entry.type));
|
||||
NazaraAssert(entry.componentIndex == 0 || entry.component == VertexComponent::Userdata, "only userdata components can have non-zero component indexes");
|
||||
|
||||
if (entry.component != VertexComponent::Unused)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ namespace Nz
|
|||
{
|
||||
assert(m_atlases.find(atlas) != m_atlases.end());
|
||||
|
||||
NazaraWarning("TextSprite " + PointerToString(this) + " has been cleared because atlas " + PointerToString(atlas) + " has been invalidated (cleared or released)");
|
||||
NazaraWarningFmt("TextSprite {0} has been cleared because atlas {1} has been invalidated (cleared or released)", fmt::ptr(this), fmt::ptr(atlas));
|
||||
Clear();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,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 " + NumberToString(errno) + ": " + Error::GetLastSystemError() + ')');
|
||||
NazaraWarningFmt("an error occured while removing socket from epoll structure (errno {0}: {1})", errno, Error::GetLastSystemError());
|
||||
}
|
||||
|
||||
unsigned int SocketPollerImpl::Wait(int msTimeout, SocketError* error)
|
||||
|
|
@ -116,7 +116,8 @@ namespace Nz
|
|||
}
|
||||
else
|
||||
{
|
||||
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) + ')');
|
||||
// static_cast is required because the field are packed and cannot be taken by reference
|
||||
NazaraWarningFmt("Descriptor {0} was returned by epoll without EPOLLIN nor EPOLLOUT flags (events: {1:#x}", static_cast<int>(m_events[i].data.fd), static_cast<unsigned int>(m_events[i].events));
|
||||
activeSockets--;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ namespace Nz
|
|||
return ResolveError::TemporaryFailure;
|
||||
}
|
||||
|
||||
NazaraWarning("Unhandled EAI error: " + Error::GetLastSystemError(error) + " (" + NumberToString(error) + ") as " + gai_strerror(error));
|
||||
NazaraWarningFmt("unhandled EAI error: {0} ({1}) as {2}", Error::GetLastSystemError(error), error, gai_strerror(error));
|
||||
return ResolveError::Unknown;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ namespace Nz
|
|||
NazaraAssert(handle != InvalidHandle, "Invalid handle");
|
||||
|
||||
if (close(handle) == -1)
|
||||
NazaraWarning("Failed to close socket: " + Error::GetLastSystemError(errno));
|
||||
NazaraWarningFmt("failed to close socket: {0}", Error::GetLastSystemError(errno));
|
||||
}
|
||||
|
||||
void SocketImpl::ClearErrorCode(SocketHandle handle)
|
||||
|
|
@ -101,7 +101,7 @@ namespace Nz
|
|||
|
||||
SocketError error;
|
||||
if (GetLastError(handle, &error) != SocketError::NoError)
|
||||
NazaraWarning(std::string("Failed to clear socket error code: ") + ErrorToString(error));
|
||||
NazaraWarningFmt("failed to clear socket error code: {0}", ErrorToString(error));
|
||||
}
|
||||
|
||||
SocketState SocketImpl::Connect(SocketHandle handle, const IpAddress& address, SocketError* error)
|
||||
|
|
@ -431,7 +431,7 @@ namespace Nz
|
|||
return SocketState::Connected;
|
||||
else
|
||||
{
|
||||
NazaraWarning("Socket " + std::to_string(handle) + " was returned by poll without POLLOUT nor error events (events: 0x" + NumberToString(descriptor.revents, 16) + ')');
|
||||
NazaraWarningFmt("socket {0} was returned by poll without POLLOUT nor error events (events: {1:#x})", handle, descriptor.revents);
|
||||
return SocketState::NotConnected;
|
||||
}
|
||||
}
|
||||
|
|
@ -964,7 +964,7 @@ namespace Nz
|
|||
case EALREADY:
|
||||
case EISCONN:
|
||||
case EWOULDBLOCK:
|
||||
NazaraWarning("Internal error occurred: " + Error::GetLastSystemError(error) + " (" + NumberToString(error)+')');
|
||||
NazaraWarningFmt("internal error occurred: {0} ({1})", Error::GetLastSystemError(error), error);
|
||||
return SocketError::Internal;
|
||||
|
||||
case EADDRNOTAVAIL:
|
||||
|
|
@ -1010,7 +1010,7 @@ namespace Nz
|
|||
return SocketError::TimedOut;
|
||||
}
|
||||
|
||||
NazaraWarning("Unhandled POSIX error: " + Error::GetLastSystemError(error) + " (" + NumberToString(error) + ')');
|
||||
NazaraWarningFmt("unhandled POSIX error: {0} ({1})", Error::GetLastSystemError(error), error);
|
||||
return SocketError::Unknown;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ namespace Nz
|
|||
}
|
||||
else
|
||||
{
|
||||
NazaraWarning("Socket " + NumberToString(entry.fd) + " was returned by poll without POLLRDNORM nor POLLWRNORM events (events: 0x" + NumberToString(entry.revents, 16) + ')');
|
||||
NazaraWarningFmt("Socket {0} was returned by poll without POLLRDNORM nor POLLWRNORM events (events: {1:#x})", entry.fd, entry.revents);
|
||||
activeSockets--;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -187,14 +187,14 @@ namespace Nz
|
|||
if (!NetPacket::DecodeHeader(packet->GetConstData(), &packetSize, &netCode))
|
||||
{
|
||||
m_lastError = SocketError::Packet;
|
||||
NazaraWarning("Invalid header data");
|
||||
NazaraWarning("invalid header data");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (packetSize != received)
|
||||
{
|
||||
m_lastError = SocketError::Packet;
|
||||
NazaraWarning("Invalid packet size (packet size is " + NumberToString(packetSize) + " bytes, received " + NumberToString(received) + " bytes)");
|
||||
NazaraWarningFmt("Invalid packet size (packet size is {0} bytes, received {1} bytes)", packetSize, received);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ namespace Nz
|
|||
}
|
||||
|
||||
default:
|
||||
NazaraInternalError("Unhandled ip protocol (0x" + NumberToString(UnderlyingCast(ipAddress.GetProtocol())) + ')');
|
||||
NazaraInternalErrorFmt("unhandled ip protocol ({0:#x})", UnderlyingCast(ipAddress.GetProtocol()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -347,7 +347,7 @@ namespace Nz
|
|||
return ResolveError::TemporaryFailure;
|
||||
}
|
||||
|
||||
NazaraWarning("Unhandled WinSock error: " + Error::GetLastSystemError(error) + " (" + NumberToString(error) + ')');
|
||||
NazaraWarningFmt("unhandled WinSock error: {0} ({1})", Error::GetLastSystemError(error), error);
|
||||
return ResolveError::Unknown;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,10 @@ namespace Nz
|
|||
NazaraAssert(handle != InvalidHandle, "Invalid handle");
|
||||
|
||||
if (closesocket(handle) == SOCKET_ERROR)
|
||||
NazaraWarning("Failed to close socket: " + Error::GetLastSystemError(WSAGetLastError()));
|
||||
{
|
||||
int lastError = WSAGetLastError();
|
||||
NazaraWarningFmt("failed to close socket: {0} ({1})", Error::GetLastSystemError(lastError), lastError);
|
||||
}
|
||||
}
|
||||
|
||||
void SocketImpl::ClearErrorCode(SocketHandle handle)
|
||||
|
|
@ -110,7 +113,10 @@ namespace Nz
|
|||
NazaraAssert(handle != InvalidHandle, "Invalid handle");
|
||||
|
||||
if (GetLastError(handle, nullptr) == SocketError::Internal)
|
||||
NazaraWarning("Failed to clear socket error code: " + Error::GetLastSystemError(WSAGetLastError()));
|
||||
{
|
||||
int lastError = WSAGetLastError();
|
||||
NazaraWarningFmt("failed to clear socket error code: {0} ({1})", Error::GetLastSystemError(lastError), lastError);
|
||||
}
|
||||
}
|
||||
|
||||
SocketState SocketImpl::Connect(SocketHandle handle, const IpAddress& address, SocketError* error)
|
||||
|
|
@ -164,7 +170,7 @@ namespace Nz
|
|||
return false;
|
||||
}
|
||||
|
||||
NazaraDebug("Initialized Windows Socket " + NumberToString(LOBYTE(s_WSA.wVersion)) + '.' + NumberToString(HIBYTE(s_WSA.wVersion)) + " (" + std::string(s_WSA.szDescription) + ')');
|
||||
NazaraDebug("Initialized Windows Socket {0}.{1} ({2})", LOBYTE(s_WSA.wVersion), HIBYTE(s_WSA.wVersion), s_WSA.szDescription);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ namespace Nz
|
|||
}
|
||||
else
|
||||
{
|
||||
NazaraWarning("Socket " + NumberToString(entry.fd) + " was returned by WSAPoll without POLLRDNORM nor POLLWRNORM events (events: 0x" + NumberToString(entry.revents, 16) + ')');
|
||||
NazaraWarningFmt("Socket {0} was returned by WSAPoll without POLLRDNORM nor POLLWRNORM events (events: {1:#x})", entry.fd, entry.revents);
|
||||
activeSockets--;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ namespace Nz
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraWarning(std::string("Failed to load WGL: ") + e.what());
|
||||
NazaraWarningFmt("failed to load WGL: {0}", e.what());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ namespace Nz
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraWarning(std::string("Failed to load EGL: ") + e.what());
|
||||
NazaraWarningFmt("failed to load EGL: {0}", e.what());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ namespace Nz
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraWarning(std::string("Failed to load WebGL: ") + e.what());
|
||||
NazaraWarningFmt("failed to load WebGL: {0}", e.what());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/OpenGLRenderer/Utils.hpp>
|
||||
#include <NazaraUtils/Algorithm.hpp>
|
||||
#include <Nazara/Core/Format.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
|
@ -31,6 +33,6 @@ namespace Nz
|
|||
case GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS: return "GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS: a framebuffer attachment is layered and a populated attachment is not (or color attachements are not from textures of the same target)";
|
||||
}
|
||||
|
||||
return "Unknown OpenGL error (0x" + NumberToString(code, 16) + ')';
|
||||
return Format("unknown OpenGL error ({0:#x})", code);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ namespace Nz::GL
|
|||
while (sampleCount > 1);
|
||||
|
||||
if (int(m_params.sampleCount) != sampleCount)
|
||||
NazaraWarning("couldn't find a pixel format matching " + std::to_string(m_params.sampleCount) + " sample count, using " + std::to_string(sampleCount) + " sample(s) instead");
|
||||
NazaraWarningFmt("couldn't find a pixel format matching {0} sample count, using {1} sample(s) instead", m_params.sampleCount, sampleCount);
|
||||
|
||||
m_params.sampleCount = sampleCount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -527,7 +527,7 @@ namespace Nz
|
|||
glyph.valid = true;
|
||||
}
|
||||
else
|
||||
NazaraWarning("Failed to extract glyph \"" + FromUtf32String(std::u32string_view(&character, 1)) + "\"");
|
||||
NazaraWarningFmt("failed to extract glyph \"{0}\"", FromUtf32String(std::u32string_view(&character, 1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,8 +2,10 @@
|
|||
// This file is part of the "Nazara Engine - Vulkan renderer"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <Nazara/VulkanRenderer/Utils.hpp>
|
||||
#include <Nazara/Core/Format.hpp>
|
||||
#include <NazaraUtils/Algorithm.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <Nazara/VulkanRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
|
@ -98,6 +100,6 @@ namespace Nz
|
|||
break;
|
||||
}
|
||||
|
||||
return "Unknown Vulkan error (0x" + NumberToString(code, 16) + ')';
|
||||
return Format("unknown Vulkan error ({0:#x})", UnderlyingCast(code));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ namespace Nz
|
|||
{
|
||||
PixelFormatContent formatContent = PixelFormatInfo::GetContent(format);
|
||||
if (formatContent != PixelFormatContent::DepthStencil && formatContent != PixelFormatContent::Stencil)
|
||||
NazaraWarning("Invalid format " + std::string(PixelFormatInfo::GetName(format)) + " for depth-stencil attachment");
|
||||
NazaraWarningFmt("invalid format {0} for depth-stencil attachment", PixelFormatInfo::GetName(format));
|
||||
|
||||
m_depthStencilFormat = ToVulkan(format);
|
||||
if (m_depthStencilFormat == VK_FORMAT_UNDEFINED)
|
||||
|
|
|
|||
Loading…
Reference in New Issue