diff options
author | mdejong <mdejong> | 2002-03-08 01:45:51 (GMT) |
---|---|---|
committer | mdejong <mdejong> | 2002-03-08 01:45:51 (GMT) |
commit | 12d2dcaa42dce1168e5487ead798a7486e0c4f8a (patch) | |
tree | b1bc8f3cb80b121d126f7bf0f4cb96a6bc14e98d | |
parent | 55889909abdf66ad1c7b86b10244d9dd09cc46e2 (diff) | |
download | tcl-12d2dcaa42dce1168e5487ead798a7486e0c4f8a.zip tcl-12d2dcaa42dce1168e5487ead798a7486e0c4f8a.tar.gz tcl-12d2dcaa42dce1168e5487ead798a7486e0c4f8a.tar.bz2 |
* win/tclWin32Dll.c (TclpCheckStackSpace):
* win/tclWinFCmd.c (DoRenameFile, DoCopyFile): Replace
hard coded constants with Win32 symbolic names.
Move control flow statements out of __try blocks
since the documentation indicates it is frowned upon.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | win/tclWin32Dll.c | 13 | ||||
-rw-r--r-- | win/tclWinFCmd.c | 33 |
3 files changed, 42 insertions, 14 deletions
@@ -1,3 +1,11 @@ +2002-03-07 Mo DeJong <mdejong@users.sourceforge.net> + + * win/tclWin32Dll.c (TclpCheckStackSpace): + * win/tclWinFCmd.c (DoRenameFile, DoCopyFile): Replace + hard coded constants with Win32 symbolic names. + Move control flow statements out of __try blocks + since the documentation indicates it is frowned upon. + 2002-03-07 Don Porter <dgp@users.sourceforge.net> * doc/interp.n: @@ -235,7 +243,7 @@ sign symbols '+' and '-' and '0X' and raise overflow errors. [Bug 440916] Also corrects prototype and errno problems. -2002-02-23 Mo DeJong <supermo@bayarea.net> +2002-02-23 Mo DeJong <mdejong@users.sourceforge.net> * configure: Regen. * unix/tcl.m4 (SC_CONFIG_CFLAGS): Link with -n32 diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index 6ab2545..dde720e 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWin32Dll.c,v 1.13 2002/02/08 02:52:54 dgp Exp $ + * RCS: @(#) $Id: tclWin32Dll.c,v 1.14 2002/03/08 01:45:52 mdejong Exp $ */ #include "tclWinInt.h" @@ -340,6 +340,8 @@ TclWinNoBackslash( int TclpCheckStackSpace() { + int retval = 0; + /* * We can recurse only if there is at least TCL_WIN_STACK_THRESHOLD * bytes of stack space left. alloca() is cheap on windows; basically @@ -349,10 +351,13 @@ TclpCheckStackSpace() __try { alloca(TCL_WIN_STACK_THRESHOLD); - return 1; - } __except (1) {} + retval = 1; + } __except (EXCEPTION_EXECUTE_HANDLER) {} - return 0; + /* + * Avoid using control flow statements in the SEH guarded block! + */ + return retval; } diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index 725f4cf..0859269 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFCmd.c,v 1.22 2002/02/08 02:52:55 dgp Exp $ + * RCS: @(#) $Id: tclWinFCmd.c,v 1.23 2002/03/08 01:45:52 mdejong Exp $ */ #include "tclWinInt.h" @@ -164,17 +164,24 @@ DoRenameFile( * (native). */ { DWORD srcAttr, dstAttr; + int retval = -1; /* - * Would throw an exception under NT if one of the arguments is a - * char block device. + * The moveFileProc below would throw an exception under NT + * if one of the arguments is a char block device. */ __try { if ((*tclWinProcs->moveFileProc)(nativeSrc, nativeDst) != FALSE) { - return TCL_OK; + retval = TCL_OK; } - } __except (-1) {} + } __except (EXCEPTION_CONTINUE_EXECUTION) {} + + /* + * Avoid using control flow statements in the SEH guarded block! + */ + if (retval != -1) + return retval; TclWinConvertError(GetLastError()); @@ -432,9 +439,11 @@ DoCopyFile( CONST TCHAR *nativeSrc, /* Pathname of file to be copied (native). */ CONST TCHAR *nativeDst) /* Pathname of file to copy to (native). */ { + int retval = -1; + /* - * Would throw an exception under NT if one of the arguments is a char - * block device. + * The copyFileProc below would throw an exception under NT if one + * of the arguments is a char block device. */ /* @@ -463,9 +472,15 @@ DoCopyFile( __try { if ((*tclWinProcs->copyFileProc)(nativeSrc, nativeDst, 0) != FALSE) { - return TCL_OK; + retval = -1; } - } __except (-1) {} + } __except (EXCEPTION_CONTINUE_EXECUTION) {} + + /* + * Avoid using control flow statements in the SEH guarded block! + */ + if (retval != -1) + return retval; TclWinConvertError(GetLastError()); if (Tcl_GetErrno() == EBADF) { |