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

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