diff --git a/src/compiler.h b/src/compiler.h index d7ebbde98..90f7d2390 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -24,10 +24,47 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - June 14, 2002 - February 17, 2006 + June 14, 2002 - February 18, 2006 $Id$ */ +#ifdef WIN32 +/* + The SDL stderr redirection trick doesn't seem to work for perror(). + This does pretty much the same thing. +*/ +static void win32_perror(const char * const str) +{ + if ( str && *str ) + fprintf(stderr,"%s : ",str); + fprintf(stderr, + "%s [%d]\n", + (errno<_sys_nerr)?_sys_errlist[errno]:"unknown",errno ); +} +#define perror win32_perror + +/* + MinGW implementation of isspace() crashes on some Win98 boxes + if c is 'out-of-range'. +*/ + +static int win32_isspace(int c) +{ + return (c == 0x20) || (c >= 0x09 && c <= 0x0D); +} +#define isspace win32_isspace + +/* + WIN32 and MINGW don't have strcasestr(). +*/ +#define NOMINMAX +#include "Shlwapi.h" +#define strcasestr StrStrI +#endif /* WIN32 */ + + + + #ifdef __GNUC__ // This version has strict type checking for safety. // See the "unnecessary" pointer comparison. (from Linux) @@ -118,4 +155,3 @@ #define CLOCK_ASM(x) x=42 #endif - diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 534bae48c..50980f442 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -358,40 +358,6 @@ static int font_socket_fd; #include "malloc.c" #endif -#ifdef WIN32 -/* - The SDL stderr redirection trick doesn't seem to work for perror(). - This does pretty much the same thing. -*/ -static void win32_perror(const char * const str) -{ - if ( str && *str ) - fprintf(stderr,"%s : ",str); - fprintf(stderr, - "%s [%d]\n", - (errno<_sys_nerr)?_sys_errlist[errno]:"unknown",errno ); -} -#define perror win32_perror - -/* - MinGW implementation of isspace() crashes on some Win98 boxes - if c is 'out-of-range'. -*/ - -static int win32_isspace(int c) -{ - return (c == 0x20) || (c >= 0x09 && c <= 0x0D); -} -#define isspace win32_isspace - -/* - WIN32 and MINGW don't have strcasestr(). -*/ -#define NOMINMAX -#include "Shlwapi.h" -#define strcasestr StrStrI -#endif /* WIN32 */ - #include "compiler.h"