From 12d2dcaa42dce1168e5487ead798a7486e0c4f8a Mon Sep 17 00:00:00 2001 From: mdejong Date: Fri, 8 Mar 2002 01:45:51 +0000 Subject: * 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. --- ChangeLog | 10 +++++++++- win/tclWin32Dll.c | 13 +++++++++---- win/tclWinFCmd.c | 33 ++++++++++++++++++++++++--------- 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8cc2eaa..382231e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2002-03-07 Mo DeJong + + * 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 * 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 +2002-02-23 Mo DeJong * 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) { -- cgit v0.12