[Python-checkins] python/dist/src/Modules _iconv_codec.c,1.7,1.8

doerwalter@users.sourceforge.net doerwalter@users.sourceforge.net
Tue, 04 Feb 2003 10:02:31 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv25990/Modules

Modified Files:
	_iconv_codec.c 
Log Message:
Use size_t instead of int for various variables to prevent
signed/unsigned comparison warnings on the call to iconv().

Fix comment typos.

>From SF patch #680146.


Index: _iconv_codec.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_iconv_codec.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** _iconv_codec.c	31 Jan 2003 17:19:07 -0000	1.7
--- _iconv_codec.c	4 Feb 2003 18:02:28 -0000	1.8
***************
*** 43,47 ****
  staticforward PyTypeObject iconvcodec_Type;
  
! /* does the choosen internal encoding require
   * byteswapping to get native endianness?
   * 0=no, 1=yes, -1=unknown */
--- 43,47 ----
  staticforward PyTypeObject iconvcodec_Type;
  
! /* does the chosen internal encoding require
   * byteswapping to get native endianness?
   * 0=no, 1=yes, -1=unknown */
***************
*** 147,151 ****
  
      while (inplen > 0) {
!         if (iconv(self->enchdl, (char**)&inp, &inplen, &out, &outlen) == -1) {
              char         reason[128];
              int          errpos;
--- 147,151 ----
  
      while (inplen > 0) {
!         if (iconv(self->enchdl, (char**)&inp, &inplen, &out, &outlen) == (size_t)-1) {
              char         reason[128];
              int          errpos;
***************
*** 354,358 ****
      while (inplen > 0) {
          char *oldout = out;
!         char res = iconv(self->dechdl, (char**)&inp, &inplen, &out, &outlen);
  
          if (byteswap) {
--- 354,358 ----
      while (inplen > 0) {
          char *oldout = out;
!         size_t res = iconv(self->dechdl, (char**)&inp, &inplen, &out, &outlen);
  
          if (byteswap) {
***************
*** 373,377 ****
              }
          }
!         if (res == -1) {
              char         reason[128], *reasonpos = (char *)reason;
              int          errpos;
--- 373,377 ----
              }
          }
!         if (res == (size_t)-1) {
              char         reason[128], *reasonpos = (char *)reason;
              int          errpos;
***************
*** 663,671 ****
      char in = 1;
      char *inptr = ∈
!     int insize = 1;
      Py_UNICODE out = 0;
      char *outptr = (char *)&out;
!     int outsize = sizeof(out);
!     int res;
  
      iconv_t hdl = iconv_open(UNICODE_ENCODING, "ASCII");
--- 663,671 ----
      char in = 1;
      char *inptr = ∈
!     size_t insize = 1;
      Py_UNICODE out = 0;
      char *outptr = (char *)&out;
!     size_t outsize = sizeof(out);
!     size_t res;
  
      iconv_t hdl = iconv_open(UNICODE_ENCODING, "ASCII");
***************
*** 675,682 ****
  
      res = iconv(hdl, &inptr, &insize, &outptr, &outsize);
!     if (res == -1)
          Py_FatalError("can't initialize the _iconv_codec module: iconv() failed");
  
!     /* Check whether conv() returned native endianess or not for the choosen encoding */
      if (out == 0x1)
         byteswap = 0;
--- 675,682 ----
  
      res = iconv(hdl, &inptr, &insize, &outptr, &outsize);
!     if (res == (size_t)-1)
          Py_FatalError("can't initialize the _iconv_codec module: iconv() failed");
  
!     /* Check whether conv() returned native endianess or not for the chosen encoding */
      if (out == 0x1)
         byteswap = 0;