From: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
To: Junio C Hamano <junkio@cox.net>
Cc: GIT Mailing-list <git@vger.kernel.org>
Subject: [PATCH 6/6] Fix a "pointer type missmatch" warning.
Date: Sat, 03 Mar 2007 18:29:03 +0000 [thread overview]
Message-ID: <45E9BE6F.9090400@ramsay1.demon.co.uk> (raw)
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>
---
Note: set OLD_ICONV in your config.mak file on Cygwin.
Makefile | 7 +++++++
utf8.c | 10 ++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 8390a94..d447c43 100644
--- a/Makefile
+++ b/Makefile
@@ -85,6 +85,9 @@ all::
#
# 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.
@@ -560,6 +563,10 @@ ifdef NO_ICONV
BASIC_CFLAGS += -DNO_ICONV
endif
+ifdef OLD_ICONV
+ BASIC_CFLAGS += -DOLD_ICONV
+endif
+
ifdef PPC_SHA1
SHA1_HEADER = "ppc/sha1.h"
LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
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;
+#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);
--
1.5.0
next reply other threads:[~2007-03-03 18:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-03 18:29 Ramsay Jones [this message]
2007-03-03 18:41 ` [PATCH 6/6] Fix a "pointer type missmatch" warning Johannes Schindelin
2007-03-04 16:30 ` Ramsay Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45E9BE6F.9090400@ramsay1.demon.co.uk \
--to=ramsay@ramsay1.demon.co.uk \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.