xwininfo: const in iconv

Thomas Klausner wiz at NetBSD.org
Thu Aug 23 07:52:23 PDT 2012


When compiling xwininfo on NetBSD, I get:
xwininfo.c:1912:6: warning: passing argument 2 of 'iconv' from incompatible pointer type
/usr/include/iconv.h:46:8: note: expected 'const char ** restrict' but argument is of type 'char **'

In NetBSD's xsrc we use the attached patch to fix this.

I think that the argument is const on NetBSD and Solaris and not-const
on Linux (and perhaps other systems).

Suggestions how to fix this, or is it just not worth the effort?
 Thomas
-------------- next part --------------
Index: xwininfo/dist/xwininfo.c
===================================================================
RCS file: /cvsroot/xsrc/external/mit/xwininfo/dist/xwininfo.c,v
retrieving revision 1.1.1.5
retrieving revision 1.3
diff -u -r1.1.1.5 -r1.3
--- xwininfo/dist/xwininfo.c	23 Jul 2011 05:56:36 -0000	1.1.1.5
+++ xwininfo/dist/xwininfo.c	23 Jul 2011 06:02:16 -0000	1.3
@@ -1909,7 +1909,7 @@
 	    char *outp = convbuf;
 	    size_t outlen = sizeof(convbuf);
 
-	    convres = iconv (iconv_from_utf8, &inp, &inlen, &outp, &outlen);
+	    convres = iconv (iconv_from_utf8, (const char **)&inp, &inlen, &outp, &outlen);
 
 	    if ((convres == -1) && (errno == E2BIG)) {
 		done = False;


More information about the xorg-devel mailing list