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 /win/tclWinFCmd.c | |
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.
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) { |