@matheusbsbs / matheus-bagliano / commits / fd547a972a
Fork 0

Fix a "pointer type missmatch" warning.

In particular, the second parameter in the call to iconv() will cause this warning if your library declares iconv() with the second (input buffer pointer) parameter of type const char **. This is the old prototype, which is none-the-less used by the current version of newlib on Cygwin. (It appears in old versions of glibc too). Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <junkio@cox.net>

Ramsay Jones committed Mar 3, 2007 at 18:29 UTC fd547a972ad1ad714e1dac0a9ffc7637a64dd9b2
2 files changed +15 -2
Makefile
+7
@@ -89,6 +89,9 @@ all::
89 #
90 # Define NO_ICONV if your libc does not properly support iconv.
91 #
92 +# Define OLD_ICONV if your library has an old iconv(), where the second
93 +# (input buffer pointer) parameter is declared with type (const char **).
94 +#
95 # Define NO_R_TO_GCC if your gcc does not like "-R/path/lib" that
96 # tells runtime paths to dynamic libraries; "-Wl,-rpath=/path/lib"
97 # is used instead.
@@ -573,6 +576,10 @@ ifdef NO_ICONV
576 BASIC_CFLAGS += -DNO_ICONV
577 endif
578
579 +ifdef OLD_ICONV
580 + BASIC_CFLAGS += -DOLD_ICONV
581 +endif
582 +
583 ifdef PPC_SHA1
584 SHA1_HEADER = "ppc/sha1.h"
585 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
utf8.c
+8 -2
@@ -293,11 +293,17 @@ int is_encoding_utf8(const char *name)
293 * with iconv. If the conversion fails, returns NULL.
294 */
295 #ifndef NO_ICONV
296 +#ifdef OLD_ICONV
297 + typedef const char * iconv_ibp;
298 +#else
299 + typedef char * iconv_ibp;
300 +#endif
301 char *reencode_string(const char *in, const char *out_encoding, const char *in_encoding)
302 {
303 iconv_t conv;
304 size_t insz, outsz, outalloc;
300 - char *out, *outpos, *cp;
305 + char *out, *outpos;
306 + iconv_ibp cp;
307
308 if (!in_encoding)
309 return NULL;
@@ -309,7 +315,7 @@ char *reencode_string(const char *in, const char *out_encoding, const char *in_e
315 outalloc = outsz + 1; /* for terminating NUL */
316 out = xmalloc(outalloc);
317 outpos = out;
312 - cp = (char *)in;
318 + cp = (iconv_ibp)in;
319
320 while (1) {
321 size_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz);