Replace the #define for "iconv" so it is for the function name instead of

a macro with parameters.  Remove a __DECONST hack and add consts instead
for gnu libiconv API compatability.  This makes it work with things like
devel/boost-libs that expects to use "iconv" as though it were a pointer.
This commit is contained in:
Peter Wemm 2013-07-03 07:03:19 +00:00
parent 7f87e7c276
commit 19dfd82d81
6 changed files with 12 additions and 10 deletions

View File

@ -43,7 +43,7 @@
#define iconv_open libiconv_open
#define iconv_close libiconv_close
#define iconv(cd, in, insize, out, outsize) libiconv(cd, __DECONST(char **, in), insize, out, outsize)
#define iconv libiconv
#define iconv_t libiconv_t
struct __tag_iconv_t;
@ -51,7 +51,7 @@ typedef struct __tag_iconv_t *iconv_t;
__BEGIN_DECLS
iconv_t libiconv_open(const char *, const char *);
size_t libiconv(iconv_t, char ** __restrict,
size_t libiconv(iconv_t, const char ** __restrict,
size_t * __restrict, char ** __restrict,
size_t * __restrict);
int libiconv_close(iconv_t);
@ -60,7 +60,7 @@ int libiconv_close(iconv_t);
*/
int __iconv_get_list(char ***, size_t *, bool);
void __iconv_free_list(char **, size_t);
size_t __iconv(iconv_t, char **, size_t *, char **,
size_t __iconv(iconv_t, const char **, size_t *, char **,
size_t *, __uint32_t, size_t *);
#define __ICONV_F_HIDE_INVALID 0x0001

View File

@ -52,7 +52,7 @@ __END_DECLS
*/
static __inline int
_citrus_iconv_convert(struct _citrus_iconv * __restrict cv,
char * __restrict * __restrict in, size_t * __restrict inbytes,
const char * __restrict * __restrict in, size_t * __restrict inbytes,
char * __restrict * __restrict out, size_t * __restrict outbytes,
uint32_t flags, size_t * __restrict nresults)
{

View File

@ -45,7 +45,7 @@ static void _citrus_##_m_##_iconv_uninit_shared \
(struct _citrus_iconv_shared *); \
static int _citrus_##_m_##_iconv_convert \
(struct _citrus_iconv * __restrict, \
char * __restrict * __restrict, \
const char * __restrict * __restrict, \
size_t * __restrict, \
char * __restrict * __restrict, \
size_t * __restrict outbytes, \
@ -74,7 +74,7 @@ typedef void (*_citrus_iconv_uninit_shared_t)
(struct _citrus_iconv_shared *);
typedef int (*_citrus_iconv_convert_t)
(struct _citrus_iconv * __restrict,
char *__restrict* __restrict, size_t * __restrict,
const 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 *);

View File

@ -130,7 +130,7 @@ libiconv_close(iconv_t handle)
}
size_t
libiconv(iconv_t handle, char **in, size_t *szin, char **out, size_t *szout)
libiconv(iconv_t handle, const char **in, size_t *szin, char **out, size_t *szout)
{
size_t ret;
int err;
@ -151,7 +151,7 @@ libiconv(iconv_t handle, char **in, size_t *szin, char **out, size_t *szout)
}
size_t
__iconv(iconv_t handle, char **in, size_t *szin, char **out,
__iconv(iconv_t handle, const char **in, size_t *szin, char **out,
size_t *szout, uint32_t flags, size_t *invalids)
{
size_t ret;

View File

@ -57,7 +57,8 @@ cXXrtomb_l(char * __restrict s, charXX_t c, mbstate_t * __restrict ps,
{
_ConversionState *cs;
struct _citrus_iconv *handle;
char *src, *dst;
const char *src;
char *dst;
size_t srcleft, dstleft, invlen;
int err;

View File

@ -99,7 +99,8 @@ 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++) {
char *src, *dst;
const char *src;
char *dst;
size_t srcleft, dstleft, invlen;
int err;