Files
macports-ports/math/xmfract/files/fix-c99-collisions.diff
Tim HentenaarandRenee Otten f2deb2ebac xmfract: change openmotif to motif and bump revision
* Add a patch to fix the configure tests, and correct the collision
  between the cimag / creal globals and the C99 complex functions.
* Add a patch to enable xmfract to run on TrueColor visuals.
* Add a patch to fix declarations with implicit int type.
* Added -std=c99 for compatibility with newer compilers.
* Fix port linting nits.
2026-05-20 17:50:10 -04:00

106 lines
2.7 KiB
Diff

--- configure 1995-06-20 11:46:54.000000000 -0400
+++ configure 2026-04-29 21:23:17.000000000 -0400
@@ -1539,7 +1539,7 @@
cat > conftest.$ac_ext <<EOF
#line 1541 "configure"
#include "confdefs.h"
-main(){return(0);}
+int main(){return(0);}
EOF
eval $ac_link
if test -s conftest && (./conftest; exit) 2>/dev/null; then
@@ -1621,6 +1621,7 @@
cat > conftest.$ac_ext <<EOF
#line 1623 "configure"
#include "confdefs.h"
+#include <stdlib.h>
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
@@ -1770,7 +1771,7 @@
int main() { return 0; }
int t() {
-} $ac_kw foo() {
+} $ac_kw int foo() {
; return 0; }
EOF
if eval $ac_compile; then
@@ -1936,8 +1937,10 @@
cat > conftest.$ac_ext <<EOF
#line 1938 "configure"
#include "confdefs.h"
+#include <stdlib.h>
+#include <string.h>
-main()
+int main(void)
{
char c0 = 0x40, c1 = 0x80, c2 = 0x81;
exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
--- src/calcfracinit.c 2026-04-29 20:49:59.000000000 -0400
+++ src/calcfracinit.c 2026-04-29 22:11:46.000000000 -0400
@@ -189,8 +189,8 @@
if(fractype != CELLULAR)
{
/* integer equivs for it all */
- creal = fudgetolong(param[0]);
- cimag = fudgetolong(param[1]);
+ lcreal = fudgetolong(param[0]);
+ lcimag = fudgetolong(param[1]);
xmin = fudgetolong(xxmin);
xmax = fudgetolong(xxmax);
x3rd = fudgetolong(xx3rd);
--- src/globals.c 2026-04-29 20:49:59.000000000 -0400
+++ src/globals.c 2026-04-29 22:11:10.000000000 -0400
@@ -541,9 +541,9 @@
long ListFront;
long ListSize;
long calctime;
-long cimag;
+long lcimag;
long con;
-long creal;
+long lcreal;
long delmin;
long delx;
long dely;
--- src/globals.h 2026-04-29 20:49:59.000000000 -0400
+++ src/globals.h 2026-04-29 22:10:42.000000000 -0400
@@ -544,9 +544,9 @@
extern long ListFront;
extern long ListSize;
extern long calctime;
-extern long cimag;
+extern long lcimag;
extern long con;
-extern long creal;
+extern long lcreal;
extern long delmin;
extern long delx;
extern long dely;
--- src/prototyp.h 2026-04-29 20:49:59.000000000 -0400
+++ src/prototyp.h 2026-04-29 20:54:59.000000000 -0400
@@ -901,7 +901,7 @@
(Widget w, XtPointer client_data, XtPointer call_data);
/* xmfract.c */
-extern void main(int argc, char **argv);
+extern int main(int argc, char **argv);
extern void delay_display_authors_window
(XtPointer client_data, XtIntervalId Id);
extern void delay_display_disclaimer
diff -ru src/xmfract.c xmfract_1.4/src/xmfract.c
--- src/xmfract.c 2026-04-29 20:49:59.000000000 -0400
+++ src/xmfract.c 2026-04-29 20:55:25.000000000 -0400
@@ -20,8 +20,7 @@
NULL
};
-void
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
int n;
long xmversion;