version 1.16, 2006/08/09 21:12:42
|
version 1.17, 2006/09/05 19:59:33
|
|
|
#define MAX_BYTE (Uint32)0x0000FFFF | #define MAX_BYTE (Uint32)0x0000FFFF |
#define MAX_UTF16 (Uint32)0x0010FFFF | #define MAX_UTF16 (Uint32)0x0010FFFF |
| |
static const Uint32 halfBase = 0x0010000UL; |
PEGASUS_COMMON_LINKAGE extern const Uint32 halfBase; |
static const Uint32 halfMask = 0x3FFUL; |
PEGASUS_COMMON_LINKAGE extern const Uint32 halfMask; |
static const int halfShift = 10; |
PEGASUS_COMMON_LINKAGE extern const int halfShift; |
static const Uint8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; |
PEGASUS_COMMON_LINKAGE extern const Uint8 firstByteMark[]; |
|
|
static const Uint32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, |
PEGASUS_COMMON_LINKAGE extern const Uint32 offsetsFromUTF8[]; |
0x03C82080UL, 0xFA082080UL, 0x82082080UL }; |
|
|
PEGASUS_COMMON_LINKAGE extern const char trailingBytesForUTF8[]; |
static const char trailingBytesForUTF8[256] = { |
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, |
|
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 |
|
}; |
|
| |
#define UTF_8_COUNT_TRAIL_BYTES(leadByte) (trailingBytesForUTF8[(Uint8)leadByte]) | #define UTF_8_COUNT_TRAIL_BYTES(leadByte) (trailingBytesForUTF8[(Uint8)leadByte]) |
| |
|
|
(i)=((i) + UTF_8_COUNT_TRAIL_BYTES((s)[(i)]) + 1); \ | (i)=((i) + UTF_8_COUNT_TRAIL_BYTES((s)[(i)]) + 1); \ |
} | } |
| |
|
|
PEGASUS_COMMON_LINKAGE Boolean isValid_U8(const Uint8 *src,int size); | PEGASUS_COMMON_LINKAGE Boolean isValid_U8(const Uint8 *src,int size); |
| |
PEGASUS_COMMON_LINKAGE int UTF16toUTF8( | PEGASUS_COMMON_LINKAGE int UTF16toUTF8( |