Skip to content

Commit

Permalink
MFC r275805:
Browse files Browse the repository at this point in the history
Fix incorrect type of "invalids" argument in __iconv() prototype.

MFC r281550,281591:

Remove the const qualifier from iconv(3) to comply with POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html

Adjust all code that calls iconv.

PR:		199099
  • Loading branch information
TijlCoosemans committed Apr 30, 2015
1 parent de0424c commit b709ec8
Show file tree
Hide file tree
Showing 43 changed files with 95 additions and 95 deletions.
4 changes: 4 additions & 0 deletions UPDATING
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ from older versions of FreeBSD, try WITHOUT_CLANG to bootstrap to the tip of
stable/10, and then rebuild without this option. The bootstrap process from
older version of current is a bit fragile.

20150430:
The const qualifier has been removed from iconv(3) to comply with
POSIX. The ports tree is aware of this from r384038 onwards.

20141215:
At svn r275807, The default linux compat kernel ABI has been adjusted
to 2.6.18 in support of the linux-c6 compat ports infrastructure
Expand Down
2 changes: 1 addition & 1 deletion bin/csh/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
#define HAVE_WCWIDTH 1

/* Define as const if the declaration of iconv() needs const. */
#define ICONV_CONST const
#define ICONV_CONST

/* Support NLS. */
#define NLS 1
Expand Down
2 changes: 1 addition & 1 deletion bin/csh/iconv_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define _ICONV_H_

typedef void *iconv_t;
typedef size_t dl_iconv_t(iconv_t, const char **, size_t *, char **, size_t *);
typedef size_t dl_iconv_t(iconv_t, char **, size_t *, char **, size_t *);
typedef int dl_iconv_close_t(iconv_t);

extern iconv_t dl_iconv_open(const char *, const char *);
Expand Down
14 changes: 7 additions & 7 deletions contrib/smbfs/include/netsmb/smb_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ int smb_ctx_readrc(struct smb_ctx *);
int smb_ctx_resolve(struct smb_ctx *);
int smb_ctx_setflags(struct smb_ctx *, int, int, int);

int smb_smb_open_print_file(struct smb_ctx *, int, int, const char *, smbfh*);
int smb_smb_open_print_file(struct smb_ctx *, int, int, char *, smbfh*);
int smb_smb_close_print_file(struct smb_ctx *, smbfh);

int smb_read(struct smb_ctx *, smbfh, off_t, size_t, char *);
Expand All @@ -204,8 +204,8 @@ int smb_rq_init(struct smb_ctx *, u_char, size_t, struct smb_rq **);
void smb_rq_done(struct smb_rq *);
void smb_rq_wend(struct smb_rq *);
int smb_rq_simple(struct smb_rq *);
int smb_rq_dmem(struct mbdata *, const char *, size_t);
int smb_rq_dstring(struct mbdata *, const char *);
int smb_rq_dmem(struct mbdata *, char *, size_t);
int smb_rq_dstring(struct mbdata *, char *);

int smb_t2_request(struct smb_ctx *, int, int, const char *,
int, void *, int, void *, int *, void *, int *, void *);
Expand Down Expand Up @@ -246,10 +246,10 @@ extern u_char nls_lower[256], nls_upper[256];

int nls_setrecode(const char *, const char *);
int nls_setlocale(const char *);
char* nls_str_toext(char *, const char *);
char* nls_str_toloc(char *, const char *);
void* nls_mem_toext(void *, const void *, int);
void* nls_mem_toloc(void *, const void *, int);
char* nls_str_toext(char *, char *);
char* nls_str_toloc(char *, char *);
void* nls_mem_toext(void *, void *, int);
void* nls_mem_toloc(void *, void *, int);
char* nls_str_upper(char *, const char *);
char* nls_str_lower(char *, const char *);

Expand Down
12 changes: 6 additions & 6 deletions contrib/smbfs/lib/smb/nls.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ nls_setrecode(const char *local, const char *external)
}

