Nicolas George wrote on 13 Dec 2004 01:53:59 +0100:

> xterm is built with the default -mstructure-size-boundary value, 32. This
> leads to sizeof(XChar2b) being 4 and not 2 as it should be. The result is
> that xterm with wide-chars enabled will display a null character between
> each second character.

> The problem disappears if xterm is build with the
> -mstructure-size-boundary=8 option.

Rather than adding a flag when compiling every X program, we could add a
__attribute__(packed) in X11/Xlib.h. The attached patch gives
sizeof(XChar2b)==2.

-- 
Gaƫtan LEURENT
--- /usr/X11R6/include/X11/Xlib.h	2004-09-30 16:54:31.000000000 +0200
+++ X11/Xlib.h	2004-12-13 02:54:16.000000000 +0100
@@ -1059,7 +1059,11 @@
 typedef struct {		/* normal 16 bit characters are two bytes */
     unsigned char byte1;
     unsigned char byte2;
-} XChar2b;
+}
+#ifdef __GNUC__
+__attribute__ ((packed))
+#endif
+XChar2b;
 
 typedef struct {
     XChar2b *chars;		/* two byte characters */

Reply via email to