apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jean-frederic clere <jfrederic.cl...@fujitsu-siemens.com>
Subject Re: cvs commit: apr-iconv/lib iconv.c iconv.h iconv_ccs.c iconv_ces_euc.c iconv_ces_iso2022.c iconv_int.c iconv_module.c iconv_uc.c
Date Thu, 28 Jun 2001 07:46:08 GMT
Thanks for fixing all theses, specialy this one:
+++
   1.5       +1 -1      apr-iconv/lib/iconv_ccs.c
 
   Index: iconv_ccs.c
   ===================================================================
   RCS file: /home/cvs/apr-iconv/lib/iconv_ccs.c,v
   retrieving revision 1.4
   retrieving revision 1.5
   diff -u -r1.4 -r1.5
   --- iconv_ccs.c       2001/06/21 12:24:11     1.4
   +++ iconv_ccs.c       2001/06/28 05:45:01     1.5
   @@ -34,7 +34,7 @@
    #include "iconv.h"   /* iconv_ccs_desc, iconv_ccs_module */
 
    apr_status_t
   -iconv_ccs_event(struct iconv_module *mod, int event)
   +iconv_ccs_event(struct iconv_module *mod, int event, apr_pool_t *ctx)
    {
    /*   struct iconv_ccs_desc *desc =
+++
I should have noted it before!

Cheers

Jean-frederic
> 
> 
> 
epc

wrowe@apache.org wrote:
> 
> wrowe       01/06/27 22:45:06
> 
>   Modified:    lib      iconv.c iconv.h iconv_ccs.c iconv_ces_euc.c
>                         iconv_ces_iso2022.c iconv_int.c iconv_module.c
>                         iconv_uc.c
>   Log:
>     More apr-ization (size/ssize/pools/stat etc)
> 
>   Revision  Changes    Path
>   1.5       +9 -9      apr-iconv/lib/iconv.c
> 
>   Index: iconv.c
>   ===================================================================
>   RCS file: /home/cvs/apr-iconv/lib/iconv.c,v
>   retrieving revision 1.4
>   retrieving revision 1.5
>   diff -u -r1.4 -r1.5
>   --- iconv.c   2001/06/21 12:24:10     1.4
>   +++ iconv.c   2001/06/28 05:45:00     1.5
>   @@ -45,25 +45,25 @@
>    };
> 
>    /*
>   - * size_t *result is what the iconv() returns but it is cleaner to return
>   + * apr_size_t *result is what the iconv() returns but it is cleaner to return
>     * a status.
>     * APR_EBADF:   cd is not valid.
>     * APR_BADARG: The ouput arguments are not valid.
>     */
> 
>    apr_status_t
>   -apr_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft,
>   -     char **outbuf, size_t *outbytesleft, size_t *result)
>   +apr_iconv(iconv_t cd, const char **inbuf, apr_size_t *inbytesleft,
>   +     char **outbuf, apr_size_t *outbytesleft, apr_size_t *result)
>    {
>         struct iconv_converter *icp = (struct iconv_converter *)cd;
> 
>         if (icp == NULL) {
>   -             *result = (size_t) -1;
>   +             *result = (apr_size_t) -1;
>                 return(APR_EBADF);
>         }
>         if (outbytesleft == NULL || *outbytesleft == 0 ||
>             outbuf == NULL || *outbuf == 0) {
>   -             *result = (size_t) -1;
>   +             *result = (apr_size_t) -1;
>                 return(APR_BADARG);
>         }
>         return ( icp->ic_desc->icd_conv(icp->ic_data,
>   @@ -123,17 +123,17 @@
>                const char *from_charset, apr_pool_t *ctx, iconv_t **res)
>    {
>         *res = iconv_open(to_charset, from_charset);
>   -     if (*res == (size_t) -1)
>   +     if (*res == (apr_size_t) -1)
>                 return apr_get_os_error();
>         return APR_SUCCESS;
>    }
> 
>    apr_status_t apr_iconv(iconv_t cd, const char **inbuf,
>   -            size_t *inbytesleft, char **outbuf,
>   -            size_t *outbytesleft, size_t *result)
>   +            apr_size_t *inbytesleft, char **outbuf,
>   +            apr_size_t *outbytesleft, apr_size_t *result)
>    {
>         *result = iconv(cd , inbuf, inbytesleft, outbuf, outbytesleft);
>   -     if (*result == (size_t) -1)
>   +     if (*result == (apr_size_t) -1)
>                 return apr_get_os_error();
>         return APR_SUCCESS;
>    }
> 
> 
> 
>   1.9       +7 -3      apr-iconv/lib/iconv.h
> 
>   Index: iconv.h
>   ===================================================================
>   RCS file: /home/cvs/apr-iconv/lib/iconv.h,v
>   retrieving revision 1.8
>   retrieving revision 1.9
>   diff -u -r1.8 -r1.9
>   --- iconv.h   2001/06/21 12:24:11     1.8
>   +++ iconv.h   2001/06/28 05:45:00     1.9
>   @@ -34,7 +34,11 @@
> 
>    #include "apr.h"
>    #include "apr_pools.h"
>   +#ifdef WIN32
>   +#define ICONV_DEFAULT_PATH "iconv"
>   +#else
>    #include "apr_iconv_private.h" /* contains ICONV_DEFAULT_PATH */
>   +#endif
> 
>    #include <stddef.h>
> 
>   @@ -50,7 +54,7 @@
>    /* __BEGIN_DECLS */
> 
>    apr_status_t apr_iconv_open(const char *, const char *, apr_pool_t *, iconv_t *);
>   -apr_status_t apr_iconv(iconv_t, const char **, apr_size_t *, char **, apr_size_t *,
size_t *);
>   +apr_status_t apr_iconv(iconv_t, const char **, apr_size_t *, char **, apr_size_t *,
apr_size_t *);
>    apr_status_t apr_iconv_close(iconv_t, apr_pool_t *);
> 
>    /* __END_DECLS */
>   @@ -88,7 +92,7 @@
> 
>    /* _tbl_simple.c table_load_ccs() calls iconv_mod_load(...ctx) */
> 
>   -typedef int iconv_mod_event_t(struct iconv_module *, int, apr_pool_t *ctx );
>   +typedef int iconv_mod_event_t(struct iconv_module *, int, apr_pool_t *ctx);
> 
>    struct iconv_module_desc {
>         int             imd_type;
>   @@ -248,7 +252,7 @@
>    typedef      int  iconv_ces_nbits_t(struct iconv_ces *);
>    typedef      int  iconv_ces_nbytes_t(struct iconv_ces *);
> 
>   -typedef ssize_t iconv_ces_convert_from_ucs_t
>   +typedef apr_ssize_t iconv_ces_convert_from_ucs_t
>        (struct iconv_ces *data, ucs_t in,
>        unsigned char **outbuf, apr_size_t *outbytesleft);
> 
> 
> 
> 
>   1.5       +1 -1      apr-iconv/lib/iconv_ccs.c
> 
>   Index: iconv_ccs.c
>   ===================================================================
>   RCS file: /home/cvs/apr-iconv/lib/iconv_ccs.c,v
>   retrieving revision 1.4
>   retrieving revision 1.5
>   diff -u -r1.4 -r1.5
>   --- iconv_ccs.c       2001/06/21 12:24:11     1.4
>   +++ iconv_ccs.c       2001/06/28 05:45:01     1.5
>   @@ -34,7 +34,7 @@
>    #include "iconv.h"   /* iconv_ccs_desc, iconv_ccs_module */
> 
>    apr_status_t
>   -iconv_ccs_event(struct iconv_module *mod, int event)
>   +iconv_ccs_event(struct iconv_module *mod, int event, apr_pool_t *ctx)
>    {
>    /*   struct iconv_ccs_desc *desc =
>             (struct iconv_ccs_desc *)mod->im_desc->imd_data;*/
> 
> 
> 
>   1.5       +7 -7      apr-iconv/lib/iconv_ces_euc.c
> 
>   Index: iconv_ces_euc.c
>   ===================================================================
>   RCS file: /home/cvs/apr-iconv/lib/iconv_ces_euc.c,v
>   retrieving revision 1.4
>   retrieving revision 1.5
>   diff -u -r1.4 -r1.5
>   --- iconv_ces_euc.c   2001/06/21 12:24:12     1.4
>   +++ iconv_ces_euc.c   2001/06/28 05:45:01     1.5
>   @@ -50,7 +50,7 @@
>    {
>         struct iconv_module *depmod = ces->mod->im_deplist;
>         iconv_ces_euc_state_t *state;
>   -     size_t stsz;
>   +     apr_size_t stsz;
>         int i;
> 
>         stsz = sizeof(iconv_ces_euc_state_t) +
>   @@ -76,15 +76,15 @@
>    #define is_7_14bit(data) ((data)->nbits & 7)
>    #define is_7bit(data) ((data)->nbits & 1)
> 
>   -ssize_t
>   +apr_ssize_t
>    iconv_euc_convert_from_ucs(struct iconv_ces *ces, ucs_t in,
>   -     unsigned char **outbuf, size_t *outbytesleft)
>   +     unsigned char **outbuf, apr_size_t *outbytesleft)
>    {
>         iconv_ces_euc_state_t *euc_state = CESTOSTATE(ces);
>         const iconv_ces_euc_ccs_t *ccsattr;
>         const struct iconv_ccs_desc *ccs;
>         ucs_t res;
>   -     size_t bytes;
>   +     apr_size_t bytes;
>         int i;
> 
>         if (in == UCS_CHAR_NONE)
>   @@ -123,9 +123,9 @@
> 
>    static ucs_t
>    cvt2ucs(const struct iconv_ccs_desc *ccs, const unsigned char *inbuf,
>   -     size_t inbytesleft, int hi_plane, const unsigned char **bufptr)
>   +     apr_size_t inbytesleft, int hi_plane, const unsigned char **bufptr)
>    {
>   -     size_t bytes = ccs->nbits > 8 ? 2 : 1;
>   +     apr_size_t bytes = ccs->nbits > 8 ? 2 : 1;
>         ucs_t ch = *(const unsigned char *)inbuf++;
> 
>         if (inbytesleft < bytes)
>   @@ -145,7 +145,7 @@
> 
>    ucs_t
>    iconv_euc_convert_to_ucs(struct iconv_ces *ces,
>   -     const unsigned char **inbuf, size_t *inbytesleft)
>   +     const unsigned char **inbuf, apr_size_t *inbytesleft)
>    {
>         iconv_ces_euc_state_t *euc_state = CESTOSTATE(ces);
>         const iconv_ces_euc_ccs_t *ccsattr;
> 
> 
> 
>   1.5       +13 -13    apr-iconv/lib/iconv_ces_iso2022.c
> 
>   Index: iconv_ces_iso2022.c
>   ===================================================================
>   RCS file: /home/cvs/apr-iconv/lib/iconv_ces_iso2022.c,v
>   retrieving revision 1.4
>   retrieving revision 1.5
>   diff -u -r1.4 -r1.5
>   --- iconv_ces_iso2022.c       2001/06/21 12:24:13     1.4
>   +++ iconv_ces_iso2022.c       2001/06/28 05:45:02     1.5
>   @@ -38,7 +38,7 @@
> 
>    typedef struct {
>         const char      *sequence;
>   -     size_t          length;
>   +     apr_size_t      length;
>         int             prefix_type;
>    } iconv_ces_iso2022_shift;
> 
>   @@ -73,7 +73,7 @@
>         const struct iconv_ccs_desc *ccs;
>         iconv_ces_iso2022_state_t *state;
>         struct iconv_module *depmod;
>   -     size_t stsz, shiftsz;
>   +     apr_size_t stsz, shiftsz;
>         int i;
> 
>         shiftsz = SHIFT_LEN;
>   @@ -128,7 +128,7 @@
>    update_shift_state(const struct iconv_ces *ces, ucs_t ch)
>    {
>         struct iconv_ces_iso2022_state *iso_state = CESTOSTATE(ces);
>   -     size_t i;
>   +     apr_size_t i;
> 
>         if (ch == '\n' && iso_state->previous_char == '\r') {
>                 for (i = 0; i < shift_num; i ++) {
>   @@ -141,15 +141,15 @@
> 
>    #define is_7_14bit(ccs) ((ccs)->nbits & 7)
> 
>   -static ssize_t
>   +static apr_ssize_t
>    cvt_ucs2iso(const struct iconv_ces *ces, ucs_t in,
>   -     unsigned char **outbuf, size_t *outbytesleft, int cs)
>   +     unsigned char **outbuf, apr_size_t *outbytesleft, int cs)
>    {
>         struct iconv_ces_iso2022_state *iso_state = CESTOSTATE(ces);
>         const struct iconv_ces_iso2022_ccs *ccsattr;
>         const struct iconv_ccs_desc *ccs;
>         ucs_t res;
>   -     size_t len = 0;
>   +     apr_size_t len = 0;
>         int need_designator, need_shift;
> 
>         ccs = MODTOCCS(iso_state->ccsmod[cs]);
>   @@ -198,12 +198,12 @@
>         return 1;
>    }
> 
>   -ssize_t
>   +apr_ssize_t
>    iconv_iso2022_convert_from_ucs(struct iconv_ces *ces,
>   -     ucs_t in, unsigned char **outbuf, size_t *outbytesleft)
>   +     ucs_t in, unsigned char **outbuf, apr_size_t *outbytesleft)
>    {
>         struct iconv_ces_iso2022_state *iso_state = CESTOSTATE(ces);
>   -     ssize_t res;
>   +     apr_ssize_t res;
>         int cs, i;
> 
>         if (in == UCS_CHAR_NONE)
>   @@ -226,9 +226,9 @@
> 
>    static ucs_t
>    cvt_iso2ucs(const struct iconv_ccs_desc *ccs, const unsigned char **inbuf,
>   -     size_t *inbytesleft, int prefix_type)
>   +     apr_size_t *inbytesleft, int prefix_type)
>    {
>   -     size_t bytes = ccs->nbits > 8 ? 2 : 1;
>   +     apr_size_t bytes = ccs->nbits > 8 ? 2 : 1;
>         ucs_t ch = **inbuf;
> 
>         if (*inbytesleft < bytes)
>   @@ -246,14 +246,14 @@
> 
>    ucs_t
>    iconv_iso2022_convert_to_ucs(struct iconv_ces *ces,
>   -     const unsigned char **inbuf, size_t *inbytesleft)
>   +     const unsigned char **inbuf, apr_size_t *inbytesleft)
>    {
>         struct iconv_ces_iso2022_state *iso_state = CESTOSTATE(ces);
>         const struct iconv_ces_iso2022_ccs *ccsattr;
>         ucs_t res;
>         const unsigned char *ptr = *inbuf;
>         unsigned char byte;
>   -     size_t len, left = *inbytesleft;
>   +     apr_size_t len, left = *inbytesleft;
>         int i;
> 
>         while (left) {
> 
> 
> 
>   1.5       +1 -1      apr-iconv/lib/iconv_int.c
> 
>   Index: iconv_int.c
>   ===================================================================
>   RCS file: /home/cvs/apr-iconv/lib/iconv_int.c,v
>   retrieving revision 1.4
>   retrieving revision 1.5
>   diff -u -r1.4 -r1.5
>   --- iconv_int.c       2001/06/21 12:24:13     1.4
>   +++ iconv_int.c       2001/06/28 05:45:02     1.5
>   @@ -39,7 +39,7 @@
>    #include "iconv.h"
> 
>    apr_status_t
>   -iconv_malloc(size_t size, void **pp)
>   +iconv_malloc(apr_size_t size, void **pp)
>    {
>         void *p = malloc(size);
> 
> 
> 
> 
>   1.7       +12 -9     apr-iconv/lib/iconv_module.c
> 
>   Index: iconv_module.c
>   ===================================================================
>   RCS file: /home/cvs/apr-iconv/lib/iconv_module.c,v
>   retrieving revision 1.6
>   retrieving revision 1.7
>   diff -u -r1.6 -r1.7
>   --- iconv_module.c    2001/06/05 15:17:01     1.6
>   +++ iconv_module.c    2001/06/28 05:45:02     1.7
>   @@ -41,17 +41,20 @@
>    #include <sys/types.h>
>    #include <sys/stat.h>
> 
>   -static int
>   -iconv_getpathname(char *buffer, const char *dir, const char *name)
>   +static apr_status_t
>   +iconv_getpathname(char *buffer, const char *dir, const char *name, apr_pool_t *ctx)
>    {
>   -     struct stat sb;
>   +        apr_status_t rv;
>   +     apr_finfo_t sb;
> 
>         apr_snprintf(buffer, APR_PATH_MAX, "%s/%s", dir, name);
>   -     return (stat(buffer, &sb) || ! S_ISREG(sb.st_mode)) ? EINVAL : 0;
>   +        if (rv = apr_stat(&sb, buffer, APR_FINFO_TYPE, ctx))
>   +            return rv;
>   +     return ((sb.filetype != APR_REG) ? APR_EINVAL : 0);
>    }
> 
>   -static int
>   -iconv_getpath(char *buf, const char *name)
>   +static apr_status_t
>   +iconv_getpath(char *buf, const char *name, apr_pool_t *ctx)
>    {
>         char buffer[APR_PATH_MAX];
>         char *ptr;
>   @@ -70,7 +73,7 @@
>                         if (p == NULL)
>                                 return ENOMEM;
>                         for (ptr = p; (dir = strtok(p, ":")); p = NULL) {
>   -                             if (iconv_getpathname(buf, dir, buffer) == 0) {
>   +                             if (iconv_getpathname(buf, dir, buffer, ctx) == 0) {
>                                         free(ptr);
>                                         return 0;
>                                 }
>   @@ -78,7 +81,7 @@
>                         free(ptr); /* otherwise memory leak */
>                 }
>         }
>   -     return iconv_getpathname(buf, ICONV_DEFAULT_PATH, buffer);
>   +     return iconv_getpathname(buf, ICONV_DEFAULT_PATH, buffer, ctx);
>    }
> 
>    static int
>   @@ -112,7 +115,7 @@
>         void *handle;
>         int error;
> 
>   -     if (iconv_getpath(buffer, modname) != 0)
>   +     if (iconv_getpath(buffer, modname, ctx) != 0)
>                 return EINVAL;
> 
>         error = iconv_dlopen(buffer, "iconv_module", &handle, (void**)&mdesc,
ctx);
> 
> 
> 
>   1.5       +6 -6      apr-iconv/lib/iconv_uc.c
> 
>   Index: iconv_uc.c
>   ===================================================================
>   RCS file: /home/cvs/apr-iconv/lib/iconv_uc.c,v
>   retrieving revision 1.4
>   retrieving revision 1.5
>   diff -u -r1.4 -r1.5
>   --- iconv_uc.c        2001/06/21 12:24:14     1.4
>   +++ iconv_uc.c        2001/06/28 05:45:03     1.5
>   @@ -67,24 +67,24 @@
>    }
> 
>    apr_status_t
>   -iconv_uc_conv(void *data, const unsigned char **inbuf, size_t *inbytesleft,
>   -     unsigned char **outbuf, size_t *outbytesleft, size_t *res)
>   +iconv_uc_conv(void *data, const unsigned char **inbuf, apr_size_t *inbytesleft,
>   +     unsigned char **outbuf, apr_size_t *outbytesleft, apr_size_t *res)
>    {
>         struct iconv_uc *ic = (struct iconv_uc *)data;
>         const unsigned char *ptr;
>         ucs_t ch;
>   -        ssize_t size;
>   +        apr_ssize_t size;
> 
>   -     *res = (size_t)(0);
>   +     *res = (apr_size_t)(0);
>         if (data == NULL) {
>   -             *res = (size_t) -1;
>   +             *res = (apr_size_t) -1;
>                 return APR_EBADF;
>         }
> 
>         if (inbuf == NULL || *inbuf == NULL) {
>                 if (ICONV_CES_CONVERT_FROM_UCS(ic->to, UCS_CHAR_NONE,
>                     outbuf, outbytesleft) <= 0) {
>   -                     *res = (size_t) -1;
>   +                     *res = (apr_size_t) -1;
>                         return APR_BADARG; /* too big */
>                 }
>                 ICONV_CES_RESET(ic->from);
> 
> 
>

Mime
View raw message