Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Jul 2013 07:03:19 +0000 (UTC)
From:      Peter Wemm <peter@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r252547 - in head: include lib/libc/iconv lib/libc/locale
Message-ID:  <201307030703.r6373JCI064505@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: peter
Date: Wed Jul  3 07:03:19 2013
New Revision: 252547
URL: http://svnweb.freebsd.org/changeset/base/252547

Log:
  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.

Modified:
  head/include/iconv.h
  head/lib/libc/iconv/citrus_iconv.h
  head/lib/libc/iconv/citrus_iconv_local.h
  head/lib/libc/iconv/iconv.c
  head/lib/libc/locale/cXXrtomb_iconv.h
  head/lib/libc/locale/mbrtocXX_iconv.h

Modified: head/include/iconv.h
==============================================================================
--- head/include/iconv.h	Wed Jul  3 06:43:49 2013	(r252546)
+++ head/include/iconv.h	Wed Jul  3 07:03:19 2013	(r252547)
@@ -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
 

Modified: head/lib/libc/iconv/citrus_iconv.h
==============================================================================
--- head/lib/libc/iconv/citrus_iconv.h	Wed Jul  3 06:43:49 2013	(r252546)
+++ head/lib/libc/iconv/citrus_iconv.h	Wed Jul  3 07:03:19 2013	(r252547)
@@ -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)
 {

Modified: head/lib/libc/iconv/citrus_iconv_local.h
==============================================================================
--- head/lib/libc/iconv/citrus_iconv_local.h	Wed Jul  3 06:43:49 2013	(r252546)
+++ head/lib/libc/iconv/citrus_iconv_local.h	Wed Jul  3 07:03:19 2013	(r252547)
@@ -45,7 +45,7 @@ static void	 _citrus_##_m_##_iconv_unini
 		    (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_shar
     (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 *);

Modified: head/lib/libc/iconv/iconv.c
==============================================================================
--- head/lib/libc/iconv/iconv.c	Wed Jul  3 06:43:49 2013	(r252546)
+++ head/lib/libc/iconv/iconv.c	Wed Jul  3 07:03:19 2013	(r252547)
@@ -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
 }
 
 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;

Modified: head/lib/libc/locale/cXXrtomb_iconv.h
==============================================================================
--- head/lib/libc/locale/cXXrtomb_iconv.h	Wed Jul  3 06:43:49 2013	(r252546)
+++ head/lib/libc/locale/cXXrtomb_iconv.h	Wed Jul  3 07:03:19 2013	(r252547)
@@ -57,7 +57,8 @@ cXXrtomb_l(char * __restrict s, charXX_t
 {
 	_ConversionState *cs;
 	struct _citrus_iconv *handle;
-	char *src, *dst;
+	const char *src;
+	char *dst;
 	size_t srcleft, dstleft, invlen;
 	int err;
 

Modified: head/lib/libc/locale/mbrtocXX_iconv.h
==============================================================================
--- head/lib/libc/locale/mbrtocXX_iconv.h	Wed Jul  3 06:43:49 2013	(r252546)
+++ head/lib/libc/locale/mbrtocXX_iconv.h	Wed Jul  3 07:03:19 2013	(r252547)
@@ -99,7 +99,8 @@ mbrtocXX_l(charXX_t * __restrict pc, con
 
 	/* 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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307030703.r6373JCI064505>