char *
nls_str_toloc(char *dst, const char *src)
nls_str_toloc(char *dst, char *src)
{
#ifdef HAVE_ICONV
char *p = dst;
Expand All @@ -125,7 +125,7 @@ nls_str_toloc(char *dst, const char *src)
}

char *
nls_str_toext(char *dst, const char *src)
nls_str_toext(char *dst, char *src)
{
#ifdef HAVE_ICONV
char *p = dst;
Expand All @@ -148,11 +148,11 @@ nls_str_toext(char *dst, const char *src)
}

void *
nls_mem_toloc(void *dst, const void *src, int size)
nls_mem_toloc(void *dst, void *src, int size)
{
#ifdef HAVE_ICONV
char *p = dst;
const char *s = src;
char *s = src;
size_t inlen, outlen;

if (size == 0)
Expand All @@ -174,11 +174,11 @@ nls_mem_toloc(void *dst, const void *src, int size)
}

void *
nls_mem_toext(void *dst, const void *src, int size)
nls_mem_toext(void *dst, void *src, int size)
{
#ifdef HAVE_ICONV
char *p = dst;
const char *s = src;
char *s = src;
size_t inlen, outlen;

if (size == 0)
Expand Down
2 changes: 1 addition & 1 deletion contrib/smbfs/lib/smb/print.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

int
smb_smb_open_print_file(struct smb_ctx *ctx, int setuplen, int mode,
const char *ident, smbfh *fhp)
char *ident, smbfh *fhp)
{
struct smb_rq *rqp;
struct mbdata *mbp;
Expand Down
4 changes: 2 additions & 2 deletions contrib/smbfs/lib/smb/rq.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ smb_rq_wend(struct smb_rq *rqp)
}

int
smb_rq_dmem(struct mbdata *mbp, const char *src, size_t size)
smb_rq_dmem(struct mbdata *mbp, char *src, size_t size)
{
struct mbuf *m;
char * dst;
Expand Down Expand Up @@ -118,7 +118,7 @@ smb_rq_dmem(struct mbdata *mbp, const char *src, size_t size)
}

int
smb_rq_dstring(struct mbdata *mbp, const char *s)
smb_rq_dstring(struct mbdata *mbp, char *s)
{
return smb_rq_dmem(mbp, s, strlen(s) + 1);
}
Expand Down
4 changes: 2 additions & 2 deletions include/iconv.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ typedef struct __tag_iconv_t *iconv_t;

