r37360 - in trunk: configure gui/win32/skinload.c
Author: ib Date: Fri Jan 16 22:38:35 2015 New Revision: 37360 Log: Replace stricmp by strcasecmp. This is preferable to the approach in r37357. (We have to define strcasecmp for Wine because there is only a prototype for it with the msvcrt C library, but we are using the native glibc one.) Modified: trunk/configure trunk/gui/win32/skinload.c Modified: trunk/configure ============================================================================== --- trunk/configure Fri Jan 16 22:30:02 2015 (r37359) +++ trunk/configure Fri Jan 16 22:38:35 2015 (r37360) @@ -1821,7 +1821,7 @@ if os2 ; then fi if wine ; then - extra_cflags="-fno-pic -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -DWINE_NOWINSOCK -Dstricmp=lstrcmpiA $extra_cflags" + extra_cflags="-fno-pic -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -DWINE_NOWINSOCK -Dstrcasecmp=lstrcmpiA $extra_cflags" fi if darwin && test "$cc_vendor" != "clang" ; then Modified: trunk/gui/win32/skinload.c ============================================================================== --- trunk/gui/win32/skinload.c Fri Jan 16 22:30:02 2015 (r37359) +++ trunk/gui/win32/skinload.c Fri Jan 16 22:38:35 2015 (r37360) @@ -39,12 +39,6 @@ #include "gui/util/mem.h" #include "gui/util/bitmap.h" -#ifndef stricmp -#ifdef __CYGWIN__ -#define stricmp strcasecmp -#endif -#endif - #define MAX_LINESIZE 256 typedef struct @@ -152,7 +146,7 @@ static image *pngRead(skin_t *skin, cons char *filename = NULL; FILE *fp; - if(!stricmp(fname, "NULL")) return 0; + if(!strcasecmp(fname, "NULL")) return 0; /* find filename in order file file.png */ if(!(fp = fopen(fname, "rb")))
On Fri, Jan 16, 2015 at 10:38:35PM +0100, ib wrote:
(We have to define strcasecmp for Wine because there is only a prototype for it with the msvcrt C library, but we are using the native glibc one.)
Modified: trunk/configure trunk/gui/win32/skinload.c
Modified: trunk/configure ============================================================================== --- trunk/configure Fri Jan 16 22:30:02 2015 (r37359) +++ trunk/configure Fri Jan 16 22:38:35 2015 (r37360) @@ -1821,7 +1821,7 @@ if os2 ; then fi
if wine ; then - extra_cflags="-fno-pic -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -DWINE_NOWINSOCK -Dstricmp=lstrcmpiA $extra_cflags" + extra_cflags="-fno-pic -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -DWINE_NOWINSOCK -Dstrcasecmp=lstrcmpiA $extra_cflags"
Something doesn't add up. strcasecmp is used all over the place, for example in m_option.c and it seems to have worked fine for the WINE build without extra defines. What is different about the GUI code that makes it not work there?
Reimar Döffinger wrote on Sun, 18 Jan 2015 19:05:00 +0100:
On Fri, Jan 16, 2015 at 10:38:35PM +0100, ib wrote:
(We have to define strcasecmp for Wine because there is only a prototype for it with the msvcrt C library, but we are using the native glibc one.)
Modified: trunk/configure trunk/gui/win32/skinload.c
Modified: trunk/configure ========================================================================= ===== --- trunk/configure Fri Jan 16 22:30:02 2015 (r37359) +++ trunk/configure Fri Jan 16 22:38:35 2015 (r37360) @@ -1821,7 +1821,7 @@ if os2 ; then fi
if wine ; then - extra_cflags="-fno-pic -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -DWINE_NOWINSOCK -Dstricmp=lstrcmpiA $extra_cflags" + extra_cflags="-fno-pic -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -DWINE_NOWINSOCK -Dstrcasecmp=lstrcmpiA $extra_cflags"
Something doesn't add up. strcasecmp is used all over the place, for example in m_option.c and it seems to have worked fine for the WINE build without extra defines.
It works, but only with a "no prototype" warning. (I gave the explanation in the commit message.)
What is different about the GUI code that makes it not work there?
It's not about the GUI but Wine and just about compiling without warnings (and without an #ifdef for Wine). Ingo
On Sun, Jan 18, 2015 at 07:22:01PM +0100, Ingo Brückl wrote:
Reimar Döffinger wrote on Sun, 18 Jan 2015 19:05:00 +0100:
On Fri, Jan 16, 2015 at 10:38:35PM +0100, ib wrote:
(We have to define strcasecmp for Wine because there is only a prototype for it with the msvcrt C library, but we are using the native glibc one.)
Modified: trunk/configure trunk/gui/win32/skinload.c
Modified: trunk/configure ========================================================================= ===== --- trunk/configure Fri Jan 16 22:30:02 2015 (r37359) +++ trunk/configure Fri Jan 16 22:38:35 2015 (r37360) @@ -1821,7 +1821,7 @@ if os2 ; then fi
if wine ; then - extra_cflags="-fno-pic -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -DWINE_NOWINSOCK -Dstricmp=lstrcmpiA $extra_cflags" + extra_cflags="-fno-pic -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -DWINE_NOWINSOCK -Dstrcasecmp=lstrcmpiA $extra_cflags"
Something doesn't add up. strcasecmp is used all over the place, for example in m_option.c and it seems to have worked fine for the WINE build without extra defines.
It works, but only with a "no prototype" warning. (I gave the explanation in the commit message.)
What is different about the GUI code that makes it not work there?
It's not about the GUI but Wine and just about compiling without warnings (and without an #ifdef for Wine).
And the others all give warnings? Because I think the missing prototype is an error for all files, not just GUI... Because to me it looks like the issue really is a missing #include <strings.h> (note "strings.h", not "string.h")
Reimar Döffinger wrote on Sun, 18 Jan 2015 19:45:21 +0100:
On Sun, Jan 18, 2015 at 07:22:01PM +0100, Ingo Brückl wrote:
if wine ; then - extra_cflags="-fno-pic -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -DWINE_NOWINSOCK -Dstricmp=lstrcmpiA $extra_cflags" + extra_cflags="-fno-pic -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -DWINE_NOWINSOCK -Dstrcasecmp=lstrcmpiA $extra_cflags"
Something doesn't add up. strcasecmp is used all over the place, for example in m_option.c and it seems to have worked fine for the WINE build without extra defines.
It works, but only with a "no prototype" warning. (I gave the explanation in the commit message.)
What is different about the GUI code that makes it not work there?
It's not about the GUI but Wine and just about compiling without warnings (and without an #ifdef for Wine).
And the others all give warnings?
I don't care about warnings in the non-GUI code. Since we don't have a possibility to compile silently, warnings aren't easily spotted, so I don't even try in the first place. The GUI code, however, shall compile without warnings and I'm keeping an eye on that.
Because I think the missing prototype is an error for all files, not just GUI...
Very likely.
Because to me it looks like the issue really is a missing #include <strings.h> (note "strings.h", not "string.h")
You're right, string.h is Windows. Ingo
On Sun, Jan 18, 2015 at 08:26:38PM +0100, Ingo Brückl wrote:
Because to me it looks like the issue really is a missing #include <strings.h> (note "strings.h", not "string.h")
You're right, string.h is Windows.
Not really, string.h is for memset, memcpy, strlen etc. strings.h on the other hand is only a few ones like bzero, index, rindex and strcasecmp. Not sure there is much sense in a header for essentially 4 functions, but that's how it is...
Reimar Döffinger wrote on Sun, 18 Jan 2015 23:37:47 +0100:
On Sun, Jan 18, 2015 at 08:26:38PM +0100, Ingo Brückl wrote:
Because to me it looks like the issue really is a missing #include <strings.h> (note "strings.h", not "string.h")
You're right, string.h is Windows.
Not really, string.h is for memset, memcpy, strlen etc.
string.h is Windows for the case independent string comparison function is what I meant to say. Ingo
participants (3)
-
ib -
Ingo Brückl -
Reimar Döffinger