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

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