{"thread":{"id":"7068","subject":"[PATCH 6/6] Fix a \"pointer type missmatch\" warning.","startedAt":"2007-03-03T18:29:03Z","lastAt":"2007-03-04T16:30:27Z","messageCount":3,"participants":["Ramsay Jones","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"36191","messageId":"45E9BE6F.9090400@ramsay1.demon.co.uk","threadId":"7068","inReplyTo":null,"subject":"[PATCH 6/6] Fix a \"pointer type missmatch\" warning.","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2007-03-03T18:29:03Z","receivedAt":"2007-03-03T18:29:03Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nIn particular, the second parameter in the call to iconv() will\ncause this warning if your library declares iconv() with the\nsecond (input buffer pointer) parameter of type const char **.\nThis is the old prototype, which is none-the-less used by the\ncurrent version of newlib on Cygwin. (It appears in old versions\nof glibc too).\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n\nNote: set OLD_ICONV in your config.mak file on Cygwin.\n\n  Makefile |    7 +++++++\n  utf8.c   |   10 ++++++++--\n  2 files changed, 15 insertions(+), 2 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 8390a94..d447c43 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -85,6 +85,9 @@ all::\n  #\n  # Define NO_ICONV if your libc does not properly support iconv.\n  #\n+# Define OLD_ICONV if your library has an old iconv(), where the second\n+# (input buffer pointer) parameter is declared with type (const char **).\n+#\n  # Define NO_R_TO_GCC if your gcc does not like \"-R/path/lib\" that\n  # tells runtime paths to dynamic libraries; \"-Wl,-rpath=/path/lib\"\n  # is used instead.\n@@ -560,6 +563,10 @@ ifdef NO_ICONV\n  \tBASIC_CFLAGS += -DNO_ICONV\n  endif\n\n+ifdef OLD_ICONV\n+\tBASIC_CFLAGS += -DOLD_ICONV\n+endif\n+\n  ifdef PPC_SHA1\n  \tSHA1_HEADER = \"ppc/sha1.h\"\n  \tLIB_OBJS += ppc/sha1.o ppc/sha1ppc.o\ndiff --git a/utf8.c b/utf8.c\nindex 211e100..f381a7f 100644\n--- a/utf8.c\n+++ b/utf8.c\n@@ -293,11 +293,17 @@ int is_encoding_utf8(const char *name)\n   * with iconv.  If the conversion fails, returns NULL.\n   */\n  #ifndef NO_ICONV\n+#ifdef OLD_ICONV\n+\ttypedef const char * iconv_ibp;\n+#else\n+\ttypedef char * iconv_ibp;\n+#endif\n  char *reencode_string(const char *in, const char *out_encoding, const char *in_encoding)\n  {\n  \ticonv_t conv;\n  \tsize_t insz, outsz, outalloc;\n-\tchar *out, *outpos, *cp;\n+\tchar *out, *outpos;\n+\ticonv_ibp cp;\n\n  \tif (!in_encoding)\n  \t\treturn NULL;\n@@ -309,7 +315,7 @@ char *reencode_string(const char *in, const char *out_encoding, const char *in_e\n  \toutalloc = outsz + 1; /* for terminating NUL */\n  \tout = xmalloc(outalloc);\n  \toutpos = out;\n-\tcp = (char *)in;\n+\tcp = (iconv_ibp)in;\n\n  \twhile (1) {\n  \t\tsize_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz);\n-- \n1.5.0\n"},{"id":"36194","messageId":"Pine.LNX.4.63.0703031941240.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"7068","inReplyTo":"45E9BE6F.9090400@ramsay1.demon.co.uk","subject":"Re: [PATCH 6/6] Fix a \"pointer type missmatch\" warning.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-03-03T18:41:44Z","receivedAt":"2007-03-03T18:41:44Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 3 Mar 2007, Ramsay Jones wrote:\n\n> Note: set OLD_ICONV in your config.mak file on Cygwin.\n\nShouldn't you set it in Makefile instead?\n\nCiao,\nDscho\n"},{"id":"36243","messageId":"45EAF423.8060609@ramsay1.demon.co.uk","threadId":"7068","inReplyTo":"Pine.LNX.4.63.0703031941240.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH 6/6] Fix a \"pointer type missmatch\" warning.","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2007-03-04T16:30:27Z","receivedAt":"2007-03-04T16:30:27Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Hi Johannes,\n\nJohannes Schindelin wrote:\n> On Sat, 3 Mar 2007, Ramsay Jones wrote:\n> \n>> Note: set OLD_ICONV in your config.mak file on Cygwin.\n> \n> Shouldn't you set it in Makefile instead?\n> \n\nYes, well the first version of that patch did exactly that!\n(which caused me to use \"git commit --amend\" for the first time.)\n\nHowever, I changed my mind, in order to be consistent with\nthe NO_C99_FORMAT patch (2/6); I am assuming that at some point\nnewlib will update iconv() to the new prototype, and I would\nhave to remove OLD_ICONV from the Makefile again.\n\nTo be clear, the setting of both NO_C99_FORMAT and OLD_ICONV in\nthe config.mak file is determined by the capabilities (version)\nof your compiler/library. (And is not just a Cygwin issue)\n\nHaving said that, I don't really mind if it is added to the Makefile.\n\nAll the best,\n\nRamsay Jones\n"}]}