Mercurial > mplayer.hg
comparison TOOLS/subfont-c/subfont.c @ 1677:1bf2c3dbc36e
Resolved endianess issues.
author | zybi |
---|---|
date | Fri, 24 Aug 2001 10:46:31 +0000 |
parents | 8ccac62ddfb7 |
children | 958bcb3b5725 |
comparison
equal
deleted
inserted
replaced
1676:1f3030b34f5c | 1677:1bf2c3dbc36e |
---|---|
15 #include <string.h> | 15 #include <string.h> |
16 #include <libgen.h> | 16 #include <libgen.h> |
17 | 17 |
18 | 18 |
19 #ifndef OLD_FREETYPE2 | 19 #ifndef OLD_FREETYPE2 |
20 | |
21 #include <ft2build.h> | 20 #include <ft2build.h> |
22 #include FT_FREETYPE_H | 21 #include FT_FREETYPE_H |
23 #include FT_GLYPH_H | 22 #include FT_GLYPH_H |
24 | |
25 #else /* freetype 2.0.1 */ | 23 #else /* freetype 2.0.1 */ |
26 | |
27 #include <freetype/freetype.h> | 24 #include <freetype/freetype.h> |
28 #include <freetype/ftglyph.h> | 25 #include <freetype/ftglyph.h> |
29 | 26 #endif |
30 #endif | 27 |
28 | |
29 #include "../../bswap.h" | |
30 | |
31 | 31 |
32 #ifndef DEBUG | 32 #ifndef DEBUG |
33 #define DEBUG 0 | 33 #define DEBUG 0 |
34 #endif | 34 #endif |
35 | 35 |
416 char *outbuf = (char*)&o; | 416 char *outbuf = (char*)&o; |
417 int inbytesleft = 1; | 417 int inbytesleft = 1; |
418 int outbytesleft = sizeof(FT_ULong); | 418 int outbytesleft = sizeof(FT_ULong); |
419 | 419 |
420 size_t count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft); | 420 size_t count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft); |
421 // if (count==-1) o = 0; // not OK, at least my iconv() returns E2BIG for all | 421 |
422 /* convert unicode BigEndian -> MachineEndian */ | |
423 o = be2me_32(o); | |
424 | |
425 // if (count==-1) o = 0; // not OK, at least my iconv() returns E2BIG for all | |
422 if (outbytesleft!=0) o = 0; | 426 if (outbytesleft!=0) o = 0; |
423 | |
424 /* convert unicode BE -> LE */ | |
425 o = ((o>>24)&0xff) | |
426 | ((o>>8)&0xff00) | |
427 | ((o&0xff00)<<8) | |
428 | ((o&0xff)<<24); | |
429 | 427 |
430 /* we don't want control characters */ | 428 /* we don't want control characters */ |
431 if (o>=0x7f && o<0xa0) o = 0; | 429 if (o>=0x7f && o<0xa0) o = 0; |
432 return o; | 430 return o; |
433 } | 431 } |