FLTK 1.3.2

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

ucs2be.h
1 /*
2 * UCS-2BE = UCS-2 big endian
3 */
4 /* $XFree86: xc/lib/X11/lcUniConv/ucs2be.h,v 1.1 2000/11/28 17:25:09 dawes Exp $ */
5
6 static int
7 ucs2be_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
8 {
9 if (n >= 2) {
10 if (s[0] >= 0xd8 && s[0] < 0xe0) {
11 return RET_ILSEQ;
12 } else {
13 *pwc = (s[0] << 8) + s[1];
14 return 2;
15 }
16 }
17 return RET_TOOFEW(0);
18 }
19
20 static int
21 ucs2be_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
22 {
23 if (wc < 0x10000 && !(wc >= 0xd800 && wc < 0xe000)) {
24 if (n >= 2) {
25 r[0] = (unsigned char) (wc >> 8);
26 r[1] = (unsigned char) wc;
27 return 2;
28 } else
29 return RET_TOOSMALL;
30 }
31 return RET_ILSEQ;
32 }
- © 1998-2012 by Bill Spitzak and others.