version 1.1, 2012/02/21 22:57:48
|
version 1.1.1.2, 2021/03/17 13:38:46
|
Line 1
|
Line 1
|
/* |
/* |
* Copyright (C) 1999-2001, 2005 Free Software Foundation, Inc. | * Copyright (C) 1999-2001, 2005, 2012, 2016 Free Software Foundation, Inc. |
* This file is part of the GNU LIBICONV Library. |
* This file is part of the GNU LIBICONV Library. |
* |
* |
* The GNU LIBICONV Library is free software; you can redistribute it |
* The GNU LIBICONV Library is free software; you can redistribute it |
Line 14
|
Line 14
|
* |
* |
* You should have received a copy of the GNU Library General Public |
* You should have received a copy of the GNU Library General Public |
* License along with the GNU LIBICONV Library; see the file COPYING.LIB. |
* License along with the GNU LIBICONV Library; see the file COPYING.LIB. |
* If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | * If not, see <https://www.gnu.org/licenses/>. |
* Fifth Floor, Boston, MA 02110-1301, USA. | |
*/ |
*/ |
|
|
/* |
/* |
Line 145
|
Line 144
|
* p. 12 0xA7C2..0xA7D0 U+E7A0..U+E7AE |
* p. 12 0xA7C2..0xA7D0 U+E7A0..U+E7AE |
* p. 12 0xA7F2..0xA7FE U+E7AF..U+E7BB |
* p. 12 0xA7F2..0xA7FE U+E7AF..U+E7BB |
* p. 82 0xA896..0xA8A0 U+E7BC..U+E7C6 |
* p. 82 0xA896..0xA8A0 U+E7BC..U+E7C6 |
* p. 12 0xA8BC [glyphs here!!] U+E7C7 | * p. 12 0x8135F437 U+E7C7 |
* p. 255 0x8336C830 U+E7C8 |
* p. 255 0x8336C830 U+E7C8 |
* p. 12 0xA8C1..0xA8C4 U+E7C9..U+E7CC |
* p. 12 0xA8C1..0xA8C4 U+E7C9..U+E7CC |
* p. 12 0xA8EA..0xA8FE U+E7CD..U+E7E1 |
* p. 12 0xA8EA..0xA8FE U+E7CD..U+E7E1 |
Line 186
|
Line 185
|
#include "gb18030uni.h" |
#include "gb18030uni.h" |
|
|
static int |
static int |
gb18030_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | gb18030_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) |
{ |
{ |
int ret; |
int ret; |
|
|
Line 267 gb18030_mbtowc (conv_t conv, ucs4_t *pwc, const unsign
|
Line 266 gb18030_mbtowc (conv_t conv, ucs4_t *pwc, const unsign
|
} |
} |
} |
} |
|
|
static const unsigned short gb18030_pua2charset[32*3] = { | static const unsigned short gb18030_pua2charset[31*3] = { |
/* Unicode range GB18030 range */ |
/* Unicode range GB18030 range */ |
0xe766, 0xe76b, 0xa2ab, /*.. 0xa2b0, */ |
0xe766, 0xe76b, 0xa2ab, /*.. 0xa2b0, */ |
0xe76d, 0xe76d, 0xa2e4, |
0xe76d, 0xe76d, 0xa2e4, |
Line 283 static const unsigned short gb18030_pua2charset[32*3]
|
Line 282 static const unsigned short gb18030_pua2charset[32*3]
|
0xe7a0, 0xe7ae, 0xa7c2, /*.. 0xa7d0, */ |
0xe7a0, 0xe7ae, 0xa7c2, /*.. 0xa7d0, */ |
0xe7af, 0xe7bb, 0xa7f2, /*.. 0xa7fe, */ |
0xe7af, 0xe7bb, 0xa7f2, /*.. 0xa7fe, */ |
0xe7bc, 0xe7c6, 0xa896, /*.. 0xa8a0, */ |
0xe7bc, 0xe7c6, 0xa896, /*.. 0xa8a0, */ |
0xe7c7, 0xe7c7, 0xa8bc, |
|
0xe7c9, 0xe7cc, 0xa8c1, /*.. 0xa8c4, */ |
0xe7c9, 0xe7cc, 0xa8c1, /*.. 0xa8c4, */ |
0xe7cd, 0xe7e1, 0xa8ea, /*.. 0xa8fe, */ |
0xe7cd, 0xe7e1, 0xa8ea, /*.. 0xa8fe, */ |
0xe7e2, 0xe7e2, 0xa958, |
0xe7e2, 0xe7e2, 0xa958, |
Line 304 static const unsigned short gb18030_pua2charset[32*3]
|
Line 302 static const unsigned short gb18030_pua2charset[32*3]
|
}; |
}; |
|
|
static int |
static int |
gb18030_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | gb18030_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) |
{ |
{ |
int ret; |
int ret; |
|
|
Line 341 gb18030_wctomb (conv_t conv, unsigned char *r, ucs4_t
|
Line 339 gb18030_wctomb (conv_t conv, unsigned char *r, ucs4_t
|
} else { |
} else { |
/* User-defined characters, two-byte part of range U+E766..U+E864 */ |
/* User-defined characters, two-byte part of range U+E766..U+E864 */ |
unsigned int k1 = 0; |
unsigned int k1 = 0; |
unsigned int k2 = 32; | unsigned int k2 = 31; |
/* Invariant: We know that if wc occurs in Unicode interval in |
/* Invariant: We know that if wc occurs in Unicode interval in |
gb18030_pua2charset, it does so at a k with k1 <= k < k2. */ |
gb18030_pua2charset, it does so at a k with k1 <= k < k2. */ |
while (k1 < k2) { |
while (k1 < k2) { |