apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject cvs commit: apr-util/xlate xlate.c
Date Tue, 30 Mar 2004 09:58:22 GMT
jorton      2004/03/30 01:58:22

  Modified:    xlate    xlate.c
  Log:
  * xlate/xlate.c (check_sbcs): Remove function which made unsafe
  assumptions (a theoretical issue), and was buggy in not resetting the
  iconv handle on failure (the cause of at least one real issue).
  (apr_xlate_open): Updated caller.
  
  Revision  Changes    Path
  1.20      +0 -73     apr-util/xlate/xlate.c
  
  Index: xlate.c
  ===================================================================
  RCS file: /home/cvs/apr-util/xlate/xlate.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -w -d -u -r1.19 -r1.20
  --- xlate.c	13 Feb 2004 09:55:27 -0000	1.19
  +++ xlate.c	30 Mar 2004 09:58:22 -0000	1.20
  @@ -101,77 +101,6 @@
       return APR_SUCCESS;
   }
   
  -#if APU_HAVE_ICONV
  -static void check_sbcs(apr_xlate_t *convset)
  -{
  -    char inbuf[256], outbuf[256];
  -    char *inbufptr = inbuf;
  -    char *outbufptr = outbuf;
  -    apr_size_t inbytes_left, outbytes_left;
  -    int i;
  -    apr_size_t translated;
  -
  -    for (i = 0; i < sizeof(inbuf); i++) {
  -        inbuf[i] = i;
  -    }
  -
  -    inbytes_left = outbytes_left = sizeof(inbuf);
  -    translated = iconv(convset->ich, (ICONV_INBUF_TYPE)&inbufptr,
  -                       &inbytes_left, &outbufptr, &outbytes_left);
  -
  -    if (translated != (apr_size_t)-1
  -        && inbytes_left == 0
  -        && outbytes_left == 0) {
  -        /* hurray... this is simple translation; save the table,
  -         * close the iconv descriptor
  -         */
  -
  -        convset->sbcs_table = apr_palloc(convset->pool, sizeof(outbuf));
  -        memcpy(convset->sbcs_table, outbuf, sizeof(outbuf));
  -        iconv_close(convset->ich);
  -        convset->ich = (iconv_t)-1;
  -
  -        /* TODO: add the table to the cache */
  -    }
  -}
  -#elif APU_HAVE_APR_ICONV
  -static void check_sbcs(apr_xlate_t *convset)
  -{
  -    char inbuf[256], outbuf[256];
  -    char *inbufptr = inbuf;
  -    char *outbufptr = outbuf;
  -    apr_size_t inbytes_left, outbytes_left;
  -    int i;
  -    apr_size_t translated;
  -    apr_status_t rv;
  -
  -    for (i = 0; i < sizeof(inbuf); i++) {
  -        inbuf[i] = i;
  -    }
  -
  -    inbytes_left = outbytes_left = sizeof(inbuf);
  -    rv = apr_iconv(convset->ich, (ICONV_INBUF_TYPE)&inbufptr,
  -                   &inbytes_left, &outbufptr, &outbytes_left,
  -                   &translated);
  -
  -    if ((rv == APR_SUCCESS)
  -        && (translated != (apr_size_t)-1)
  -        && inbytes_left == 0
  -        && outbytes_left == 0) {
  -        /* hurray... this is simple translation; save the table,
  -         * close the iconv descriptor
  -         */
  -
  -        convset->sbcs_table = apr_palloc(convset->pool, sizeof(outbuf));
  -        memcpy(convset->sbcs_table, outbuf, sizeof(outbuf));
  -        apr_iconv_close(convset->ich, convset->pool);
  -        convset->ich = (apr_iconv_t)-1;
  -
  -        /* TODO: add the table to the cache */
  -    }
  -}
  -#endif /* APU_HAVE_APR_ICONV */
  -
   static void make_identity_table(apr_xlate_t *convset)
   {
     int i;
  @@ -228,7 +157,6 @@
               return rv;
           }
           found = 1;
  -        check_sbcs(new);
       } else
           new->ich = (apr_iconv_t)-1;
   
  @@ -241,7 +169,6 @@
               return rv ? rv : APR_EINVAL;
           }
           found = 1;
  -        check_sbcs(new);
       } else
           new->ich = (iconv_t)-1;
   #endif /* APU_HAVE_ICONV */
  
  
  

Mime
View raw message