From 38063feccee0827493c153f71c4e102f9d15428c Mon Sep 17 00:00:00 2001
From: asmwarrior <hidden@example.com>
Date: Sat, 8 Feb 2025 11:09:06 +0800
Subject: [PATCH] - compilergcc plugin: fix build warning in the depslib, see
 discussion here:
%I64d or %lld in the plugins\compilergcc\depslib\src\cache.c
https://forums.codeblocks.org/index.php/topic,25960.0.html
---
 src/plugins/compilergcc/depslib/src/cache.c | 23 +++++++++++++++------
 src/plugins/compilergcc/depslib/src/hash.c  |  7 +++++--
 2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/src/plugins/compilergcc/depslib/src/cache.c b/src/plugins/compilergcc/depslib/src/cache.c
index 8e90756f..1d2f8211 100644
--- a/src/plugins/compilergcc/depslib/src/cache.c
+++ b/src/plugins/compilergcc/depslib/src/cache.c
@@ -16,6 +16,9 @@
 #include "newstr.h"
 #include "cache.h"
 
+/* C::B patch: Compatibility with 64 bit compiler / OS*/
+# include "inttypes.h" // PRId64
+
 #include "depslib.h" /* for struct depsStats */
 extern struct depsStats g_stats;
 
@@ -138,10 +141,14 @@ void cache_read(const char *path)
 		}
 
 		/* C::B patch: Compatibility with 64 bit compiler / OS */
-		#if defined(_WIN64)
-		sscanf(buf, "%I64d %n", &timeval, &n);
+		#if  (_USE_LONG_TIME_T)
+			sscanf(buf, "%ld %n", &timeval, &n);
 		#else
-		sscanf(buf, "%lld %n", &timeval, &n);
+			#if defined(PRId64)
+				sscanf(buf, "%" PRId64 " %n", &timeval, &n);
+			#else
+				sscanf(buf, "%lld %n", &timeval, &n);
+			#endif
 		#endif
 		h = hdr_enter (buf + n);
 		h->time = timeval;
@@ -169,10 +176,14 @@ void cache_write(const char *path)
 	{
 		LIST *l;
 		/* C::B patch: Compatibility with 64 bit compiler / OS */
-		#if defined(_WIN64)
-		fprintf(f, "%I64d %s\n", h->time, h->file);
+		#if  (_USE_LONG_TIME_T)
+			fprintf(f, "%ld %s\n", h->time, h->file);
 		#else
-		fprintf(f, "%lld %s\n", h->time, h->file);
+			#if defined(PRId64)
+				fprintf(f, "%" PRId64 " %s\n", h->time, h->file);
+			#else
+				fprintf(f, "%lld %s\n", h->time, h->file);
+			#endif
 		#endif
 		for (l = h->includes; l; l = list_next (l))
 		{
diff --git a/src/plugins/compilergcc/depslib/src/hash.c b/src/plugins/compilergcc/depslib/src/hash.c
index 78823e43..57e00297 100644
--- a/src/plugins/compilergcc/depslib/src/hash.c
+++ b/src/plugins/compilergcc/depslib/src/hash.c
@@ -42,6 +42,9 @@
 # include "jam.h"
 # include "hash.h"
 
+/* C::B patch: Compatibility with 64 bit compiler / OS*/
+# include "inttypes.h" // PRId64
+
 /* Header attached to all data items entered into a hash table. */
 
 struct hashhdr {
@@ -266,8 +269,8 @@ hashstat( struct hash *hp )
 #ifdef __LP64__ /* avoid warning on 64-bit machines */
 	printf( "%s table: %d+%d+%d (%dK+%luK) items+table+hash, %f density\n",
 /* C::B patch: Compatibility with 64 bit compiler / OS*/
-#elif defined(_WIN64)
-	printf( "%s table: %d+%d+%d (%dK+%I64dK) items+table+hash, %f density\n",
+#elif defined(PRId64)
+	printf( "%s table: %d+%d+%d (%dK+%" PRId64 "K) items+table+hash, %f density\n",
 #else
 	printf( "%s table: %d+%d+%d (%dK+%dK) items+table+hash, %f density\n",
 #endif
-- 
2.42.0.windows.2