__BEGIN_DECLS
iconv_t iconv_open(const char *, const char *);
size_t iconv(iconv_t, const char ** __restrict,
size_t iconv(iconv_t, char ** __restrict,
size_t * __restrict, char ** __restrict,
size_t * __restrict);
int iconv_close(iconv_t);
Expand All @@ -62,7 +62,7 @@ int iconv_close(iconv_t);
*/
int __iconv_get_list(char ***, size_t *, __iconv_bool);
void __iconv_free_list(char **, size_t);
size_t __iconv(iconv_t, const char **, size_t *, char **,
size_t __iconv(iconv_t, char **, size_t *, char **,
size_t *, __uint32_t, size_t *);
#define __ICONV_F_HIDE_INVALID 0x0001

Expand Down
2 changes: 1 addition & 1 deletion lib/libarchive/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ LDADD+= -lmd
.if ${MK_ICONV} != "no"
# TODO: This can be changed back to CFLAGS once iconv works correctly
# with statically linked binaries.
SHARED_CFLAGS+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -DICONV_CONST=const
SHARED_CFLAGS+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -DICONV_CONST=
.endif

.if ${MACHINE_ARCH:Marm*} != "" || ${MACHINE_ARCH:Mmips*} != "" || \
Expand Down
2 changes: 1 addition & 1 deletion lib/libc/iconv/__iconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "iconv-internal.h"

size_t
__iconv(iconv_t a, const char **b, size_t *c, char **d,
__iconv(iconv_t a, char **b, size_t *c, char **d,
size_t *e, __uint32_t f, size_t *g)
{
return __bsd___iconv(a, b, c, d, e, f, g);
Expand Down
4 changes: 2 additions & 2 deletions lib/libc/iconv/bsd_iconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ __bsd_iconv_close(iconv_t handle)
}

size_t
__bsd_iconv(iconv_t handle, const char **in, size_t *szin, char **out, size_t *szout)
__bsd_iconv(iconv_t handle, char **in, size_t *szin, char **out, size_t *szout)
{
size_t ret;
int err;
Expand All @@ -141,7 +141,7 @@ __bsd_iconv(iconv_t handle, const char **in, size_t *szin, char **out, size_t *s
}

size_t
__bsd___iconv(iconv_t handle, const char **in, size_t *szin, char **out,
__bsd___iconv(iconv_t handle, char **in, size_t *szin, char **out,
size_t *szout, uint32_t flags, size_t *invalids)
{
size_t ret;
Expand Down
2 changes: 1 addition & 1 deletion lib/libc/iconv/citrus_iconv.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ __END_DECLS
*/
static __inline int
_citrus_iconv_convert(struct _citrus_iconv * __restrict cv,
const char * __restrict * __restrict in, size_t * __restrict inbytes,
char * __restrict * __restrict in, size_t * __restrict inbytes,
char * __restrict * __restrict out, size_t * __restrict outbytes,
uint32_t flags, size_t * __restrict nresults)
{
Expand Down
4 changes: 2 additions & 2 deletions lib/libc/iconv/citrus_iconv_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static void _citrus_##_m_##_iconv_uninit_shared \
(struct _citrus_iconv_shared *); \
static int _citrus_##_m_##_iconv_convert \
(struct _citrus_iconv * __restrict, \
const char * __restrict * __restrict, \
char * __restrict * __restrict, \
size_t * __restrict, \
char * __restrict * __restrict, \
size_t * __restrict outbytes, \
Expand Down Expand Up @@ -75,7 +75,7 @@ typedef void (*_citrus_iconv_uninit_shared_t)
(struct _citrus_iconv_shared *);
typedef int (*_citrus_iconv_convert_t)
(struct _citrus_iconv * __restrict,
const char *__restrict* __restrict, size_t * __restrict,
char *__restrict* __restrict, size_t * __restrict,
char * __restrict * __restrict, size_t * __restrict, uint32_t,
size_t * __restrict);
typedef int (*_citrus_iconv_init_context_t)(struct _citrus_iconv *);
Expand Down
4 changes: 2 additions & 2 deletions lib/libc/iconv/citrus_none.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ _citrus_NONE_stdenc_init_state(struct _citrus_stdenc * __restrict ce __unused,

static int
_citrus_NONE_stdenc_mbtocs(struct _citrus_stdenc * __restrict ce __unused,
_csid_t *csid, _index_t *idx, const char **s, size_t n,
_csid_t *csid, _index_t *idx, char **s, size_t n,
void *ps __unused, size_t *nresult, struct iconv_hooks *hooks)
{

Expand Down Expand Up @@ -159,7 +159,7 @@ _citrus_NONE_stdenc_cstomb(struct _citrus_stdenc * __restrict ce __unused,

static int
_citrus_NONE_stdenc_mbtowc(struct _citrus_stdenc * __restrict ce __unused,
_wc_t * __restrict pwc, const char ** __restrict s, size_t n,
_wc_t * __restrict pwc, char ** __restrict s, size_t n,
void * __restrict pspriv __unused, size_t * __restrict nresult,
struct iconv_hooks *hooks)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/libc/iconv/citrus_stdenc.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ _citrus_stdenc_init_state(struct _citrus_stdenc * __restrict ce,
static __inline int
_citrus_stdenc_mbtocs(struct _citrus_stdenc * __restrict ce,
_citrus_csid_t * __restrict csid, _citrus_index_t * __restrict idx,
const char ** __restrict s, size_t n, void * __restrict ps,
char ** __restrict s, size_t n, void * __restrict ps,
size_t * __restrict nresult, struct iconv_hooks *hooks)
{

Expand Down
8 changes: 4 additions & 4 deletions lib/libc/iconv/citrus_stdenc_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static int _citrus_##_e_##_stdenc_mbtocs \
(struct _citrus_stdenc * __restrict, \
_citrus_csid_t * __restrict, \
_citrus_index_t * __restrict, \
const char ** __restrict, size_t, \
char ** __restrict, size_t, \
void * __restrict, size_t * __restrict, \
struct iconv_hooks *); \
static int _citrus_##_e_##_stdenc_cstomb \
Expand All @@ -66,7 +66,7 @@ static int _citrus_##_e_##_stdenc_cstomb \
static int _citrus_##_e_##_stdenc_mbtowc \
(struct _citrus_stdenc * __restrict, \
_citrus_wc_t * __restrict, \
const char ** __restrict, size_t, \
char ** __restrict, size_t, \
void * __restrict, size_t * __restrict, \
struct iconv_hooks *); \
static int _citrus_##_e_##_stdenc_wctomb \
Expand Down Expand Up @@ -106,7 +106,7 @@ typedef int (*_citrus_stdenc_init_state_t)
typedef int (*_citrus_stdenc_mbtocs_t)
(struct _citrus_stdenc * __restrict,
_citrus_csid_t * __restrict, _citrus_index_t * __restrict,
const char ** __restrict, size_t,
char ** __restrict, size_t,
void * __restrict, size_t * __restrict,
struct iconv_hooks *);
typedef int (*_citrus_stdenc_cstomb_t)
Expand All @@ -116,7 +116,7 @@ typedef int (*_citrus_stdenc_cstomb_t)
typedef int (*_citrus_stdenc_mbtowc_t)
(struct _citrus_stdenc * __restrict,
_citrus_wc_t * __restrict,
const char ** __restrict, size_t,
char ** __restrict, size_t,
void * __restrict, size_t * __restrict,
struct iconv_hooks *);
typedef int (*_citrus_stdenc_wctomb_t)
Expand Down
4 changes: 2 additions & 2 deletions lib/libc/iconv/citrus_stdenc_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ _FUNCNAME(stdenc_init_state)(struct _citrus_stdenc * __restrict ce,
static int
_FUNCNAME(stdenc_mbtocs)(struct _citrus_stdenc * __restrict ce,
_citrus_csid_t * __restrict csid, _citrus_index_t * __restrict idx,
const char ** __restrict s, size_t n, void * __restrict ps,
char ** __restrict s, size_t n, void * __restrict ps,
size_t * __restrict nresult, struct iconv_hooks *hooks)
{
wchar_t wc;
Expand Down Expand Up @@ -151,7 +151,7 @@ _FUNCNAME(stdenc_cstomb)(struct _citrus_stdenc * __restrict ce,

static int
_FUNCNAME(stdenc_mbtowc)(struct _citrus_stdenc * __restrict ce,
_citrus_wc_t * __restrict wc, const char ** __restrict s, size_t n,
_citrus_wc_t * __restrict wc, char ** __restrict s, size_t n,
void * __restrict ps, size_t * __restrict nresult,
struct iconv_hooks *hooks)
{
Expand Down
4 changes: 2 additions & 2 deletions lib/libc/iconv/iconv-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
/*
* Interal prototypes for our back-end functions.
*/
size_t __bsd___iconv(iconv_t, const char **, size_t *, char **,
size_t __bsd___iconv(iconv_t, char **, size_t *, char **,
size_t *, __uint32_t, size_t *);
void __bsd___iconv_free_list(char **, size_t);
int __bsd___iconv_get_list(char ***, size_t *, __iconv_bool);
size_t __bsd_iconv(iconv_t, const char ** __restrict,
size_t __bsd_iconv(iconv_t, char ** __restrict,
size_t * __restrict, char ** __restrict,
size_t * __restrict);
const char *__bsd_iconv_canonicalize(const char *);
Expand Down
2 changes: 1 addition & 1 deletion lib/libc/iconv/iconv.3
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
.Ft size_t
.Fn iconv "iconv_t cd" "char ** restrict src" "size_t * restrict srcleft" "char ** restrict dst" "size_t * restrict dstleft"
.Ft size_t
.Fn __iconv "iconv_t cd" "const char ** restrict src" "size_t * restrict srcleft" "char ** restrict dst" "size_t * restrict dstleft" "uint32_t flags" "size_t invalids"
.Fn __iconv "iconv_t cd" "char ** restrict src" "size_t * restrict srcleft" "char ** restrict dst" "size_t * restrict dstleft" "uint32_t flags" "size_t * invalids"
.Sh DESCRIPTION
The
.Fn iconv_open
Expand Down
2 changes: 1 addition & 1 deletion lib/libc/iconv/iconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "iconv-internal.h"

size_t
iconv(iconv_t a, const char ** __restrict b,
iconv(iconv_t a, char ** __restrict b,
size_t * __restrict c, char ** __restrict d,
size_t * __restrict e)
{
Expand Down
4 changes: 2 additions & 2 deletions lib/libc/iconv/iconv_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "iconv-internal.h"

size_t
__iconv_compat(iconv_t a, const char ** b, size_t * c, char ** d,
__iconv_compat(iconv_t a, char ** b, size_t * c, char ** d,
size_t * e, __uint32_t f, size_t *g)
{
return __bsd___iconv(a, b, c, d, e, f, g);
Expand All @@ -56,7 +56,7 @@ __iconv_get_list_compat(char ***a, size_t *b, __iconv_bool c)
}

size_t
iconv_compat(iconv_t a, const char ** __restrict b,
iconv_compat(iconv_t a, char ** __restrict b,
size_t * __restrict c, char ** __restrict d,
size_t * __restrict e)
{
Expand Down
3 changes: 1 addition & 2 deletions lib/libc/locale/cXXrtomb_iconv.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ cXXrtomb_l(char * __restrict s, charXX_t c, mbstate_t * __restrict ps,
{
_ConversionState *cs;
struct _citrus_iconv *handle;
const char *src;
char *dst;
char *src, *dst;
size_t srcleft, dstleft, invlen;
int err;

Expand Down
3 changes: 1 addition & 2 deletions lib/libc/locale/mbrtocXX_iconv.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ mbrtocXX_l(charXX_t * __restrict pc, const char * __restrict s, size_t n,

/* Convert as few characters to the dst buffer as possible. */
for (i = 0; ; i++) {
const char *src;
char *dst;
char *src, *dst;
size_t srcleft, dstleft, invlen;
int err;

Expand Down
4 changes: 2 additions & 2 deletions lib/libiconv_modules/BIG5/citrus_big5.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,12 @@ static int
/*ARGSUSED*/
_citrus_BIG5_mbrtowc_priv(_BIG5EncodingInfo * __restrict ei,
wchar_t * __restrict pwc,
const char ** __restrict s, size_t n,
char ** __restrict s, size_t n,
_BIG5State * __restrict psenc,
size_t * __restrict nresult)
{
wchar_t wchar;
const char *s0;
char *s0;
int c, chlenbak;

s0 = *s;
Expand Down
4 changes: 2 additions & 2 deletions lib/libiconv_modules/DECHanyu/citrus_dechanyu.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ is_94charset(int c)
static int
/*ARGSUSED*/
_citrus_DECHanyu_mbrtowc_priv(_DECHanyuEncodingInfo * __restrict ei,
wchar_t * __restrict pwc, const char ** __restrict s, size_t n,
wchar_t * __restrict pwc, char ** __restrict s, size_t n,
_DECHanyuState * __restrict psenc, size_t * __restrict nresult)
{
const char *s0;
char *s0;
wchar_t wc;
int ch;

Expand Down
Loading

0 comments on commit b709ec8

Please sign in to comment.