GNOME Bugzilla – Bug 163133
[CYGWIN] Win32-specific compile warning fix
Last modified: 2005-01-09 22:56:29 UTC
glib/gwin32.c compiles with warnings due to a typecasting bug and a missing header. The attached patch corrects this. Note: I'm not a Win32 programmer, and I can't confirm correctness of this patch, other than conformance to the function prototype.
Created attachment 35555 [details] [review] Patch to correct compiler warning and missing header
Is wchar.h really needed? At least in my mingw installation string.h has a prototype for wcslen(), if that's what you think is missing, and just fixing the cast gives a warning-free compile. (Re-open bug if it is needed for you.) The cast is now fixed.
wcslen is prototyped in <wchar.h>, not <string.h>. That's according to the C99 Standard, Single UNIX Spec. v3, and the Linux manpage. On Cygwin, <wchar.h> is required to prototype wcslen, so IMO MinGW is buggy here. This is taken from the ISO C99 draft I have: #include <wchar.h> size_t wcslen(const wchar_t *s); Regards, Roger
Hmm, yes, mingw follows MSVC in having wcslen in string.h. And gwin32.c is built also for Cygwin, didn't think of that. Added the wchar.h.