diff options
author | mdejong <mdejong@noemail.net> | 2002-03-08 01:45:50 (GMT) |
---|---|---|
committer | mdejong <mdejong@noemail.net> | 2002-03-08 01:45:50 (GMT) |
commit | d51f9aedb54f334808195ec0690871f445e7e40e (patch) | |
tree | b1bc8f3cb80b121d126f7bf0f4cb96a6bc14e98d /win/tclWinFCmd.c | |
parent | bc6e5978b6e22eccd4768063002968305197397f (diff) | |
download | tcl-d51f9aedb54f334808195ec0690871f445e7e40e.zip tcl-d51f9aedb54f334808195ec0690871f445e7e40e.tar.gz tcl-d51f9aedb54f334808195ec0690871f445e7e40e.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.
FossilOrigin-Name: 6556155cb422ad8eb37641d835cab0c2a1e661f4
Diffstat (limited to 'win/tclWinFCmd.c')
-rw-r--r-- | win/tclWinFCmd.c | 33 |
1 files changed, 24 insertions, 9 deletions
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) { |