make sure that the iconv(3) follows the POSIX specification;

change the 2nd argument from "const char ** restrict" to "char ** restrict".
This commit is contained in:
tshiozak 2004-08-01 16:40:58 +00:00
parent 88c36114af
commit ab8d4be7c6
3 changed files with 13 additions and 13 deletions

View File

@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: nls.c,v 1.5 2004/03/01 07:46:33 jdolecek Exp $");
__RCSID("$NetBSD: nls.c,v 1.6 2004/08/01 16:40:58 tshiozak Exp $");
#include <sys/param.h>
#include <sys/types.h>
@ -110,7 +110,7 @@ nls_str_toloc(char *dst, const char *src)
return strcpy(dst, src);
inlen = outlen = strlen(src);
iconv(nls_toloc, NULL, NULL, &p, &outlen);
while (iconv(nls_toloc, &src, &inlen, &p, &outlen) == -1) {
while (iconv(nls_toloc, (char **)&src, &inlen, &p, &outlen) == -1) {
*p++ = *src++;
inlen--;
outlen--;
@ -129,7 +129,7 @@ nls_str_toext(char *dst, const char *src)
return strcpy(dst, src);
inlen = outlen = strlen(src);
iconv(nls_toext, NULL, NULL, &p, &outlen);
while (iconv(nls_toext, &src, &inlen, &p, &outlen) == -1) {
while (iconv(nls_toext, (char **)&src, &inlen, &p, &outlen) == -1) {
*p++ = *src++;
inlen--;
outlen--;
@ -152,7 +152,7 @@ nls_mem_toloc(void *dst, const void *src, size_t size)
return memcpy(dst, src, size);
inlen = outlen = size;
iconv(nls_toloc, NULL, NULL, &p, &outlen);
while (iconv(nls_toloc, &s, &inlen, &p, &outlen) == -1) {
while (iconv(nls_toloc, (char **)&s, &inlen, &p, &outlen) == -1) {
*p++ = *s++;
inlen--;
outlen--;
@ -175,7 +175,7 @@ nls_mem_toext(void *dst, const void *src, size_t size)
inlen = outlen = size;
iconv(nls_toext, NULL, NULL, &p, &outlen);
while (iconv(nls_toext, &s, &inlen, &p, &outlen) == -1) {
while (iconv(nls_toext, (char **)&s, &inlen, &p, &outlen) == -1) {
*p++ = *s++;
inlen--;
outlen--;

View File

@ -1,4 +1,4 @@
/* $NetBSD: iconv.h,v 1.3 2003/08/22 14:05:03 kleink Exp $ */
/* $NetBSD: iconv.h,v 1.4 2004/08/01 16:40:58 tshiozak Exp $ */
/*-
* Copyright (c)2003 Citrus Project,
@ -43,9 +43,8 @@ typedef struct __tag_iconv_t *iconv_t;
__BEGIN_DECLS
iconv_t iconv_open __P((const char *, const char *));
size_t iconv __P((iconv_t, const char ** __restrict,
size_t * __restrict, char ** __restrict,
size_t * __restrict));
size_t iconv __P((iconv_t, char ** __restrict, size_t * __restrict,
char ** __restrict, size_t * __restrict));
int iconv_close __P((iconv_t));
/*
* non-portable interfaces for iconv

View File

@ -1,4 +1,4 @@
/* $NetBSD: iconv.c,v 1.2 2003/07/01 09:42:17 tshiozak Exp $ */
/* $NetBSD: iconv.c,v 1.3 2004/08/01 16:40:58 tshiozak Exp $ */
/*-
* Copyright (c)2003 Citrus Project,
@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: iconv.c,v 1.2 2003/07/01 09:42:17 tshiozak Exp $");
__RCSID("$NetBSD: iconv.c,v 1.3 2004/08/01 16:40:58 tshiozak Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -84,7 +84,7 @@ _iconv_close(iconv_t handle)
}
size_t
_iconv(iconv_t handle, const char **in, size_t *szin, char **out, size_t *szout)
_iconv(iconv_t handle, char **in, size_t *szin, char **out, size_t *szout)
{
int err;
size_t ret;
@ -95,7 +95,8 @@ _iconv(iconv_t handle, const char **in, size_t *szin, char **out, size_t *szout)
}
err = _citrus_iconv_convert(
(struct _citrus_iconv *)(void *)handle, in, szin, out, szout,
(struct _citrus_iconv *)(void *)handle, (const char **)in, szin,
out, szout,
0, &ret);
if (err) {
errno = err;