changeset 1677:1bf2c3dbc36e

Resolved endianess issues.
author zybi
date Fri, 24 Aug 2001 10:46:31 +0000
parents 1f3030b34f5c
children 9305c0d5216b
files TOOLS/subfont-c/Makefile TOOLS/subfont-c/README TOOLS/subfont-c/subfont.c
diffstat 3 files changed, 12 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/TOOLS/subfont-c/Makefile	Fri Aug 24 10:05:46 2001 +0000
+++ b/TOOLS/subfont-c/Makefile	Fri Aug 24 10:46:31 2001 +0000
@@ -12,10 +12,10 @@
 
 subfont:	subfont.o
 
-subfont.o:	subfont.c Makefile
+subfont.o:	subfont.c Makefile ../../bswap.h
 
-subfont.S:	subfont.c
-	$(CC) $(CFLAGS) -S $^ -o $@
+subfont.S:	subfont.c Makefile ../../bswap.h
+	$(CC) $(CFLAGS) -S $< -o $@
 
 clean:
 	rm -f subfont subfont.o core
--- a/TOOLS/subfont-c/README	Fri Aug 24 10:05:46 2001 +0000
+++ b/TOOLS/subfont-c/README	Fri Aug 24 10:46:31 2001 +0000
@@ -100,8 +100,6 @@
   + Starting x position of each character and the bitmap width is aligned
 to multiple of 8 (required by mplayer).
 
-  + Currently subfont won't work on big-endian systems. I need help.
-
   + My development platform is RedHat 7.1.  FreeType versions tested are
 2.0.1 through 2.0.4.
 
--- a/TOOLS/subfont-c/subfont.c	Fri Aug 24 10:05:46 2001 +0000
+++ b/TOOLS/subfont-c/subfont.c	Fri Aug 24 10:46:31 2001 +0000
@@ -17,17 +17,17 @@
 
 
 #ifndef OLD_FREETYPE2
-
 #include <ft2build.h>	
 #include FT_FREETYPE_H
 #include FT_GLYPH_H
-
 #else			/* freetype 2.0.1 */
-
 #include <freetype/freetype.h>
 #include <freetype/ftglyph.h>
+#endif
 
-#endif
+
+#include "../../bswap.h"
+
 
 #ifndef DEBUG
 #define DEBUG	0
@@ -418,14 +418,12 @@
     int outbytesleft = sizeof(FT_ULong);
 
     size_t count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
-//    if (count==-1) o = 0; // not OK, at least my iconv() returns E2BIG for all
-    if (outbytesleft!=0) o = 0;
 
-    /* convert unicode BE -> LE */
-    o = ((o>>24)&0xff)
-      | ((o>>8)&0xff00)
-      | ((o&0xff00)<<8)
-      | ((o&0xff)<<24);
+    /* convert unicode BigEndian -> MachineEndian */
+    o = be2me_32(o);
+
+    // if (count==-1) o = 0; // not OK, at least my iconv() returns E2BIG for all
+    if (outbytesleft!=0) o = 0;
 
     /* we don't want control characters */
     if (o>=0x7f && o<0xa0) o = 0;