From 3ecced3ba3ad710b6f86104a648f2c1b6dbb86fa Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@videolabs.io>
Date: Fri, 16 Feb 2024 07:50:03 +0100
Subject: [PATCH 3/3] Define AMFPRI(d|ud|x)64 using the standard C++ format for
 C+11 and up

See https://en.cppreference.com/w/cpp/types/integer

When compiled in C, it depends whether it's the Microsoft flavor or the standard C format. Not
whether it's Win32 or not. Clang or GCC use the proper string formats on windows.
---
 core/Platform.h | 33 +++++++++++++++---------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/core/Platform.h b/core/Platform.h
index 12541f3..a1fa96c 100644
--- a/core/Platform.h
+++ b/core/Platform.h
@@ -109,12 +109,6 @@ typedef signed int HRESULT;
     #define AMF_FORCEINLINE         __forceinline
 #endif
 
-    #define AMFPRId64   "I64d"
-
-    #define AMFPRIud64   "Iu64d"
-
-    #define AMFPRIx64   "I64x"
-
 #else // !WIN32 - Linux and Mac
 
     #define AMF_STD_CALL
@@ -128,21 +122,28 @@ typedef signed int HRESULT;
     #define AMF_FORCEINLINE         __inline__
 #endif
 
-    #if defined(__x86_64__) || defined(__aarch64__)
-        #define AMFPRId64    "ld"
+#endif // WIN32
 
-        #define AMFPRIud64    "uld"
+#if defined(__cplusplus) && (__cplusplus >= 201103L)
+    #include <cinttypes>
+    #define AMFPRId64   PRId64
 
-        #define AMFPRIx64    "lx"
-    #else
-        #define AMFPRId64    "lld"
+    #define AMFPRIud64  PRIu64
 
-        #define AMFPRIud64    "ulld"
+    #define AMFPRIx64   PRIx64
+#elif defined(_MSC_VER)
+    #define AMFPRId64   "I64d"
 
-        #define AMFPRIx64    "llx"
-    #endif
+    #define AMFPRIud64  "Iu64d"
 
-#endif // WIN32
+    #define AMFPRIx64   "I64x"
+#elif !defined(AMFPRId64)
+    #define AMFPRId64    "lld"
+
+    #define AMFPRIud64   "ulld"
+
+     #define AMFPRIx64    "llx"
+#endif
 
 #define LPRId64   AMF_UNICODE(AMFPRId64)
 #define LPRIud64  AMF_UNICODE(AMFPRIud64)
-- 
2.45.0.windows.1

