[KoCo-CVS] [Commit] iconvcodec MANIFEST.in _iconv_codec.c
Brought to you by:
perky
From: Hye-Shik C. <pe...@us...> - 2003-06-11 05:51:13
|
perky 03/06/10 22:51:11 Modified: . MANIFEST.in _iconv_codec.c Log: Fix unbalanced parenthesis when Py_UNICODE_SIZE == 4. Submitted by: Changwoo Ryu <cw...@de...> Revision Changes Path 1.2 +2 -2 iconvcodec/MANIFEST.in Index: MANIFEST.in =================================================================== RCS file: /cvsroot/koco/iconvcodec/MANIFEST.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MANIFEST.in 20 Apr 2003 21:09:00 -0000 1.1 +++ MANIFEST.in 11 Jun 2003 05:51:11 -0000 1.2 @@ -1,4 +1,4 @@ -# $Id: MANIFEST.in,v 1.1 2003/04/20 21:09:00 perky Exp $ +# $Id: MANIFEST.in,v 1.2 2003/06/11 05:51:11 perky Exp $ -include COPYRIGHT MANIFEST.in AUTHORS README +include COPYRIGHT MANIFEST.in AUTHORS README THANKS include test_iconv_codec.py _iconv_codec_compat.h 1.5 +11 -8 iconvcodec/_iconv_codec.c Index: _iconv_codec.c =================================================================== RCS file: /cvsroot/koco/iconvcodec/_iconv_codec.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- _iconv_codec.c 20 Apr 2003 21:40:05 -0000 1.4 +++ _iconv_codec.c 11 Jun 2003 05:51:11 -0000 1.5 @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: _iconv_codec.c,v 1.4 2003/04/20 21:40:05 perky Exp $ + * $Id: _iconv_codec.c,v 1.5 2003/06/11 05:51:11 perky Exp $ */ #include "Python.h" @@ -572,7 +572,7 @@ if (code < 0x80) size = 1; else if (code < 0x800) size = 2; #if Py_UNICODE_SIZE == 2 - else size = 3; + else size = 3; /* XXX put surrogate characters for EMP! */ #else else if (code < 0x10000) size = 3; else if (code < 0x200000) size = 4; @@ -1000,7 +1000,7 @@ if (*ubuf < 0x80) { *buf->outbuf++ = (unsigned char)*ubuf++; - } else if (*ubuf < 0xc2 || *ubuf == 0xff) { + } else if (*ubuf < 0xc2) { ilseq: PyErr_SetString(PyExc_RuntimeError, "iconv returned illegal utf-8 sequence"); goto errorexit; @@ -1021,10 +1021,10 @@ ubuf += 3; } #if Py_UNICODE_SIZE == 2 - else + else /* XXX: put surrogate characters here! */ goto ilseq; #else - } else if (*ubuf < 0xf8) { + else if (*ubuf < 0xf8) { if (uleft < 4 || !((ubuf[1] ^ 0x80) < 0x40 && (ubuf[2] ^ 0x80) < 0x40 && (ubuf[3] ^ 0x80) < 0x40 && (ubuf[0] >= 0xf1 || ubuf[1] >= 0x90))) @@ -1046,7 +1046,7 @@ | ((Py_UNICODE)(ubuf[3] ^ 0x80) << 6) | (Py_UNICODE)(ubuf[4] ^ 0x80); ubuf += 5; - } else { /* 0xff is excluded above */ + } else if (*ubuf < 0xff) { if (uleft < 6 || !((ubuf[1] ^ 0x80) < 0x40 && (ubuf[2] ^ 0x80) < 0x40 && (ubuf[3] ^ 0x80) < 0x40 && (ubuf[4] ^ 0x80) < 0x40 && (ubuf[5] ^ 0x80) < 0x40 && @@ -1059,7 +1059,8 @@ | ((Py_UNICODE)(ubuf[4] ^ 0x80) << 6) | (Py_UNICODE)(ubuf[5] ^ 0x80); ubuf += 6; - } + } else + return 1; #endif } @@ -2033,9 +2034,11 @@ void init_iconv_codec(void) { + PyObject *m; + detect_iconv_endian(); - Py_InitModule("_iconv_codec", _iconv_codec_methods); + m = Py_InitModule("_iconv_codec", _iconv_codec_methods); if (PyErr_Occurred()) Py_FatalError("can't initialize the _iconv_codec module"); |