[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#354577: Patch



The maxnames parameter of XListFonts can take values that exceed 32767
(the hardcoded value) on platforms where sizeof(int) is greater than 2
bytes. The patch supplied eliminates the problem. It was made for
XFree-4.5.0, not x.org for two reasons:

1. source code of old utilities doesn't differ too much between the
two distributions;
2. I don't have x.org sources handy.

---- patch BEGIN ----
diff -ur xc.orig/programs/xfontsel/xfontsel.c xc/programs/xfontsel/xfontsel.c
--- xc.orig/programs/xfontsel/xfontsel.c	2004-04-04 02:38:55.000000000 +0400
+++ xc/programs/xfontsel/xfontsel.c	2006-02-28 17:51:11.000000000 +0300
@@ -505,7 +505,7 @@
     int work_priority = 0;

     fontNames = parseRec->fontNames =
-	XListFonts(dpy, AppRes.pattern, 32767, &numFonts);
+	XListFonts(dpy, AppRes.pattern, (int) ((((long) ((unsigned) -1)) +
1) / 2 - 1), &numFonts);

     fonts = (FontValues*)XtMalloc( numFonts*sizeof(FontValues) );
     fontInSet = (Boolean*)XtMalloc( numFonts*sizeof(Boolean) );
---- patch END ----



Reply to: