summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-04-13 13:37:28 (GMT)
committernijtmans <nijtmans>2010-04-13 13:37:28 (GMT)
commitc06c61b28e8878da81a9b56f34c5570f3f3f747a (patch)
tree76f71209be2c8e9b03c7e2c8ae1cfc7612b3ad78
parentf10d81b895d8ca9d30428aac9884685fb284986a (diff)
downloadtcl-c06c61b28e8878da81a9b56f34c5570f3f3f747a.zip
tcl-c06c61b28e8878da81a9b56f34c5570f3f3f747a.tar.gz
tcl-c06c61b28e8878da81a9b56f34c5570f3f3f747a.tar.bz2
Fix [Patch 2986105]: conditionally defining strcasecmp/strncasecmp
Fix gcc warning: comparison of unsigned expression >= 0 is always true
-rw-r--r--ChangeLog7
-rw-r--r--win/tclWinFile.c8
-rw-r--r--win/tclWinLoad.c17
-rw-r--r--win/tclWinPort.h54
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 <nijtmans@users.sf.net>
+
+ * 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 <dkf@users.sf.net>
* 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 <unistd.h>
-# include <wchar.h>
-#else
-# include <io.h>
-#endif
-#include <stdio.h>
+#include <wchar.h>
+#include <io.h>
#include <stdlib.h>
+#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <float.h>
@@ -58,14 +54,18 @@
#include <signal.h>
#include <string.h>
-/*
- * 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 <unistd.h>
+# 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__ */