GNOME Bugzilla – Bug 329043
[ppc] fontilus will not thumbnail/display any fonts (endianness)
Last modified: 2006-01-30 12:27:49 UTC
Freetype compiled with -DFT_DEBUG_LEVEL_ERROR $ gnome-font-viewer /usr/share/fonts/corefonts/timesi.ttf FT_Stream_ReadLong: invalid i/o; pos = 0x0, size = 0x3c534 FT_Stream_ReadAt: invalid read; expected 128 bytes, got 0 could not load face 'file:///usr/share/fonts/corefonts/timesi.ttf' This is a regression, introduced by commits http://cvs.gnome.org/viewcvs/gnome-control-center/vfs-methods/fontilus/ftstream-vfs.c?r1=1.11&r2=1.12 and http://cvs.gnome.org/viewcvs/gnome-control-center/vfs-methods/fontilus/ftstream-vfs.c?r1=1.11&r2=1.11.4.1 (to HEAD and 2.12 branch resp.) --- ftstream-vfs.c 2004/12/25 14:37:33 1.11 +++ ftstream-vfs.c 2005/11/14 15:25:36 1.11.4.1 @@ -26,7 +26,7 @@ #include FT_FREETYPE_H #include <libgnomevfs/gnome-vfs.h> -static unsigned long +static guint64 vfs_stream_read(FT_Stream stream, unsigned long offset, unsigned char *buffer, Associated bug is bug 320157, generic cleanup. The change is incorrect; vfs_stream_read is used only as read member in a FT_Stream struct, which has signature typedef unsigned long (*FT_Stream_IoFunc)( FT_Stream stream, unsigned long offset, unsigned char* buffer, unsigned long count ); Thus unsigned long is the correct return type. The problem is that if defined with return type guint64 and then cast to unsigned long (*FT_Stream_IoFunc) (...), vfs_stream_read pushes 8 bytes on the stack as return value, but on a 32-bit system only the first 4 bytes (sizeof (unsigned long)) are read off. This is not a problem on little-endian systems (x86) as the first 4 bytes correspond to the low 4 bytes of the returned guint64. However on big-endian (ppc) they are the high 4 bytes, which are all zero.
Created attachment 58311 [details] [review] 329043.bugzilla.gnome.org-fontilus-endianness.patch Patch; reversion of above commit. Confirmed fixes problem. Will need to be applied to 2.12 branch and MAIN. Referred downstream: http://bugs.gentoo.org/show_bug.cgi?id=120790
Committed to CVS, thanks