1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-23 23:56:20 +00:00

Resolved endianess issues.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1678 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
zybi 2001-08-24 10:46:31 +00:00
parent 31bcbc3e5f
commit 5a91214b59
3 changed files with 12 additions and 16 deletions

View File

@ -12,10 +12,10 @@ CFLAGS=$(OPTFLAGS) $(shell freetype-config --cflags)
subfont: subfont.o subfont: subfont.o
subfont.o: subfont.c Makefile subfont.o: subfont.c Makefile ../../bswap.h
subfont.S: subfont.c subfont.S: subfont.c Makefile ../../bswap.h
$(CC) $(CFLAGS) -S $^ -o $@ $(CC) $(CFLAGS) -S $< -o $@
clean: clean:
rm -f subfont subfont.o core rm -f subfont subfont.o core

View File

@ -100,8 +100,6 @@ Notes:
+ Starting x position of each character and the bitmap width is aligned + Starting x position of each character and the bitmap width is aligned
to multiple of 8 (required by mplayer). 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 + My development platform is RedHat 7.1. FreeType versions tested are
2.0.1 through 2.0.4. 2.0.1 through 2.0.4.

View File

@ -17,18 +17,18 @@
#ifndef OLD_FREETYPE2 #ifndef OLD_FREETYPE2
#include <ft2build.h> #include <ft2build.h>
#include FT_FREETYPE_H #include FT_FREETYPE_H
#include FT_GLYPH_H #include FT_GLYPH_H
#else /* freetype 2.0.1 */ #else /* freetype 2.0.1 */
#include <freetype/freetype.h> #include <freetype/freetype.h>
#include <freetype/ftglyph.h> #include <freetype/ftglyph.h>
#endif #endif
#include "../../bswap.h"
#ifndef DEBUG #ifndef DEBUG
#define DEBUG 0 #define DEBUG 0
#endif #endif
@ -418,15 +418,13 @@ FT_ULong decode_char(char c) {
int outbytesleft = sizeof(FT_ULong); int outbytesleft = sizeof(FT_ULong);
size_t count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft); size_t count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
/* convert unicode BigEndian -> MachineEndian */
o = be2me_32(o);
// if (count==-1) o = 0; // not OK, at least my iconv() returns E2BIG for all // if (count==-1) o = 0; // not OK, at least my iconv() returns E2BIG for all
if (outbytesleft!=0) o = 0; if (outbytesleft!=0) o = 0;
/* convert unicode BE -> LE */
o = ((o>>24)&0xff)
| ((o>>8)&0xff00)
| ((o&0xff00)<<8)
| ((o&0xff)<<24);
/* we don't want control characters */ /* we don't want control characters */
if (o>=0x7f && o<0xa0) o = 0; if (o>=0x7f && o<0xa0) o = 0;
return o; return o;