Code

Fix a "pointer type missmatch" warning.
[git.git] / utf8.c
diff --git a/utf8.c b/utf8.c
index 211e100b95fa7f4f943965dac3e74339869a9b03..f381a7f137319f636955f2e4b21b8926a442c35e 100644 (file)
--- 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;
+#else
+       typedef char * iconv_ibp;
+#endif
 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);