From c06c61b28e8878da81a9b56f34c5570f3f3f747a Mon Sep 17 00:00:00 2001 From: nijtmans Date: Tue, 13 Apr 2010 13:37:28 +0000 Subject: Fix [Patch 2986105]: conditionally defining strcasecmp/strncasecmp Fix gcc warning: comparison of unsigned expression >= 0 is always true --- ChangeLog | 7 +++++++ win/tclWinFile.c | 8 ++++---- win/tclWinLoad.c | 17 ++++++++--------- win/tclWinPort.h | 54 +++++++++++++++++++++++++++--------------------------- 4 files changed, 46 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index a232ac5..b73c2e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-04-13 Jan Nijtmans + + * win/tclWinPort.h Fix [Patch 2986105]: conditionally defining + * win/tclWinFile.c strcasecmp/strncasecmp + * win/tclWinLoad.c Fix gcc warning: comparison of unsigned expression + >= 0 is always true + 2010-04-08 Donal K. Fellows * generic/tclCompCmdsSZ.c (TclSubstCompile): If the first token does diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 2785912..b18aa1c 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFile.c,v 1.105 2010/03/07 14:39:25 nijtmans Exp $ + * RCS: @(#) $Id: tclWinFile.c,v 1.106 2010/04/13 13:37:29 nijtmans Exp $ */ /* #define _WIN32_WINNT 0x0500 */ @@ -1787,9 +1787,9 @@ NativeIsExec( * Use wide-char case-insensitive comparison */ - if ((wcscasecmp(path+len-3, L"exe") == 0) - || (wcscasecmp(path+len-3, L"com") == 0) - || (wcscasecmp(path+len-3, L"bat") == 0)) { + if ((_wcsicmp(path+len-3, L"exe") == 0) + || (_wcsicmp(path+len-3, L"com") == 0) + || (_wcsicmp(path+len-3, L"bat") == 0)) { return 1; } } else { diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c index 606171d..f1eb1e0 100644 --- a/win/tclWinLoad.c +++ b/win/tclWinLoad.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinLoad.c,v 1.27 2010/04/02 21:21:06 kennykb Exp $ + * RCS: @(#) $Id: tclWinLoad.c,v 1.28 2010/04/13 13:37:29 nijtmans Exp $ */ #include "tclWinInt.h" @@ -305,14 +305,13 @@ TclpTempFileNameForLibrary(Tcl_Interp* interp, /* Tcl interpreter */ if (dllDirectoryName == NULL) { Tcl_MutexLock(&loadMutex); if (dllDirectoryName == NULL) { - if ((nameLen = GetTempPathW(MAX_PATH, name)) >= 0) { - if (nameLen >= MAX_PATH-12) { - Tcl_SetErrno(ENAMETOOLONG); - nameLen = 0; - } else { - wcscpy(name+nameLen, L"TCLXXXXXXXX"); - nameLen += 11; - } + nameLen = GetTempPathW(MAX_PATH, name); + if (nameLen >= MAX_PATH-12) { + Tcl_SetErrno(ENAMETOOLONG); + nameLen = 0; + } else { + wcscpy(name+nameLen, L"TCLXXXXXXXX"); + nameLen += 11; } status = 1; if (nameLen != 0) { diff --git a/win/tclWinPort.h b/win/tclWinPort.h index df76d46..b5edc6e 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinPort.h,v 1.54 2010/01/22 13:02:50 nijtmans Exp $ + * RCS: @(#) $Id: tclWinPort.h,v 1.55 2010/04/13 13:37:28 nijtmans Exp $ */ #ifndef _TCLWINPORT @@ -42,14 +42,10 @@ *--------------------------------------------------------------------------- */ -#ifdef __CYGWIN__ -# include -# include -#else -# include -#endif -#include +#include +#include #include +#include #include #include #include @@ -58,14 +54,18 @@ #include #include -/* - * These string functions are not defined with the same names on Windows. - */ - -#ifndef __CYGWIN__ -#define wcscasecmp _wcsicmp -#define strcasecmp stricmp -#define strncasecmp strnicmp +#ifdef __CYGWIN__ +# include +# ifndef _wcsicmp +# define _wcsicmp wcscasecmp +# endif +#else +# ifndef strncasecmp +# define strncasecmp strnicmp +# endif +# ifndef strcasecmp +# define strcasecmp stricmp +# endif #endif /* @@ -305,7 +305,7 @@ */ #ifndef S_IFLNK -#define S_IFLNK 0120000 /* Symbolic Link */ +# define S_IFLNK 0120000 /* Symbolic Link */ #endif #ifndef S_ISREG @@ -357,11 +357,11 @@ */ #ifndef MAXPATH -#define MAXPATH MAX_PATH +# define MAXPATH MAX_PATH #endif /* MAXPATH */ #ifndef MAXPATHLEN -#define MAXPATHLEN MAXPATH +# define MAXPATHLEN MAXPATH #endif /* MAXPATHLEN */ /* @@ -382,13 +382,13 @@ */ #if defined(_MSC_VER) || defined(__MINGW32__) -# define environ _environ -# define hypot _hypot -# define exception _exception -# undef EDEADLOCK -# if defined(__MINGW32__) && !defined(__MSVCRT__) +# define environ _environ +# define hypot _hypot +# define exception _exception +# undef EDEADLOCK +# if defined(__MINGW32__) && !defined(__MSVCRT__) # define timezone _timezone -# endif +# endif #endif /* _MSC_VER || __MINGW32__ */ /* @@ -402,8 +402,8 @@ #ifdef __CYGWIN__ /* On Cygwin, the environment is imported from the Cygwin DLL. */ -# define putenv TclCygwinPutenv -# define timezone _timezone +# define putenv TclCygwinPutenv +# define timezone _timezone #endif /* __CYGWIN__ */ -- cgit v0.12