From e98bab8a75c563b2e4790c1e8f37a4bd2d4c9b42 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 18:39:00 -0700 Subject: [PATCH] fixing format strings Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/LogFile.cpp | 4 ++-- Code/Editor/Util/GuidUtil.h | 4 ++-- .../Platform/Common/WinAPI/AzCore/Debug/Trace_WinAPI.cpp | 2 +- .../Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp | 2 +- Code/Framework/GridMate/Tests/Carrier.cpp | 2 +- Code/Legacy/CrySystem/DebugCallStack.cpp | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Code/Editor/LogFile.cpp b/Code/Editor/LogFile.cpp index 5978356781..0a375882f6 100644 --- a/Code/Editor/LogFile.cpp +++ b/Code/Editor/LogFile.cpp @@ -288,7 +288,7 @@ AZ_POP_DISABLE_WARNING str += "Version Unknown"; } } - azsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, " %d.%d", OSVerInfo.dwMajorVersion, OSVerInfo.dwMinorVersion); + azsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, " %ld.%ld", OSVerInfo.dwMajorVersion, OSVerInfo.dwMinorVersion); str += szBuffer; ////////////////////////////////////////////////////////////////////// @@ -338,7 +338,7 @@ AZ_POP_DISABLE_WARNING str += " "; azstrdate(szBuffer); str += szBuffer; - azsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, ", system running for %d minutes", GetTickCount() / 60000); + azsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, ", system running for %ld minutes", GetTickCount() / 60000); str += szBuffer; CryLog("%s", str.toUtf8().data()); #else diff --git a/Code/Editor/Util/GuidUtil.h b/Code/Editor/Util/GuidUtil.h index 9952d6b4ed..c53589b6ca 100644 --- a/Code/Editor/Util/GuidUtil.h +++ b/Code/Editor/Util/GuidUtil.h @@ -48,7 +48,7 @@ inline bool GuidUtil::IsEmpty(REFGUID guid) inline const char* GuidUtil::ToString(REFGUID guid) { static char guidString[64]; - sprintf_s(guidString, "{%.8X-%.4X-%.4X-%.2X%.2X-%.2X%.2X%.2X%.2X%.2X%.2X}", guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], + sprintf_s(guidString, "{%.8lX-%.4X-%.4X-%.2X%.2X-%.2X%.2X%.2X%.2X%.2X%.2X}", guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]); return guidString; } @@ -62,7 +62,7 @@ inline GUID GuidUtil::FromString(const char* guidString) guid.Data1 = 0; guid.Data2 = 0; guid.Data3 = 0; - azsscanf(guidString, "{%8" SCNx32 "-%4hX-%4hX-%2X%2X-%2X%2X%2X%2X%2X%2X}", + azsscanf(guidString, "{%8lX-%4hX-%4hX-%2X%2X-%2X%2X%2X%2X%2X%2X}", &guid.Data1, &guid.Data2, &guid.Data3, &d[0], &d[1], &d[2], &d[3], &d[4], &d[5], &d[6], &d[7]); guid.Data4[0] = static_cast(d[0]); guid.Data4[1] = static_cast(d[1]); diff --git a/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/Debug/Trace_WinAPI.cpp b/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/Debug/Trace_WinAPI.cpp index 99ea10e4bc..02c1988215 100644 --- a/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/Debug/Trace_WinAPI.cpp +++ b/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/Debug/Trace_WinAPI.cpp @@ -145,7 +145,7 @@ namespace AZ char message[g_maxMessageLength]; Debug::Trace::Instance().Output(nullptr, "==================================================================\n"); - azsnprintf(message, g_maxMessageLength, "Exception : 0x%X - '%s' [%p]\n", ExceptionInfo->ExceptionRecord->ExceptionCode, GetExeptionName(ExceptionInfo->ExceptionRecord->ExceptionCode), ExceptionInfo->ExceptionRecord->ExceptionAddress); + azsnprintf(message, g_maxMessageLength, "Exception : 0x%lX - '%s' [%p]\n", ExceptionInfo->ExceptionRecord->ExceptionCode, GetExeptionName(ExceptionInfo->ExceptionRecord->ExceptionCode), ExceptionInfo->ExceptionRecord->ExceptionAddress); Debug::Trace::Instance().Output(nullptr, message); EBUS_EVENT(Debug::TraceMessageDrillerBus, OnException, message); diff --git a/Code/Framework/AzCore/Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp b/Code/Framework/AzCore/Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp index c4a12730ad..4558a6a3aa 100644 --- a/Code/Framework/AzCore/Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp +++ b/Code/Framework/AzCore/Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp @@ -478,7 +478,7 @@ namespace AZ { DWORD displacement; if (g_SymGetLineFromAddr64(g_currentProcess, pc, &displacement, &line) && line.FileName[0] != 0) { - azsnprintf(textLine, textLineSize, "%s (%d) : ", line.FileName, line.LineNumber); + azsnprintf(textLine, textLineSize, "%s (%ld) : ", line.FileName, line.LineNumber); } else { diff --git a/Code/Framework/GridMate/Tests/Carrier.cpp b/Code/Framework/GridMate/Tests/Carrier.cpp index 8d3ec4eef6..9a18eb9a2c 100644 --- a/Code/Framework/GridMate/Tests/Carrier.cpp +++ b/Code/Framework/GridMate/Tests/Carrier.cpp @@ -1707,7 +1707,7 @@ TEST_F(GridMateCarrierTestFixture, Test_GetSocketErrorString) static constexpr char posixErrorWouldBlockPosixErrStr[] = "Resource temporarily unavailable"; azsnprintf(expectedBuffer.data(), expectedBuffer.size()-1 , "%s", posixErrorWouldBlockPosixErrStr); #else - azsnprintf(expectedBuffer.data(), expectedBuffer.size()-1 , "%d", AZ_EWOULDBLOCK); + azsnprintf(expectedBuffer.data(), expectedBuffer.size()-1 , "%ld", AZ_EWOULDBLOCK); #endif // !AZ_TRAIT_USE_POSIX_STRERROR_R EXPECT_STREQ(expectedBuffer.data(), socketErrorString); EXPECT_STREQ(expectedBuffer.data(), buffer.data()); diff --git a/Code/Legacy/CrySystem/DebugCallStack.cpp b/Code/Legacy/CrySystem/DebugCallStack.cpp index cdfc5de21e..bea6c8c035 100644 --- a/Code/Legacy/CrySystem/DebugCallStack.cpp +++ b/Code/Legacy/CrySystem/DebugCallStack.cpp @@ -284,7 +284,7 @@ int DebugCallStack::handleException(EXCEPTION_POINTERS* exception_pointer) char excAddr[80]; WriteLineToLog(""); sprintf_s(excAddr, "0x%04X:0x%p", exception_pointer->ContextRecord->SegCs, exception_pointer->ExceptionRecord->ExceptionAddress); - sprintf_s(excCode, "0x%08X", exception_pointer->ExceptionRecord->ExceptionCode); + sprintf_s(excCode, "0x%08lX", exception_pointer->ExceptionRecord->ExceptionCode); WriteLineToLog("Exception: %s, at Address: %s", excCode, excAddr); } @@ -445,7 +445,7 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex) else { sprintf_s(excAddr, "0x%04X:0x%p", pex->ContextRecord->SegCs, pex->ExceptionRecord->ExceptionAddress); - sprintf_s(excCode, "0x%08X", pex->ExceptionRecord->ExceptionCode); + sprintf_s(excCode, "0x%08lX", pex->ExceptionRecord->ExceptionCode); excName = TranslateExceptionCode(pex->ExceptionRecord->ExceptionCode); azstrcpy(desc, AZ_ARRAY_SIZE(desc), ""); sprintf_s(excDesc, "%s\r\n%s", excName, desc);