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

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