apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfcl...@apache.org
Subject cvs commit: apr-iconv/util iconv.c iconv_stream.c
Date Thu, 21 Jun 2001 12:24:22 GMT
jfclere     01/06/21 05:24:22

  Modified:    ces      _tbl_simple.c utf-16.c
               lib      iconv.c iconv.h iconv_ccs.c iconv_ces.c
                        iconv_ces_euc.c iconv_ces_iso2022.c iconv_int.c
                        iconv_uc.c
               util     iconv.c iconv_stream.c
  Log:
  Arrange the error codes. Return apr_status_t instead setting errno.
  
  Revision  Changes    Path
  1.4       +6 -8      apr-iconv/ces/_tbl_simple.c
  
  Index: _tbl_simple.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/ces/_tbl_simple.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- _tbl_simple.c	2001/04/04 17:28:54	1.3
  +++ _tbl_simple.c	2001/06/21 12:24:07	1.4
  @@ -35,8 +35,6 @@
   #define ICONV_INTERNAL
   #include "iconv.h"
   
  -#include <errno.h>
  -
   static int
   table_open(struct iconv_ces *ces, apr_pool_t *ctx)
   {
  @@ -118,23 +116,23 @@
   	return res;
   }
   
  -static int
  +static apr_status_t
   table_load_ccs(struct iconv_module *mod, apr_pool_t *ctx)
   {
   	struct iconv_module *ccsmod;
   	int error;
   
   	if (mod->im_args == NULL)
  -		return EINVAL;
  +		return APR_EINVAL;
   	error = iconv_mod_load(mod->im_args, ICMOD_UC_CCS, NULL, &ccsmod, ctx);
   	if (error)
   		return error;
   	ccsmod->im_next = mod->im_deplist;
   	mod->im_deplist = ccsmod;
  -	return 0;
  +	return APR_SUCCESS;
   }
   
  -static int
  +static apr_status_t
   table_event(struct iconv_module *mod, int event, apr_pool_t *ctx)
   {
   	switch (event) {
  @@ -144,9 +142,9 @@
   	    case ICMODEV_DYNDEPS:
   		return table_load_ccs(mod,ctx);
   	    default:
  -		return EINVAL;
  +		return APR_EINVAL;
   	}
  -	return 0;
  +	return APR_SUCCESS;
   }
   
   static const struct iconv_ces_desc iconv_ces_desc = {
  
  
  
  1.3       +0 -3      apr-iconv/ces/utf-16.c
  
  Index: utf-16.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/ces/utf-16.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- utf-16.c	2001/03/24 04:06:22	1.2
  +++ utf-16.c	2001/06/21 12:24:08	1.3
  @@ -30,9 +30,6 @@
    *	iconv (Charset Conversion Library) v1.0
    */
   
  -#include <errno.h>
  -#include <stdlib.h>	/* free, malloc */
  -
   #define ICONV_INTERNAL
   #include <iconv.h>
   
  
  
  
  1.4       +46 -33    apr-iconv/lib/iconv.c
  
  Index: iconv.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/lib/iconv.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- iconv.c	2001/04/04 17:28:56	1.3
  +++ iconv.c	2001/06/21 12:24:10	1.4
  @@ -32,7 +32,6 @@
   
   #ifndef HAVE_ICONV
   
  -#include <errno.h>	/* errno */
   #include <stdlib.h>	/* free, malloc */
   #include <string.h>
   
  @@ -45,65 +44,70 @@
   	NULL
   };
   
  -size_t
  +/* 
  + * 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)
  +	char **outbuf, size_t *outbytesleft, size_t *result)
   {
   	struct iconv_converter *icp = (struct iconv_converter *)cd;
  -	ssize_t res = -1;
   
   	if (icp == NULL) {
  -		errno = EBADF;
  -		return (size_t)(-1);
  +		*result = (size_t) -1;
  +		return(APR_EBADF);
   	}
   	if (outbytesleft == NULL || *outbytesleft == 0 ||
   	    outbuf == NULL || *outbuf == 0) {
  -		errno = E2BIG;
  -		return (size_t)(-1);
  +		*result = (size_t) -1;
  +		return(APR_BADARG);
   	}
  -	res = icp->ic_desc->icd_conv(icp->ic_data,
  +	return ( icp->ic_desc->icd_conv(icp->ic_data,
   	    (const unsigned char**)inbuf, inbytesleft,
  -	    (unsigned char**)outbuf, outbytesleft);
  -	return (size_t)res;
  +	    (unsigned char**)outbuf, outbytesleft, result));
   }
   
  -iconv_t
  -apr_iconv_open(const char *to, const char *from, apr_pool_t *ctx)
  +apr_status_t
  +apr_iconv_open(const char *to, const char *from, apr_pool_t *ctx, iconv_t *res)
   {
   	struct iconv_converter_desc **idesc;
   	struct iconv_converter *icp;
   	void *data;
  -	int error;
  +	apr_status_t error;
   
  +	*res = (iconv_t)-1;
   	icp = malloc(sizeof(*icp));
   	if (icp == NULL)
  -		return (iconv_t)(-1);
  -	error = EINVAL;
  +		return (APR_ENOMEM);
  +	error = APR_EINVAL;
   	for (idesc = converters; *idesc; idesc++) {
   		error = (*idesc)->icd_open(to, from, &data, ctx);
  -		if (error == 0)
  +		if (error == APR_SUCCESS)
   			break;
   	}
   	if (error) {
   		free(icp);
  -		errno = error;
  -		return (iconv_t)(-1);
  +		return (error);
   	}
   	icp->ic_desc = *idesc;
   	icp->ic_data = data;
  -	return (iconv_t)icp;
  +	*res = icp;
  +	return(APR_SUCCESS);
   }
   
  -int
  +apr_status_t
   apr_iconv_close(iconv_t cd, apr_pool_t *ctx)
   {
   	struct iconv_converter *icp = (struct iconv_converter *)cd;
   	int error = 0;
   
  -	if (icp == NULL) {
  -		errno = EBADF;
  -		return -1;
  -	}
  +	if (icp == NULL)
  +		return(APR_EBADF);
  +
   	if (icp->ic_desc)
   		error = icp->ic_desc->icd_close(icp->ic_data, ctx);
   		
  @@ -115,21 +119,30 @@
   
   #include <iconv.h>
   
  -iconv_t apr_iconv_open(const char *to_charset,
  -            const char *from_charset, apr_pool_t *ctx)
  +apr_status_t apr_iconv_open(const char *to_charset,
  +            const char *from_charset, apr_pool_t *ctx, iconv_t **res)
   {
  -	return (iconv_open(to_charset, from_charset));
  +	*res = iconv_open(to_charset, from_charset);
  +	if (*res == (size_t) -1)
  +		return apr_get_os_error();
  +	return APR_SUCCESS;
   }
   
  -size_t apr_iconv(iconv_t cd, const char **inbuf,
  +apr_status_t apr_iconv(iconv_t cd, const char **inbuf,
               size_t *inbytesleft, char **outbuf,
  -            size_t *outbytesleft)
  +            size_t *outbytesleft, size_t *result)
   {
  -	return (iconv(cd , inbuf, inbytesleft, outbuf, outbytesleft));
  +	*result = iconv(cd , inbuf, inbytesleft, outbuf, outbytesleft);
  +	if (*result == (size_t) -1)
  +		return apr_get_os_error();
  +	return APR_SUCCESS;
   }
  -int apr_iconv_close(iconv_t cd)
  +apr_status_t apr_iconv_close(iconv_t cd)
   {
  -	return (iconv_close(cd));
  +	int status;
  +	if (iconv_close(cd))
  +		return apr_get_os_error();
  +	return APR_SUCCESS;
   }
   
   #endif /* !defined(HAVE_ICONV) */
  
  
  
  1.8       +5 -9      apr-iconv/lib/iconv.h
  
  Index: iconv.h
  ===================================================================
  RCS file: /home/cvs/apr-iconv/lib/iconv.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- iconv.h	2001/05/22 07:42:27	1.7
  +++ iconv.h	2001/06/21 12:24:11	1.8
  @@ -38,10 +38,6 @@
   
   #include <stddef.h>
   
  -/* To be processed by configure */
  -#define APR_ICONV_EFTYPE -1234
  -/* To be processed by configure */
  -
   /* apr additions */
   #define issetugid() 0
   /* apr additions */
  @@ -53,9 +49,9 @@
   
   /* __BEGIN_DECLS */
   
  -iconv_t	apr_iconv_open(const char *, const char *, apr_pool_t *);
  -apr_size_t	apr_iconv(iconv_t, const char **, apr_size_t *, char **, apr_size_t *);
  -int	apr_iconv_close(iconv_t, apr_pool_t *);
  +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_close(iconv_t, apr_pool_t *);
   
   /* __END_DECLS */
   
  @@ -126,8 +122,8 @@
    */
   typedef int iconv_open_t(const char *, const char *, void **, apr_pool_t *);
   typedef int iconv_close_t(void *, apr_pool_t *);
  -typedef apr_size_t iconv_conv_t(void *, const unsigned char **, apr_size_t *,
  -	unsigned char **, apr_size_t *);
  +typedef apr_status_t iconv_conv_t(void *, const unsigned char **, apr_size_t *,
  +	unsigned char **, apr_size_t *, apr_size_t *);
   
   struct iconv_converter_desc {
   	iconv_open_t *	icd_open;
  
  
  
  1.4       +4 -8      apr-iconv/lib/iconv_ccs.c
  
  Index: iconv_ccs.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/lib/iconv_ccs.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- iconv_ccs.c	2001/04/04 17:28:57	1.3
  +++ iconv_ccs.c	2001/06/21 12:24:11	1.4
  @@ -30,14 +30,10 @@
    *	iconv (Charset Conversion Library) v1.0
    */
   
  -#include <errno.h>	/* errno */
  -#include <stdlib.h>	/* free, malloc */
  -#include <string.h>
  -
   #define ICONV_INTERNAL
   #include "iconv.h"	/* iconv_ccs_desc, iconv_ccs_module */
   
  -int
  +apr_status_t
   iconv_ccs_event(struct iconv_module *mod, int event)
   {
   /*	struct iconv_ccs_desc *desc =
  @@ -46,14 +42,14 @@
   	switch (event) {
   	    case ICMODEV_LOAD:
   		if (mod->im_deplist == NULL)
  -			return EINVAL;
  +			return APR_EINVAL;
   		mod->im_methods = mod->im_deplist->im_desc->imd_data;
   		mod->im_data = mod->im_desc->imd_data;
   		break;
   	    case ICMODEV_UNLOAD:
   		break;
   	    default:
  -		return EINVAL;
  +		return APR_EINVAL;
   	}
  -	return 0;
  +	return APR_SUCCESS;
   }
  
  
  
  1.5       +8 -9      apr-iconv/lib/iconv_ces.c
  
  Index: iconv_ces.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/lib/iconv_ces.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- iconv_ces.c	2001/05/17 12:32:21	1.4
  +++ iconv_ces.c	2001/06/21 12:24:12	1.5
  @@ -30,7 +30,6 @@
    *	iconv (Charset Conversion Library) v1.0
    */
   
  -#include <errno.h>	/* errno */
   #include <limits.h>	/* PATH_MAX */
   #include <stdlib.h>	/* free, malloc */
   #include <string.h>
  @@ -38,35 +37,35 @@
   #define ICONV_INTERNAL
   #include "iconv.h"	/* iconv_ccs_desc, iconv_ccs */
   
  -int
  +apr_status_t
   iconv_ces_open(const char *cesname, struct iconv_ces **cespp, apr_pool_t *ctx)
   {
   	struct iconv_module *mod;
   	struct iconv_ces *ces;
  -	int error;
  +	apr_status_t error;
   
   	error = iconv_mod_load(cesname, ICMOD_UC_CES, NULL, &mod, ctx);
  -	if (error == APR_ICONV_EFTYPE)
  +	if (APR_STATUS_IS_EFTYPE(error))
   		error = iconv_mod_load("_tbl_simple", ICMOD_UC_CES, cesname, &mod, ctx);
  -	if (error)
  -		return (error == APR_ICONV_EFTYPE) ? EINVAL : error;
  +	if (error != APR_SUCCESS)
  +		return (APR_STATUS_IS_EFTYPE(error)) ? APR_EINVAL : error;
   	ces = malloc(sizeof(*ces));
   	if (ces == NULL) {
   		iconv_mod_unload(mod, ctx);
  -		return ENOMEM;
  +		return APR_ENOMEM;
   	}
   	memset(ces,0, sizeof(*ces));
   	ces->desc = (struct iconv_ces_desc*)mod->im_desc->imd_data;
   	ces->data = mod->im_data;
   	ces->mod = mod;
   	error = ICONV_CES_OPEN(ces,ctx);
  -	if (error) {
  +	if (error != APR_SUCCESS) {
   		free(ces);
   		iconv_mod_unload(mod, ctx);
   		return error;
   	}
   	*cespp = ces;
  -	return 0;
  +	return APR_SUCCESS;
   }
   
   int
  
  
  
  1.4       +5 -6      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- iconv_ces_euc.c	2001/04/04 17:28:57	1.3
  +++ iconv_ces_euc.c	2001/06/21 12:24:12	1.4
  @@ -30,7 +30,6 @@
    *	iconv (Charset Conversion Library) v1.0
    */
   
  -#include <errno.h>
   #include <stdlib.h>	/* free, malloc */
   #include <string.h>
   
  @@ -46,7 +45,7 @@
   	const struct iconv_module *ccs[1];
   } iconv_ces_euc_state_t;
   
  -int
  +apr_status_t
   iconv_euc_open(struct iconv_ces *ces, apr_pool_t *ctx)
   {
   	struct iconv_module *depmod = ces->mod->im_deplist;
  @@ -58,20 +57,20 @@
   	    sizeof(struct iconv_module *) * (ces->mod->im_depcnt - 1);
   	state = (iconv_ces_euc_state_t *)malloc(stsz);
   	if (state == NULL)
  -		return errno;
  +		return APR_ENOMEM;
   	memset(state, 0, stsz);
   	state->nccs = ces->mod->im_depcnt;
   	for (i = ces->mod->im_depcnt; i; i--, depmod = depmod->im_next)
   		state->ccs[i - 1] = depmod;
   	CESTOSTATE(ces) = state;
  -	return 0;
  +	return APR_SUCCESS;
   }
   
  -int
  +apr_status_t
   iconv_euc_close(struct iconv_ces *ces)
   {
   	free(CESTOSTATE(ces));
  -	return 0;
  +	return APR_SUCCESS;
   }
   
   #define is_7_14bit(data) ((data)->nbits & 7)
  
  
  
  1.4       +3 -4      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- iconv_ces_iso2022.c	2001/04/04 17:28:58	1.3
  +++ iconv_ces_iso2022.c	2001/06/21 12:24:13	1.4
  @@ -30,7 +30,6 @@
    *	iconv (Charset Conversion Library) v1.0
    */
   
  -#include <errno.h>
   #include <stdlib.h>	/* free, malloc */
   #include <string.h>	/* memset, memcmp, memcpy */
   
  @@ -67,7 +66,7 @@
   	const struct iconv_module *ccsmod[1];
   } iconv_ces_iso2022_state_t;
   
  -int
  +apr_status_t
   iconv_iso2022_open(struct iconv_ces *ces, apr_pool_t *ctx)
   {
   	const iconv_ces_iso2022_ccs_t *ccsattr;
  @@ -82,7 +81,7 @@
   	    sizeof(struct iconv_module *) * (ces->mod->im_depcnt - 1);
   	state = (iconv_ces_iso2022_state_t *)malloc(stsz + shiftsz);
   	if (state == NULL)
  -		return errno;
  +		return APR_ENOMEM;
   	memset(state, 0, stsz + shiftsz);
   	ces->data = state;
   	state->shift_tab = (int*)((char*)state + stsz);
  @@ -99,7 +98,7 @@
   		if (ccsattr->shift >= 0)
   			state->prefix[(int)(iso_shift[ccsattr->shift].sequence[0])] = 1;
   	}
  -	return 0;
  +	return APR_SUCCESS;
   }
   
   int
  
  
  
  1.4       +3 -4      apr-iconv/lib/iconv_int.c
  
  Index: iconv_int.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/lib/iconv_int.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- iconv_int.c	2001/04/04 17:28:58	1.3
  +++ iconv_int.c	2001/06/21 12:24:13	1.4
  @@ -31,7 +31,6 @@
    */
   
   #include <ctype.h>	/* tolower */
  -#include <errno.h>	/* errno */
   #include <stdio.h>	/* snprintf */
   #include <stdlib.h>
   #include <string.h>	/* strdup, strlen */
  @@ -39,16 +38,16 @@
   #define ICONV_INTERNAL
   #include "iconv.h"
   
  -int
  +apr_status_t
   iconv_malloc(size_t size, void **pp)
   {
   	void *p = malloc(size);
   
   	if (p == NULL)
  -		return errno;
  +		return APR_ENOMEM;
   	memset(p, 0, size);
   	*pp = p;
  -	return 0;
  +	return APR_SUCCESS;
   }
   
   #ifdef ICONV_DEBUG
  
  
  
  1.4       +29 -28    apr-iconv/lib/iconv_uc.c
  
  Index: iconv_uc.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/lib/iconv_uc.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- iconv_uc.c	2001/04/04 17:28:59	1.3
  +++ iconv_uc.c	2001/06/21 12:24:14	1.4
  @@ -1,7 +1,6 @@
   #define ICONV_INTERNAL
   #include "iconv.h"
   
  -#include <errno.h>
   #include <stdlib.h>
   #include <string.h>
   
  @@ -22,7 +21,10 @@
   	iconv_uc_conv
   };
   
  -int
  +/*
  + * It is call by apr_iconv_open: (*idesc)->icd_open()
  + */
  +apr_status_t
   iconv_uc_open(const char *to, const char *from, void **data, apr_pool_t *ctx)
   {
   	struct iconv_uc *ic;
  @@ -30,78 +32,78 @@
   
   	ic = malloc(sizeof(*ic));
   	if (ic == NULL)
  -		return ENOMEM;
  +		return APR_ENOMEM;
   	memset(ic, 0, sizeof(*ic));
   	error = iconv_ces_open(from, &ic->from, ctx);
  -	if (error)
  +	if (error!=APR_SUCCESS) {
   		goto bad;
  +	}
   	error = iconv_ces_open(to, &ic->to, ctx);
  -	if (error)
  +	if (error!=APR_SUCCESS) {
   		goto bad;
  +	}
   	ic->ignore_ilseq = 0;
   	ic->missing = '_';
   	*data = (void*)ic;
  -	return 0;
  +	return APR_SUCCESS;
   bad:
   	iconv_uc_close(ic,ctx);
   	return error;
   }
   
  -int
  +apr_status_t
   iconv_uc_close(void *data, apr_pool_t *ctx)
   {
   	struct iconv_uc *ic = (struct iconv_uc *)data;
   
   	if (ic == NULL)
  -		return EBADF;
  +		return APR_EBADF;
   	if (ic->from)
   		iconv_ces_close(ic->from, ctx);
   	if (ic->to)
   		iconv_ces_close(ic->to, ctx);
   	free(ic);
  -	return 0;
  +	return APR_SUCCESS;
   }
   
  -size_t
  +apr_status_t
   iconv_uc_conv(void *data, const unsigned char **inbuf, size_t *inbytesleft,
  -	unsigned char **outbuf, size_t *outbytesleft)
  +	unsigned char **outbuf, size_t *outbytesleft, size_t *res)
   {
   	struct iconv_uc *ic = (struct iconv_uc *)data;
   	const unsigned char *ptr;
   	ucs_t ch;
           ssize_t size;
  -	size_t res = 0;
   
  +	*res = (size_t)(0);
   	if (data == NULL) {
  -		errno = EBADF;
  -		return (size_t)(-1);
  +		*res = (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) {
  -			errno = E2BIG;
  -			return (size_t)(-1);
  +			*res = (size_t) -1;
  +			return APR_BADARG; /* too big */
   		}
   		ICONV_CES_RESET(ic->from);
   		ICONV_CES_RESET(ic->to);
  -		return res;
  +		return APR_SUCCESS;
   	}
   	if (inbytesleft == NULL || *inbytesleft == 0)
  -		return 0;
  +		return APR_SUCCESS;
   	while (*inbytesleft > 0 && *outbytesleft > 0) {
   		ptr = *inbuf;
   		ch = ICONV_CES_CONVERT_TO_UCS(ic->from, inbuf, inbytesleft);
  -		if (ch == UCS_CHAR_NONE) {
  -			errno = EINVAL;
  -			return res;
  -		}
  +		if (ch == UCS_CHAR_NONE)
  +			return APR_EINVAL;
   		if (ch == UCS_CHAR_INVALID) { /* Invalid character in source buffer */
   			if (ic->ignore_ilseq)
   				continue;
   			*inbytesleft += *inbuf - ptr;
   			*inbuf = ptr;
  -			errno = EILSEQ;
  -			return res;
  +			return APR_BADCH; /* eilseq invalid */
   		}
   		size = ICONV_CES_CONVERT_FROM_UCS(ic->to, ch,
   		    outbuf, outbytesleft);
  @@ -109,16 +111,15 @@
   			size = ICONV_CES_CONVERT_FROM_UCS(ic->to, ic->missing,
   			    outbuf, outbytesleft);
   			if (size)
  -				res ++;
  +				*res ++;
   		}
   		if (!size) {		 /* No space to write to */
   			*inbytesleft += *inbuf - ptr;
   			*inbuf = ptr; 
  -			errno = E2BIG;
  -			return res;
  +			return APR_BADARG; /* too big */
   		}
   	}
  -	return res;
  +	return APR_SUCCESS;
   }
   
   #if 0
  
  
  
  1.4       +3 -2      apr-iconv/util/iconv.c
  
  Index: iconv.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/util/iconv.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- iconv.c	2001/04/04 17:29:02	1.3
  +++ iconv.c	2001/06/21 12:24:19	1.4
  @@ -86,6 +86,7 @@
   	char *from = NULL, *to = NULL, *input = NULL;
   	int opt;
   	apr_pool_t *ctx; 
  +	apr_status_t status;
   
   	while ((opt = getopt(argc, argv, "f:s:t:")) > 0) {
   		switch (opt) {
  @@ -117,8 +118,8 @@
   	}
   
   	/* Use it */
  -	cd = apr_iconv_open(to, from,ctx);
  -	if ((int)cd < 0) {
  +	status = apr_iconv_open(to, from,ctx, &cd);
  +	if (status) {
   		fprintf(stderr, "unable to open specified convertor\n");
   		exit(6);
   		}
  
  
  
  1.3       +3 -1      apr-iconv/util/iconv_stream.c
  
  Index: iconv_stream.c
  ===================================================================
  RCS file: /home/cvs/apr-iconv/util/iconv_stream.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- iconv_stream.c	2001/03/30 17:21:06	1.2
  +++ iconv_stream.c	2001/06/21 12:24:19	1.3
  @@ -70,9 +70,11 @@
       char *outbuf = buffer;
       const char *inbuf = buf;
       size_t chars;
  +    apr_status_t status;
  +
       if (!buf)
           insize = 0;
  -    chars = apr_iconv(stream->cd, (const char **)&buf, &insize, &outbuf,
&outsize);
  +    status = apr_iconv(stream->cd, (const char **)&buf, &insize, &outbuf,
&outsize, &chars);
       if ((int)chars < 0)
           return -1;
       stream->chars += chars;
  
  
  

Mime
View raw message