path: root/utf8.c
diff options
authorRamsay Jones <>2007-03-03 18:29:03 (GMT)
committerJunio C Hamano <>2007-03-04 02:55:17 (GMT)
commitfd547a972ad1ad714e1dac0a9ffc7637a64dd9b2 (patch)
tree99a2ecf4b486a000fbb25d4ebdf9335cb0be1563 /utf8.c
parent2832114532d92bdd533f84fa520050c5de95c012 (diff)
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 <>
Diffstat (limited to 'utf8.c')
1 files changed, 8 insertions, 2 deletions
diff --git a/utf8.c b/utf8.c
index 211e100..f381a7f 100644
--- a/utf8.c
+++ b/utf8.c
@@ -293,11 +293,17 @@ int is_encoding_utf8(const char *name)
* 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;
@@ -309,7 +315,7 @@ char *reencode_string(const char *in, const char *out_encoding, const char *in_e
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);