diff -r -u -N --exclude='*.orig' libiconv-1.11.orig/include/iconv.h.build.in libiconv-1.11/include/iconv.h.build.in --- libiconv-1.11.orig/include/iconv.h.build.in 2006-05-15 14:28:04.000000000 -0700 +++ libiconv-1.11/include/iconv.h.build.in 2008-03-11 01:08:52.000000000 -0700 @@ -21,6 +21,13 @@ #ifndef _LIBICONV_H #define _LIBICONV_H +#include <sys/cdefs.h> +#include <_types.h> +#ifndef _SIZE_T +#define _SIZE_T +typedef __darwin_size_t size_t; +#endif + #define _LIBICONV_VERSION 0x010B /* version number: (major<<8) + minor */ #if @HAVE_VISIBILITY@ && BUILDING_LIBICONV @@ -48,21 +55,9 @@ from iconv_open().) */ /* Define iconv_t ourselves. */ -#undef iconv_t -#define iconv_t libiconv_t +#ifndef _ICONV_T +#define _ICONV_T typedef void* iconv_t; - -/* Get size_t declaration. - Get wchar_t declaration if it exists. */ -#include <stddef.h> - -/* Get errno declaration and values. */ -#include <errno.h> -/* Some systems, like SunOS 4, don't have EILSEQ. Some systems, like BSD/OS, - have EILSEQ in a different header. On these systems, define EILSEQ - ourselves. */ -#ifndef EILSEQ -#define EILSEQ @EILSEQ@ #endif @@ -73,9 +68,6 @@ /* Allocates descriptor for code conversion from encoding `fromcode' to encoding `tocode'. */ -#ifndef LIBICONV_PLUG -#define iconv_open libiconv_open -#endif extern LIBICONV_DLL_EXPORTED iconv_t iconv_open (const char* tocode, const char* fromcode); /* Converts, using conversion descriptor `cd', at most `*inbytesleft' bytes @@ -83,24 +75,23 @@ `*outbuf'. Decrements `*inbytesleft' and increments `*inbuf' by the same amount. Decrements `*outbytesleft' and increments `*outbuf' by the same amount. */ -#ifndef LIBICONV_PLUG -#define iconv libiconv -#endif -extern LIBICONV_DLL_EXPORTED size_t iconv (iconv_t cd, @ICONV_CONST@ char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft); +extern LIBICONV_DLL_EXPORTED size_t iconv (iconv_t cd, char* * __restrict inbuf, size_t * __restrict inbytesleft, char* * __restrict outbuf, size_t * __restrict outbytesleft); /* Frees resources allocated for conversion descriptor `cd'. */ -#ifndef LIBICONV_PLUG -#define iconv_close libiconv_close -#endif extern LIBICONV_DLL_EXPORTED int iconv_close (iconv_t cd); - -#ifndef LIBICONV_PLUG +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* Nonstandard extensions. */ +#ifndef __cplusplus +#ifndef _WCHAR_T +#define _WCHAR_T +typedef __darwin_wchar_t wchar_t; +#endif /* _WCHAR_T */ +#endif /* __cplusplus */ + /* Control of attributes. */ -#define iconvctl libiconvctl extern LIBICONV_DLL_EXPORTED int iconvctl (iconv_t cd, int request, void* argument); /* Hook performed after every successful conversion of a Unicode character. */ @@ -180,7 +171,6 @@ #define ICONV_SET_FALLBACKS 6 /* const struct iconv_fallbacks *argument */ /* Listing of locale independent encodings. */ -#define iconvlist libiconvlist extern LIBICONV_DLL_EXPORTED void iconvlist (int (*do_one) (unsigned int namescount, const char * const * names, void* data), @@ -200,7 +190,7 @@ extern LIBICONV_DLL_EXPORTED void libiconv_set_relocation_prefix (const char *orig_prefix, const char *curr_prefix); -#endif +#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #ifdef __cplusplus diff -r -u -N --exclude='*.orig' libiconv-1.11.orig/include/iconv.h.in libiconv-1.11/include/iconv.h.in --- libiconv-1.11.orig/include/iconv.h.in 2006-05-15 14:21:46.000000000 -0700 +++ libiconv-1.11/include/iconv.h.in 2007-02-12 02:02:38.000000000 -0800 @@ -21,6 +21,13 @@ #ifndef _LIBICONV_H #define _LIBICONV_H +#include <sys/cdefs.h> +#include <_types.h> +#ifndef _SIZE_T +#define _SIZE_T +typedef __darwin_size_t size_t; +#endif + #define _LIBICONV_VERSION 0x010B /* version number: (major<<8) + minor */ extern @DLL_VARIABLE@ int _libiconv_version; /* Likewise */ @@ -42,21 +49,9 @@ from iconv_open().) */ /* Define iconv_t ourselves. */ -#undef iconv_t -#define iconv_t libiconv_t +#ifndef _ICONV_T +#define _ICONV_T typedef void* iconv_t; - -/* Get size_t declaration. - Get wchar_t declaration if it exists. */ -#include <stddef.h> - -/* Get errno declaration and values. */ -#include <errno.h> -/* Some systems, like SunOS 4, don't have EILSEQ. Some systems, like BSD/OS, - have EILSEQ in a different header. On these systems, define EILSEQ - ourselves. */ -#ifndef EILSEQ -#define EILSEQ @EILSEQ@ #endif @@ -67,35 +62,33 @@ /* Allocates descriptor for code conversion from encoding `fromcode' to encoding `tocode'. */ -#ifndef LIBICONV_PLUG -#define iconv_open libiconv_open -#endif -extern iconv_t iconv_open (const char* tocode, const char* fromcode); +iconv_t iconv_open (const char* /*tocode*/, const char* /*fromcode*/); /* Converts, using conversion descriptor `cd', at most `*inbytesleft' bytes starting at `*inbuf', writing at most `*outbytesleft' bytes starting at `*outbuf'. Decrements `*inbytesleft' and increments `*inbuf' by the same amount. Decrements `*outbytesleft' and increments `*outbuf' by the same amount. */ -#ifndef LIBICONV_PLUG -#define iconv libiconv -#endif -extern size_t iconv (iconv_t cd, @ICONV_CONST@ char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft); +size_t iconv (iconv_t /*cd*/, + char ** __restrict /*inbuf*/, size_t * __restrict /*inbytesleft*/, + char ** __restrict /*outbuf*/, size_t * __restrict /*outbytesleft*/); /* Frees resources allocated for conversion descriptor `cd'. */ -#ifndef LIBICONV_PLUG -#define iconv_close libiconv_close -#endif -extern int iconv_close (iconv_t cd); - +int iconv_close (iconv_t /*cd*/); -#ifndef LIBICONV_PLUG +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* Nonstandard extensions. */ +#ifndef __cplusplus +#ifndef _WCHAR_T +#define _WCHAR_T +typedef __darwin_wchar_t wchar_t; +#endif /* _WCHAR_T */ +#endif /* __cplusplus */ + /* Control of attributes. */ -#define iconvctl libiconvctl -extern int iconvctl (iconv_t cd, int request, void* argument); +int iconvctl (iconv_t /*cd*/, int /*request*/, void* /*argument*/); /* Hook performed after every successful conversion of a Unicode character. */ typedef void (*iconv_unicode_char_hook) (unsigned int uc, void* data); @@ -174,11 +167,10 @@ #define ICONV_SET_FALLBACKS 6 /* const struct iconv_fallbacks *argument */ /* Listing of locale independent encodings. */ -#define iconvlist libiconvlist -extern void iconvlist (int (*do_one) (unsigned int namescount, - const char * const * names, - void* data), - void* data); +void iconvlist (int (* /*do_one*/) (unsigned int /*namescount*/, + const char * const * /*names*/, + void* /*data*/), + void* /*data*/); /* Canonicalize an encoding name. The result is either a canonical encoding name, or name itself. */ @@ -191,10 +183,10 @@ by the corresponding pathname with the current prefix instead. Both prefixes should be directory names without trailing slash (i.e. use "" instead of "/"). */ -extern void libiconv_set_relocation_prefix (const char *orig_prefix, - const char *curr_prefix); +void libiconv_set_relocation_prefix (const char * /*orig_prefix*/, + const char * /*curr_prefix*/); -#endif +#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #ifdef __cplusplus diff -r -u -N --exclude='*.orig' libiconv-1.11.orig/lib/iconv.c libiconv-1.11/lib/iconv.c --- libiconv-1.11.orig/lib/iconv.c 2006-01-23 05:16:12.000000000 -0800 +++ libiconv-1.11/lib/iconv.c 2007-02-12 02:15:36.000000000 -0800 @@ -437,8 +437,8 @@ } size_t iconv (iconv_t icd, - ICONV_CONST char* * inbuf, size_t *inbytesleft, - char* * outbuf, size_t *outbytesleft) + char* * __restrict inbuf, size_t * __restrict inbytesleft, + char* * __restrict outbuf, size_t * __restrict outbytesleft) { conv_t cd = (conv_t) icd; if (inbuf == NULL || *inbuf == NULL) @@ -720,6 +720,44 @@ strong_alias (libiconv_open, iconv_open) strong_alias (libiconv, iconv) strong_alias (libiconv_close, iconv_close) +#elif defined __APPLE__ +#if defined(__ppc__) || defined(__i386__) +/* backward compatibility */ +iconv_t +libiconv_open(const char *tocode, const char *fromcode) +{ + return iconv_open(tocode, fromcode); +} + +size_t +libiconv(iconv_t cd, const char ** inbuf, + size_t * inbytesleft, char ** outbuf, + size_t * outbytesleft) +{ + return iconv(cd, (char **)inbuf, inbytesleft, outbuf, outbytesleft); +} + +int +libiconv_close(iconv_t cd) +{ + return iconv_close(cd); +} + +int +libiconvctl(iconv_t cd, int request, void* argument) +{ + return iconvctl(cd, request, argument); +} + +libiconvlist(int (*do_one) (unsigned int namescount, + const char * const * names, + void* data), + void* data) +{ + iconvlist(do_one, data); +} + +#endif /* __ppc__ || __i386__ */ #endif #endif