summaryrefslogtreecommitdiff
blob: 2031d744007af5df6b05adb351f74dab2dbc43a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
Fix two remaining problems for C99/C23 compatibility.
With this, package builds with GCC-15.
true and false are strings, so replacement is trivial
and doesn't interact with ABI.
Casts to Widget are uses everywhere in this program, and
are correct, as MatrixWidget embeds same core struct from Xt
as Widget consists of, as first member.
XtRImmediate indicates that next pointer would be interpreted
as a value, so integer reinterpreted as a pointer to low mem is
actually fine, it won't be dereferenced and won't crash whole
program.
https://bugs.gentoo.org/944748
https://bugs.gentoo.org/919195
--- a/examples/input/input.c
+++ b/examples/input/input.c
@@ -126,7 +126,7 @@
 {
     Widget toplevel, rc, pattern, cw, radio, frame;
     XtAppContext app;
-    XmString true, false, begin, centre, end;
+    XmString true_str, false_str, begin, centre, end;
 
     toplevel = XtVaAppInitialize(&app, "Input",
 				 NULL, 0,
@@ -160,8 +160,8 @@
 
     XtAddCallback(input, XmNvalidateCallback, validateCB, NULL);
 
-    true = XmStringCreateSimple("True");
-    false = XmStringCreateSimple("False");
+    true_str = XmStringCreateSimple("True");
+    false_str = XmStringCreateSimple("False");
 
     cw = XtVaCreateManagedWidget(
 	"XmNautofill", xbaeCaptionWidgetClass, rc,
@@ -173,8 +173,8 @@
 
     radio = XmVaCreateSimpleRadioBox(
 	frame, "XmNautoFill", 0, autoFillToggle,
-	XmVaRADIOBUTTON, false, NULL, NULL, NULL,
-	XmVaRADIOBUTTON, true, NULL, NULL, NULL,
+	XmVaRADIOBUTTON, false_str, NULL, NULL, NULL,
+	XmVaRADIOBUTTON, true_str, NULL, NULL, NULL,
 	NULL);
 
     XtVaSetValues(radio, XmNtraversalOn, False, NULL);
@@ -191,8 +191,8 @@
 
     radio = XmVaCreateSimpleRadioBox(
 	frame, "XmNconvertCase", 1, convertCaseToggle,
-	XmVaRADIOBUTTON, false, NULL, NULL, NULL,
-	XmVaRADIOBUTTON, true, NULL, NULL, NULL,
+	XmVaRADIOBUTTON, false_str, NULL, NULL, NULL,
+	XmVaRADIOBUTTON, true_str, NULL, NULL, NULL,
 	NULL);
 
     XtVaSetValues(radio, XmNtraversalOn, False, NULL);
@@ -224,8 +224,8 @@
 
     radio = XmVaCreateSimpleRadioBox(
 	frame, "XmNoverwriteMode", 0, overwriteModeToggle,
-	XmVaRADIOBUTTON, false, NULL, NULL, NULL,
-	XmVaRADIOBUTTON, true, NULL, NULL, NULL,
+	XmVaRADIOBUTTON, false_str, NULL, NULL, NULL,
+	XmVaRADIOBUTTON, true_str, NULL, NULL, NULL,
 	NULL);
 
     XtVaSetValues(radio, XmNtraversalOn, False, NULL);
@@ -254,8 +254,8 @@
 
     XtManageChild(radio);
 
-    XmStringFree(true);
-    XmStringFree(false);
+    XmStringFree(true_str);
+    XmStringFree(false_str);
     XmStringFree(begin);
     XmStringFree(centre);
     XmStringFree(end);
--- a/examples/input/pattern.c
+++ b/examples/input/pattern.c
@@ -128,7 +128,7 @@
 {
     Widget toplevel, rc, pattern, cw, radio, frame;
     XtAppContext app;
-    XmString true, false, begin, centre, end;
+    XmString true_str, false_str, begin, centre, end;
 
     toplevel = XtVaAppInitialize(&app, "Input",
 				 NULL, 0,
@@ -167,8 +167,8 @@
 		XmNoverwriteMode,	False,
 		NULL);
 
-    true = XmStringCreateSimple("True");
-    false = XmStringCreateSimple("False");
+    true_str = XmStringCreateSimple("True");
+    false_str = XmStringCreateSimple("False");
 
     cw = XtVaCreateManagedWidget(
 	"XmNautofill", xbaeCaptionWidgetClass, rc,
@@ -180,8 +180,8 @@
 
     radio = XmVaCreateSimpleRadioBox(
 	frame, "XmNautoFill", 0, autoFillToggle,
-	XmVaRADIOBUTTON, false, NULL, NULL, NULL,
-	XmVaRADIOBUTTON, true, NULL, NULL, NULL,
+	XmVaRADIOBUTTON, false_str, NULL, NULL, NULL,
+	XmVaRADIOBUTTON, true_str, NULL, NULL, NULL,
 	NULL);
 
     XtVaSetValues(radio, XmNtraversalOn, False, NULL);
@@ -198,8 +198,8 @@
 
     radio = XmVaCreateSimpleRadioBox(
 	frame, "XmNconvertCase", 1, convertCaseToggle,
-	XmVaRADIOBUTTON, false, NULL, NULL, NULL,
-	XmVaRADIOBUTTON, true, NULL, NULL, NULL,
+	XmVaRADIOBUTTON, false_str, NULL, NULL, NULL,
+	XmVaRADIOBUTTON, true_str, NULL, NULL, NULL,
 	NULL);
 
     XtVaSetValues(radio, XmNtraversalOn, False, NULL);
@@ -231,8 +231,8 @@
 
     radio = XmVaCreateSimpleRadioBox(
 	frame, "XmNoverwriteMode", 0, overwriteModeToggle,
-	XmVaRADIOBUTTON, false, NULL, NULL, NULL,
-	XmVaRADIOBUTTON, true, NULL, NULL, NULL,
+	XmVaRADIOBUTTON, false_str, NULL, NULL, NULL,
+	XmVaRADIOBUTTON, true_str, NULL, NULL, NULL,
 	NULL);
 
     XtVaSetValues(radio, XmNtraversalOn, False, NULL);
@@ -261,8 +261,8 @@
 
     XtManageChild(radio);
 
-    XmStringFree(true);
-    XmStringFree(false);
+    XmStringFree(true_str);
+    XmStringFree(false_str);
     XmStringFree(begin);
     XmStringFree(centre);
     XmStringFree(end);
--- a/examples/tests/leak2.c
+++ b/examples/tests/leak2.c
@@ -20,7 +20,7 @@
 
 XtResource	resources[] = {
 	{ "numIter", "NumIter", XtRInt, sizeof(int),
-		XtOffsetOf(AppRes, numIter), XtRImmediate, 1000 },
+		XtOffsetOf(AppRes, numIter), XtRImmediate, (XtPointer)1000 },
 };
 
 int
--- a/src/Methods.c
+++ b/src/Methods.c
@@ -1688,7 +1688,7 @@
                                          * The event must have occurred in a legal position
                                          * otherwise control wouldn't have made it here
                                          */
-                                        xbaeEventToRowColumn(mw, event, &r, &c, &x, &y);
+                                        xbaeEventToRowColumn((Widget) mw, event, &r, &c, &x, &y);
                                         x -= mw->matrix.cell_shadow_thickness;
                                         y -= mw->matrix.cell_shadow_thickness;
                                         position = XmTextXYToPos(TextField(mw), x, y);