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

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