__compar_fn_t Linuxism in dlls/wineps/afm.c

Gerald Pfeifer pfeifer at dbai.tuwien.ac.at
Fri May 11 06:09:27 CDT 2001

I believe relying on __compar_fn_t in dlls/wineps/afm.c is a Linuxism
recently added to dlls/wineps/afm.c (and only there), Ian.

Given that __compar_fn_t is only used in that single file and nowhere
else, I'd suggest to simply use a typedef of your own instead of the
non-portable __compar_fn_t. -- Could you please have a look?

Alexandre, in the mean-time please consider my patch below, which gets
rid of the build failure at least.

/usr/bin/gcc -c -I. -I. -I../../include -I../../include  -g -O2 -Wall -mpreferred-stack-boundary=2 -fPIC -D__WINE__  -D_REENTRANT -I/usr/X11R6/include -o afm.o afm.c
afm.c: In function `SortFontMetrics':
afm.c:686: `__compar_fn_t' undeclared (first use in this function)
afm.c:686: (Each undeclared identifier is reported only once
afm.c:686: for each function it appears in.)
afm.c:686: syntax error before `UnicodeGlyphByNameIndex'
afm.c:698: syntax error before `UnicodeGlyphByNameIndex'
afm.c:718: syntax error before `UnicodeGlyphByUV'
afm.c:729: syntax error before `AFMMetricsByUV'
afm.c:691: warning: `pug' might be used uninitialized in this function
afm.c: At top level:
afm.c:644: warning: `UnicodeGlyphByNameIndex' defined but not used
afm.c:649: warning: `UnicodeGlyphByUV' defined but not used
afm.c:654: warning: `AFMMetricsByUV' defined but not used
gmake[2]: *** [afm.o] Error 1
gmake[2]: Leaving directory `/.amd_mnt/vexpert/files8/test/wine/dlls/wineps'
gmake[1]: *** [wineps/libwineps.so] Error 2


Index: afm.c
RCS file: /home/wine/wine/dlls/wineps/afm.c,v
retrieving revision 1.13
diff -u -3 -p -r1.13 afm.c
--- afm.c	2001/05/09 17:11:59	1.13
+++ afm.c	2001/05/11 10:58:58
@@ -683,7 +683,7 @@ static BOOL SortFontMetrics()

 		    qsort(aglCopy, PSDRV_AdobeGlyphList.size,
-			    (__compar_fn_t)UnicodeGlyphByNameIndex);
+			    UnicodeGlyphByNameIndex);

 		for (i = 0; i < afm->NumofMetrics; ++i)
@@ -695,7 +695,7 @@ static BOOL SortFontMetrics()

 		    pug = bsearch(&ug, aglCopy, PSDRV_AdobeGlyphList.size,
-			    (__compar_fn_t)UnicodeGlyphByNameIndex);
+			    UnicodeGlyphByNameIndex);
 		    if (pug == NULL)
 		    	WARN("Glyph '%s' in font '%s' does not have a UV\n",
@@ -715,7 +715,7 @@ static BOOL SortFontMetrics()

 		/* typecast avoids compiler warning */
     	    	qsort((void *)(afm->Encoding->glyphs), afm->Encoding->size,
-		    	sizeof(UNICODEGLYPH), (__compar_fn_t)UnicodeGlyphByUV);
+		    	sizeof(UNICODEGLYPH), UnicodeGlyphByUV);

 		for (i = 0; i < afm->Encoding->size; ++i)
 		    if (afm->Encoding->glyphs[i].UV >= 0)
@@ -726,7 +726,7 @@ static BOOL SortFontMetrics()

 	    qsort(afm->Metrics, afm->NumofMetrics, sizeof(AFMMETRICS),
-	    	    (__compar_fn_t)AFMMetricsByUV);
+	    	    AFMMetricsByUV);

 	    for (i = 0; i < afm->NumofMetrics; ++i)
 	    	if (afm->Metrics[i].UV >= 0)

More information about the wine-devel mailing list