|
1 From 0dc93f7e43deb102b1f8fb7c4c4844cdce7ffd1e Mon Sep 17 00:00:00 2001 |
|
2 From: Alan Coopersmith <[email protected]> |
|
3 Date: Fri, 29 Jun 2012 22:57:13 -0700 |
|
4 Subject: [PATCH:libX11 02/58] XCreate{Pix,Bit}map...Data: Free pixmap in |
|
5 error path if XCreateGC fails |
|
6 |
|
7 Fixes leaks in error paths found by Parfait 1.0.0: |
|
8 |
|
9 Error: X Resource Leak |
|
10 Leaked X Resource pix |
|
11 at line 62 of CrBFData.c in function 'XCreateBitmapFromData'. |
|
12 pix initialized at line 60 with XCreatePixmap |
|
13 Error: X Resource Leak |
|
14 Leaked X Resource pix |
|
15 at line 70 of CrPFBData.c in function 'XCreatePixmapFromBitmapData'. |
|
16 pix initialized at line 66 with XCreatePixmap |
|
17 |
|
18 Signed-off-by: Alan Coopersmith <[email protected]> |
|
19 Reviewed-by: Aaron Plattner <[email protected]> |
|
20 --- |
|
21 src/CrBFData.c | 7 +++++-- |
|
22 src/CrPFBData.c | 7 +++++-- |
|
23 2 files changed, 10 insertions(+), 4 deletions(-) |
|
24 |
|
25 diff --git a/src/CrBFData.c b/src/CrBFData.c |
|
26 index 4490956..9515875 100644 |
|
27 --- a/src/CrBFData.c |
|
28 +++ b/src/CrBFData.c |
|
29 @@ -58,8 +58,11 @@ Pixmap XCreateBitmapFromData( |
|
30 Pixmap pix; |
|
31 |
|
32 pix = XCreatePixmap(display, d, width, height, 1); |
|
33 - if (! (gc = XCreateGC(display, pix, (unsigned long) 0, (XGCValues *) 0))) |
|
34 - return (Pixmap) None; |
|
35 + gc = XCreateGC(display, pix, (unsigned long) 0, (XGCValues *) 0); |
|
36 + if (gc == NULL) { |
|
37 + XFreePixmap(display, pix); |
|
38 + return (Pixmap) None; |
|
39 + } |
|
40 ximage.height = height; |
|
41 ximage.width = width; |
|
42 ximage.depth = 1; |
|
43 diff --git a/src/CrPFBData.c b/src/CrPFBData.c |
|
44 index 57cd153..d343420 100644 |
|
45 --- a/src/CrPFBData.c |
|
46 +++ b/src/CrPFBData.c |
|
47 @@ -66,8 +66,11 @@ Pixmap XCreatePixmapFromBitmapData( |
|
48 pix = XCreatePixmap(display, d, width, height, depth); |
|
49 gcv.foreground = fg; |
|
50 gcv.background = bg; |
|
51 - if (! (gc = XCreateGC(display, pix, GCForeground|GCBackground, &gcv))) |
|
52 - return (Pixmap) NULL; |
|
53 + gc = XCreateGC(display, pix, GCForeground|GCBackground, &gcv); |
|
54 + if (gc == NULL) { |
|
55 + XFreePixmap(display, pix); |
|
56 + return (Pixmap) None; |
|
57 + } |
|
58 ximage.height = height; |
|
59 ximage.width = width; |
|
60 ximage.depth = 1; |
|
61 -- |
|
62 1.7.9.2 |
|
63 |
|
64 From 65358ea5079236b2508f787ac2fb2024a477e36d Mon Sep 17 00:00:00 2001 |
|
65 From: Alan Coopersmith <[email protected]> |
|
66 Date: Fri, 29 Jun 2012 23:08:04 -0700 |
|
67 Subject: [PATCH:libX11 03/58] Convert XCreate{Pix,Bit}map...Data to use C99 |
|
68 designated initializers |
|
69 |
|
70 Signed-off-by: Alan Coopersmith <[email protected]> |
|
71 --- |
|
72 src/CrBFData.c | 42 ++++++++++++++++++++---------------------- |
|
73 src/CrPFBData.c | 49 ++++++++++++++++++++++++------------------------- |
|
74 2 files changed, 44 insertions(+), 47 deletions(-) |
|
75 |
|
76 diff --git a/src/CrBFData.c b/src/CrBFData.c |
|
77 index 9515875..6708a9b 100644 |
|
78 --- a/src/CrBFData.c |
|
79 +++ b/src/CrBFData.c |
|
80 @@ -53,30 +53,28 @@ Pixmap XCreateBitmapFromData( |
|
81 unsigned int width, |
|
82 unsigned int height) |
|
83 { |
|
84 - XImage ximage; |
|
85 - GC gc; |
|
86 - Pixmap pix; |
|
87 - |
|
88 - pix = XCreatePixmap(display, d, width, height, 1); |
|
89 - gc = XCreateGC(display, pix, (unsigned long) 0, (XGCValues *) 0); |
|
90 + Pixmap pix = XCreatePixmap(display, d, width, height, 1); |
|
91 + GC gc = XCreateGC(display, pix, (unsigned long) 0, (XGCValues *) 0); |
|
92 if (gc == NULL) { |
|
93 XFreePixmap(display, pix); |
|
94 return (Pixmap) None; |
|
95 + } else { |
|
96 + XImage ximage = { |
|
97 + .height = height, |
|
98 + .width = width, |
|
99 + .depth = 1, |
|
100 + .bits_per_pixel = 1, |
|
101 + .xoffset = 0, |
|
102 + .format = XYPixmap, |
|
103 + .data = (char *) data, |
|
104 + .byte_order = LSBFirst, |
|
105 + .bitmap_unit = 8, |
|
106 + .bitmap_bit_order = LSBFirst, |
|
107 + .bitmap_pad = 8, |
|
108 + .bytes_per_line = (width + 7) / 8, |
|
109 + }; |
|
110 + XPutImage(display, pix, gc, &ximage, 0, 0, 0, 0, width, height); |
|
111 + XFreeGC(display, gc); |
|
112 + return(pix); |
|
113 } |
|
114 - ximage.height = height; |
|
115 - ximage.width = width; |
|
116 - ximage.depth = 1; |
|
117 - ximage.bits_per_pixel = 1; |
|
118 - ximage.xoffset = 0; |
|
119 - ximage.format = XYPixmap; |
|
120 - ximage.data = (char *)data; |
|
121 - ximage.byte_order = LSBFirst; |
|
122 - ximage.bitmap_unit = 8; |
|
123 - ximage.bitmap_bit_order = LSBFirst; |
|
124 - ximage.bitmap_pad = 8; |
|
125 - ximage.bytes_per_line = (width+7)/8; |
|
126 - |
|
127 - XPutImage(display, pix, gc, &ximage, 0, 0, 0, 0, width, height); |
|
128 - XFreeGC(display, gc); |
|
129 - return(pix); |
|
130 } |
|
131 diff --git a/src/CrPFBData.c b/src/CrPFBData.c |
|
132 index d343420..17d551b 100644 |
|
133 --- a/src/CrPFBData.c |
|
134 +++ b/src/CrPFBData.c |
|
135 @@ -58,33 +58,32 @@ Pixmap XCreatePixmapFromBitmapData( |
|
136 unsigned long bg, |
|
137 unsigned int depth) |
|
138 { |
|
139 - XImage ximage; |
|
140 - GC gc; |
|
141 - XGCValues gcv; |
|
142 - Pixmap pix; |
|
143 - |
|
144 - pix = XCreatePixmap(display, d, width, height, depth); |
|
145 - gcv.foreground = fg; |
|
146 - gcv.background = bg; |
|
147 - gc = XCreateGC(display, pix, GCForeground|GCBackground, &gcv); |
|
148 + Pixmap pix = XCreatePixmap(display, d, width, height, depth); |
|
149 + XGCValues gcv = { |
|
150 + .foreground = fg, |
|
151 + .background = bg |
|
152 + }; |
|
153 + GC gc = XCreateGC(display, pix, GCForeground|GCBackground, &gcv); |
|
154 if (gc == NULL) { |
|
155 XFreePixmap(display, pix); |
|
156 return (Pixmap) None; |
|
157 + } else { |
|
158 + XImage ximage = { |
|
159 + .height = height, |
|
160 + .width = width, |
|
161 + .depth = 1, |
|
162 + .bits_per_pixel = 1, |
|
163 + .xoffset = 0, |
|
164 + .format = XYBitmap, |
|
165 + .data = data, |
|
166 + .byte_order = LSBFirst, |
|
167 + .bitmap_unit = 8, |
|
168 + .bitmap_bit_order = LSBFirst, |
|
169 + .bitmap_pad = 8, |
|
170 + .bytes_per_line = (width + 7) / 8 |
|
171 + }; |
|
172 + XPutImage(display, pix, gc, &ximage, 0, 0, 0, 0, width, height); |
|
173 + XFreeGC(display, gc); |
|
174 + return(pix); |
|
175 } |
|
176 - ximage.height = height; |
|
177 - ximage.width = width; |
|
178 - ximage.depth = 1; |
|
179 - ximage.bits_per_pixel = 1; |
|
180 - ximage.xoffset = 0; |
|
181 - ximage.format = XYBitmap; |
|
182 - ximage.data = data; |
|
183 - ximage.byte_order = LSBFirst; |
|
184 - ximage.bitmap_unit = 8; |
|
185 - ximage.bitmap_bit_order = LSBFirst; |
|
186 - ximage.bitmap_pad = 8; |
|
187 - ximage.bytes_per_line = (width+7)/8; |
|
188 - |
|
189 - XPutImage(display, pix, gc, &ximage, 0, 0, 0, 0, width, height); |
|
190 - XFreeGC(display, gc); |
|
191 - return(pix); |
|
192 } |
|
193 -- |
|
194 1.7.9.2 |
|
195 |
|
196 From 59c9ee8cd58857c5769b643611cbe526005a9e45 Mon Sep 17 00:00:00 2001 |
|
197 From: Alan Coopersmith <[email protected]> |
|
198 Date: Sun, 16 Dec 2012 17:44:42 -0800 |
|
199 Subject: [PATCH:libX11 31/58] Tell clang not to report -Wpadded warnings on |
|
200 public headers we can't fix |
|
201 |
|
202 Better to silence the compiler warning than break ABI. |
|
203 |
|
204 Signed-off-by: Alan Coopersmith <[email protected]> |
|
205 --- |
|
206 include/X11/Xcms.h | 12 ++++++++++++ |
|
207 include/X11/Xlib.h | 12 ++++++++++++ |
|
208 include/X11/Xlibint.h | 12 ++++++++++++ |
|
209 include/X11/Xutil.h | 12 ++++++++++++ |
|
210 4 files changed, 48 insertions(+) |
|
211 |
|
212 diff --git a/include/X11/Xcms.h b/include/X11/Xcms.h |
|
213 index 8151fd1..6631854 100644 |
|
214 --- a/include/X11/Xcms.h |
|
215 +++ b/include/X11/Xcms.h |
|
216 @@ -31,6 +31,14 @@ |
|
217 |
|
218 #include <X11/Xlib.h> |
|
219 |
|
220 +/* The Xcms structs are full of implicit padding to properly align members. |
|
221 + We can't clean that up without breaking ABI, so tell clang not to bother |
|
222 + complaining about it. */ |
|
223 +#ifdef __clang__ |
|
224 +#pragma clang diagnostic push |
|
225 +#pragma clang diagnostic ignored "-Wpadded" |
|
226 +#endif |
|
227 + |
|
228 /* |
|
229 * XCMS Status Values |
|
230 */ |
|
231 @@ -798,6 +806,10 @@ extern Visual *XcmsVisualOfCCC ( |
|
232 XcmsCCC /* ccc */ |
|
233 ); |
|
234 |
|
235 +#ifdef __clang__ |
|
236 +#pragma clang diagnostic pop |
|
237 +#endif |
|
238 + |
|
239 _XFUNCPROTOEND |
|
240 |
|
241 #endif /* _X11_XCMS_H_ */ |
|
242 diff --git a/include/X11/Xlib.h b/include/X11/Xlib.h |
|
243 index dd4c7c4..9618081 100644 |
|
244 --- a/include/X11/Xlib.h |
|
245 +++ b/include/X11/Xlib.h |
|
246 @@ -81,6 +81,14 @@ _Xmblen( |
|
247 November 2000. Its presence is indicated through the following macro. */ |
|
248 #define X_HAVE_UTF8_STRING 1 |
|
249 |
|
250 +/* The Xlib structs are full of implicit padding to properly align members. |
|
251 + We can't clean that up without breaking ABI, so tell clang not to bother |
|
252 + complaining about it. */ |
|
253 +#ifdef __clang__ |
|
254 +#pragma clang diagnostic push |
|
255 +#pragma clang diagnostic ignored "-Wpadded" |
|
256 +#endif |
|
257 + |
|
258 typedef char *XPointer; |
|
259 |
|
260 #define Bool int |
|
261 @@ -4019,6 +4027,10 @@ extern void XFreeEventData( |
|
262 XGenericEventCookie* /* cookie*/ |
|
263 ); |
|
264 |
|
265 +#ifdef __clang__ |
|
266 +#pragma clang diagnostic pop |
|
267 +#endif |
|
268 + |
|
269 _XFUNCPROTOEND |
|
270 |
|
271 #endif /* _X11_XLIB_H_ */ |
|
272 diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h |
|
273 index 80edeec..23e751b 100644 |
|
274 --- a/include/X11/Xlibint.h |
|
275 +++ b/include/X11/Xlibint.h |
|
276 @@ -42,6 +42,14 @@ from The Open Group. |
|
277 #include <X11/Xproto.h> /* to declare xEvent */ |
|
278 #include <X11/XlibConf.h> /* for configured options like XTHREADS */ |
|
279 |
|
280 +/* The Xlib structs are full of implicit padding to properly align members. |
|
281 + We can't clean that up without breaking ABI, so tell clang not to bother |
|
282 + complaining about it. */ |
|
283 +#ifdef __clang__ |
|
284 +#pragma clang diagnostic push |
|
285 +#pragma clang diagnostic ignored "-Wpadded" |
|
286 +#endif |
|
287 + |
|
288 #ifdef WIN32 |
|
289 #define _XFlush _XFlushIt |
|
290 #endif |
|
291 @@ -1364,6 +1372,10 @@ extern void xlocaledir( |
|
292 int buf_len |
|
293 ); |
|
294 |
|
295 +#ifdef __clang__ |
|
296 +#pragma clang diagnostic pop |
|
297 +#endif |
|
298 + |
|
299 _XFUNCPROTOEND |
|
300 |
|
301 #endif /* _X11_XLIBINT_H_ */ |
|
302 diff --git a/include/X11/Xutil.h b/include/X11/Xutil.h |
|
303 index 8cab50e..62cdf55 100644 |
|
304 --- a/include/X11/Xutil.h |
|
305 +++ b/include/X11/Xutil.h |
|
306 @@ -53,6 +53,14 @@ SOFTWARE. |
|
307 #include <X11/Xlib.h> |
|
308 #include <X11/keysym.h> |
|
309 |
|
310 +/* The Xlib structs are full of implicit padding to properly align members. |
|
311 + We can't clean that up without breaking ABI, so tell clang not to bother |
|
312 + complaining about it. */ |
|
313 +#ifdef __clang__ |
|
314 +#pragma clang diagnostic push |
|
315 +#pragma clang diagnostic ignored "-Wpadded" |
|
316 +#endif |
|
317 + |
|
318 /* |
|
319 * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding |
|
320 * value (x, y, width, height) was found in the parsed string. |
|
321 @@ -821,6 +829,10 @@ extern int XXorRegion( |
|
322 Region /* dr_return */ |
|
323 ); |
|
324 |
|
325 +#ifdef __clang__ |
|
326 +#pragma clang diagnostic pop |
|
327 +#endif |
|
328 + |
|
329 _XFUNCPROTOEND |
|
330 |
|
331 #endif /* _X11_XUTIL_H_ */ |
|
332 -- |
|
333 1.7.9.2 |
|
334 |
|
335 From a6e5b36a3e6d4a7a9fb4bad905ed127e67b1957e Mon Sep 17 00:00:00 2001 |
|
336 From: Alan Coopersmith <[email protected]> |
|
337 Date: Wed, 26 Dec 2012 22:56:38 -0800 |
|
338 Subject: [PATCH:libX11 32/58] Remove unused TLI ("STREAMSCONN") code from |
|
339 Xlib |
|
340 |
|
341 Has never been converted to build in modular builds, so has been unusable |
|
342 since X11R7.0 release in 2005. All known platforms with TLI/XTI support |
|
343 that X11R7 & later releases run on also have (and mostly prefer) BSD |
|
344 socket support for their networking API. |
|
345 |
|
346 Signed-off-by: Alan Coopersmith <[email protected]> |
|
347 --- |
|
348 modules/im/ximcp/imTransR.c | 3 -- |
|
349 src/globals.c | 121 ------------------------------------------- |
|
350 src/xlibi18n/XimTrInt.h | 2 +- |
|
351 3 files changed, 1 insertion(+), 125 deletions(-) |
|
352 |
|
353 diff --git a/modules/im/ximcp/imTransR.c b/modules/im/ximcp/imTransR.c |
|
354 index 1fd0088..4f843a0 100644 |
|
355 --- a/modules/im/ximcp/imTransR.c |
|
356 +++ b/modules/im/ximcp/imTransR.c |
|
357 @@ -69,9 +69,6 @@ TransportSW _XimTransportRec[] = { |
|
358 #ifdef DNETCONN |
|
359 { "dnet", _XimTransConf }, /* use X transport lib */ |
|
360 #endif /* DNETCONN */ |
|
361 -#ifdef STREAMSCONN |
|
362 - { "streams", _XimTransConf }, /* use X transport lib */ |
|
363 -#endif /* STREAMSCONN */ |
|
364 { (char *)NULL, (Bool (*)(Xim, char *))NULL }, |
|
365 }; |
|
366 |
|
367 diff --git a/src/globals.c b/src/globals.c |
|
368 index 89e38a7..b7e49dd 100644 |
|
369 --- a/src/globals.c |
|
370 +++ b/src/globals.c |
|
371 @@ -87,127 +87,6 @@ ZEROINIT (int, _Xdebug, 0); |
|
372 ZEROINIT (Display *, _XHeadOfDisplayList, NULL); |
|
373 |
|
374 |
|
375 - |
|
376 -#if 0 |
|
377 -#ifdef STREAMSCONN |
|
378 - |
|
379 - |
|
380 -/* The following are how the Xstream connections are used: */ |
|
381 -/* 1) Local connections over pseudo-tty ports. */ |
|
382 -/* 2) SVR4 local connections using named streams or SVR3.2 */ |
|
383 -/* local connections using streams. */ |
|
384 -/* 3) SVR4 stream pipe code. This code is proprietary and */ |
|
385 -/* the actual code is not included in the XC distribution. */ |
|
386 -/* 4) remote connections using tcp */ |
|
387 -/* 5) remote connections using StarLan */ |
|
388 - |
|
389 -/* |
|
390 - * descriptor block for streams connections |
|
391 - */ |
|
392 - |
|
393 -#include "Xstreams.h" |
|
394 - |
|
395 -char _XsTypeOfStream[100] = { 0 }; |
|
396 - |
|
397 -extern int write(); |
|
398 -extern int close(); |
|
399 -#ifdef SVR4 |
|
400 -extern int _XsSetupSpStream(); |
|
401 -extern int _XsSetupNamedStream(); |
|
402 -#endif |
|
403 -extern int _XsSetupLocalStream(); |
|
404 -extern int _XsConnectLocalClient(); |
|
405 -extern int _XsCallLocalServer(); |
|
406 -extern int _XsReadLocalStream(); |
|
407 -extern int _XsErrorCall(); |
|
408 -extern int _XsWriteLocalStream(); |
|
409 -extern int _XsCloseLocalStream(); |
|
410 -extern int _XsSetupTliStream(); |
|
411 -extern int _XsConnectTliClient(); |
|
412 -extern int _XsCallTliServer(); |
|
413 -extern int _XsReadTliStream(); |
|
414 -extern int _XsWriteTliStream(); |
|
415 -extern int _XsCloseTliStream(); |
|
416 - |
|
417 - |
|
418 -Xstream _XsStream[] = { |
|
419 - |
|
420 - { |
|
421 - /* local connections using pseudo-ttys */ |
|
422 - |
|
423 - _XsSetupLocalStream, |
|
424 - _XsConnectLocalClient, |
|
425 - _XsCallLocalServer, |
|
426 - _XsReadLocalStream, |
|
427 - _XsErrorCall, |
|
428 - write, |
|
429 - close, |
|
430 - NULL |
|
431 - }, |
|
432 - { |
|
433 -#ifdef SVR4 |
|
434 - /* local connections using named streams */ |
|
435 - |
|
436 - _XsSetupNamedStream, |
|
437 -#else |
|
438 - /* local connections using streams */ |
|
439 - _XsSetupLocalStream, |
|
440 -#endif |
|
441 - _XsConnectLocalClient, |
|
442 - _XsCallLocalServer, |
|
443 - _XsReadLocalStream, |
|
444 - _XsErrorCall, |
|
445 - write, |
|
446 - close, |
|
447 - NULL |
|
448 - }, |
|
449 - /* Enhanced Application Compatibility Support */ |
|
450 - { |
|
451 -#ifdef SVR4 |
|
452 - /* SVR4 stream pipe code */ |
|
453 - _XsSetupSpStream, |
|
454 -#else |
|
455 - _XsSetupLocalStream, |
|
456 -#endif |
|
457 - _XsConnectLocalClient, |
|
458 - _XsCallLocalServer, |
|
459 - _XsReadLocalStream, |
|
460 - _XsErrorCall, |
|
461 - write, |
|
462 - close, |
|
463 - NULL |
|
464 - }, |
|
465 - /* End Enhanced Application Compatibility Support */ |
|
466 - |
|
467 - { |
|
468 - /* remote connections using tcp */ |
|
469 - _XsSetupTliStream, |
|
470 - _XsConnectTliClient, |
|
471 - _XsCallTliServer, |
|
472 - _XsReadLocalStream, |
|
473 - _XsErrorCall, |
|
474 - write, |
|
475 - close, |
|
476 - NULL |
|
477 - }, |
|
478 - { |
|
479 - /* remote connections using StarLan */ |
|
480 - _XsSetupTliStream, |
|
481 - _XsConnectTliClient, |
|
482 - _XsCallTliServer, |
|
483 - _XsReadLocalStream, |
|
484 - _XsErrorCall, |
|
485 - write, |
|
486 - close, |
|
487 - NULL |
|
488 - } |
|
489 -}; |
|
490 - |
|
491 - |
|
492 -#endif /* STREAMSCONN */ |
|
493 -#endif |
|
494 - |
|
495 - |
|
496 #ifdef XTEST1 |
|
497 /* |
|
498 * Stuff for input synthesis extension: |
|
499 diff --git a/src/xlibi18n/XimTrInt.h b/src/xlibi18n/XimTrInt.h |
|
500 index a08ac03..7cc9f85 100644 |
|
501 --- a/src/xlibi18n/XimTrInt.h |
|
502 +++ b/src/xlibi18n/XimTrInt.h |
|
503 @@ -73,7 +73,7 @@ extern Bool _XimXConf( |
|
504 char *address |
|
505 ); |
|
506 |
|
507 -#if defined(TCPCONN) || defined(UNIXCONN) || defined(DNETCONN) || defined(STREAMSCONN) |
|
508 +#if defined(TCPCONN) || defined(UNIXCONN) || defined(DNETCONN) |
|
509 |
|
510 extern Bool _XimTransConf( |
|
511 Xim im, |
|
512 -- |
|
513 1.7.9.2 |
|
514 |
|
515 From 3cd974b1d4d1fa6389d3695fa9fcc0c22a51d50c Mon Sep 17 00:00:00 2001 |
|
516 From: Alan Coopersmith <[email protected]> |
|
517 Date: Wed, 26 Dec 2012 22:57:39 -0800 |
|
518 Subject: [PATCH:libX11 33/58] Remove unused DECnet ("DNETCONN") code from |
|
519 Xlib |
|
520 |
|
521 Has never been converted to build in modular builds, so has been unusable |
|
522 since X11R7.0 release in 2005. DNETCONN support was removed from xtrans |
|
523 back in 2008. |
|
524 |
|
525 Signed-off-by: Alan Coopersmith <[email protected]> |
|
526 --- |
|
527 modules/im/ximcp/imTransR.c | 3 --- |
|
528 src/xlibi18n/XimTrInt.h | 2 +- |
|
529 2 files changed, 1 insertion(+), 4 deletions(-) |
|
530 |
|
531 diff --git a/modules/im/ximcp/imTransR.c b/modules/im/ximcp/imTransR.c |
|
532 index 4f843a0..caa5309 100644 |
|
533 --- a/modules/im/ximcp/imTransR.c |
|
534 +++ b/modules/im/ximcp/imTransR.c |
|
535 @@ -66,9 +66,6 @@ TransportSW _XimTransportRec[] = { |
|
536 #if defined(UNIXCONN) || defined(LOCALCONN) |
|
537 { "local", _XimTransConf }, /* use X transport lib */ |
|
538 #endif /* UNIXCONN */ |
|
539 -#ifdef DNETCONN |
|
540 - { "dnet", _XimTransConf }, /* use X transport lib */ |
|
541 -#endif /* DNETCONN */ |
|
542 { (char *)NULL, (Bool (*)(Xim, char *))NULL }, |
|
543 }; |
|
544 |
|
545 diff --git a/src/xlibi18n/XimTrInt.h b/src/xlibi18n/XimTrInt.h |
|
546 index 7cc9f85..bceab98 100644 |
|
547 --- a/src/xlibi18n/XimTrInt.h |
|
548 +++ b/src/xlibi18n/XimTrInt.h |
|
549 @@ -73,7 +73,7 @@ extern Bool _XimXConf( |
|
550 char *address |
|
551 ); |
|
552 |
|
553 -#if defined(TCPCONN) || defined(UNIXCONN) || defined(DNETCONN) |
|
554 +#if defined(TCPCONN) || defined(UNIXCONN) |
|
555 |
|
556 extern Bool _XimTransConf( |
|
557 Xim im, |
|
558 -- |
|
559 1.7.9.2 |
|
560 |
|
561 From deedeada53676ee529d700bf96fde0b29a3a1def Mon Sep 17 00:00:00 2001 |
|
562 From: Nickolai Zeldovich <[email protected]> |
|
563 Date: Tue, 22 Jan 2013 10:03:00 -0500 |
|
564 Subject: [PATCH:libX11 36/58] XListFontsWithInfo: avoid accessing realloc'ed |
|
565 memory |
|
566 |
|
567 If exactly one of the two reallocs in XListFontsWithInfo() fails, the |
|
568 subsequent code accesses memory freed by the other realloc. |
|
569 |
|
570 Signed-off-by: Nickolai Zeldovich <[email protected]> |
|
571 Reviewed-by: Alan Coopersmith <[email protected]> |
|
572 Signed-off-by: Alan Coopersmith <[email protected]> |
|
573 --- |
|
574 src/FontInfo.c | 13 +++++++------ |
|
575 1 file changed, 7 insertions(+), 6 deletions(-) |
|
576 |
|
577 diff --git a/src/FontInfo.c b/src/FontInfo.c |
|
578 index a3ab65b..97de40e 100644 |
|
579 --- a/src/FontInfo.c |
|
580 +++ b/src/FontInfo.c |
|
581 @@ -90,6 +90,11 @@ XFontStruct **info) /* RETURN */ |
|
582 Xrealloc ((char *) flist, |
|
583 (unsigned) (sizeof(char *) * (size+1))); |
|
584 |
|
585 + if (tmp_finfo) |
|
586 + finfo = tmp_finfo; |
|
587 + if (tmp_flist) |
|
588 + flist = tmp_flist; |
|
589 + |
|
590 if ((! tmp_finfo) || (! tmp_flist)) { |
|
591 /* free all the memory that we allocated */ |
|
592 for (j=(i-1); (j >= 0); j--) { |
|
593 @@ -97,14 +102,10 @@ XFontStruct **info) /* RETURN */ |
|
594 if (finfo[j].properties) |
|
595 Xfree((char *) finfo[j].properties); |
|
596 } |
|
597 - if (tmp_flist) Xfree((char *) tmp_flist); |
|
598 - else Xfree((char *) flist); |
|
599 - if (tmp_finfo) Xfree((char *) tmp_finfo); |
|
600 - else Xfree((char *) finfo); |
|
601 + Xfree((char *) flist); |
|
602 + Xfree((char *) finfo); |
|
603 goto clearwire; |
|
604 } |
|
605 - finfo = tmp_finfo; |
|
606 - flist = tmp_flist; |
|
607 } |
|
608 else { |
|
609 if (! (finfo = (XFontStruct *) |
|
610 -- |
|
611 1.7.9.2 |
|
612 |
|
613 From 54527eab93d46055cf11eb6c18abb353a03ae544 Mon Sep 17 00:00:00 2001 |
|
614 From: Alan Coopersmith <[email protected]> |
|
615 Date: Fri, 15 Feb 2013 22:45:19 -0800 |
|
616 Subject: [PATCH:libX11 37/58] cmsColNm.c: maintain constness of arguments to |
|
617 qsort helper function |
|
618 |
|
619 Fixes gcc warning: |
|
620 |
|
621 cmsColNm.c: In function 'FirstCmp': |
|
622 cmsColNm.c:257:20: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] |
|
623 cmsColNm.c:257:45: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] |
|
624 |
|
625 Signed-off-by: Alan Coopersmith <[email protected]> |
|
626 --- |
|
627 src/xcms/cmsColNm.c | 2 +- |
|
628 1 file changed, 1 insertion(+), 1 deletion(-) |
|
629 |
|
630 diff --git a/src/xcms/cmsColNm.c b/src/xcms/cmsColNm.c |
|
631 index 73977e5..a6749c0 100644 |
|
632 --- a/src/xcms/cmsColNm.c |
|
633 +++ b/src/xcms/cmsColNm.c |
|
634 @@ -254,7 +254,7 @@ FirstCmp(const void *p1, const void *p2) |
|
635 * |
|
636 */ |
|
637 { |
|
638 - return(strcmp(((XcmsPair *)p1)->first, ((XcmsPair *)p2)->first)); |
|
639 + return(strcmp(((const XcmsPair *)p1)->first, ((const XcmsPair *)p2)->first)); |
|
640 } |
|
641 |
|
642 |
|
643 -- |
|
644 1.7.9.2 |
|
645 |
|
646 From 7e3bf4dd83fec22bd568146de75e6d59eff74e21 Mon Sep 17 00:00:00 2001 |
|
647 From: Alan Coopersmith <[email protected]> |
|
648 Date: Fri, 15 Feb 2013 23:14:40 -0800 |
|
649 Subject: [PATCH:libX11 38/58] XRebindKeysym: Drop unnecessary const-removing |
|
650 cast |
|
651 |
|
652 C89 defines memcpy as taking a const void *, so casting from |
|
653 const unsigned char * to char * simply angers gcc for no benefit: |
|
654 |
|
655 KeyBind.c:1017:24: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] |
|
656 |
|
657 Signed-off-by: Alan Coopersmith <[email protected]> |
|
658 --- |
|
659 src/KeyBind.c | 2 +- |
|
660 1 file changed, 1 insertion(+), 1 deletion(-) |
|
661 |
|
662 diff --git a/src/KeyBind.c b/src/KeyBind.c |
|
663 index 221cedd..f22feca 100644 |
|
664 --- a/src/KeyBind.c |
|
665 +++ b/src/KeyBind.c |
|
666 @@ -1014,7 +1014,7 @@ XRebindKeysym ( |
|
667 dpy->key_bindings = p; |
|
668 dpy->free_funcs->key_bindings = _XFreeKeyBindings; |
|
669 p->next = tmp; /* chain onto list */ |
|
670 - memcpy (p->string, (char *) str, nbytes); |
|
671 + memcpy (p->string, str, nbytes); |
|
672 p->len = nbytes; |
|
673 memcpy ((char *) p->modifiers, (char *) mlist, nb); |
|
674 p->key = keysym; |
|
675 -- |
|
676 1.7.9.2 |
|
677 |
|
678 From afd6593da90e51234d59f8921c411317f91ab48b Mon Sep 17 00:00:00 2001 |
|
679 From: Alan Coopersmith <[email protected]> |
|
680 Date: Fri, 15 Feb 2013 23:25:38 -0800 |
|
681 Subject: [PATCH:libX11 39/58] XStringToKeysym: preserve constness when |
|
682 casting off unsignedness for strcmp |
|
683 |
|
684 Fixes gcc warning: |
|
685 StrKeysym.c:97:17: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] |
|
686 |
|
687 Signed-off-by: Alan Coopersmith <[email protected]> |
|
688 --- |
|
689 src/StrKeysym.c | 2 +- |
|
690 1 file changed, 1 insertion(+), 1 deletion(-) |
|
691 |
|
692 diff --git a/src/StrKeysym.c b/src/StrKeysym.c |
|
693 index 4394e0c..12fce68 100644 |
|
694 --- a/src/StrKeysym.c |
|
695 +++ b/src/StrKeysym.c |
|
696 @@ -94,7 +94,7 @@ XStringToKeysym(_Xconst char *s) |
|
697 { |
|
698 entry = &_XkeyTable[idx]; |
|
699 if ((entry[0] == sig1) && (entry[1] == sig2) && |
|
700 - !strcmp(s, (char *)entry + 6)) |
|
701 + !strcmp(s, (const char *)entry + 6)) |
|
702 { |
|
703 val = (entry[2] << 24) | (entry[3] << 16) | |
|
704 (entry[4] << 8) | entry[5]; |
|
705 -- |
|
706 1.7.9.2 |
|
707 |
|
708 From 6c558ee357292dd9dfc6d9006f4525f625327c52 Mon Sep 17 00:00:00 2001 |
|
709 From: Alan Coopersmith <[email protected]> |
|
710 Date: Fri, 15 Feb 2013 22:58:54 -0800 |
|
711 Subject: [PATCH:libX11 40/58] Fix comment typo & confusing indentation levels |
|
712 in Data() macro definition |
|
713 |
|
714 The final } matches the one on the #define line, not one that doesn't |
|
715 appear after the else statement it was lined up with |
|
716 |
|
717 Signed-off-by: Alan Coopersmith <[email protected]> |
|
718 --- |
|
719 include/X11/Xlibint.h | 4 ++-- |
|
720 1 file changed, 2 insertions(+), 2 deletions(-) |
|
721 |
|
722 diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h |
|
723 index 23e751b..7911fd7 100644 |
|
724 --- a/include/X11/Xlibint.h |
|
725 +++ b/include/X11/Xlibint.h |
|
726 @@ -574,7 +574,7 @@ extern void _XFlushGCCache(Display *dpy, GC gc); |
|
727 * 32 bit word alignment. Transmit if the buffer fills. |
|
728 * |
|
729 * "dpy" is a pointer to a Display. |
|
730 - * "data" is a pinter to a data buffer. |
|
731 + * "data" is a pointer to a data buffer. |
|
732 * "len" is the length of the data buffer. |
|
733 */ |
|
734 #ifndef DataRoutineIsProcedure |
|
735 @@ -584,7 +584,7 @@ extern void _XFlushGCCache(Display *dpy, GC gc); |
|
736 dpy->bufptr += ((len) + 3) & ~3;\ |
|
737 } else\ |
|
738 _XSend(dpy, data, len);\ |
|
739 - } |
|
740 +} |
|
741 #endif /* DataRoutineIsProcedure */ |
|
742 |
|
743 |
|
744 -- |
|
745 1.7.9.2 |
|
746 |
|
747 From f0b171c8ea7b055ba520272ea9a2604e18841ac7 Mon Sep 17 00:00:00 2001 |
|
748 From: Alan Coopersmith <[email protected]> |
|
749 Date: Fri, 15 Feb 2013 23:34:40 -0800 |
|
750 Subject: [PATCH:libX11 41/58] Preserve constness in casting arguments through |
|
751 the Data*() routines |
|
752 |
|
753 Casts were annoying gcc by dropping constness when changing types, |
|
754 when routines simply either copy data into the request buffer or |
|
755 send it directly to the X server, and never modify the input. |
|
756 |
|
757 Fixes gcc warnings including: |
|
758 ChProp.c: In function 'XChangeProperty': |
|
759 ChProp.c:65:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] |
|
760 ChProp.c:65:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] |
|
761 ChProp.c:74:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] |
|
762 ChProp.c:74:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] |
|
763 ChProp.c:83:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] |
|
764 SetHints.c: In function 'XSetStandardProperties': |
|
765 SetHints.c:262:20: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] |
|
766 SetPntMap.c: In function 'XSetPointerMapping': |
|
767 SetPntMap.c:46:5: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] |
|
768 SetPntMap.c:46:5: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] |
|
769 StBytes.c: In function 'XStoreBuffer': |
|
770 StBytes.c:97:33: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] |
|
771 StName.c: In function 'XStoreName': |
|
772 StName.c:40:27: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] |
|
773 StName.c: In function 'XSetIconName': |
|
774 StName.c:51:27: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] |
|
775 |
|
776 Signed-off-by: Alan Coopersmith <[email protected]> |
|
777 --- |
|
778 include/X11/Xlibint.h | 12 ++++++------ |
|
779 src/ChProp.c | 6 +++--- |
|
780 src/SetHints.c | 4 +++- |
|
781 src/SetPntMap.c | 2 +- |
|
782 src/StBytes.c | 2 +- |
|
783 src/StName.c | 6 +++--- |
|
784 src/XlibInt.c | 12 ++++++------ |
|
785 7 files changed, 23 insertions(+), 21 deletions(-) |
|
786 |
|
787 diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h |
|
788 index 7911fd7..c2232de 100644 |
|
789 --- a/include/X11/Xlibint.h |
|
790 +++ b/include/X11/Xlibint.h |
|
791 @@ -610,17 +610,17 @@ extern void _XFlushGCCache(Display *dpy, GC gc); |
|
792 dpy->bufptr += (n); |
|
793 |
|
794 #ifdef WORD64 |
|
795 -#define Data16(dpy, data, len) _XData16(dpy, (short *)data, len) |
|
796 -#define Data32(dpy, data, len) _XData32(dpy, (long *)data, len) |
|
797 +#define Data16(dpy, data, len) _XData16(dpy, (_Xconst short *)data, len) |
|
798 +#define Data32(dpy, data, len) _XData32(dpy, (_Xconst long *)data, len) |
|
799 #else |
|
800 -#define Data16(dpy, data, len) Data((dpy), (char *)(data), (len)) |
|
801 +#define Data16(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) |
|
802 #define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len)) |
|
803 #define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len)) |
|
804 #ifdef LONG64 |
|
805 -#define Data32(dpy, data, len) _XData32(dpy, (long *)data, len) |
|
806 +#define Data32(dpy, data, len) _XData32(dpy, (_Xconst long *)data, len) |
|
807 extern int _XData32( |
|
808 Display *dpy, |
|
809 - register long *data, |
|
810 + register _Xconst long *data, |
|
811 unsigned len |
|
812 ); |
|
813 extern void _XRead32( |
|
814 @@ -629,7 +629,7 @@ extern void _XRead32( |
|
815 long len |
|
816 ); |
|
817 #else |
|
818 -#define Data32(dpy, data, len) Data((dpy), (char *)(data), (len)) |
|
819 +#define Data32(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) |
|
820 #define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len)) |
|
821 #endif |
|
822 #endif /* not WORD64 */ |
|
823 diff --git a/src/ChProp.c b/src/ChProp.c |
|
824 index b957751..190a224 100644 |
|
825 --- a/src/ChProp.c |
|
826 +++ b/src/ChProp.c |
|
827 @@ -62,7 +62,7 @@ XChangeProperty ( |
|
828 len = ((long)nelements + 3)>>2; |
|
829 if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) { |
|
830 SetReqLen(req, len, len); |
|
831 - Data (dpy, (char *)data, nelements); |
|
832 + Data (dpy, (_Xconst char *)data, nelements); |
|
833 } /* else force BadLength */ |
|
834 break; |
|
835 |
|
836 @@ -71,7 +71,7 @@ XChangeProperty ( |
|
837 if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) { |
|
838 SetReqLen(req, len, len); |
|
839 len = (long)nelements << 1; |
|
840 - Data16 (dpy, (short *) data, len); |
|
841 + Data16 (dpy, (_Xconst short *) data, len); |
|
842 } /* else force BadLength */ |
|
843 break; |
|
844 |
|
845 @@ -80,7 +80,7 @@ XChangeProperty ( |
|
846 if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) { |
|
847 SetReqLen(req, len, len); |
|
848 len = (long)nelements << 2; |
|
849 - Data32 (dpy, (long *) data, len); |
|
850 + Data32 (dpy, (_Xconst long *) data, len); |
|
851 } /* else force BadLength */ |
|
852 break; |
|
853 |
|
854 diff --git a/src/SetHints.c b/src/SetHints.c |
|
855 index 0c33f59..1cde48f 100644 |
|
856 --- a/src/SetHints.c |
|
857 +++ b/src/SetHints.c |
|
858 @@ -259,7 +259,9 @@ XSetStandardProperties ( |
|
859 |
|
860 if (icon_string != NULL) { |
|
861 XChangeProperty (dpy, w, XA_WM_ICON_NAME, XA_STRING, 8, |
|
862 - PropModeReplace, (unsigned char *)icon_string, safestrlen(icon_string)); |
|
863 + PropModeReplace, |
|
864 + (_Xconst unsigned char *)icon_string, |
|
865 + safestrlen(icon_string)); |
|
866 } |
|
867 |
|
868 if (icon_pixmap != None) { |
|
869 diff --git a/src/SetPntMap.c b/src/SetPntMap.c |
|
870 index 2e29201..14e104d 100644 |
|
871 --- a/src/SetPntMap.c |
|
872 +++ b/src/SetPntMap.c |
|
873 @@ -43,7 +43,7 @@ XSetPointerMapping ( |
|
874 GetReq (SetPointerMapping, req); |
|
875 req->nElts = nmaps; |
|
876 req->length += (nmaps + 3)>>2; |
|
877 - Data (dpy, (char *)map, (long) nmaps); |
|
878 + Data (dpy, (_Xconst char *)map, (long) nmaps); |
|
879 if (_XReply (dpy, (xReply *)&rep, 0, xFalse) == 0) |
|
880 rep.success = MappingSuccess; |
|
881 UnlockDisplay(dpy); |
|
882 diff --git a/src/StBytes.c b/src/StBytes.c |
|
883 index 13ac879..07ee441 100644 |
|
884 --- a/src/StBytes.c |
|
885 +++ b/src/StBytes.c |
|
886 @@ -94,7 +94,7 @@ XStoreBuffer ( |
|
887 { |
|
888 if ((buffer < 0) || (buffer > 7)) return 0; |
|
889 return XChangeProperty(dpy, RootWindow(dpy, 0), n_to_atom[buffer], |
|
890 - XA_STRING, 8, PropModeReplace, (unsigned char *) bytes, nbytes); |
|
891 + XA_STRING, 8, PropModeReplace, (_Xconst unsigned char *) bytes, nbytes); |
|
892 } |
|
893 |
|
894 int |
|
895 diff --git a/src/StName.c b/src/StName.c |
|
896 index fb1e6f5..b4048bf 100644 |
|
897 --- a/src/StName.c |
|
898 +++ b/src/StName.c |
|
899 @@ -37,7 +37,7 @@ XStoreName ( |
|
900 _Xconst char *name) |
|
901 { |
|
902 return XChangeProperty(dpy, w, XA_WM_NAME, XA_STRING, |
|
903 - 8, PropModeReplace, (unsigned char *)name, |
|
904 + 8, PropModeReplace, (_Xconst unsigned char *)name, |
|
905 name ? strlen(name) : 0); |
|
906 } |
|
907 |
|
908 @@ -47,7 +47,7 @@ XSetIconName ( |
|
909 Window w, |
|
910 _Xconst char *icon_name) |
|
911 { |
|
912 - return XChangeProperty(dpy, w, XA_WM_ICON_NAME, XA_STRING, |
|
913 - 8, PropModeReplace, (unsigned char *)icon_name, |
|
914 + return XChangeProperty(dpy, w, XA_WM_ICON_NAME, XA_STRING, 8, |
|
915 + PropModeReplace, (_Xconst unsigned char *)icon_name, |
|
916 icon_name ? strlen(icon_name) : 0); |
|
917 } |
|
918 diff --git a/src/XlibInt.c b/src/XlibInt.c |
|
919 index 2827c10..e4d35fd 100644 |
|
920 --- a/src/XlibInt.c |
|
921 +++ b/src/XlibInt.c |
|
922 @@ -1722,7 +1722,7 @@ void _Xbcopy(b1, b2, length) |
|
923 #ifdef DataRoutineIsProcedure |
|
924 void Data( |
|
925 Display *dpy, |
|
926 - char *data, |
|
927 + _Xconst char *data, |
|
928 long len) |
|
929 { |
|
930 if (dpy->bufptr + (len) <= dpy->bufmax) { |
|
931 @@ -1739,7 +1739,7 @@ void Data( |
|
932 int |
|
933 _XData32( |
|
934 Display *dpy, |
|
935 - register long *data, |
|
936 + register _Xconst long *data, |
|
937 unsigned len) |
|
938 { |
|
939 register int *buf; |
|
940 @@ -1781,7 +1781,7 @@ _XData32( |
|
941 |
|
942 static doData16( |
|
943 register Display *dpy, |
|
944 - short *data, |
|
945 + _Xconst short *data, |
|
946 unsigned len, |
|
947 char *packbuffer) |
|
948 { |
|
949 @@ -1814,7 +1814,7 @@ static doData16( |
|
950 |
|
951 _XData16 ( |
|
952 Display *dpy, |
|
953 - short *data, |
|
954 + _Xconst short *data, |
|
955 unsigned len) |
|
956 { |
|
957 char packbuffer[PACKBUFFERSIZE]; |
|
958 @@ -1836,7 +1836,7 @@ _XData16 ( |
|
959 |
|
960 static doData32( |
|
961 register Display *dpy |
|
962 - long *data, |
|
963 + _Xconst long *data, |
|
964 unsigned len, |
|
965 char *packbuffer) |
|
966 { |
|
967 @@ -1867,7 +1867,7 @@ static doData32( |
|
968 |
|
969 void _XData32( |
|
970 Display *dpy, |
|
971 - long *data, |
|
972 + _Xconst long *data, |
|
973 unsigned len) |
|
974 { |
|
975 char packbuffer[PACKBUFFERSIZE]; |
|
976 -- |
|
977 1.7.9.2 |
|
978 |
|
979 From b092dabbd712d7b656abcf572d253b9b206c0237 Mon Sep 17 00:00:00 2001 |
|
980 From: Alan Coopersmith <[email protected]> |
|
981 Date: Fri, 15 Feb 2013 23:43:12 -0800 |
|
982 Subject: [PATCH:libX11 42/58] XKeysymToString: move variable declarations to |
|
983 the scope of their usage |
|
984 |
|
985 Makes it easier for readers to understand scope of variable usage, and |
|
986 clears up gcc warning: |
|
987 |
|
988 KeysymStr.c: In function 'XKeysymToString': |
|
989 KeysymStr.c:128:13: warning: declaration of 'i' shadows a previous local [-Wshadow] |
|
990 KeysymStr.c:73:18: warning: shadowed declaration is here [-Wshadow] |
|
991 |
|
992 Signed-off-by: Alan Coopersmith <[email protected]> |
|
993 --- |
|
994 src/KeysymStr.c | 24 ++++++++++-------------- |
|
995 1 file changed, 10 insertions(+), 14 deletions(-) |
|
996 |
|
997 diff --git a/src/KeysymStr.c b/src/KeysymStr.c |
|
998 index 101f297..f24f3b1 100644 |
|
999 --- a/src/KeysymStr.c |
|
1000 +++ b/src/KeysymStr.c |
|
1001 @@ -70,11 +70,6 @@ SameValue( |
|
1002 |
|
1003 char *XKeysymToString(KeySym ks) |
|
1004 { |
|
1005 - register int i, n; |
|
1006 - int h; |
|
1007 - register int idx; |
|
1008 - const unsigned char *entry; |
|
1009 - unsigned char val1, val2, val3, val4; |
|
1010 XrmDatabase keysymdb; |
|
1011 |
|
1012 if (!ks || (ks & ((unsigned long) ~0x1fffffff)) != 0) |
|
1013 @@ -83,16 +78,17 @@ char *XKeysymToString(KeySym ks) |
|
1014 ks = 0; |
|
1015 if (ks <= 0x1fffffff) |
|
1016 { |
|
1017 - val1 = ks >> 24; |
|
1018 - val2 = (ks >> 16) & 0xff; |
|
1019 - val3 = (ks >> 8) & 0xff; |
|
1020 - val4 = ks & 0xff; |
|
1021 - i = ks % VTABLESIZE; |
|
1022 - h = i + 1; |
|
1023 - n = VMAXHASH; |
|
1024 + unsigned char val1 = ks >> 24; |
|
1025 + unsigned char val2 = (ks >> 16) & 0xff; |
|
1026 + unsigned char val3 = (ks >> 8) & 0xff; |
|
1027 + unsigned char val4 = ks & 0xff; |
|
1028 + int i = ks % VTABLESIZE; |
|
1029 + int h = i + 1; |
|
1030 + int n = VMAXHASH; |
|
1031 + int idx; |
|
1032 while ((idx = hashKeysym[i])) |
|
1033 { |
|
1034 - entry = &_XkeyTable[idx]; |
|
1035 + const unsigned char *entry = &_XkeyTable[idx]; |
|
1036 if ((entry[0] == val1) && (entry[1] == val2) && |
|
1037 (entry[2] == val3) && (entry[3] == val4)) |
|
1038 return ((char *)entry + 4); |
|
1039 @@ -136,7 +132,7 @@ char *XKeysymToString(KeySym ks) |
|
1040 i--; |
|
1041 s[i--] = '\0'; |
|
1042 for (; i; i--){ |
|
1043 - val1 = val & 0xf; |
|
1044 + unsigned char val1 = val & 0xf; |
|
1045 val >>= 4; |
|
1046 if (val1 < 10) |
|
1047 s[i] = '0'+ val1; |
|
1048 -- |
|
1049 1.7.9.2 |
|
1050 |
|
1051 From b687440c28c7da6ee0ae44514d20248db5161606 Mon Sep 17 00:00:00 2001 |
|
1052 From: Alan Coopersmith <[email protected]> |
|
1053 Date: Sat, 16 Feb 2013 10:42:23 -0800 |
|
1054 Subject: [PATCH:libX11 43/58] Convert more sprintf calls to snprintf |
|
1055 |
|
1056 You could analyze most of these and quickly recognize that there was no |
|
1057 chance of buffer overflow already, but why make everyone spend time doing |
|
1058 that when we can just make it obviously safe? |
|
1059 |
|
1060 Signed-off-by: Alan Coopersmith <[email protected]> |
|
1061 --- |
|
1062 src/ErrDes.c | 9 +++++---- |
|
1063 src/GetDflt.c | 2 +- |
|
1064 src/KeysymStr.c | 2 +- |
|
1065 src/XlibInt.c | 8 ++++---- |
|
1066 4 files changed, 11 insertions(+), 10 deletions(-) |
|
1067 |
|
1068 diff --git a/src/ErrDes.c b/src/ErrDes.c |
|
1069 index 9a5b180..ef5edad 100644 |
|
1070 --- a/src/ErrDes.c |
|
1071 +++ b/src/ErrDes.c |
|
1072 @@ -109,7 +109,7 @@ XGetErrorText( |
|
1073 |
|
1074 if (nbytes == 0) return 0; |
|
1075 if (code <= BadImplementation && code > 0) { |
|
1076 - sprintf(buf, "%d", code); |
|
1077 + snprintf(buf, sizeof(buf), "%d", code); |
|
1078 (void) XGetErrorDatabaseText(dpy, "XProtoError", buf, |
|
1079 _XErrorList + _XErrorOffsets[code], |
|
1080 buffer, nbytes); |
|
1081 @@ -125,11 +125,12 @@ XGetErrorText( |
|
1082 bext = ext; |
|
1083 } |
|
1084 if (!buffer[0] && bext) { |
|
1085 - sprintf(buf, "%s.%d", bext->name, code - bext->codes.first_error); |
|
1086 + snprintf(buf, sizeof(buf), "%s.%d", |
|
1087 + bext->name, code - bext->codes.first_error); |
|
1088 (void) XGetErrorDatabaseText(dpy, "XProtoError", buf, "", buffer, nbytes); |
|
1089 } |
|
1090 if (!buffer[0]) |
|
1091 - sprintf(buffer, "%d", code); |
|
1092 + snprintf(buffer, nbytes, "%d", code); |
|
1093 return 0; |
|
1094 } |
|
1095 |
|
1096 @@ -190,7 +191,7 @@ XGetErrorDatabaseText( |
|
1097 else |
|
1098 tptr = Xmalloc (tlen); |
|
1099 if (tptr) { |
|
1100 - sprintf(tptr, "%s.%s", name, type); |
|
1101 + snprintf(tptr, tlen, "%s.%s", name, type); |
|
1102 XrmGetResource(db, tptr, "ErrorType.ErrorNumber", |
|
1103 &type_str, &result); |
|
1104 if (tptr != temp) |
|
1105 diff --git a/src/GetDflt.c b/src/GetDflt.c |
|
1106 index dfda1c6..6f62cd8 100644 |
|
1107 --- a/src/GetDflt.c |
|
1108 +++ b/src/GetDflt.c |
|
1109 @@ -110,7 +110,7 @@ GetHomeDir( |
|
1110 len2 = strlen (ptr2); |
|
1111 } |
|
1112 if ((len1 + len2 + 1) < len) |
|
1113 - sprintf (dest, "%s%s", ptr1, (ptr2) ? ptr2 : ""); |
|
1114 + snprintf (dest, len, "%s%s", ptr1, (ptr2) ? ptr2 : ""); |
|
1115 else |
|
1116 *dest = '\0'; |
|
1117 #else |
|
1118 diff --git a/src/KeysymStr.c b/src/KeysymStr.c |
|
1119 index f24f3b1..c7c4704 100644 |
|
1120 --- a/src/KeysymStr.c |
|
1121 +++ b/src/KeysymStr.c |
|
1122 @@ -107,7 +107,7 @@ char *XKeysymToString(KeySym ks) |
|
1123 XrmQuark empty = NULLQUARK; |
|
1124 GRNData data; |
|
1125 |
|
1126 - sprintf(buf, "%lX", ks); |
|
1127 + snprintf(buf, sizeof(buf), "%lX", ks); |
|
1128 resval.addr = (XPointer)buf; |
|
1129 resval.size = strlen(buf) + 1; |
|
1130 data.name = (char *)NULL; |
|
1131 diff --git a/src/XlibInt.c b/src/XlibInt.c |
|
1132 index e4d35fd..c436842 100644 |
|
1133 --- a/src/XlibInt.c |
|
1134 +++ b/src/XlibInt.c |
|
1135 @@ -1432,7 +1432,7 @@ static int _XPrintDefaultError( |
|
1136 mesg, BUFSIZ); |
|
1137 (void) fprintf(fp, mesg, event->request_code); |
|
1138 if (event->request_code < 128) { |
|
1139 - sprintf(number, "%d", event->request_code); |
|
1140 + snprintf(number, sizeof(number), "%d", event->request_code); |
|
1141 XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); |
|
1142 } else { |
|
1143 for (ext = dpy->ext_procs; |
|
1144 @@ -1452,7 +1452,7 @@ static int _XPrintDefaultError( |
|
1145 fputs(" ", fp); |
|
1146 (void) fprintf(fp, mesg, event->minor_code); |
|
1147 if (ext) { |
|
1148 - sprintf(mesg, "%s.%d", ext->name, event->minor_code); |
|
1149 + snprintf(mesg, sizeof(mesg), "%s.%d", ext->name, event->minor_code); |
|
1150 XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ); |
|
1151 (void) fprintf(fp, " (%s)", buffer); |
|
1152 } |
|
1153 @@ -1475,8 +1475,8 @@ static int _XPrintDefaultError( |
|
1154 bext = ext; |
|
1155 } |
|
1156 if (bext) |
|
1157 - sprintf(buffer, "%s.%d", bext->name, |
|
1158 - event->error_code - bext->codes.first_error); |
|
1159 + snprintf(buffer, sizeof(buffer), "%s.%d", bext->name, |
|
1160 + event->error_code - bext->codes.first_error); |
|
1161 else |
|
1162 strcpy(buffer, "Value"); |
|
1163 XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ); |
|
1164 -- |
|
1165 1.7.9.2 |
|
1166 |
|
1167 From 9399caf2c12cbe1ed56f4f6b368c5811cb5d0458 Mon Sep 17 00:00:00 2001 |
|
1168 From: Alan Coopersmith <[email protected]> |
|
1169 Date: Thu, 28 Feb 2013 20:04:25 -0800 |
|
1170 Subject: [PATCH:libX11 44/58] unifdef MUSTCOPY |
|
1171 |
|
1172 MUSTCOPY seems to have only been defined in <X11/Xmd.h> when building for |
|
1173 CRAY, to handle missing some sizes of integer type. |
|
1174 |
|
1175 (mostly performed with unifdef, followed by some manual cleanup of |
|
1176 spacing/indenting in the remaining code) |
|
1177 |
|
1178 Signed-off-by: Alan Coopersmith <[email protected]> |
|
1179 Reviewed-by: Peter Hutterer <[email protected]> |
|
1180 --- |
|
1181 include/X11/Xlibint.h | 9 ----- |
|
1182 modules/om/generic/omXChar.c | 91 +++++------------------------------------- |
|
1183 src/ChWindow.c | 9 ----- |
|
1184 src/ConfWind.c | 13 ------ |
|
1185 src/CrWindow.c | 9 ----- |
|
1186 src/DrArc.c | 12 ------ |
|
1187 src/DrLine.c | 16 -------- |
|
1188 src/DrPoint.c | 15 ------- |
|
1189 src/DrRect.c | 16 -------- |
|
1190 src/FillArc.c | 16 -------- |
|
1191 src/FillRct.c | 15 ------- |
|
1192 src/Font.c | 44 +------------------- |
|
1193 src/FontInfo.c | 24 +---------- |
|
1194 src/MoveWin.c | 9 ----- |
|
1195 src/PolyTxt16.c | 23 ----------- |
|
1196 src/RestackWs.c | 9 ----- |
|
1197 src/StColor.c | 12 ------ |
|
1198 src/Text16.c | 23 ----------- |
|
1199 src/XlibAsync.c | 5 --- |
|
1200 19 files changed, 11 insertions(+), 359 deletions(-) |
|
1201 |
|
1202 diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h |
|
1203 index c2232de..5a7c0ed 100644 |
|
1204 --- a/include/X11/Xlibint.h |
|
1205 +++ b/include/X11/Xlibint.h |
|
1206 @@ -701,19 +701,10 @@ extern void _XRead32( |
|
1207 } |
|
1208 |
|
1209 |
|
1210 -#ifdef MUSTCOPY |
|
1211 - |
|
1212 -/* for when 32-bit alignment is not good enough */ |
|
1213 -#define OneDataCard32(dpy,dstaddr,srcvar) \ |
|
1214 - { dpy->bufptr -= 4; Data32 (dpy, (char *) &(srcvar), 4); } |
|
1215 - |
|
1216 -#else |
|
1217 - |
|
1218 /* srcvar must be a variable for large architecture version */ |
|
1219 #define OneDataCard32(dpy,dstaddr,srcvar) \ |
|
1220 { *(CARD32 *)(dstaddr) = (srcvar); } |
|
1221 |
|
1222 -#endif /* MUSTCOPY */ |
|
1223 |
|
1224 typedef struct _XInternalAsync { |
|
1225 struct _XInternalAsync *next; |
|
1226 diff --git a/modules/om/generic/omXChar.c b/modules/om/generic/omXChar.c |
|
1227 index ff517d5..c9bbb8e 100644 |
|
1228 --- a/modules/om/generic/omXChar.c |
|
1229 +++ b/modules/om/generic/omXChar.c |
|
1230 @@ -262,47 +262,6 @@ _XomGetFontSetFromCharSet( |
|
1231 return (FontSet) NULL; |
|
1232 } |
|
1233 |
|
1234 -#ifdef MUSTCOPY |
|
1235 -static void |
|
1236 -cs_to_xchar2b( |
|
1237 - register char *from, |
|
1238 - register XChar2b *to, |
|
1239 - register length) |
|
1240 -{ |
|
1241 - while (length-- > 0) { |
|
1242 - to->byte1 = *from++; |
|
1243 - to->byte2 = *from++; |
|
1244 - to++; |
|
1245 - } |
|
1246 -} |
|
1247 - |
|
1248 -static void |
|
1249 -cs_to_xchar2b_gl( |
|
1250 - register char *from, |
|
1251 - register XChar2b *to, |
|
1252 - register length) |
|
1253 -{ |
|
1254 - while (length-- > 0) { |
|
1255 - to->byte1 = *from++ & 0x7f; |
|
1256 - to->byte2 = *from++ & 0x7f; |
|
1257 - to++; |
|
1258 - } |
|
1259 -} |
|
1260 - |
|
1261 -static void |
|
1262 -cs_to_xchar2b_gr( |
|
1263 - register char *from, |
|
1264 - register XChar2b *to, |
|
1265 - register length) |
|
1266 -{ |
|
1267 - while (length-- > 0) { |
|
1268 - to->byte1 = *from++ | 0x80; |
|
1269 - to->byte2 = *from++ | 0x80; |
|
1270 - to++; |
|
1271 - } |
|
1272 -} |
|
1273 -#endif |
|
1274 - |
|
1275 static void |
|
1276 shift_to_gl( |
|
1277 register char *text, |
|
1278 @@ -358,10 +317,6 @@ _XomConvert( |
|
1279 XlcCharSet charset; |
|
1280 int length, cs_left, ret; |
|
1281 FontSet font_set; |
|
1282 -#ifdef MUSTCOPY |
|
1283 - XChar2b *xchar2b; |
|
1284 - char *buf, buf_local[BUFSIZ]; |
|
1285 -#endif |
|
1286 |
|
1287 cs = *to; |
|
1288 cs_left = *to_left; |
|
1289 @@ -380,46 +335,18 @@ _XomConvert( |
|
1290 |
|
1291 length = *to_left - cs_left; |
|
1292 |
|
1293 -#ifdef MUSTCOPY |
|
1294 - if (font_set->is_xchar2b) { |
|
1295 - buf = (length > BUFSIZ) ? Xmalloc(length) : buf_local; |
|
1296 - if (buf == NULL) |
|
1297 - return -1; |
|
1298 - memcpy(buf, (char *) *to, length); |
|
1299 - |
|
1300 - xchar2b = (XChar2b *) *to; |
|
1301 - length >>= 1; |
|
1302 - |
|
1303 - if (font_set->side == charset->side) |
|
1304 - cs_to_xchar2b(buf, xchar2b, length); |
|
1305 - else if (font_set->side == XlcGL) |
|
1306 - cs_to_xchar2b_gl(buf, xchar2b, length); |
|
1307 + if (font_set->side != charset->side) { |
|
1308 + if (font_set->side == XlcGL) |
|
1309 + shift_to_gl(*to, length); |
|
1310 else if (font_set->side == XlcGR) |
|
1311 - cs_to_xchar2b_gr(buf, xchar2b, length); |
|
1312 - else |
|
1313 - cs_to_xchar2b(buf, xchar2b, length); |
|
1314 - |
|
1315 - if (buf != buf_local) |
|
1316 - Xfree(buf); |
|
1317 - |
|
1318 - *to = (XPointer) (xchar2b + length); |
|
1319 - *to_left -= length; |
|
1320 - } else |
|
1321 -#endif |
|
1322 - { |
|
1323 - if (font_set->side != charset->side) { |
|
1324 - if (font_set->side == XlcGL) |
|
1325 - shift_to_gl(*to, length); |
|
1326 - else if (font_set->side == XlcGR) |
|
1327 - shift_to_gr(*to, length); |
|
1328 - } |
|
1329 - |
|
1330 - if (font_set->is_xchar2b) |
|
1331 - length >>= 1; |
|
1332 - *to = cs; |
|
1333 - *to_left -= length; |
|
1334 + shift_to_gr(*to, length); |
|
1335 } |
|
1336 |
|
1337 + if (font_set->is_xchar2b) |
|
1338 + length >>= 1; |
|
1339 + *to = cs; |
|
1340 + *to_left -= length; |
|
1341 + |
|
1342 *((XFontStruct **) args[0]) = font_set->font; |
|
1343 *((Bool *) args[1]) = font_set->is_xchar2b; |
|
1344 if(num_args >= 3){ |
|
1345 diff --git a/src/ChWindow.c b/src/ChWindow.c |
|
1346 index fbd6e88..89a81e1 100644 |
|
1347 --- a/src/ChWindow.c |
|
1348 +++ b/src/ChWindow.c |
|
1349 @@ -43,20 +43,11 @@ XResizeWindow( |
|
1350 |
|
1351 req->window = w; |
|
1352 req->mask = CWWidth | CWHeight; |
|
1353 -#ifdef MUSTCOPY |
|
1354 - { |
|
1355 - unsigned long lwidth = width, lheight = height; |
|
1356 - dpy->bufptr -= 8; |
|
1357 - Data32 (dpy, (long *) &lwidth, 4); /* order dictated by values of */ |
|
1358 - Data32 (dpy, (long *) &lheight, 4); /* CWWidth and CWHeight */ |
|
1359 - } |
|
1360 -#else |
|
1361 { |
|
1362 CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xConfigureWindowReq); |
|
1363 *valuePtr++ = width; |
|
1364 *valuePtr = height; |
|
1365 } |
|
1366 -#endif /* MUSTCOPY */ |
|
1367 UnlockDisplay(dpy); |
|
1368 SyncHandle(); |
|
1369 return 1; |
|
1370 diff --git a/src/ConfWind.c b/src/ConfWind.c |
|
1371 index dd55b44..eefce4d 100644 |
|
1372 --- a/src/ConfWind.c |
|
1373 +++ b/src/ConfWind.c |
|
1374 @@ -44,18 +44,6 @@ XMoveResizeWindow( |
|
1375 GetReqExtra(ConfigureWindow, 16, req); |
|
1376 req->window = w; |
|
1377 req->mask = CWX | CWY | CWWidth | CWHeight; |
|
1378 -#ifdef MUSTCOPY |
|
1379 - { |
|
1380 - long lx = x, ly = y; |
|
1381 - unsigned long lwidth = width, lheight = height; |
|
1382 - |
|
1383 - dpy->bufptr -= 16; |
|
1384 - Data32 (dpy, (long *) &lx, 4); /* order must match values of */ |
|
1385 - Data32 (dpy, (long *) &ly, 4); /* CWX, CWY, CWWidth, and CWHeight */ |
|
1386 - Data32 (dpy, (long *) &lwidth, 4); |
|
1387 - Data32 (dpy, (long *) &lheight, 4); |
|
1388 - } |
|
1389 -#else |
|
1390 { |
|
1391 register CARD32 *valuePtr = |
|
1392 (CARD32 *) NEXTPTR(req,xConfigureWindowReq); |
|
1393 @@ -64,7 +52,6 @@ XMoveResizeWindow( |
|
1394 *valuePtr++ = width; |
|
1395 *valuePtr = height; |
|
1396 } |
|
1397 -#endif /* MUSTCOPY */ |
|
1398 UnlockDisplay(dpy); |
|
1399 SyncHandle(); |
|
1400 return 1; |
|
1401 diff --git a/src/CrWindow.c b/src/CrWindow.c |
|
1402 index 23f7ddc..7b54601 100644 |
|
1403 --- a/src/CrWindow.c |
|
1404 +++ b/src/CrWindow.c |
|
1405 @@ -57,20 +57,11 @@ Window XCreateSimpleWindow( |
|
1406 wid = req->wid = XAllocID(dpy); |
|
1407 req->mask = CWBackPixel | CWBorderPixel; |
|
1408 |
|
1409 -#ifdef MUSTCOPY |
|
1410 - { |
|
1411 - unsigned long lbackground = background, lborder = border; |
|
1412 - dpy->bufptr -= 8; |
|
1413 - Data32 (dpy, (long *) &lbackground, 4); |
|
1414 - Data32 (dpy, (long *) &lborder, 4); |
|
1415 - } |
|
1416 -#else |
|
1417 { |
|
1418 register CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xCreateWindowReq); |
|
1419 *valuePtr++ = background; |
|
1420 *valuePtr = border; |
|
1421 } |
|
1422 -#endif /* MUSTCOPY */ |
|
1423 |
|
1424 UnlockDisplay(dpy); |
|
1425 SyncHandle(); |
|
1426 diff --git a/src/DrArc.c b/src/DrArc.c |
|
1427 index 1dc4a07..d72fac9 100644 |
|
1428 --- a/src/DrArc.c |
|
1429 +++ b/src/DrArc.c |
|
1430 @@ -49,12 +49,6 @@ XDrawArc( |
|
1431 { |
|
1432 register xPolyArcReq *req; |
|
1433 register xArc *arc; |
|
1434 -#ifdef MUSTCOPY |
|
1435 - xArc arcdata; |
|
1436 - long len = SIZEOF(xArc); |
|
1437 - |
|
1438 - arc = &arcdata; |
|
1439 -#endif /* MUSTCOPY */ |
|
1440 |
|
1441 LockDisplay(dpy); |
|
1442 FlushGC(dpy, gc); |
|
1443 @@ -63,9 +57,7 @@ XDrawArc( |
|
1444 req->drawable = d; |
|
1445 req->gc = gc->gid; |
|
1446 |
|
1447 -#ifndef MUSTCOPY |
|
1448 arc = (xArc *) NEXTPTR(req,xPolyArcReq); |
|
1449 -#endif /* MUSTCOPY */ |
|
1450 |
|
1451 arc->x = x; |
|
1452 arc->y = y; |
|
1453 @@ -74,10 +66,6 @@ XDrawArc( |
|
1454 arc->angle1 = angle1; |
|
1455 arc->angle2 = angle2; |
|
1456 |
|
1457 -#ifdef MUSTCOPY |
|
1458 - dpy->bufptr -= SIZEOF(xArc); |
|
1459 - Data (dpy, (char *) arc, len); |
|
1460 -#endif /* MUSTCOPY */ |
|
1461 |
|
1462 UnlockDisplay(dpy); |
|
1463 SyncHandle(); |
|
1464 diff --git a/src/DrLine.c b/src/DrLine.c |
|
1465 index 3786f59..dc82d5a 100644 |
|
1466 --- a/src/DrLine.c |
|
1467 +++ b/src/DrLine.c |
|
1468 @@ -45,12 +45,6 @@ XDrawLine ( |
|
1469 int y2) |
|
1470 { |
|
1471 register xSegment *segment; |
|
1472 -#ifdef MUSTCOPY |
|
1473 - xSegment segmentdata; |
|
1474 - long len = SIZEOF(xSegment); |
|
1475 - |
|
1476 - segment = &segmentdata; |
|
1477 -#endif /* not MUSTCOPY */ |
|
1478 |
|
1479 LockDisplay(dpy); |
|
1480 FlushGC(dpy, gc); |
|
1481 @@ -67,21 +61,15 @@ XDrawLine ( |
|
1482 && (((char *)dpy->bufptr - (char *)req) < (gc->values.line_width ? |
|
1483 wsize : zsize)) ) { |
|
1484 req->length += SIZEOF(xSegment) >> 2; |
|
1485 -#ifndef MUSTCOPY |
|
1486 segment = (xSegment *) dpy->bufptr; |
|
1487 dpy->bufptr += SIZEOF(xSegment); |
|
1488 -#endif /* not MUSTCOPY */ |
|
1489 } |
|
1490 |
|
1491 else { |
|
1492 GetReqExtra (PolySegment, SIZEOF(xSegment), req); |
|
1493 req->drawable = d; |
|
1494 req->gc = gc->gid; |
|
1495 -#ifdef MUSTCOPY |
|
1496 - dpy->bufptr -= SIZEOF(xSegment); |
|
1497 -#else |
|
1498 segment = (xSegment *) NEXTPTR(req,xPolySegmentReq); |
|
1499 -#endif /* MUSTCOPY */ |
|
1500 } |
|
1501 |
|
1502 segment->x1 = x1; |
|
1503 @@ -89,10 +77,6 @@ XDrawLine ( |
|
1504 segment->x2 = x2; |
|
1505 segment->y2 = y2; |
|
1506 |
|
1507 -#ifdef MUSTCOPY |
|
1508 - Data (dpy, (char *) &segmentdata, len); |
|
1509 -#endif /* MUSTCOPY */ |
|
1510 - |
|
1511 UnlockDisplay(dpy); |
|
1512 SyncHandle(); |
|
1513 } |
|
1514 diff --git a/src/DrPoint.c b/src/DrPoint.c |
|
1515 index 5c89b5c..f0332e8 100644 |
|
1516 --- a/src/DrPoint.c |
|
1517 +++ b/src/DrPoint.c |
|
1518 @@ -42,12 +42,6 @@ XDrawPoint( |
|
1519 int y) /* INT16 */ |
|
1520 { |
|
1521 xPoint *point; |
|
1522 -#ifdef MUSTCOPY |
|
1523 - xPoint pointdata; |
|
1524 - long len = SIZEOF(xPoint); |
|
1525 - |
|
1526 - point = &pointdata; |
|
1527 -#endif /* MUSTCOPY */ |
|
1528 |
|
1529 LockDisplay(dpy); |
|
1530 FlushGC(dpy, gc); |
|
1531 @@ -65,10 +59,8 @@ XDrawPoint( |
|
1532 && ((dpy->bufptr + SIZEOF(xPoint)) <= dpy->bufmax) |
|
1533 && (((char *)dpy->bufptr - (char *)req) < size) ) { |
|
1534 req->length += SIZEOF(xPoint) >> 2; |
|
1535 -#ifndef MUSTCOPY |
|
1536 point = (xPoint *) dpy->bufptr; |
|
1537 dpy->bufptr += SIZEOF(xPoint); |
|
1538 -#endif /* not MUSTCOPY */ |
|
1539 } |
|
1540 |
|
1541 else { |
|
1542 @@ -76,19 +68,12 @@ XDrawPoint( |
|
1543 req->drawable = d; |
|
1544 req->gc = gc->gid; |
|
1545 req->coordMode = CoordModeOrigin; |
|
1546 -#ifdef MUSTCOPY |
|
1547 - dpy->bufptr -= SIZEOF(xPoint); |
|
1548 -#else |
|
1549 point = (xPoint *) NEXTPTR(req,xPolyPointReq); |
|
1550 -#endif /* MUSTCOPY */ |
|
1551 } |
|
1552 |
|
1553 point->x = x; |
|
1554 point->y = y; |
|
1555 |
|
1556 -#ifdef MUSTCOPY |
|
1557 - Data (dpy, (char *) point, len); |
|
1558 -#endif /* MUSTCOPY */ |
|
1559 } |
|
1560 UnlockDisplay(dpy); |
|
1561 SyncHandle(); |
|
1562 diff --git a/src/DrRect.c b/src/DrRect.c |
|
1563 index dadd55e..d9141ee 100644 |
|
1564 --- a/src/DrRect.c |
|
1565 +++ b/src/DrRect.c |
|
1566 @@ -45,12 +45,6 @@ XDrawRectangle( |
|
1567 unsigned int height) /* CARD16 */ |
|
1568 { |
|
1569 xRectangle *rect; |
|
1570 -#ifdef MUSTCOPY |
|
1571 - xRectangle rectdata; |
|
1572 - long len = SIZEOF(xRectangle); |
|
1573 - |
|
1574 - rect = &rectdata; |
|
1575 -#endif /* MUSTCOPY */ |
|
1576 |
|
1577 LockDisplay(dpy); |
|
1578 FlushGC(dpy, gc); |
|
1579 @@ -67,21 +61,15 @@ XDrawRectangle( |
|
1580 && (((char *)dpy->bufptr - (char *)req) < (gc->values.line_width ? |
|
1581 wsize : zsize)) ) { |
|
1582 req->length += SIZEOF(xRectangle) >> 2; |
|
1583 -#ifndef MUSTCOPY |
|
1584 rect = (xRectangle *) dpy->bufptr; |
|
1585 dpy->bufptr += SIZEOF(xRectangle); |
|
1586 -#endif /* not MUSTCOPY */ |
|
1587 } |
|
1588 |
|
1589 else { |
|
1590 GetReqExtra(PolyRectangle, SIZEOF(xRectangle), req); |
|
1591 req->drawable = d; |
|
1592 req->gc = gc->gid; |
|
1593 -#ifdef MUSTCOPY |
|
1594 - dpy->bufptr -= SIZEOF(xRectangle); |
|
1595 -#else |
|
1596 rect = (xRectangle *) NEXTPTR(req,xPolyRectangleReq); |
|
1597 -#endif /* MUSTCOPY */ |
|
1598 } |
|
1599 |
|
1600 rect->x = x; |
|
1601 @@ -89,10 +77,6 @@ XDrawRectangle( |
|
1602 rect->width = width; |
|
1603 rect->height = height; |
|
1604 |
|
1605 -#ifdef MUSTCOPY |
|
1606 - Data (dpy, (char *) rect, len); /* subtracted bufptr up above */ |
|
1607 -#endif /* MUSTCOPY */ |
|
1608 - |
|
1609 } |
|
1610 UnlockDisplay(dpy); |
|
1611 SyncHandle(); |
|
1612 diff --git a/src/FillArc.c b/src/FillArc.c |
|
1613 index 0f1ad02..c67f977 100644 |
|
1614 --- a/src/FillArc.c |
|
1615 +++ b/src/FillArc.c |
|
1616 @@ -46,12 +46,6 @@ XFillArc( |
|
1617 int angle2) /* INT16 */ |
|
1618 { |
|
1619 xArc *arc; |
|
1620 -#ifdef MUSTCOPY |
|
1621 - xArc arcdata; |
|
1622 - long len = SIZEOF(xArc); |
|
1623 - |
|
1624 - arc = &arcdata; |
|
1625 -#endif /* MUSTCOPY */ |
|
1626 |
|
1627 LockDisplay(dpy); |
|
1628 FlushGC(dpy, gc); |
|
1629 @@ -67,10 +61,8 @@ XFillArc( |
|
1630 && ((dpy->bufptr + SIZEOF(xArc)) <= dpy->bufmax) |
|
1631 && (((char *)dpy->bufptr - (char *)req) < size) ) { |
|
1632 req->length += SIZEOF(xArc) >> 2; |
|
1633 -#ifndef MUSTCOPY |
|
1634 arc = (xArc *) dpy->bufptr; |
|
1635 dpy->bufptr += SIZEOF(xArc); |
|
1636 -#endif /* not MUSTCOPY */ |
|
1637 } |
|
1638 |
|
1639 else { |
|
1640 @@ -78,11 +70,7 @@ XFillArc( |
|
1641 |
|
1642 req->drawable = d; |
|
1643 req->gc = gc->gid; |
|
1644 -#ifdef MUSTCOPY |
|
1645 - dpy->bufptr -= SIZEOF(xArc); |
|
1646 -#else |
|
1647 arc = (xArc *) NEXTPTR(req,xPolyFillArcReq); |
|
1648 -#endif /* MUSTCOPY */ |
|
1649 } |
|
1650 arc->x = x; |
|
1651 arc->y = y; |
|
1652 @@ -91,10 +79,6 @@ XFillArc( |
|
1653 arc->angle1 = angle1; |
|
1654 arc->angle2 = angle2; |
|
1655 |
|
1656 -#ifdef MUSTCOPY |
|
1657 - Data (dpy, (char *) arc, len); |
|
1658 -#endif /* MUSTCOPY */ |
|
1659 - |
|
1660 } |
|
1661 UnlockDisplay(dpy); |
|
1662 SyncHandle(); |
|
1663 diff --git a/src/FillRct.c b/src/FillRct.c |
|
1664 index 4cd104c..3ca9afe 100644 |
|
1665 --- a/src/FillRct.c |
|
1666 +++ b/src/FillRct.c |
|
1667 @@ -44,12 +44,6 @@ XFillRectangle( |
|
1668 unsigned int height) /* CARD16 */ |
|
1669 { |
|
1670 xRectangle *rect; |
|
1671 -#ifdef MUSTCOPY |
|
1672 - xRectangle rectdata; |
|
1673 - long len = SIZEOF(xRectangle); |
|
1674 - |
|
1675 - rect = &rectdata; |
|
1676 -#endif /* MUSTCOPY */ |
|
1677 |
|
1678 LockDisplay(dpy); |
|
1679 FlushGC(dpy, gc); |
|
1680 @@ -66,30 +60,21 @@ XFillRectangle( |
|
1681 && ((dpy->bufptr + SIZEOF(xRectangle)) <= dpy->bufmax) |
|
1682 && (((char *)dpy->bufptr - (char *)req) < size) ) { |
|
1683 req->length += SIZEOF(xRectangle) >> 2; |
|
1684 -#ifndef MUSTCOPY |
|
1685 rect = (xRectangle *) dpy->bufptr; |
|
1686 dpy->bufptr += SIZEOF(xRectangle); |
|
1687 -#endif /* not MUSTCOPY */ |
|
1688 } |
|
1689 |
|
1690 else { |
|
1691 GetReqExtra(PolyFillRectangle, SIZEOF(xRectangle), req); |
|
1692 req->drawable = d; |
|
1693 req->gc = gc->gid; |
|
1694 -#ifdef MUSTCOPY |
|
1695 - dpy->bufptr -= SIZEOF(xRectangle); |
|
1696 -#else |
|
1697 rect = (xRectangle *) NEXTPTR(req,xPolyFillRectangleReq); |
|
1698 -#endif /* MUSTCOPY */ |
|
1699 } |
|
1700 rect->x = x; |
|
1701 rect->y = y; |
|
1702 rect->width = width; |
|
1703 rect->height = height; |
|
1704 |
|
1705 -#ifdef MUSTCOPY |
|
1706 - Data (dpy, (char *) rect, len); |
|
1707 -#endif /* MUSTCOPY */ |
|
1708 } |
|
1709 UnlockDisplay(dpy); |
|
1710 SyncHandle(); |
|
1711 diff --git a/src/Font.c b/src/Font.c |
|
1712 index 7f56f68..25e1790 100644 |
|
1713 --- a/src/Font.c |
|
1714 +++ b/src/Font.c |
|
1715 @@ -32,7 +32,7 @@ authorization from the X Consortium and the XFree86 Project. |
|
1716 #endif |
|
1717 #include "Xlibint.h" |
|
1718 |
|
1719 -#if defined(XF86BIGFONT) && !defined(MUSTCOPY) |
|
1720 +#if defined(XF86BIGFONT) |
|
1721 #define USE_XF86BIGFONT |
|
1722 #endif |
|
1723 #ifdef USE_XF86BIGFONT |
|
1724 @@ -228,31 +228,9 @@ _XQueryFont ( |
|
1725 fs->ascent = cvtINT16toInt (reply.fontAscent); |
|
1726 fs->descent = cvtINT16toInt (reply.fontDescent); |
|
1727 |
|
1728 -#ifdef MUSTCOPY |
|
1729 - { |
|
1730 - xCharInfo *xcip; |
|
1731 - |
|
1732 - xcip = (xCharInfo *) &reply.minBounds; |
|
1733 - fs->min_bounds.lbearing = cvtINT16toShort(xcip->leftSideBearing); |
|
1734 - fs->min_bounds.rbearing = cvtINT16toShort(xcip->rightSideBearing); |
|
1735 - fs->min_bounds.width = cvtINT16toShort(xcip->characterWidth); |
|
1736 - fs->min_bounds.ascent = cvtINT16toShort(xcip->ascent); |
|
1737 - fs->min_bounds.descent = cvtINT16toShort(xcip->descent); |
|
1738 - fs->min_bounds.attributes = xcip->attributes; |
|
1739 - |
|
1740 - xcip = (xCharInfo *) &reply.maxBounds; |
|
1741 - fs->max_bounds.lbearing = cvtINT16toShort(xcip->leftSideBearing); |
|
1742 - fs->max_bounds.rbearing = cvtINT16toShort(xcip->rightSideBearing); |
|
1743 - fs->max_bounds.width = cvtINT16toShort(xcip->characterWidth); |
|
1744 - fs->max_bounds.ascent = cvtINT16toShort(xcip->ascent); |
|
1745 - fs->max_bounds.descent = cvtINT16toShort(xcip->descent); |
|
1746 - fs->max_bounds.attributes = xcip->attributes; |
|
1747 - } |
|
1748 -#else |
|
1749 /* XXX the next two statements won't work if short isn't 16 bits */ |
|
1750 fs->min_bounds = * (XCharStruct *) &reply.minBounds; |
|
1751 fs->max_bounds = * (XCharStruct *) &reply.maxBounds; |
|
1752 -#endif /* MUSTCOPY */ |
|
1753 |
|
1754 fs->n_properties = reply.nFontProps; |
|
1755 /* |
|
1756 @@ -276,7 +254,6 @@ _XQueryFont ( |
|
1757 * If no characters in font, then it is a bad font, but |
|
1758 * shouldn't try to read nothing. |
|
1759 */ |
|
1760 - /* have to unpack charinfos on some machines (CRAY) */ |
|
1761 fs->per_char = NULL; |
|
1762 if (reply.nCharInfos > 0){ |
|
1763 nbytes = reply.nCharInfos * sizeof(XCharStruct); |
|
1764 @@ -288,27 +265,8 @@ _XQueryFont ( |
|
1765 return (XFontStruct *)NULL; |
|
1766 } |
|
1767 |
|
1768 -#ifdef MUSTCOPY |
|
1769 - { |
|
1770 - register XCharStruct *cs = fs->per_char; |
|
1771 - register int i; |
|
1772 - |
|
1773 - for (i = 0; i < reply.nCharInfos; i++, cs++) { |
|
1774 - xCharInfo xcip; |
|
1775 - |
|
1776 - _XRead(dpy, (char *)&xcip, SIZEOF(xCharInfo)); |
|
1777 - cs->lbearing = cvtINT16toShort(xcip.leftSideBearing); |
|
1778 - cs->rbearing = cvtINT16toShort(xcip.rightSideBearing); |
|
1779 - cs->width = cvtINT16toShort(xcip.characterWidth); |
|
1780 - cs->ascent = cvtINT16toShort(xcip.ascent); |
|
1781 - cs->descent = cvtINT16toShort(xcip.descent); |
|
1782 - cs->attributes = xcip.attributes; |
|
1783 - } |
|
1784 - } |
|
1785 -#else |
|
1786 nbytes = reply.nCharInfos * SIZEOF(xCharInfo); |
|
1787 _XRead16 (dpy, (char *)fs->per_char, nbytes); |
|
1788 -#endif |
|
1789 } |
|
1790 |
|
1791 /* call out to any extensions interested */ |
|
1792 diff --git a/src/FontInfo.c b/src/FontInfo.c |
|
1793 index 97de40e..fb296b8 100644 |
|
1794 --- a/src/FontInfo.c |
|
1795 +++ b/src/FontInfo.c |
|
1796 @@ -29,7 +29,7 @@ in this Software without prior written authorization from The Open Group. |
|
1797 #endif |
|
1798 #include "Xlibint.h" |
|
1799 |
|
1800 -#if defined(XF86BIGFONT) && !defined(MUSTCOPY) |
|
1801 +#if defined(XF86BIGFONT) |
|
1802 #define USE_XF86BIGFONT |
|
1803 #endif |
|
1804 #ifdef USE_XF86BIGFONT |
|
1805 @@ -133,31 +133,9 @@ XFontStruct **info) /* RETURN */ |
|
1806 fs->ascent = cvtINT16toInt (reply.fontAscent); |
|
1807 fs->descent = cvtINT16toInt (reply.fontDescent); |
|
1808 |
|
1809 -#ifdef MUSTCOPY |
|
1810 - { |
|
1811 - xCharInfo *xcip; |
|
1812 - |
|
1813 - xcip = (xCharInfo *) &reply.minBounds; |
|
1814 - fs->min_bounds.lbearing = xcip->leftSideBearing; |
|
1815 - fs->min_bounds.rbearing = xcip->rightSideBearing; |
|
1816 - fs->min_bounds.width = xcip->characterWidth; |
|
1817 - fs->min_bounds.ascent = xcip->ascent; |
|
1818 - fs->min_bounds.descent = xcip->descent; |
|
1819 - fs->min_bounds.attributes = xcip->attributes; |
|
1820 - |
|
1821 - xcip = (xCharInfo *) &reply.maxBounds; |
|
1822 - fs->max_bounds.lbearing = xcip->leftSideBearing; |
|
1823 - fs->max_bounds.rbearing = xcip->rightSideBearing; |
|
1824 - fs->max_bounds.width = xcip->characterWidth; |
|
1825 - fs->max_bounds.ascent = xcip->ascent; |
|
1826 - fs->max_bounds.descent = xcip->descent; |
|
1827 - fs->max_bounds.attributes = xcip->attributes; |
|
1828 - } |
|
1829 -#else |
|
1830 /* XXX the next two statements won't work if short isn't 16 bits */ |
|
1831 fs->min_bounds = * (XCharStruct *) &reply.minBounds; |
|
1832 fs->max_bounds = * (XCharStruct *) &reply.maxBounds; |
|
1833 -#endif /* MUSTCOPY */ |
|
1834 |
|
1835 fs->n_properties = reply.nFontProps; |
|
1836 if (fs->n_properties > 0) { |
|
1837 diff --git a/src/MoveWin.c b/src/MoveWin.c |
|
1838 index 3cd75e1..2eb2283 100644 |
|
1839 --- a/src/MoveWin.c |
|
1840 +++ b/src/MoveWin.c |
|
1841 @@ -44,20 +44,11 @@ XMoveWindow ( |
|
1842 req->window = w; |
|
1843 req->mask = CWX | CWY; |
|
1844 |
|
1845 -#ifdef MUSTCOPY |
|
1846 - { |
|
1847 - long lx = (long) x, ly = (long) y; |
|
1848 - dpy->bufptr -= 8; |
|
1849 - Data32 (dpy, (long *) &lx, 4); /* order dictated by CWX and CWY */ |
|
1850 - Data32 (dpy, (long *) &ly, 4); |
|
1851 - } |
|
1852 -#else |
|
1853 { |
|
1854 CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xConfigureWindowReq); |
|
1855 *valuePtr++ = x; |
|
1856 *valuePtr = y; |
|
1857 } |
|
1858 -#endif /* MUSTCOPY */ |
|
1859 UnlockDisplay(dpy); |
|
1860 SyncHandle(); |
|
1861 return 1; |
|
1862 diff --git a/src/PolyTxt16.c b/src/PolyTxt16.c |
|
1863 index dd65818..2e4be16 100644 |
|
1864 --- a/src/PolyTxt16.c |
|
1865 +++ b/src/PolyTxt16.c |
|
1866 @@ -168,18 +168,7 @@ XDrawText16( |
|
1867 } |
|
1868 elt->len = 254; |
|
1869 |
|
1870 -#if defined(MUSTCOPY) || defined(MUSTCOPY2B) |
|
1871 - { |
|
1872 - register int i; |
|
1873 - register unsigned char *cp; |
|
1874 - for (i = 0, cp = ((unsigned char *)elt) + 2; i < 254; i++) { |
|
1875 - *cp++ = CharacterOffset[i].byte1; |
|
1876 - *cp++ = CharacterOffset[i].byte2; |
|
1877 - } |
|
1878 - } |
|
1879 -#else |
|
1880 memcpy ((char *) (elt + 1), (char *)CharacterOffset, 254 * 2); |
|
1881 -#endif |
|
1882 PartialNChars = PartialNChars - 254; |
|
1883 CharacterOffset += 254; |
|
1884 |
|
1885 @@ -213,21 +202,9 @@ XDrawText16( |
|
1886 } |
|
1887 elt->len = PartialNChars; |
|
1888 |
|
1889 -#if defined(MUSTCOPY) || defined(MUSTCOPY2B) |
|
1890 - { |
|
1891 - register int i; |
|
1892 - register unsigned char *cp; |
|
1893 - for (i = 0, cp = ((unsigned char *)elt) + 2; i < PartialNChars; |
|
1894 - i++) { |
|
1895 - *cp++ = CharacterOffset[i].byte1; |
|
1896 - *cp++ = CharacterOffset[i].byte2; |
|
1897 - } |
|
1898 - } |
|
1899 -#else |
|
1900 memcpy ((char *) (elt + 1), (char *)CharacterOffset, |
|
1901 PartialNChars * |
|
1902 2); |
|
1903 -#endif |
|
1904 } |
|
1905 } |
|
1906 item++; |
|
1907 diff --git a/src/RestackWs.c b/src/RestackWs.c |
|
1908 index 1dba3c8..52391ec 100644 |
|
1909 --- a/src/RestackWs.c |
|
1910 +++ b/src/RestackWs.c |
|
1911 @@ -36,9 +36,6 @@ XRestackWindows ( |
|
1912 int n) |
|
1913 { |
|
1914 int i = 0; |
|
1915 -#ifdef MUSTCOPY |
|
1916 - unsigned long val = Below; /* needed for macro below */ |
|
1917 -#endif |
|
1918 |
|
1919 LockDisplay(dpy); |
|
1920 while (windows++, ++i < n) { |
|
1921 @@ -47,18 +44,12 @@ XRestackWindows ( |
|
1922 GetReqExtra (ConfigureWindow, 8, req); |
|
1923 req->window = *windows; |
|
1924 req->mask = CWSibling | CWStackMode; |
|
1925 -#ifdef MUSTCOPY |
|
1926 - dpy->bufptr -= 8; |
|
1927 - Data32 (dpy, (long *)(windows-1), 4); |
|
1928 - Data32 (dpy, (long *)&val, 4); |
|
1929 -#else |
|
1930 { |
|
1931 register CARD32 *values = (CARD32 *) |
|
1932 NEXTPTR(req,xConfigureWindowReq); |
|
1933 *values++ = *(windows-1); |
|
1934 *values = Below; |
|
1935 } |
|
1936 -#endif /* MUSTCOPY */ |
|
1937 } |
|
1938 UnlockDisplay(dpy); |
|
1939 SyncHandle(); |
|
1940 diff --git a/src/StColor.c b/src/StColor.c |
|
1941 index 19f2a4b..d5a217f 100644 |
|
1942 --- a/src/StColor.c |
|
1943 +++ b/src/StColor.c |
|
1944 @@ -37,21 +37,13 @@ XStoreColor( |
|
1945 { |
|
1946 xColorItem *citem; |
|
1947 register xStoreColorsReq *req; |
|
1948 -#ifdef MUSTCOPY |
|
1949 - xColorItem citemdata; |
|
1950 - long len = SIZEOF(xColorItem); |
|
1951 - |
|
1952 - citem = &citemdata; |
|
1953 -#endif /* MUSTCOPY */ |
|
1954 |
|
1955 LockDisplay(dpy); |
|
1956 GetReqExtra(StoreColors, SIZEOF(xColorItem), req); /* assume size is 4*n */ |
|
1957 |
|
1958 req->cmap = cmap; |
|
1959 |
|
1960 -#ifndef MUSTCOPY |
|
1961 citem = (xColorItem *) NEXTPTR(req,xStoreColorsReq); |
|
1962 -#endif /* not MUSTCOPY */ |
|
1963 |
|
1964 citem->pixel = def->pixel; |
|
1965 citem->red = def->red; |
|
1966 @@ -59,10 +51,6 @@ XStoreColor( |
|
1967 citem->blue = def->blue; |
|
1968 citem->flags = def->flags; /* do_red, do_green, do_blue */ |
|
1969 |
|
1970 -#ifdef MUSTCOPY |
|
1971 - dpy->bufptr -= SIZEOF(xColorItem); /* adjust for GetReqExtra */ |
|
1972 - Data (dpy, (char *) citem, len); |
|
1973 -#endif /* MUSTCOPY */ |
|
1974 |
|
1975 UnlockDisplay(dpy); |
|
1976 SyncHandle(); |
|
1977 diff --git a/src/Text16.c b/src/Text16.c |
|
1978 index 5a66a2b..008a3f7 100644 |
|
1979 --- a/src/Text16.c |
|
1980 +++ b/src/Text16.c |
|
1981 @@ -82,18 +82,7 @@ XDrawString16( |
|
1982 BufAlloc (xTextElt *, elt, nbytes); |
|
1983 elt->delta = 0; |
|
1984 elt->len = 254; |
|
1985 -#if defined(MUSTCOPY) || defined(MUSTCOPY2B) |
|
1986 - { |
|
1987 - register int i; |
|
1988 - register unsigned char *cp; |
|
1989 - for (i = 0, cp = ((unsigned char *)elt) + 2; i < 254; i++) { |
|
1990 - *cp++ = CharacterOffset[i].byte1; |
|
1991 - *cp++ = CharacterOffset[i].byte2; |
|
1992 - } |
|
1993 - } |
|
1994 -#else |
|
1995 memcpy (((char *) elt) + 2, (char *)CharacterOffset, 254 * 2); |
|
1996 -#endif |
|
1997 PartialNChars = PartialNChars - 254; |
|
1998 CharacterOffset += 254; |
|
1999 } |
|
2000 @@ -104,19 +93,7 @@ XDrawString16( |
|
2001 BufAlloc (xTextElt *, elt, nbytes); |
|
2002 elt->delta = 0; |
|
2003 elt->len = PartialNChars; |
|
2004 -#if defined(MUSTCOPY) || defined(MUSTCOPY2B) |
|
2005 - { |
|
2006 - register int i; |
|
2007 - register unsigned char *cp; |
|
2008 - for (i = 0, cp = ((unsigned char *)elt) + 2; i < PartialNChars; |
|
2009 - i++) { |
|
2010 - *cp++ = CharacterOffset[i].byte1; |
|
2011 - *cp++ = CharacterOffset[i].byte2; |
|
2012 - } |
|
2013 - } |
|
2014 -#else |
|
2015 memcpy(((char *)elt) + 2, (char *)CharacterOffset, PartialNChars * 2); |
|
2016 -#endif |
|
2017 } |
|
2018 } |
|
2019 |
|
2020 diff --git a/src/XlibAsync.c b/src/XlibAsync.c |
|
2021 index b17135c..eb2b819 100644 |
|
2022 --- a/src/XlibAsync.c |
|
2023 +++ b/src/XlibAsync.c |
|
2024 @@ -100,11 +100,6 @@ _XGetAsyncReply( |
|
2025 _XRead(dpy, replbuf + len, size - len); |
|
2026 buf = replbuf; |
|
2027 len = size; |
|
2028 -#ifdef MUSTCOPY |
|
2029 - } else { |
|
2030 - memcpy(replbuf, buf, size); |
|
2031 - buf = replbuf; |
|
2032 -#endif |
|
2033 } |
|
2034 |
|
2035 if (discard && rep->generic.length > extra && |
|
2036 -- |
|
2037 1.7.9.2 |
|
2038 |
|
2039 From ca106eb03e5f5468df8033300c5caae3d3c6936b Mon Sep 17 00:00:00 2001 |
|
2040 From: Alan Coopersmith <[email protected]> |
|
2041 Date: Thu, 28 Feb 2013 20:04:25 -0800 |
|
2042 Subject: [PATCH:libX11 45/58] unifdef WORD64 |
|
2043 |
|
2044 WORD64 seems to have only been defined in <X11/Xmd.h> when building for |
|
2045 CRAY, to handle int being a 64-bit value (ILP64, not LP64) and having |
|
2046 64-bit alignment requirements. |
|
2047 |
|
2048 It hadn't been fully supported even before autotooling, as can be |
|
2049 seen by removed code such as: |
|
2050 |
|
2051 #ifdef WORD64 |
|
2052 _XkbWriteCopyData32 Not Implemented Yet for sizeof(int)==8 |
|
2053 #endif |
|
2054 |
|
2055 (mostly performed with unifdef, followed by some manual cleanup of |
|
2056 the remaining code) |
|
2057 |
|
2058 Signed-off-by: Alan Coopersmith <[email protected]> |
|
2059 Reviewed-by: Peter Hutterer <[email protected]> |
|
2060 --- |
|
2061 include/X11/Xlibint.h | 37 +------- |
|
2062 src/ImUtil.c | 14 +-- |
|
2063 src/LiHosts.c | 7 -- |
|
2064 src/Macros.c | 5 -- |
|
2065 src/Quarks.c | 4 - |
|
2066 src/SendEvent.c | 5 -- |
|
2067 src/XlibInt.c | 236 ------------------------------------------------- |
|
2068 src/xkb/XKBNames.c | 56 ------------ |
|
2069 src/xkb/XKBRdBuf.c | 28 ------ |
|
2070 src/xkb/XKBlibint.h | 2 +- |
|
2071 10 files changed, 4 insertions(+), 390 deletions(-) |
|
2072 |
|
2073 diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h |
|
2074 index 5a7c0ed..48323f7 100644 |
|
2075 --- a/include/X11/Xlibint.h |
|
2076 +++ b/include/X11/Xlibint.h |
|
2077 @@ -408,25 +408,8 @@ extern LockInfoPtr _Xglobal_lock; |
|
2078 * X Protocol packetizing macros. |
|
2079 */ |
|
2080 |
|
2081 -/* Need to start requests on 64 bit word boundaries |
|
2082 - * on a CRAY computer so add a NoOp (127) if needed. |
|
2083 - * A character pointer on a CRAY computer will be non-zero |
|
2084 - * after shifting right 61 bits of it is not pointing to |
|
2085 - * a word boundary. |
|
2086 - */ |
|
2087 -#ifdef WORD64 |
|
2088 -#define WORD64ALIGN if ((long)dpy->bufptr >> 61) {\ |
|
2089 - dpy->last_req = dpy->bufptr;\ |
|
2090 - *(dpy->bufptr) = X_NoOperation;\ |
|
2091 - *(dpy->bufptr+1) = 0;\ |
|
2092 - *(dpy->bufptr+2) = 0;\ |
|
2093 - *(dpy->bufptr+3) = 1;\ |
|
2094 - dpy->request++;\ |
|
2095 - dpy->bufptr += 4;\ |
|
2096 - } |
|
2097 -#else /* else does not require alignment on 64-bit boundaries */ |
|
2098 +/* Leftover from CRAY support - was defined empty on all non-Cray systems */ |
|
2099 #define WORD64ALIGN |
|
2100 -#endif /* WORD64 */ |
|
2101 |
|
2102 /** |
|
2103 * Return a len-sized request buffer for the request type. This function may |
|
2104 @@ -510,18 +493,6 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); |
|
2105 req = (xReq *) _XGetRequest(dpy, X_/**/name, SIZEOF(xReq)) |
|
2106 #endif |
|
2107 |
|
2108 -#ifdef WORD64 |
|
2109 -#define MakeBigReq(req,n) \ |
|
2110 - { \ |
|
2111 - char _BRdat[4]; \ |
|
2112 - unsigned long _BRlen = req->length - 1; \ |
|
2113 - req->length = 0; \ |
|
2114 - memcpy(_BRdat, ((char *)req) + (_BRlen << 2), 4); \ |
|
2115 - memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \ |
|
2116 - memcpy(((char *)req) + 4, _BRdat, 4); \ |
|
2117 - Data32(dpy, (long *)&_BRdat, 4); \ |
|
2118 - } |
|
2119 -#else |
|
2120 #ifdef LONG64 |
|
2121 #define MakeBigReq(req,n) \ |
|
2122 { \ |
|
2123 @@ -545,7 +516,6 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); |
|
2124 Data32(dpy, &_BRdat, 4); \ |
|
2125 } |
|
2126 #endif |
|
2127 -#endif |
|
2128 |
|
2129 #ifndef __clang_analyzer__ |
|
2130 #define SetReqLen(req,n,badlen) \ |
|
2131 @@ -609,10 +579,6 @@ extern void _XFlushGCCache(Display *dpy, GC gc); |
|
2132 memset(ptr, '\0', n); \ |
|
2133 dpy->bufptr += (n); |
|
2134 |
|
2135 -#ifdef WORD64 |
|
2136 -#define Data16(dpy, data, len) _XData16(dpy, (_Xconst short *)data, len) |
|
2137 -#define Data32(dpy, data, len) _XData32(dpy, (_Xconst long *)data, len) |
|
2138 -#else |
|
2139 #define Data16(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) |
|
2140 #define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len)) |
|
2141 #define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len)) |
|
2142 @@ -632,7 +598,6 @@ extern void _XRead32( |
|
2143 #define Data32(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) |
|
2144 #define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len)) |
|
2145 #endif |
|
2146 -#endif /* not WORD64 */ |
|
2147 |
|
2148 #define PackData16(dpy,data,len) Data16 (dpy, data, len) |
|
2149 #define PackData32(dpy,data,len) Data32 (dpy, data, len) |
|
2150 diff --git a/src/ImUtil.c b/src/ImUtil.c |
|
2151 index 3164d43..fa8d464 100644 |
|
2152 --- a/src/ImUtil.c |
|
2153 +++ b/src/ImUtil.c |
|
2154 @@ -528,9 +528,7 @@ static unsigned long _XGetPixel ( |
|
2155 return (pixel & low_bits_table[ximage->depth]); |
|
2156 } |
|
2157 |
|
2158 -#ifndef WORD64 |
|
2159 static CARD32 const byteorderpixel = MSBFirst << 24; |
|
2160 -#endif |
|
2161 |
|
2162 static unsigned long _XGetPixel32 ( |
|
2163 register XImage *ximage, |
|
2164 @@ -543,12 +541,9 @@ static unsigned long _XGetPixel32 ( |
|
2165 if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 32)) { |
|
2166 addr = &((unsigned char *)ximage->data) |
|
2167 [y * ximage->bytes_per_line + (x << 2)]; |
|
2168 -#ifndef WORD64 |
|
2169 if (*((const char *)&byteorderpixel) == ximage->byte_order) |
|
2170 pixel = *((CARD32 *)addr); |
|
2171 - else |
|
2172 -#endif |
|
2173 - if (ximage->byte_order == MSBFirst) |
|
2174 + else if (ximage->byte_order == MSBFirst) |
|
2175 pixel = ((unsigned long)addr[0] << 24 | |
|
2176 (unsigned long)addr[1] << 16 | |
|
2177 (unsigned long)addr[2] << 8 | |
|
2178 @@ -734,12 +729,9 @@ static int _XPutPixel32 ( |
|
2179 if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 32)) { |
|
2180 addr = &((unsigned char *)ximage->data) |
|
2181 [y * ximage->bytes_per_line + (x << 2)]; |
|
2182 -#ifndef WORD64 |
|
2183 if (*((const char *)&byteorderpixel) == ximage->byte_order) |
|
2184 *((CARD32 *)addr) = pixel; |
|
2185 - else |
|
2186 -#endif |
|
2187 - if (ximage->byte_order == MSBFirst) { |
|
2188 + else if (ximage->byte_order == MSBFirst) { |
|
2189 addr[0] = pixel >> 24; |
|
2190 addr[1] = pixel >> 16; |
|
2191 addr[2] = pixel >> 8; |
|
2192 @@ -997,7 +989,6 @@ _XAddPixel ( |
|
2193 x = ximage->bytes_per_line * ximage->height; |
|
2194 while (--x >= 0) |
|
2195 *dp++ += value; |
|
2196 -#ifndef WORD64 |
|
2197 } else if ((ximage->format == ZPixmap) && |
|
2198 (ximage->bits_per_pixel == 16) && |
|
2199 (*((const char *)&byteorderpixel) == ximage->byte_order)) { |
|
2200 @@ -1012,7 +1003,6 @@ _XAddPixel ( |
|
2201 x = (ximage->bytes_per_line >> 2) * ximage->height; |
|
2202 while (--x >= 0) |
|
2203 *dp++ += value; |
|
2204 -#endif |
|
2205 } else { |
|
2206 for (y = ximage->height; --y >= 0; ) { |
|
2207 for (x = ximage->width; --x >= 0; ) { |
|
2208 diff --git a/src/LiHosts.c b/src/LiHosts.c |
|
2209 index 5ae70d5..0f5e837 100644 |
|
2210 --- a/src/LiHosts.c |
|
2211 +++ b/src/LiHosts.c |
|
2212 @@ -111,15 +111,8 @@ XHostAddress *XListHosts ( |
|
2213 _XRead (dpy, (char *) buf, nbytes); |
|
2214 |
|
2215 for (i = 0; i < reply.nHosts; i++) { |
|
2216 -#ifdef WORD64 |
|
2217 - xHostEntry xhe; |
|
2218 - memcpy((char *)&xhe, bp, SIZEOF(xHostEntry)); |
|
2219 - op->family = xhe.family; |
|
2220 - op->length = xhe.length; |
|
2221 -#else |
|
2222 op->family = ((xHostEntry *) bp)->family; |
|
2223 op->length =((xHostEntry *) bp)->length; |
|
2224 -#endif |
|
2225 if (op->family == FamilyServerInterpreted) { |
|
2226 char *tp = (char *) (bp + SIZEOF(xHostEntry)); |
|
2227 char *vp = memchr(tp, 0, op->length); |
|
2228 diff --git a/src/Macros.c b/src/Macros.c |
|
2229 index 42d4cf1..cfc083a 100644 |
|
2230 --- a/src/Macros.c |
|
2231 +++ b/src/Macros.c |
|
2232 @@ -137,12 +137,7 @@ int XImageByteOrder(Display *dpy) { return (ImageByteOrder(dpy)); } |
|
2233 |
|
2234 unsigned long XNextRequest(Display *dpy) |
|
2235 { |
|
2236 -#ifdef WORD64 |
|
2237 - WORD64ALIGN |
|
2238 - return dpy->request + 1; |
|
2239 -#else |
|
2240 return (NextRequest(dpy)); |
|
2241 -#endif |
|
2242 } |
|
2243 |
|
2244 unsigned long XLastKnownRequestProcessed(Display *dpy) |
|
2245 diff --git a/src/Quarks.c b/src/Quarks.c |
|
2246 index 7a704b1..4eb90c5 100644 |
|
2247 --- a/src/Quarks.c |
|
2248 +++ b/src/Quarks.c |
|
2249 @@ -131,10 +131,8 @@ static char *permalloc(unsigned int length) |
|
2250 return(ret); |
|
2251 } |
|
2252 |
|
2253 -#ifndef WORD64 |
|
2254 typedef struct {char a; double b;} TestType1; |
|
2255 typedef struct {char a; unsigned long b;} TestType2; |
|
2256 -#endif |
|
2257 |
|
2258 #ifdef XTHREADS |
|
2259 static char *_Xpermalloc(unsigned int length); |
|
2260 @@ -157,7 +155,6 @@ char *Xpermalloc(unsigned int length) |
|
2261 int i; |
|
2262 |
|
2263 if (neverFreeTableSize && length < NEVERFREETABLESIZE) { |
|
2264 -#ifndef WORD64 |
|
2265 if ((sizeof(TestType1) != |
|
2266 (sizeof(TestType2) - sizeof(unsigned long) + sizeof(double))) && |
|
2267 !(length & (DALIGN-1)) && |
|
2268 @@ -165,7 +162,6 @@ char *Xpermalloc(unsigned int length) |
|
2269 neverFreeTableSize -= DALIGN - i; |
|
2270 neverFreeTable += DALIGN - i; |
|
2271 } else |
|
2272 -#endif |
|
2273 if ((i = (NEVERFREETABLESIZE - neverFreeTableSize) & (WALIGN-1))) { |
|
2274 neverFreeTableSize -= WALIGN - i; |
|
2275 neverFreeTable += WALIGN - i; |
|
2276 diff --git a/src/SendEvent.c b/src/SendEvent.c |
|
2277 index cc8bd5a..1de9860 100644 |
|
2278 --- a/src/SendEvent.c |
|
2279 +++ b/src/SendEvent.c |
|
2280 @@ -67,12 +67,7 @@ XSendEvent( |
|
2281 req->destination = w; |
|
2282 req->propagate = propagate; |
|
2283 req->eventMask = event_mask; |
|
2284 -#ifdef WORD64 |
|
2285 - /* avoid quad-alignment problems */ |
|
2286 - memcpy ((char *) req->eventdata, (char *) &ev, SIZEOF(xEvent)); |
|
2287 -#else |
|
2288 req->event = ev; |
|
2289 -#endif /* WORD64 */ |
|
2290 } |
|
2291 |
|
2292 UnlockDisplay(dpy); |
|
2293 diff --git a/src/XlibInt.c b/src/XlibInt.c |
|
2294 index c436842..1c964fd 100644 |
|
2295 --- a/src/XlibInt.c |
|
2296 +++ b/src/XlibInt.c |
|
2297 @@ -293,124 +293,6 @@ void _XRead32( |
|
2298 } |
|
2299 #endif /* LONG64 */ |
|
2300 |
|
2301 -#ifdef WORD64 |
|
2302 - |
|
2303 -/* |
|
2304 - * XXX This is a *really* stupid way of doing this.... |
|
2305 - * PACKBUFFERSIZE must be a multiple of 4. |
|
2306 - */ |
|
2307 - |
|
2308 -#define PACKBUFFERSIZE 4096 |
|
2309 - |
|
2310 - |
|
2311 -/* |
|
2312 - * _XRead32 - Read bytes from the socket unpacking each 32 bits |
|
2313 - * into a long (64 bits on a CRAY computer). |
|
2314 - * |
|
2315 - */ |
|
2316 -static void _doXRead32( |
|
2317 - register Display *dpy, |
|
2318 - register long *data |
|
2319 - register long size, |
|
2320 - register char *packbuffer) |
|
2321 -{ |
|
2322 - long *lpack,*lp; |
|
2323 - long mask32 = 0x00000000ffffffff; |
|
2324 - long maskw, nwords, i, bits; |
|
2325 - |
|
2326 - _XReadPad (dpy, packbuffer, size); |
|
2327 - |
|
2328 - lp = data; |
|
2329 - lpack = (long *) packbuffer; |
|
2330 - nwords = size >> 2; |
|
2331 - bits = 32; |
|
2332 - |
|
2333 - for(i=0;i<nwords;i++){ |
|
2334 - maskw = mask32 << bits; |
|
2335 - *lp++ = ( *lpack & maskw ) >> bits; |
|
2336 - bits = bits ^32; |
|
2337 - if(bits){ |
|
2338 - lpack++; |
|
2339 - } |
|
2340 - } |
|
2341 -} |
|
2342 - |
|
2343 -void _XRead32( |
|
2344 - Display *dpy, |
|
2345 - long *data, |
|
2346 - long len) |
|
2347 -{ |
|
2348 - char packbuffer[PACKBUFFERSIZE]; |
|
2349 - unsigned nunits = PACKBUFFERSIZE >> 2; |
|
2350 - |
|
2351 - for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) { |
|
2352 - _doXRead32 (dpy, data, PACKBUFFERSIZE, packbuffer); |
|
2353 - } |
|
2354 - if (len) _doXRead32 (dpy, data, len, packbuffer); |
|
2355 -} |
|
2356 - |
|
2357 - |
|
2358 - |
|
2359 -/* |
|
2360 - * _XRead16 - Read bytes from the socket unpacking each 16 bits |
|
2361 - * into a long (64 bits on a CRAY computer). |
|
2362 - * |
|
2363 - */ |
|
2364 -static _doXRead16( |
|
2365 - register Display *dpy, |
|
2366 - register short *data, |
|
2367 - register long size, |
|
2368 - char *packbuffer) |
|
2369 -{ |
|
2370 - long *lpack,*lp; |
|
2371 - long mask16 = 0x000000000000ffff; |
|
2372 - long maskw, nwords, i, bits; |
|
2373 - |
|
2374 - (void) _XRead(dpy,packbuffer,size); /* don't do a padded read... */ |
|
2375 - |
|
2376 - lp = (long *) data; |
|
2377 - lpack = (long *) packbuffer; |
|
2378 - nwords = size >> 1; /* number of 16 bit words to be unpacked */ |
|
2379 - bits = 48; |
|
2380 - for(i=0;i<nwords;i++){ |
|
2381 - maskw = mask16 << bits; |
|
2382 - *lp++ = ( *lpack & maskw ) >> bits; |
|
2383 - bits -= 16; |
|
2384 - if(bits < 0){ |
|
2385 - lpack++; |
|
2386 - bits = 48; |
|
2387 - } |
|
2388 - } |
|
2389 -} |
|
2390 - |
|
2391 -void _XRead16( |
|
2392 - Display *dpy, |
|
2393 - short *data, |
|
2394 - long len) |
|
2395 -{ |
|
2396 - char packbuffer[PACKBUFFERSIZE]; |
|
2397 - unsigned nunits = PACKBUFFERSIZE >> 1; |
|
2398 - |
|
2399 - for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) { |
|
2400 - _doXRead16 (dpy, data, PACKBUFFERSIZE, packbuffer); |
|
2401 - } |
|
2402 - if (len) _doXRead16 (dpy, data, len, packbuffer); |
|
2403 -} |
|
2404 - |
|
2405 -void _XRead16Pad( |
|
2406 - Display *dpy, |
|
2407 - short *data, |
|
2408 - long size) |
|
2409 -{ |
|
2410 - int slop = (size & 3); |
|
2411 - short slopbuf[3]; |
|
2412 - |
|
2413 - _XRead16 (dpy, data, size); |
|
2414 - if (slop > 0) { |
|
2415 - _XRead16 (dpy, slopbuf, 4 - slop); |
|
2416 - } |
|
2417 -} |
|
2418 -#endif /* WORD64 */ |
|
2419 |
|
2420 /* |
|
2421 * The hard part about this is that we only get 16 bits from a reply. |
|
2422 @@ -1764,122 +1646,6 @@ _XData32( |
|
2423 } |
|
2424 #endif /* LONG64 */ |
|
2425 |
|
2426 -#ifdef WORD64 |
|
2427 - |
|
2428 -/* |
|
2429 - * XXX This is a *really* stupid way of doing this. It should just use |
|
2430 - * dpy->bufptr directly, taking into account where in the word it is. |
|
2431 - */ |
|
2432 - |
|
2433 -/* |
|
2434 - * Data16 - Place 16 bit data in the buffer. |
|
2435 - * |
|
2436 - * "dpy" is a pointer to a Display. |
|
2437 - * "data" is a pointer to the data. |
|
2438 - * "len" is the length in bytes of the data. |
|
2439 - */ |
|
2440 - |
|
2441 -static doData16( |
|
2442 - register Display *dpy, |
|
2443 - _Xconst short *data, |
|
2444 - unsigned len, |
|
2445 - char *packbuffer) |
|
2446 -{ |
|
2447 - long *lp,*lpack; |
|
2448 - long i, nwords,bits; |
|
2449 - long mask16 = 0x000000000000ffff; |
|
2450 - |
|
2451 - lp = (long *)data; |
|
2452 - lpack = (long *)packbuffer; |
|
2453 - |
|
2454 -/* nwords is the number of 16 bit values to be packed, |
|
2455 - * the low order 16 bits of each word will be packed |
|
2456 - * into 64 bit words |
|
2457 - */ |
|
2458 - nwords = len >> 1; |
|
2459 - bits = 48; |
|
2460 - |
|
2461 - for(i=0;i<nwords;i++){ |
|
2462 - if (bits == 48) *lpack = 0; |
|
2463 - *lpack ^= (*lp & mask16) << bits; |
|
2464 - bits -= 16 ; |
|
2465 - lp++; |
|
2466 - if(bits < 0){ |
|
2467 - lpack++; |
|
2468 - bits = 48; |
|
2469 - } |
|
2470 - } |
|
2471 - Data(dpy, packbuffer, len); |
|
2472 -} |
|
2473 - |
|
2474 -_XData16 ( |
|
2475 - Display *dpy, |
|
2476 - _Xconst short *data, |
|
2477 - unsigned len) |
|
2478 -{ |
|
2479 - char packbuffer[PACKBUFFERSIZE]; |
|
2480 - unsigned nunits = PACKBUFFERSIZE >> 1; |
|
2481 - |
|
2482 - for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) { |
|
2483 - doData16 (dpy, data, PACKBUFFERSIZE, packbuffer); |
|
2484 - } |
|
2485 - if (len) doData16 (dpy, data, len, packbuffer); |
|
2486 -} |
|
2487 - |
|
2488 -/* |
|
2489 - * Data32 - Place 32 bit data in the buffer. |
|
2490 - * |
|
2491 - * "dpy" is a pointer to a Display. |
|
2492 - * "data" is a pointer to the data. |
|
2493 - * "len" is the length in bytes of the data. |
|
2494 - */ |
|
2495 - |
|
2496 -static doData32( |
|
2497 - register Display *dpy |
|
2498 - _Xconst long *data, |
|
2499 - unsigned len, |
|
2500 - char *packbuffer) |
|
2501 -{ |
|
2502 - long *lp,*lpack; |
|
2503 - long i,bits,nwords; |
|
2504 - long mask32 = 0x00000000ffffffff; |
|
2505 - |
|
2506 - lpack = (long *) packbuffer; |
|
2507 - lp = data; |
|
2508 - |
|
2509 -/* nwords is the number of 32 bit values to be packed |
|
2510 - * the low order 32 bits of each word will be packed |
|
2511 - * into 64 bit words |
|
2512 - */ |
|
2513 - nwords = len >> 2; |
|
2514 - bits = 32; |
|
2515 - |
|
2516 - for(i=0;i<nwords;i++){ |
|
2517 - if (bits == 32) *lpack = 0; |
|
2518 - *lpack ^= (*lp & mask32) << bits; |
|
2519 - bits = bits ^32; |
|
2520 - lp++; |
|
2521 - if(bits) |
|
2522 - lpack++; |
|
2523 - } |
|
2524 - Data(dpy, packbuffer, len); |
|
2525 -} |
|
2526 - |
|
2527 -void _XData32( |
|
2528 - Display *dpy, |
|
2529 - _Xconst long *data, |
|
2530 - unsigned len) |
|
2531 -{ |
|
2532 - char packbuffer[PACKBUFFERSIZE]; |
|
2533 - unsigned nunits = PACKBUFFERSIZE >> 2; |
|
2534 - |
|
2535 - for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) { |
|
2536 - doData32 (dpy, data, PACKBUFFERSIZE, packbuffer); |
|
2537 - } |
|
2538 - if (len) doData32 (dpy, data, len, packbuffer); |
|
2539 -} |
|
2540 - |
|
2541 -#endif /* WORD64 */ |
|
2542 |
|
2543 |
|
2544 /* Make sure this produces the same string as DefineLocal/DefineSelf in xdm. |
|
2545 @@ -1967,8 +1733,6 @@ void *_XGetRequest(Display *dpy, CARD8 type, size_t len) |
|
2546 { |
|
2547 xReq *req; |
|
2548 |
|
2549 - WORD64ALIGN |
|
2550 - |
|
2551 if (dpy->bufptr + len > dpy->bufmax) |
|
2552 _XFlush(dpy); |
|
2553 |
|
2554 diff --git a/src/xkb/XKBNames.c b/src/xkb/XKBNames.c |
|
2555 index cf2382c..0276c05 100644 |
|
2556 --- a/src/xkb/XKBNames.c |
|
2557 +++ b/src/xkb/XKBNames.c |
|
2558 @@ -494,38 +494,10 @@ XkbSetNames( Display * dpy, |
|
2559 if (which&XkbGroupNamesMask) |
|
2560 _XkbCopyAtoms(dpy,names->groups,groups,XkbNumKbdGroups); |
|
2561 if (which&XkbKeyNamesMask) { |
|
2562 -#ifdef WORD64 |
|
2563 - char *tmp; |
|
2564 - register int i; |
|
2565 - BufAlloc(char *,tmp,nKeys*XkbKeyNameLength); |
|
2566 - for (i=0;i<nKeys;i++,tmp+= XkbKeyNameLength) { |
|
2567 - tmp[0]= names->keys[firstKey+i].name[0]; |
|
2568 - tmp[1]= names->keys[firstKey+i].name[1]; |
|
2569 - tmp[2]= names->keys[firstKey+i].name[2]; |
|
2570 - tmp[3]= names->keys[firstKey+i].name[3]; |
|
2571 - } |
|
2572 -#else |
|
2573 Data(dpy,(char *)&names->keys[firstKey],nKeys*XkbKeyNameLength); |
|
2574 -#endif |
|
2575 } |
|
2576 if (which&XkbKeyAliasesMask) { |
|
2577 -#ifdef WORD64 |
|
2578 - char *tmp; |
|
2579 - register int i; |
|
2580 - BufAlloc(char *,tmp,nKA*XkbKeyNameLength*2); |
|
2581 - for (i=0;i<nKeys;i++,tmp+= 2*XkbKeyNameLength) { |
|
2582 - tmp[0]= names->key_aliases[i].real[0]; |
|
2583 - tmp[1]= names->key_aliases[i].real[1]; |
|
2584 - tmp[2]= names->key_aliases[i].real[2]; |
|
2585 - tmp[3]= names->key_aliases[i].real[3]; |
|
2586 - tmp[4]= names->key_aliases[i].alias[0]; |
|
2587 - tmp[5]= names->key_aliases[i].alias[1]; |
|
2588 - tmp[6]= names->key_aliases[i].alias[2]; |
|
2589 - tmp[7]= names->key_aliases[i].alias[3]; |
|
2590 - } |
|
2591 -#else |
|
2592 Data(dpy,(char *)names->key_aliases,nKA*XkbKeyNameLength*2); |
|
2593 -#endif |
|
2594 } |
|
2595 if (which&XkbRGNamesMask) { |
|
2596 Data32(dpy,(long *)names->radio_groups,nRG*4); |
|
2597 @@ -750,38 +722,10 @@ XkbChangeNames(Display *dpy,XkbDescPtr xkb,XkbNameChangesPtr changes) |
|
2598 if (which&XkbGroupNamesMask) |
|
2599 _XkbCopyAtoms(dpy,names->groups,groups,XkbNumKbdGroups); |
|
2600 if (which&XkbKeyNamesMask) { |
|
2601 -#ifdef WORD64 |
|
2602 - char *tmp; |
|
2603 - register int i; |
|
2604 - BufAlloc(char *,tmp,nKeys*4); |
|
2605 - for (i=0;i<nKeys;i++,tmp+= 4) { |
|
2606 - tmp[0]= names->keys[firstKey+i].name[0]; |
|
2607 - tmp[1]= names->keys[firstKey+i].name[1]; |
|
2608 - tmp[2]= names->keys[firstKey+i].name[2]; |
|
2609 - tmp[3]= names->keys[firstKey+i].name[3]; |
|
2610 - } |
|
2611 -#else |
|
2612 Data(dpy,(char *)&names->keys[firstKey],nKeys*XkbKeyNameLength); |
|
2613 -#endif |
|
2614 } |
|
2615 if (which&XkbKeyAliasesMask) { |
|
2616 -#ifdef WORD64 |
|
2617 - char *tmp; |
|
2618 - register int i; |
|
2619 - BufAlloc(char *,tmp,nKA*XkbKeyNameLength*2); |
|
2620 - for (i=0;i<nKeys;i++,tmp+= 2*XkbKeyNameLength) { |
|
2621 - tmp[0]= names->key_aliases[i].real[0]; |
|
2622 - tmp[1]= names->key_aliases[i].real[1]; |
|
2623 - tmp[2]= names->key_aliases[i].real[2]; |
|
2624 - tmp[3]= names->key_aliases[i].real[3]; |
|
2625 - tmp[4]= names->key_aliases[i].alias[0]; |
|
2626 - tmp[5]= names->key_aliases[i].alias[1]; |
|
2627 - tmp[6]= names->key_aliases[i].alias[2]; |
|
2628 - tmp[7]= names->key_aliases[i].alias[3]; |
|
2629 - } |
|
2630 -#else |
|
2631 Data(dpy,(char *)names->key_aliases,nKA*XkbKeyNameLength*2); |
|
2632 -#endif |
|
2633 } |
|
2634 if (which&XkbRGNamesMask) { |
|
2635 Data32(dpy,(long *)names->radio_groups,nRG*4); |
|
2636 diff --git a/src/xkb/XKBRdBuf.c b/src/xkb/XKBRdBuf.c |
|
2637 index 3023a32..bf2883a 100644 |
|
2638 --- a/src/xkb/XKBRdBuf.c |
|
2639 +++ b/src/xkb/XKBRdBuf.c |
|
2640 @@ -116,30 +116,7 @@ _XkbReadCopyData32(int *wire,long *to,int num_words) |
|
2641 } |
|
2642 return 1; |
|
2643 } |
|
2644 -#endif |
|
2645 -#ifdef WORD64 |
|
2646 -int |
|
2647 -_XkbReadCopyData32(int *from,long *lp,int num_words) |
|
2648 -{ |
|
2649 -long *lpack; |
|
2650 -long mask32 = 0x00000000ffffffff; |
|
2651 -long maskw, i, bits; |
|
2652 - |
|
2653 - lpack = (long *)from; |
|
2654 - bits = 32; |
|
2655 - |
|
2656 - for (i=0;i<num_words;i++) { |
|
2657 - maskw = mask32 << bits; |
|
2658 - *lp++ = (*lpack & maskw) >> bits; |
|
2659 - bits = bits ^ 32; |
|
2660 - if (bits) |
|
2661 - lpack++; |
|
2662 - } |
|
2663 - return 1; |
|
2664 -} |
|
2665 -#endif |
|
2666 |
|
2667 -#if defined(LONG64) || defined(WORD64) |
|
2668 int |
|
2669 _XkbReadBufferCopy32(XkbReadBufferPtr from,long *to,int num_words) |
|
2670 { |
|
2671 @@ -149,9 +126,7 @@ _XkbReadBufferCopy32(XkbReadBufferPtr from,long *to,int num_words) |
|
2672 from->data+= (4*num_words); |
|
2673 return True; |
|
2674 } |
|
2675 -#endif |
|
2676 |
|
2677 -#ifdef LONG64 |
|
2678 int |
|
2679 _XkbWriteCopyData32 (register unsigned long *from,CARD32 *to,int len) |
|
2680 { |
|
2681 @@ -163,9 +138,6 @@ _XkbWriteCopyData32 (register unsigned long *from,CARD32 *to,int len) |
|
2682 } |
|
2683 #endif /* LONG64 */ |
|
2684 |
|
2685 -#ifdef WORD64 |
|
2686 -_XkbWriteCopyData32 Not Implemented Yet for sizeof(int)==8 |
|
2687 -#endif |
|
2688 |
|
2689 char * |
|
2690 _XkbPeekAtReadBuffer(XkbReadBufferPtr from,int size) |
|
2691 diff --git a/src/xkb/XKBlibint.h b/src/xkb/XKBlibint.h |
|
2692 index ce14527..7b41c3b 100644 |
|
2693 --- a/src/xkb/XKBlibint.h |
|
2694 +++ b/src/xkb/XKBlibint.h |
|
2695 @@ -213,7 +213,7 @@ extern int _XkbCopyFromReadBuffer( |
|
2696 ); |
|
2697 |
|
2698 |
|
2699 -#if defined(WORD64) || defined(LONG64) |
|
2700 +#ifdef LONG64 |
|
2701 extern int _XkbReadCopyData32( |
|
2702 int * /* from */, |
|
2703 long * /* to */, |
|
2704 -- |
|
2705 1.7.9.2 |
|
2706 |
|
2707 From 769a0efa2298040fe8316a89fc9e75fb61e288e5 Mon Sep 17 00:00:00 2001 |
|
2708 From: Alan Coopersmith <[email protected]> |
|
2709 Date: Thu, 28 Feb 2013 20:04:25 -0800 |
|
2710 Subject: [PATCH:libX11 46/58] unifdef CRAY & _CRAY |
|
2711 |
|
2712 (mostly performed with unifdef, followed by some manual cleanup of |
|
2713 the remaining code) |
|
2714 |
|
2715 Signed-off-by: Alan Coopersmith <[email protected]> |
|
2716 Reviewed-by: Peter Hutterer <[email protected]> |
|
2717 --- |
|
2718 include/X11/Xlib.h | 4 ---- |
|
2719 include/X11/Xlibint.h | 7 ------- |
|
2720 src/xcms/cmsTrig.c | 4 ---- |
|
2721 3 files changed, 15 deletions(-) |
|
2722 |
|
2723 diff --git a/include/X11/Xlib.h b/include/X11/Xlib.h |
|
2724 index 9618081..65f253c 100644 |
|
2725 --- a/include/X11/Xlib.h |
|
2726 +++ b/include/X11/Xlib.h |
|
2727 @@ -128,11 +128,7 @@ typedef char *XPointer; |
|
2728 #define BitmapBitOrder(dpy) (((_XPrivDisplay)dpy)->bitmap_bit_order) |
|
2729 #define BitmapPad(dpy) (((_XPrivDisplay)dpy)->bitmap_pad) |
|
2730 #define ImageByteOrder(dpy) (((_XPrivDisplay)dpy)->byte_order) |
|
2731 -#ifdef CRAY /* unable to get WORD64 without pulling in other symbols */ |
|
2732 -#define NextRequest(dpy) XNextRequest(dpy) |
|
2733 -#else |
|
2734 #define NextRequest(dpy) (((_XPrivDisplay)dpy)->request + 1) |
|
2735 -#endif |
|
2736 #define LastKnownRequestProcessed(dpy) (((_XPrivDisplay)dpy)->last_request_read) |
|
2737 |
|
2738 /* macros for screen oriented applications (toolkit) */ |
|
2739 diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h |
|
2740 index 48323f7..40965c4 100644 |
|
2741 --- a/include/X11/Xlibint.h |
|
2742 +++ b/include/X11/Xlibint.h |
|
2743 @@ -209,13 +209,6 @@ struct _XDisplay |
|
2744 |
|
2745 #define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n) |
|
2746 |
|
2747 -/* |
|
2748 - * define the following if you want the Data macro to be a procedure instead |
|
2749 - */ |
|
2750 -#ifdef CRAY |
|
2751 -#define DataRoutineIsProcedure |
|
2752 -#endif /* CRAY */ |
|
2753 - |
|
2754 #ifndef _XEVENT_ |
|
2755 /* |
|
2756 * _QEvent datatype for use in input queueing. |
|
2757 diff --git a/src/xcms/cmsTrig.c b/src/xcms/cmsTrig.c |
|
2758 index 5a01a56..a917b78 100644 |
|
2759 --- a/src/xcms/cmsTrig.c |
|
2760 +++ b/src/xcms/cmsTrig.c |
|
2761 @@ -80,12 +80,8 @@ _XcmsModuloF( |
|
2762 #define XCMS_FABS(x) ((x) < 0.0 ? -(x) : (x)) |
|
2763 |
|
2764 /* XCMS_DMAXPOWTWO - largest power of two exactly representable as a double */ |
|
2765 -#ifdef _CRAY |
|
2766 -#define XCMS_DMAXPOWTWO ((double)(1 < 47)) |
|
2767 -#else |
|
2768 #define XCMS_DMAXPOWTWO ((double)(XCMS_LONG_MAX) * \ |
|
2769 (1L << ((XCMS_NBITS(double)-XCMS_DEXPLEN) - XCMS_NBITS(int) + 1))) |
|
2770 -#endif |
|
2771 |
|
2772 /* |
|
2773 * LOCAL VARIABLES |
|
2774 -- |
|
2775 1.7.9.2 |
|
2776 |
|
2777 From 9bcfd84aa1410387bc8cf002a5f90f44705aa0d1 Mon Sep 17 00:00:00 2001 |
|
2778 From: Alan Coopersmith <[email protected]> |
|
2779 Date: Fri, 1 Mar 2013 18:09:07 -0800 |
|
2780 Subject: [PATCH:libX11 47/58] unifdef XKB_IN_SERVER |
|
2781 |
|
2782 Leftovers from XKB files that were previously shared between the client |
|
2783 and server code, but aren't any more. |
|
2784 |
|
2785 Signed-off-by: Alan Coopersmith <[email protected]> |
|
2786 Reviewed-by: Peter Hutterer <[email protected]> |
|
2787 --- |
|
2788 src/xkb/XKBAlloc.c | 12 ------------ |
|
2789 src/xkb/XKBGAlloc.c | 12 ------------ |
|
2790 src/xkb/XKBMAlloc.c | 13 ------------- |
|
2791 src/xkb/XKBMisc.c | 13 ------------- |
|
2792 4 files changed, 50 deletions(-) |
|
2793 |
|
2794 diff --git a/src/xkb/XKBAlloc.c b/src/xkb/XKBAlloc.c |
|
2795 index 05e9f73..034539b 100644 |
|
2796 --- a/src/xkb/XKBAlloc.c |
|
2797 +++ b/src/xkb/XKBAlloc.c |
|
2798 @@ -30,7 +30,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
2799 #include <config.h> |
|
2800 #endif |
|
2801 |
|
2802 -#ifndef XKB_IN_SERVER |
|
2803 |
|
2804 #include <stdio.h> |
|
2805 #include "Xlibint.h" |
|
2806 @@ -39,17 +38,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
2807 #include <X11/extensions/XKBproto.h> |
|
2808 #include "XKBlibint.h" |
|
2809 |
|
2810 -#else |
|
2811 - |
|
2812 -#include <stdio.h> |
|
2813 -#include <X11/X.h> |
|
2814 -#include <X11/Xproto.h> |
|
2815 -#include "misc.h" |
|
2816 -#include "inputstr.h" |
|
2817 -#include <X11/extensions/XKBsrv.h> |
|
2818 -#include <X11/extensions/XKBgeom.h> |
|
2819 - |
|
2820 -#endif /* XKB_IN_SERVER */ |
|
2821 |
|
2822 /***===================================================================***/ |
|
2823 |
|
2824 diff --git a/src/xkb/XKBGAlloc.c b/src/xkb/XKBGAlloc.c |
|
2825 index 7679496..e55f5e8 100644 |
|
2826 --- a/src/xkb/XKBGAlloc.c |
|
2827 +++ b/src/xkb/XKBGAlloc.c |
|
2828 @@ -30,7 +30,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
2829 #include <config.h> |
|
2830 #endif |
|
2831 |
|
2832 -#ifndef XKB_IN_SERVER |
|
2833 |
|
2834 #include <stdio.h> |
|
2835 #include "Xlibint.h" |
|
2836 @@ -38,17 +37,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
2837 #include <X11/extensions/XKBgeom.h> |
|
2838 #include <X11/extensions/XKBproto.h> |
|
2839 |
|
2840 -#else |
|
2841 - |
|
2842 -#include <stdio.h> |
|
2843 -#include <X11/X.h> |
|
2844 -#include <X11/Xproto.h> |
|
2845 -#include "misc.h" |
|
2846 -#include "inputstr.h" |
|
2847 -#include <X11/extensions/XKBsrv.h> |
|
2848 -#include <X11/extensions/XKBgeom.h> |
|
2849 - |
|
2850 -#endif /* XKB_IN_SERVER */ |
|
2851 |
|
2852 #ifdef X_NOT_POSIX |
|
2853 #define Size_t unsigned int |
|
2854 diff --git a/src/xkb/XKBMAlloc.c b/src/xkb/XKBMAlloc.c |
|
2855 index a6b3921..fd75f0c 100644 |
|
2856 --- a/src/xkb/XKBMAlloc.c |
|
2857 +++ b/src/xkb/XKBMAlloc.c |
|
2858 @@ -30,7 +30,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
2859 #include <config.h> |
|
2860 #endif |
|
2861 |
|
2862 -#ifndef XKB_IN_SERVER |
|
2863 |
|
2864 #include <stdio.h> |
|
2865 #include "Xlibint.h" |
|
2866 @@ -38,18 +37,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
2867 #include <X11/keysym.h> |
|
2868 #include "XKBlibint.h" |
|
2869 |
|
2870 -#else |
|
2871 - |
|
2872 -#include <stdio.h> |
|
2873 -#include <X11/X.h> |
|
2874 -#include <X11/Xproto.h> |
|
2875 -#include "misc.h" |
|
2876 -#include "inputstr.h" |
|
2877 -#include <X11/keysym.h> |
|
2878 -#define XKBSRV_NEED_FILE_FUNCS |
|
2879 -#include <X11/extensions/XKBsrv.h> |
|
2880 - |
|
2881 -#endif /* XKB_IN_SERVER */ |
|
2882 |
|
2883 /***====================================================================***/ |
|
2884 |
|
2885 diff --git a/src/xkb/XKBMisc.c b/src/xkb/XKBMisc.c |
|
2886 index 4aa1f73..cd90da7 100644 |
|
2887 --- a/src/xkb/XKBMisc.c |
|
2888 +++ b/src/xkb/XKBMisc.c |
|
2889 @@ -30,7 +30,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
2890 #include <config.h> |
|
2891 #endif |
|
2892 |
|
2893 -#ifndef XKB_IN_SERVER |
|
2894 |
|
2895 #include <stdio.h> |
|
2896 #include "Xlibint.h" |
|
2897 @@ -38,18 +37,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
2898 #include <X11/keysym.h> |
|
2899 #include "XKBlibint.h" |
|
2900 |
|
2901 -#else |
|
2902 - |
|
2903 -#include <stdio.h> |
|
2904 -#include <X11/X.h> |
|
2905 -#include <X11/Xproto.h> |
|
2906 -#include "misc.h" |
|
2907 -#include "inputstr.h" |
|
2908 -#include <X11/keysym.h> |
|
2909 -#define XKBSRV_NEED_FILE_FUNCS |
|
2910 -#include <X11/extensions/XKBsrv.h> |
|
2911 - |
|
2912 -#endif /* XKB_IN_SERVER */ |
|
2913 |
|
2914 /***====================================================================***/ |
|
2915 |
|
2916 -- |
|
2917 1.7.9.2 |
|
2918 |
|
2919 From c23d61d1b84dca3740bf4786978c7908d0065fb9 Mon Sep 17 00:00:00 2001 |
|
2920 From: Alan Coopersmith <[email protected]> |
|
2921 Date: Fri, 1 Mar 2013 18:10:27 -0800 |
|
2922 Subject: [PATCH:libX11 48/58] Assume size_t is always available, since it was |
|
2923 defined in C89 |
|
2924 |
|
2925 Don't provide a fallback definition #ifdef X_NOT_POSIX anymore. |
|
2926 We already use size_t throughout the rest of Xlib, just had this |
|
2927 one instance left in XKBGAlloc.c of a fallback definition. |
|
2928 |
|
2929 Signed-off-by: Alan Coopersmith <[email protected]> |
|
2930 --- |
|
2931 src/xkb/XKBGAlloc.c | 9 +-------- |
|
2932 1 file changed, 1 insertion(+), 8 deletions(-) |
|
2933 |
|
2934 diff --git a/src/xkb/XKBGAlloc.c b/src/xkb/XKBGAlloc.c |
|
2935 index e55f5e8..6d4c676 100644 |
|
2936 --- a/src/xkb/XKBGAlloc.c |
|
2937 +++ b/src/xkb/XKBGAlloc.c |
|
2938 @@ -37,13 +37,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
2939 #include <X11/extensions/XKBgeom.h> |
|
2940 #include <X11/extensions/XKBproto.h> |
|
2941 |
|
2942 - |
|
2943 -#ifdef X_NOT_POSIX |
|
2944 -#define Size_t unsigned int |
|
2945 -#else |
|
2946 -#define Size_t size_t |
|
2947 -#endif |
|
2948 - |
|
2949 /***====================================================================***/ |
|
2950 |
|
2951 static void |
|
2952 @@ -464,7 +457,7 @@ _XkbGeomAlloc( XPointer * old, |
|
2953 unsigned short * num, |
|
2954 unsigned short * total, |
|
2955 int num_new, |
|
2956 - Size_t sz_elem) |
|
2957 + size_t sz_elem) |
|
2958 { |
|
2959 if (num_new<1) |
|
2960 return Success; |
|
2961 -- |
|
2962 1.7.9.2 |
|
2963 |
|
2964 From 466404007f2c8f7166e4faddfea1454c5bfe1e9a Mon Sep 17 00:00:00 2001 |
|
2965 From: Alan Coopersmith <[email protected]> |
|
2966 Date: Fri, 8 Mar 2013 17:13:09 -0800 |
|
2967 Subject: [PATCH:libX11 50/58] _xudc_code_to_glyph: check for NULL pointer |
|
2968 *before* writing to it, not after |
|
2969 |
|
2970 Signed-off-by: Alan Coopersmith <[email protected]> |
|
2971 --- |
|
2972 src/udcInf.c | 8 ++++---- |
|
2973 1 file changed, 4 insertions(+), 4 deletions(-) |
|
2974 |
|
2975 diff --git a/src/udcInf.c b/src/udcInf.c |
|
2976 index db7ad10..b7577ac 100644 |
|
2977 --- a/src/udcInf.c |
|
2978 +++ b/src/udcInf.c |
|
2979 @@ -702,14 +702,14 @@ int *num_gi; |
|
2980 _XlcCloseConverter(conv); |
|
2981 _XlcDestroyLC(lcd); |
|
2982 |
|
2983 - *gi = (_XUDCGIInf *)Xmalloc(sizeof(_XUDCGIInf)); |
|
2984 - (*gi)->charset_str = (char *)Xmalloc(strlen(charsetname)+1); |
|
2985 - strcpy((*gi)->charset_str,charsetname); |
|
2986 - (*gi)->glyph_index = glyph; |
|
2987 + *gi = Xmalloc(sizeof(_XUDCGIInf)); |
|
2988 if(*gi == NULL){ |
|
2989 _xudc_utyerrno = 0x03 ; |
|
2990 return(_XUDC_ERROR); |
|
2991 } |
|
2992 + (*gi)->charset_str = Xmalloc(strlen(charsetname)+1); |
|
2993 + strcpy((*gi)->charset_str,charsetname); |
|
2994 + (*gi)->glyph_index = glyph; |
|
2995 *num_gi = 1; |
|
2996 return(0); |
|
2997 } |
|
2998 -- |
|
2999 1.7.9.2 |
|
3000 |
|
3001 From 3facbe5c0df1b5597571b7b00d5f7bdbc92fb278 Mon Sep 17 00:00:00 2001 |
|
3002 From: Alan Coopersmith <[email protected]> |
|
3003 Date: Sat, 2 Mar 2013 12:01:39 -0800 |
|
3004 Subject: [PATCH:libX11 51/58] Add <X11/Xresource.h> hint to all Xrm* man |
|
3005 pages |
|
3006 |
|
3007 Help users figure out which header file they need to #include |
|
3008 |
|
3009 Signed-off-by: Alan Coopersmith <[email protected]> |
|
3010 --- |
|
3011 man/XrmEnumerateDatabase.man | 2 ++ |
|
3012 man/XrmGetFileDatabase.man | 2 ++ |
|
3013 man/XrmGetResource.man | 2 ++ |
|
3014 man/XrmInitialize.man | 2 ++ |
|
3015 man/XrmMergeDatabases.man | 2 ++ |
|
3016 man/XrmPutResource.man | 2 ++ |
|
3017 man/XrmUniqueQuark.man | 2 ++ |
|
3018 7 files changed, 14 insertions(+) |
|
3019 |
|
3020 diff --git a/man/XrmEnumerateDatabase.man b/man/XrmEnumerateDatabase.man |
|
3021 index 8431006..03c0f30 100644 |
|
3022 --- a/man/XrmEnumerateDatabase.man |
|
3023 +++ b/man/XrmEnumerateDatabase.man |
|
3024 @@ -84,6 +84,8 @@ |
|
3025 .SH NAME |
|
3026 XrmEnumerateDatabase \- enumerate resource database entries |
|
3027 .SH SYNTAX |
|
3028 +.HP |
|
3029 +#include <X11/Xresource.h> |
|
3030 .TS |
|
3031 lw(.5i) lw(2i) lw(2.5i). |
|
3032 T{ |
|
3033 diff --git a/man/XrmGetFileDatabase.man b/man/XrmGetFileDatabase.man |
|
3034 index 3a8a6fa..71ddd9f 100644 |
|
3035 --- a/man/XrmGetFileDatabase.man |
|
3036 +++ b/man/XrmGetFileDatabase.man |
|
3037 @@ -93,6 +93,8 @@ |
|
3038 XrmGetFileDatabase, XrmPutFileDatabase, XrmGetStringDatabase, XrmLocaleOfDatabase, XrmGetDatabase, XrmSetDatabase, XrmDestroyDatabase \- retrieve and store resource databases |
|
3039 .SH SYNTAX |
|
3040 .HP |
|
3041 +#include <X11/Xresource.h> |
|
3042 +.HP |
|
3043 XrmDatabase XrmGetFileDatabase\^(\^char *\fIfilename\fP\^); |
|
3044 .HP |
|
3045 void XrmPutFileDatabase\^(\^XrmDatabase \fIdatabase\fP\^, char |
|
3046 diff --git a/man/XrmGetResource.man b/man/XrmGetResource.man |
|
3047 index 76ca921..ef2cf9a 100644 |
|
3048 --- a/man/XrmGetResource.man |
|
3049 +++ b/man/XrmGetResource.man |
|
3050 @@ -85,6 +85,8 @@ |
|
3051 XrmGetResource, XrmQGetResource, XrmQGetSearchList, XrmQGetSearchResource \- retrieve database resources and search lists |
|
3052 .SH SYNTAX |
|
3053 .HP |
|
3054 +#include <X11/Xresource.h> |
|
3055 +.HP |
|
3056 Bool XrmGetResource\^(\^XrmDatabase \fIdatabase\fP\^, char *\fIstr_name\fP\^, |
|
3057 char *\fIstr_class\fP\^, char **\fIstr_type_return\fP\^, XrmValue |
|
3058 *\fIvalue_return\fP\^); |
|
3059 diff --git a/man/XrmInitialize.man b/man/XrmInitialize.man |
|
3060 index b8b549d..3b3ddd7 100644 |
|
3061 --- a/man/XrmInitialize.man |
|
3062 +++ b/man/XrmInitialize.man |
|
3063 @@ -83,6 +83,8 @@ |
|
3064 XrmInitialize, XrmParseCommand, XrmValue, XrmOptionKind, XrmOptionDescRec \- initialize the Resource Manager, Resource Manager structures, and parse the command line |
|
3065 .SH SYNTAX |
|
3066 .HP |
|
3067 +#include <X11/Xresource.h> |
|
3068 +.HP |
|
3069 void XrmInitialize\^(void\^); |
|
3070 .HP |
|
3071 void XrmParseCommand\^(\^XrmDatabase *\fIdatabase\fP\^, XrmOptionDescList |
|
3072 diff --git a/man/XrmMergeDatabases.man b/man/XrmMergeDatabases.man |
|
3073 index 57a6578..41b27bb 100644 |
|
3074 --- a/man/XrmMergeDatabases.man |
|
3075 +++ b/man/XrmMergeDatabases.man |
|
3076 @@ -83,6 +83,8 @@ |
|
3077 XrmMergeDatabases, XrmCombineDatabase, XrmCombineFileDatabase \- merge resource databases |
|
3078 .SH SYNTAX |
|
3079 .HP |
|
3080 +#include <X11/Xresource.h> |
|
3081 +.HP |
|
3082 void XrmMergeDatabases(\^XrmDatabase \fIsource_db\fP, XrmDatabase |
|
3083 *\fItarget_db\fP\^); |
|
3084 .HP |
|
3085 diff --git a/man/XrmPutResource.man b/man/XrmPutResource.man |
|
3086 index 9f9d088..fd64463 100644 |
|
3087 --- a/man/XrmPutResource.man |
|
3088 +++ b/man/XrmPutResource.man |
|
3089 @@ -83,6 +83,8 @@ |
|
3090 XrmPutResource, XrmQPutResource, XrmPutStringResource, XrmQPutStringResource, XrmPutLineResource \- store database resources |
|
3091 .SH SYNTAX |
|
3092 .HP |
|
3093 +#include <X11/Xresource.h> |
|
3094 +.HP |
|
3095 void XrmPutResource\^(\^XrmDatabase *\fIdatabase\fP\^, char |
|
3096 *\fIspecifier\fP\^, char *\fItype\fP\^, XrmValue *\fIvalue\fP\^); |
|
3097 .HP |
|
3098 diff --git a/man/XrmUniqueQuark.man b/man/XrmUniqueQuark.man |
|
3099 index 383d26c..93755f7 100644 |
|
3100 --- a/man/XrmUniqueQuark.man |
|
3101 +++ b/man/XrmUniqueQuark.man |
|
3102 @@ -83,6 +83,8 @@ |
|
3103 XrmUniqueQuark, XrmStringToQuark, XrmPermStringToQuark, XrmQuarkToString, XrmStringToQuarkList, XrmStringToBindingQuarkList \- manipulate resource quarks |
|
3104 .SH SYNOPSIS |
|
3105 .HP |
|
3106 +#include <X11/Xresource.h> |
|
3107 +.HP |
|
3108 XrmQuark XrmUniqueQuark\^(void); |
|
3109 .LP |
|
3110 \&#define XrmStringToName(string) XrmStringToQuark(string) |
|
3111 -- |
|
3112 1.7.9.2 |
|
3113 |
|
3114 From 39547d600a13713e15429f49768e54c3173c828d Mon Sep 17 00:00:00 2001 |
|
3115 From: Karl Tomlinson <[email protected]> |
|
3116 Date: Mon, 18 Feb 2013 01:25:34 +0000 |
|
3117 Subject: [PATCH:libX11 54/58] MakeBigReq: don't move the last word, already |
|
3118 handled by Data32 |
|
3119 |
|
3120 MakeBigReq inserts a length field after the first 4 bytes of the request |
|
3121 (after req->length), pushing everything else back by 4 bytes. |
|
3122 |
|
3123 The current memmove moves everything but the first 4 bytes back. |
|
3124 If a request aligns to the end of the buffer pointer when MakeBigReq is |
|
3125 invoked for that request, this runs over the buffer. |
|
3126 Instead, we need to memmove minus the first 4 bytes (which aren't moved), |
|
3127 minus the last 4 bytes (so we still align to the previous tail). |
|
3128 |
|
3129 The 4 bytes that fell out are already handled with Data32, which will |
|
3130 handle the buffermax correctly. |
|
3131 |
|
3132 The case where req->length = 1 was already not functional. |
|
3133 |
|
3134 Reported by Abhishek Arya <[email protected]>. |
|
3135 |
|
3136 https://bugzilla.mozilla.org/show_bug.cgi?id=803762 |
|
3137 |
|
3138 Reviewed-by: Jeff Muizelaar <[email protected]> |
|
3139 Reviewed-by: Peter Hutterer <[email protected]> |
|
3140 Signed-off-by: Alan Coopersmith <[email protected]> |
|
3141 --- |
|
3142 include/X11/Xlibint.h | 19 +++++++++++++++++-- |
|
3143 1 file changed, 17 insertions(+), 2 deletions(-) |
|
3144 |
|
3145 diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h |
|
3146 index 40965c4..06395b3 100644 |
|
3147 --- a/include/X11/Xlibint.h |
|
3148 +++ b/include/X11/Xlibint.h |
|
3149 @@ -486,6 +486,14 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); |
|
3150 req = (xReq *) _XGetRequest(dpy, X_/**/name, SIZEOF(xReq)) |
|
3151 #endif |
|
3152 |
|
3153 +/* |
|
3154 + * MakeBigReq sets the CARD16 "req->length" to 0 and inserts a new CARD32 |
|
3155 + * length, after req->length, before the data in the request. The new length |
|
3156 + * includes the "n" extra 32-bit words. |
|
3157 + * |
|
3158 + * Do not use MakeBigReq if there is no data already in the request. |
|
3159 + * req->length must already be >= 2. |
|
3160 + */ |
|
3161 #ifdef LONG64 |
|
3162 #define MakeBigReq(req,n) \ |
|
3163 { \ |
|
3164 @@ -493,7 +501,7 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); |
|
3165 CARD32 _BRlen = req->length - 1; \ |
|
3166 req->length = 0; \ |
|
3167 _BRdat = ((CARD32 *)req)[_BRlen]; \ |
|
3168 - memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \ |
|
3169 + memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ |
|
3170 ((CARD32 *)req)[1] = _BRlen + n + 2; \ |
|
3171 Data32(dpy, &_BRdat, 4); \ |
|
3172 } |
|
3173 @@ -504,12 +512,19 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); |
|
3174 CARD32 _BRlen = req->length - 1; \ |
|
3175 req->length = 0; \ |
|
3176 _BRdat = ((CARD32 *)req)[_BRlen]; \ |
|
3177 - memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \ |
|
3178 + memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ |
|
3179 ((CARD32 *)req)[1] = _BRlen + n + 2; \ |
|
3180 Data32(dpy, &_BRdat, 4); \ |
|
3181 } |
|
3182 #endif |
|
3183 |
|
3184 +/* |
|
3185 + * SetReqLen increases the count of 32-bit words in the request by "n", |
|
3186 + * or by "badlen" if "n" is too large. |
|
3187 + * |
|
3188 + * Do not use SetReqLen if "req" does not already have data after the |
|
3189 + * xReq header. req->length must already be >= 2. |
|
3190 + */ |
|
3191 #ifndef __clang_analyzer__ |
|
3192 #define SetReqLen(req,n,badlen) \ |
|
3193 if ((req->length + n) > (unsigned)65535) { \ |
|
3194 -- |
|
3195 1.7.9.2 |
|
3196 |
|
3197 From e9bd757630368afb374c5d1bcc5d4d85ad3c6c4c Mon Sep 17 00:00:00 2001 |
|
3198 From: Alan Coopersmith <[email protected]> |
|
3199 Date: Fri, 8 Mar 2013 15:37:33 -0800 |
|
3200 Subject: [PATCH:libX11 55/58] XAllocClassHint: Assume calloc sets pointers in |
|
3201 allocated memory to NULL |
|
3202 |
|
3203 While the C standard technically allows for the compiler to translate |
|
3204 pointer = 0 or pointer = NULL into something other than filling the |
|
3205 pointer address with 0 bytes, the rest of the Xlib code already assumes |
|
3206 that calloc initializes any pointers in the struct to NULL, and there |
|
3207 are no known systems supported by X.Org where this is not true. |
|
3208 |
|
3209 Signed-off-by: Alan Coopersmith <[email protected]> |
|
3210 --- |
|
3211 src/PropAlloc.c | 7 +------ |
|
3212 1 file changed, 1 insertion(+), 6 deletions(-) |
|
3213 |
|
3214 diff --git a/src/PropAlloc.c b/src/PropAlloc.c |
|
3215 index bad7681..5162830 100644 |
|
3216 --- a/src/PropAlloc.c |
|
3217 +++ b/src/PropAlloc.c |
|
3218 @@ -58,12 +58,7 @@ XWMHints *XAllocWMHints (void) |
|
3219 |
|
3220 XClassHint *XAllocClassHint (void) |
|
3221 { |
|
3222 - register XClassHint *h; |
|
3223 - |
|
3224 - if ((h = (XClassHint *) Xcalloc (1, (unsigned) sizeof (XClassHint)))) |
|
3225 - h->res_name = h->res_class = NULL; |
|
3226 - |
|
3227 - return h; |
|
3228 + return Xcalloc (1, sizeof (XClassHint)); |
|
3229 } |
|
3230 |
|
3231 |
|
3232 -- |
|
3233 1.7.9.2 |
|
3234 |
|
3235 From f9cd175a471116a616e681fb0ca1a61b3d84a6a0 Mon Sep 17 00:00:00 2001 |
|
3236 From: Alan Coopersmith <[email protected]> |
|
3237 Date: Fri, 8 Mar 2013 22:33:28 -0800 |
|
3238 Subject: [PATCH:libX11 56/58] Fix very weird indenting in src/GetFProp.c |
|
3239 |
|
3240 Signed-off-by: Alan Coopersmith <[email protected]> |
|
3241 --- |
|
3242 src/GetFProp.c | 27 ++++++++++++--------------- |
|
3243 1 file changed, 12 insertions(+), 15 deletions(-) |
|
3244 |
|
3245 diff --git a/src/GetFProp.c b/src/GetFProp.c |
|
3246 index 27ec98b..1e0cd32 100644 |
|
3247 --- a/src/GetFProp.c |
|
3248 +++ b/src/GetFProp.c |
|
3249 @@ -29,27 +29,24 @@ in this Software without prior written authorization from The Open Group. |
|
3250 #endif |
|
3251 #include "Xlibint.h" |
|
3252 |
|
3253 -Bool XGetFontProperty ( |
|
3254 +Bool |
|
3255 +XGetFontProperty( |
|
3256 XFontStruct *fs, |
|
3257 register Atom name, |
|
3258 unsigned long *valuePtr) |
|
3259 { |
|
3260 /* XXX this is a simple linear search for now. If the |
|
3261 - protocol is changed to sort the property list, this should |
|
3262 - become a binary search. */ |
|
3263 + protocol is changed to sort the property list, this should |
|
3264 + become a binary search. */ |
|
3265 register XFontProp *prop = fs->properties; |
|
3266 register XFontProp *last = prop + fs->n_properties; |
|
3267 + |
|
3268 while (prop != last) { |
|
3269 - if (prop->name == name) { |
|
3270 - *valuePtr = prop->card32; |
|
3271 - return (1); |
|
3272 - } |
|
3273 - prop++; |
|
3274 - } |
|
3275 - return (0); |
|
3276 + if (prop->name == name) { |
|
3277 + *valuePtr = prop->card32; |
|
3278 + return (1); |
|
3279 + } |
|
3280 + prop++; |
|
3281 } |
|
3282 - |
|
3283 - |
|
3284 - |
|
3285 - |
|
3286 - |
|
3287 + return (0); |
|
3288 +} |
|
3289 -- |
|
3290 1.7.9.2 |
|
3291 |
|
3292 From f49bb2dd6d4ea45c55bd21acc0efe2b764441020 Mon Sep 17 00:00:00 2001 |
|
3293 From: Alan Coopersmith <[email protected]> |
|
3294 Date: Sat, 16 Mar 2013 18:30:56 -0700 |
|
3295 Subject: [PATCH:libX11 58/58] Move big request comment in XOpenDisplay to the |
|
3296 right place |
|
3297 |
|
3298 Signed-off-by: Alan Coopersmith <[email protected]> |
|
3299 --- |
|
3300 src/OpenDis.c | 4 +++- |
|
3301 1 file changed, 3 insertions(+), 1 deletion(-) |
|
3302 |
|
3303 diff --git a/src/OpenDis.c b/src/OpenDis.c |
|
3304 index 9379fec..f6d8c70 100644 |
|
3305 --- a/src/OpenDis.c |
|
3306 +++ b/src/OpenDis.c |
|
3307 @@ -499,6 +499,9 @@ XOpenDisplay ( |
|
3308 return(NULL); |
|
3309 } |
|
3310 |
|
3311 +/* |
|
3312 + * get availability of large requests |
|
3313 + */ |
|
3314 dpy->bigreq_size = xcb_get_maximum_request_length(dpy->xcb->connection); |
|
3315 if(dpy->bigreq_size <= dpy->max_request_size) |
|
3316 dpy->bigreq_size = 0; |
|
3317 @@ -525,7 +528,6 @@ XOpenDisplay ( |
|
3318 (void) XSynchronize(dpy, _Xdebug); |
|
3319 |
|
3320 /* |
|
3321 - * get availability of large requests, and |
|
3322 * get the resource manager database off the root window. |
|
3323 */ |
|
3324 LockDisplay(dpy); |
|
3325 -- |
|
3326 1.7.9.2 |
|
3327 |