Ramsay Jones  committed fd547a9

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 <>
Signed-off-by: Junio C Hamano <>

  • Participants
  • Parent commits 2832114
  • Branches master

Comments (0)

Files changed (2)

 # Define NO_ICONV if your libc does not properly support iconv.
+# Define OLD_ICONV if your library has an old iconv(), where the second
+# (input buffer pointer) parameter is declared with type (const char **).
 # Define NO_R_TO_GCC if your gcc does not like "-R/path/lib" that
 # tells runtime paths to dynamic libraries; "-Wl,-rpath=/path/lib"
 # is used instead.
+ifdef OLD_ICONV
 ifdef PPC_SHA1
 	SHA1_HEADER = "ppc/sha1.h"
 	LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
  * with iconv.  If the conversion fails, returns NULL.
 #ifndef NO_ICONV
+#ifdef OLD_ICONV
+	typedef const char * iconv_ibp;
+	typedef char * iconv_ibp;
 char *reencode_string(const char *in, const char *out_encoding, const char *in_encoding)
 	iconv_t conv;
 	size_t insz, outsz, outalloc;
-	char *out, *outpos, *cp;
+	char *out, *outpos;
+	iconv_ibp cp;
 	if (!in_encoding)
 		return NULL;
 	outalloc = outsz + 1; /* for terminating NUL */
 	out = xmalloc(outalloc);
 	outpos = out;
-	cp = (char *)in;
+	cp = (iconv_ibp)in;
 	while (1) {
 		size_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz);