Blame SOURCES/0001-EditresCom-Fix-build-with-modern-systems.patch

2f9257
From 591ae206f83a359a590090524c286cb03e5c2494 Mon Sep 17 00:00:00 2001
2f9257
From: Olivier Fourdan <ofourdan@redhat.com>
2f9257
Date: Tue, 6 Sep 2022 17:39:19 +0200
2f9257
Subject: [PATCH] EditresCom: Fix build with modern systems.
2f9257
2f9257
The code in _XtGetStringValues() depends on the LONG_BIT define.
2f9257
2f9257
However, modern system require -D_XOPEN_SOURCE to set LONG_BIT, so with
2f9257
the current code as it is, LONG_BIT is not defined (from limits.h) and
2f9257
the build wrongly assumes this is a 32bit build.
2f9257
2f9257
Unfortunately, defining _XOPEN_SOURCE to have LONG_BIT set would disable
2f9257
the definition of caddr_t, a deprecated definition inherited from BSD,
2f9257
so we also need to replace that with a simple cast to (long *).
2f9257
2f9257
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2f9257
---
2f9257
 lib/Xm/EditresCom.c | 6 +++++-
2f9257
 1 file changed, 5 insertions(+), 1 deletion(-)
2f9257
2f9257
diff --git a/lib/Xm/EditresCom.c b/lib/Xm/EditresCom.c
2f9257
index 4114ff8b..c93d6844 100644
2f9257
--- a/lib/Xm/EditresCom.c
2f9257
+++ b/lib/Xm/EditresCom.c
2f9257
@@ -43,6 +43,9 @@ in this Software without prior written authorization from the X Consortium.
2f9257
 #include <config.h>
2f9257
 #endif
2f9257
 
2f9257
+#ifndef _XOPEN_SOURCE
2f9257
+#define _XOPEN_SOURCE 700
2f9257
+#endif
2f9257
 
2f9257
 #include <X11/IntrinsicP.h>	/* To get into the composite and core widget
2f9257
 				   structures. */
2f9257
@@ -59,6 +62,7 @@ in this Software without prior written authorization from the X Consortium.
2f9257
 #include <X11/Xmd.h>
2f9257
 
2f9257
 #include <stdio.h>
2f9257
+#include <limits.h>
2f9257
 
2f9257
 #define _XEditResPutBool _XEditResPut8	
2f9257
 #define _XEditResPutResourceType _XEditResPut8
2f9257
@@ -1608,7 +1612,7 @@ _XtGetStringValues(Widget w, Arg *warg, int numargs)
2f9257
 	old_handler = XtAppSetWarningMsgHandler(XtWidgetToApplicationContext(w),
2f9257
 					     EditResCvtWarningHandler);
2f9257
 	from.size = res->resource_size;
2f9257
-	from.addr = (caddr_t)&value;
2f9257
+	from.addr = (void *)&value;
2f9257
 	to.addr = NULL;
2f9257
 	to.size = 0;
2f9257
 	to_color.addr = NULL;
2f9257
-- 
2f9257
2.37.3
2f9257