Skip Menu |

This queue is for tickets about the Prima CPAN distribution.

Report information
The Basics
Id: 103901
Status: resolved
Priority: 0/
Queue: Prima

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.43
Fixed in: (no value)



Subject: Passing argument 2 of 'iconv' from incompatible pointer type
I noticed a compiler warning: gcc -c -Iinclude -Iinclude/generic -I/usr/local/include -I/usr/include/freetype2 -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I /usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pa ngo-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libpng16 -I/usr/include/libpng16 -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -DVERSION=\"1.43\" -DXS_VERSION=\"1.43\" -fPIC "-I/usr/lib64/perl5/CORE" unix/xft.c -o unix/xft.o unix/xft.c: In function 'prima_xft_init': unix/xft.c:232:31: warning: passing argument 2 of 'iconv' from incompatible pointer type [-Wincompatible-pointer-types] int ret = iconv( ii, ( const char **) &iptr, &ibl, ( char **) &optr, &obl); ^ In file included from unix/xft.c:82:0: /usr/include/iconv.h:42:15: note: expected 'char ** restrict' but argument is of type 'const char **' extern size_t iconv (iconv_t __cd, char **__restrict __inbuf, ^ Indeed POSIX declares the type without const (char **restrict).
Hi, Thanks for the report! However there seems to be not a single opinion in the unix distro world what that type should be. For example, FreeBSD 10 has this: size_t iconv(iconv_t, const char ** __restrict, size_t * __restrict, char ** __restrict, size_t * __restrict); and Debian wheezy this: extern size_t iconv (iconv_t __cd, char **__restrict __inbuf, size_t *__restrict __inbytesleft, char **__restrict __outbuf, size_t *__restrict __outbytesleft); so I don't have a good solution for this problem. Thanks! Dmitry
From: ppisar [...] redhat.com
Dne Čt 23.dub.2015 04:32:12, KARASIK napsal(a): Show quoted text
> Thanks for the report! However there seems to be not a single opinion > in the unix distro world what that type should be. For example, > FreeBSD 10 has this: > > size_t iconv(iconv_t, const char ** __restrict, > size_t * __restrict, char ** __restrict, > size_t * __restrict); >
FreeBSD recognized this was a bug <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=199099> and fixed it in developmental tree. Show quoted text
> and Debian wheezy this: > > extern size_t iconv (iconv_t __cd, char **__restrict __inbuf, > size_t *__restrict __inbytesleft, > char **__restrict __outbuf, > size_t *__restrict __outbytesleft); >
This is the POSIX-compliant prototype from glibc. Any distribution with glibc has this one. Show quoted text
> so I don't have a good solution for this problem. >
I propose to change the Prima to conform to the POSIX. Let suffer those who willingly diverge. -- Petr
Ah, all right, this changes matters of course! In my eyes iconv is still a 3rd party library, and that it is included now in POSIX is a bit of a surprise :) Thank you very much, I've committed the change! Sincerely, Dmitry https://github.com/dk/Prima/commit/fa92035a29fd3c2f8764857e4d5bb352e8ac235f