DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2432
Version: 1.3-current


In X11/Xlib.h struct XChar2b lacks "packed" attribute
arm-linux-gcc 4.4.4 doesn't pack structures by default, so sizeof(struct
XChar2b) is 4.
Included patch solves this problem, but was tested only on an embedded ARM
system running fltk-1.3 + nxlib + microwindows


Link: http://www.fltk.org/str.php?L2432
Version: 1.3-current
diff -urNp fltk-1.3.x-r7709/src/xutf8/utf8Wrap.c 
fltk-1.3.x-r7709.elpa/src/xutf8/utf8Wrap.c
--- fltk-1.3.x-r7709/src/xutf8/utf8Wrap.c       2009-03-18 05:47:01.000000000 
+0100
+++ fltk-1.3.x-r7709.elpa/src/xutf8/utf8Wrap.c  2010-10-17 12:14:35.997221211 
+0200
@@ -43,6 +43,11 @@
  * extern const char *encoding_name(int num);
  */
 
+typedef struct {               /* normal 16 bit characters are two bytes */
+  unsigned char byte1;
+  unsigned char byte2;
+} __attribute__((packed)) XChar2b_p;
+
 /*********************************************************************/
 /** extract a list of font from the base font name list             **/
 /*********************************************************************/
@@ -328,8 +333,8 @@ XUtf8DrawRtlString(Display          *display, 
 
   int          *encodings;     /* encodings array */
   XFontStruct  **fonts;        /* fonts array */
-  XChar2b      buf[128];       /* drawing buffer */
-  XChar2b      *ptr;           /* pointer to the drawing buffer */
+  XChar2b_p    buf[128];       /* drawing buffer */
+  XChar2b_p    *ptr;           /* pointer to the drawing buffer */
   int          fnum;           /* index of the current font in the fonts 
array*/
   int          i;              /* current byte in the XChar2b buffer */
   int          first;          /* first valid font index */
@@ -449,7 +454,7 @@ XUtf8DrawString(Display     *display, 
 
   int          *encodings; /* encodings array */
   XFontStruct  **fonts;    /* fonts array */
-  XChar2b      buf[128];   /* drawing buffer */
+  XChar2b_p    buf[128];   /* drawing buffer */
   int          fnum;       /* index of the current font in the fonts array*/
   int          i;          /* current byte in the XChar2b buffer */
   int          first;      /* first valid font index */
@@ -559,7 +564,7 @@ XUtf8TextWidth(XUtf8FontStruct      *font_se
   int          x;
   int          *encodings; /* encodings array */
   XFontStruct  **fonts;    /* fonts array */
-  XChar2b      buf[128];   /* drawing buffer */
+  XChar2b_p    buf[128];   /* drawing buffer */
   int          fnum;       /* index of the current font in the fonts array*/
   int          i;          /* current byte in the XChar2b buffer */
   int          first;      /* first valid font index */
@@ -739,7 +744,7 @@ XUtf8UcsWidth(XUtf8FontStruct  *font_set
   int          x;
   int          *encodings; /* encodings array */
   XFontStruct  **fonts;    /* fonts array */
-  XChar2b      buf[8];     /* drawing buffer */
+  XChar2b_p    buf[8];     /* drawing buffer */
   int          fnum;       /* index of the current font in the fonts array*/
   int          i;          /* current byte in the XChar2b buffer */
   int          first;      /* first valid font index */
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to