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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
|
From e26808392c53af97969fc7233958d841aeff5d3c Mon Sep 17 00:00:00 2001
From: phoebos <ben@bvnf.space>
Date: Fri, 11 Jul 2025 11:14:02 +0100
Subject: [PATCH] fixes
---
libXg/Gwin.h | 3 +++
libXg/arith.c | 4 ++++
libXg/balloc.c | 1 +
libXg/clipline.c | 2 ++
libXg/font.c | 1 +
libXg/gcs.c | 2 +-
libXg/getrect.c | 1 +
libXg/mkfont.c | 1 +
libXg/polysegment.c | 1 +
libXg/rdbitmap.c | 2 ++
libXg/rdbitmapfile.c | 2 ++
libXg/rectclip.c | 1 +
libXg/wrbitmap.c | 1 +
libXg/wrbitmapfile.c | 3 +++
libXg/xtbinit.c | 26 +++++++++++++++++++-------
15 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/libXg/Gwin.h b/libXg/Gwin.h
index 416d868..50ea622 100644
--- a/libXg/Gwin.h
+++ b/libXg/Gwin.h
@@ -2,6 +2,9 @@
#ifndef GWIN_H
#define GWIN_H
+long latin1(unsigned char *k);
+long unicode(unsigned char *k);
+
/* New resource names */
#define XtNscrollForwardR "scrollForwardR"
diff --git a/libXg/arith.c b/libXg/arith.c
index 5cf6f65..5fe0703 100644
--- a/libXg/arith.c
+++ b/libXg/arith.c
@@ -107,17 +107,20 @@ rshift(Rectangle r, int a)
return r;
}
+int
eqpt(Point p, Point q)
{
return p.x==q.x && p.y==q.y;
}
+int
eqrect(Rectangle r, Rectangle s)
{
return r.min.x==s.min.x && r.max.x==s.max.x &&
r.min.y==s.min.y && r.max.y==s.max.y;
}
+int
rectXrect(Rectangle r, Rectangle s)
{
return r.min.x<s.max.x && s.min.x<r.max.x &&
@@ -134,6 +137,7 @@ rectinrect(Rectangle r, Rectangle s)
return r.max.x<=s.max.x && r.max.y<=s.max.y;
}
+int
ptinrect(Point p, Rectangle r)
{
return p.x>=r.min.x && p.x<r.max.x &&
diff --git a/libXg/balloc.c b/libXg/balloc.c
index a9d243e..e56fd64 100644
--- a/libXg/balloc.c
+++ b/libXg/balloc.c
@@ -1,6 +1,7 @@
/* Copyright (c) 1992 AT&T - All rights reserved. */
#include <libc.h>
#include <libg.h>
+#include <stdlib.h>
#include "libgint.h"
Bitmap*
diff --git a/libXg/clipline.c b/libXg/clipline.c
index b8bbaad..93fa55f 100644
--- a/libXg/clipline.c
+++ b/libXg/clipline.c
@@ -1,6 +1,7 @@
/* Copyright (c) 1992 AT&T - All rights reserved. */
#include <libc.h>
#include <libg.h>
+#include <stdlib.h>
#include "libgint.h"
typedef struct Linedesc
@@ -133,6 +134,7 @@ gsetline(Point *pp0, Point *pp1, Linedesc *l)
*/
static
+int
code(Point *p, Rectangle *r)
{
return( (p->x<r->min.x? 1 : p->x>=r->max.x? 2 : 0) |
diff --git a/libXg/font.c b/libXg/font.c
index d55a9db..bee35e9 100644
--- a/libXg/font.c
+++ b/libXg/font.c
@@ -1,6 +1,7 @@
/* Copyright (c) 1992 AT&T - All rights reserved. */
#include <libc.h>
#include <libg.h>
+#include <stdlib.h>
#include "libgint.h"
#define PJW 0 /* use NUL==pjw for invisible characters */
diff --git a/libXg/gcs.c b/libXg/gcs.c
index 4d7d3d6..959cfbe 100644
--- a/libXg/gcs.c
+++ b/libXg/gcs.c
@@ -160,7 +160,7 @@ GC
_getgc(Bitmap *b, unsigned long gcvm, XGCValues *pgcv)
{
static GC gc0, gcn;
- static clipset = 0;
+ static int clipset = 0;
GC g;
XRectangle xr;
diff --git a/libXg/getrect.c b/libXg/getrect.c
index 2205a69..ee2e138 100644
--- a/libXg/getrect.c
+++ b/libXg/getrect.c
@@ -1,6 +1,7 @@
/* Copyright (c) 1992 AT&T - All rights reserved. */
#include <libc.h>
#include <libg.h>
+#include <unistd.h>
#include "libgint.h"
static Cursor sweep={
diff --git a/libXg/mkfont.c b/libXg/mkfont.c
index c555ecf..0addf79 100644
--- a/libXg/mkfont.c
+++ b/libXg/mkfont.c
@@ -2,6 +2,7 @@
#include <libc.h>
#include <libg.h>
#include <string.h>
+#include <stdlib.h>
/*
* Cobble fake font using existing subfont
diff --git a/libXg/polysegment.c b/libXg/polysegment.c
index 72cbe6f..b225203 100644
--- a/libXg/polysegment.c
+++ b/libXg/polysegment.c
@@ -1,6 +1,7 @@
/* Copyright (c) 1992 AT&T - All rights reserved. */
#include <libc.h>
#include <libg.h>
+#include <stdlib.h>
#include "libgint.h"
void
diff --git a/libXg/rdbitmap.c b/libXg/rdbitmap.c
index 63c508f..6142441 100644
--- a/libXg/rdbitmap.c
+++ b/libXg/rdbitmap.c
@@ -1,6 +1,8 @@
/* Copyright (c) 1992 AT&T - All rights reserved. */
#include <libc.h>
#include <libg.h>
+#include <stdlib.h>
+#include <string.h>
#include "libgint.h"
void
diff --git a/libXg/rdbitmapfile.c b/libXg/rdbitmapfile.c
index ae8ec52..c57dca9 100644
--- a/libXg/rdbitmapfile.c
+++ b/libXg/rdbitmapfile.c
@@ -1,6 +1,8 @@
/* Copyright (c) 1992 AT&T - All rights reserved. */
#include <libc.h>
#include <libg.h>
+#include <stdlib.h>
+#include <unistd.h>
#include "libgint.h"
#define CHUNK 6000
diff --git a/libXg/rectclip.c b/libXg/rectclip.c
index 9e03614..ae01bf6 100644
--- a/libXg/rectclip.c
+++ b/libXg/rectclip.c
@@ -2,6 +2,7 @@
#include <libc.h>
#include <libg.h>
+int
rectclip(Rectangle *rp, Rectangle b) /* first by reference, second by value */
{
Rectangle *bp = &b;
diff --git a/libXg/wrbitmap.c b/libXg/wrbitmap.c
index e1f43cd..0ae38cb 100644
--- a/libXg/wrbitmap.c
+++ b/libXg/wrbitmap.c
@@ -1,6 +1,7 @@
/* Copyright (c) 1992 AT&T - All rights reserved. */
#include <libc.h>
#include <libg.h>
+#include <stdlib.h>
#include "libgint.h"
#include <X11/Intrinsic.h>
#ifndef XtSpecificationRelease
diff --git a/libXg/wrbitmapfile.c b/libXg/wrbitmapfile.c
index eb1237a..c239882 100644
--- a/libXg/wrbitmapfile.c
+++ b/libXg/wrbitmapfile.c
@@ -1,6 +1,9 @@
/* Copyright (c) 1992 AT&T - All rights reserved. */
#include <libc.h>
#include <libg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
#include "libgint.h"
#define CHUNK 4096
diff --git a/libXg/xtbinit.c b/libXg/xtbinit.c
index a711319..43952ef 100644
--- a/libXg/xtbinit.c
+++ b/libXg/xtbinit.c
@@ -2,6 +2,8 @@
#include <libc.h>
#include <libg.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
#include "libgint.h"
#define COMPRESSMOUSE
@@ -85,7 +87,7 @@ static Font * initfont(char *, XFontStruct *, char *);
static void reshaped(int, int, int, int);
static void gotchar(int);
static void gotmouse(Gwinmouse *);
-static int log2(int);
+static int mylog2(int);
static void pixtocolor(Pixel, XColor *);
static Subfont *XFontStructtoSubfont(XFontStruct *);
static Ebuf *ebread(Esrc *);
@@ -127,6 +129,16 @@ ioerr(Display *d)
return 0;
}
+static int
+ioerre(Display *d, XErrorEvent *e)
+{
+ if(onerr)
+ (*onerr)("ioerr");
+ else
+ exit(1);
+ return 0;
+}
+
void
xtbinit(Errfunc f, char *class, int *pargc, char **argv, char **fallbacks)
{
@@ -174,7 +186,7 @@ xtbinit(Errfunc f, char *class, int *pargc, char **argv, char **fallbacks)
XtSetArg(args[n], XtNcomposeMod, &compose); n++;
XtGetValues(widg, args, n);
XSetIOErrorHandler(ioerr);
- XSetErrorHandler(ioerr);
+ XSetErrorHandler(ioerre);
if (compose < 0 || compose > 5) {
n = 0;
@@ -188,7 +200,7 @@ xtbinit(Errfunc f, char *class, int *pargc, char **argv, char **fallbacks)
pixtocolor(_fgpixel, &_fgcolor);
pixtocolor(_bgpixel, &_bgcolor);
screen.id = (int) XtWindow(widg);
- screen.ldepth = log2(depth);
+ screen.ldepth = mylog2(depth);
screen.flag = SCR;
if(_fgpixel != 0)
screen.flag |= BL1;
@@ -364,7 +376,7 @@ gottimeout(XtPointer cldata, XtIntervalId *id)
}
static int
-log2(int n)
+mylog2(int n)
{
int i, v;
@@ -592,7 +604,7 @@ void
einit(unsigned long keys)
{
/*
- * Make sure Smouse = log2(Emouse) and Skeyboard == log2(Ekeyboard)
+ * Make sure Smouse = mylog2(Emouse) and Skeyboard == mylog2(Ekeyboard)
*/
nsrc = 0;
if(keys&Emouse){
@@ -653,7 +665,7 @@ estop(unsigned long key)
{
int s;
- s = log2(key);
+ s = mylog2(key);
if (!esrc[s].inuse){
berror("key not in use");
}
@@ -666,7 +678,7 @@ estoptimer(unsigned long key)
{
int s;
- s = log2(key);
+ s = mylog2(key);
if (!esrc[s].inuse){
berror("key not in use");
}
--
2.49.0
|