Check-in [6556155cb4]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: * 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.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6556155cb422ad8eb37641d835cab0c2a1e661f4
User & Date: mdejong 2002-03-08 01:45:51.000
Context
2002-03-08
23:46
(DoCopyFile): correctly set retval to TCL_OK check-in: cd63d1f3b2 user: hobbs tags: trunk
01:45
* win/tclWin32Dll.c (TclpCheckStackSpace): * win/tclWinFCmd.c (DoRenameFile, DoCopyFile): Replace ... check-in: 6556155cb4 user: mdejong tags: trunk
2002-03-07
20:17
* Added the [interp recursionlimit] command to set/query the recursion limit of an interpre... check-in: 74cba3cfd3 user: dgp tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to ChangeLog.








1
2
3
4
5
6
7








2002-03-07  Don Porter  <dgp@users.sourceforge.net>

	* doc/interp.n:
	* generic/tclInterp.c(Tcl_InterpObjCmd,SlaveObjCmd,SlaveRecursionLimit):
	* generic/tclTest.c:
	* tests/interp.test: Added the [interp recursionlimit] command to
	set/query the recursion limit of an interpreter.  Proposal and
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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:
	* generic/tclInterp.c(Tcl_InterpObjCmd,SlaveObjCmd,SlaveRecursionLimit):
	* generic/tclTest.c:
	* tests/interp.test: Added the [interp recursionlimit] command to
	set/query the recursion limit of an interpreter.  Proposal and
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245

	* compat/strtoull.c (strtoull):
	* compat/strtoll.c (strtoll):
	* compat/strtoul.c (strtoul): Fixed failure to handle leading
	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>

	* configure: Regen.
	* unix/tcl.m4 (SC_CONFIG_CFLAGS): Link with -n32
	instead of -32 when building on IRIX64-6.* system.
	[Tcl bug 521707]

2002-02-22  Don Porter <dgp@users.sourceforge.net>







|







239
240
241
242
243
244
245
246
247
248
249
250
251
252
253

	* compat/strtoull.c (strtoull):
	* compat/strtoll.c (strtoll):
	* compat/strtoul.c (strtoul): Fixed failure to handle leading
	sign symbols '+' and '-' and '0X' and raise overflow errors.
	[Bug 440916]  Also corrects prototype and errno problems.

2002-02-23  Mo DeJong  <mdejong@users.sourceforge.net>

	* configure: Regen.
	* unix/tcl.m4 (SC_CONFIG_CFLAGS): Link with -n32
	instead of -32 when building on IRIX64-6.* system.
	[Tcl bug 521707]

2002-02-22  Don Porter <dgp@users.sourceforge.net>
Changes to win/tclWin32Dll.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* 
 * tclWin32Dll.c --
 *
 *	This file contains the DLL entry point.
 *
 * Copyright (c) 1995-1996 Sun Microsystems, Inc.
 * Copyright (c) 1998-2000 Scriptics Corporation.
 *
 * 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 $
 */

#include "tclWinInt.h"

/*
 * The following data structures are used when loading the thunking 
 * library for execing child processes under Win32s.











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* 
 * tclWin32Dll.c --
 *
 *	This file contains the DLL entry point.
 *
 * Copyright (c) 1995-1996 Sun Microsystems, Inc.
 * Copyright (c) 1998-2000 Scriptics Corporation.
 *
 * 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.14 2002/03/08 01:45:52 mdejong Exp $
 */

#include "tclWinInt.h"

/*
 * The following data structures are used when loading the thunking 
 * library for execing child processes under Win32s.
336
337
338
339
340
341
342


343
344
345
346
347
348
349
350
351
352
353
354



355
356
357
358
359
360
361
362
 *
 *----------------------------------------------------------------------
 */

int
TclpCheckStackSpace()
{


    /*
     * We can recurse only if there is at least TCL_WIN_STACK_THRESHOLD
     * bytes of stack space left.  alloca() is cheap on windows; basically
     * it just subtracts from the stack pointer causing the OS to throw an
     * exception if the stack pointer is set below the bottom of the stack.
     */

    __try {
	alloca(TCL_WIN_STACK_THRESHOLD);
	return 1;
    } __except (1) {}




    return 0;
}


/*
 *----------------------------------------------------------------------
 *
 * TclWinGetPlatform --







>
>









|
|

>
>
>
|







336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
 *
 *----------------------------------------------------------------------
 */

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
     * it just subtracts from the stack pointer causing the OS to throw an
     * exception if the stack pointer is set below the bottom of the stack.
     */

    __try {
	alloca(TCL_WIN_STACK_THRESHOLD);
	retval = 1;
    } __except (EXCEPTION_EXECUTE_HANDLER) {}

    /*
     * Avoid using control flow statements in the SEH guarded block!
     */
    return retval;
}


/*
 *----------------------------------------------------------------------
 *
 * TclWinGetPlatform --
Changes to win/tclWinFCmd.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * tclWinFCmd.c
 *
 *      This file implements the Windows specific portion of file manipulation 
 *      subcommands of the "file" command. 
 *
 * Copyright (c) 1996-1998 Sun Microsystems, Inc.
 *
 * 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 $
 */

#include "tclWinInt.h"

/*
 * The following constants specify the type of callback when
 * TraverseWinTree() calls the traverseProc()











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * tclWinFCmd.c
 *
 *      This file implements the Windows specific portion of file manipulation 
 *      subcommands of the "file" command. 
 *
 * Copyright (c) 1996-1998 Sun Microsystems, Inc.
 *
 * 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.23 2002/03/08 01:45:52 mdejong Exp $
 */

#include "tclWinInt.h"

/*
 * The following constants specify the type of callback when
 * TraverseWinTree() calls the traverseProc()
160
161
162
163
164
165
166

167
168
169
170
171
172
173
174
175
176
177






178
179
180
181
182
183
184
DoRenameFile(
    CONST TCHAR *nativeSrc,	/* Pathname of file or dir to be renamed
				 * (native). */ 
    CONST TCHAR *nativeDst)	/* New pathname for file or directory
				 * (native). */
{    
    DWORD srcAttr, dstAttr;


    /*
     * 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;
	}
    } __except (-1) {}







    TclWinConvertError(GetLastError());

    srcAttr = (*tclWinProcs->getFileAttributesProc)(nativeSrc);
    dstAttr = (*tclWinProcs->getFileAttributesProc)(nativeDst);
    if (srcAttr == 0xffffffff) {
	if ((*tclWinProcs->getFullPathNameProc)(nativeSrc, 0, NULL, NULL) >= MAX_PATH) {







>


|
|




|

|
>
>
>
>
>
>







160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
DoRenameFile(
    CONST TCHAR *nativeSrc,	/* Pathname of file or dir to be renamed
				 * (native). */ 
    CONST TCHAR *nativeDst)	/* New pathname for file or directory
				 * (native). */
{    
    DWORD srcAttr, dstAttr;
    int retval = -1;

    /*
     * 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) {
	    retval = TCL_OK;
	}
    } __except (EXCEPTION_CONTINUE_EXECUTION) {}

    /*
     * Avoid using control flow statements in the SEH guarded block!
     */
    if (retval != -1)
        return retval;

    TclWinConvertError(GetLastError());

    srcAttr = (*tclWinProcs->getFileAttributesProc)(nativeSrc);
    dstAttr = (*tclWinProcs->getFileAttributesProc)(nativeDst);
    if (srcAttr == 0xffffffff) {
	if ((*tclWinProcs->getFullPathNameProc)(nativeSrc, 0, NULL, NULL) >= MAX_PATH) {
428
429
430
431
432
433
434


435
436
437
438
439
440
441
442
443
444
}

static int
DoCopyFile(
   CONST TCHAR *nativeSrc,	/* Pathname of file to be copied (native). */
   CONST TCHAR *nativeDst)	/* Pathname of file to copy to (native). */
{


    /*
     * Would throw an exception under NT if one of the arguments is a char
     * block device.
     */

    /* 
     * If 'nativeDst' is NULL, the following code can lock the process
     * up, at least under Windows2000.  Therefore we have to bail at
     * that point.
     */







>
>

|
|







435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
}

static int
DoCopyFile(
   CONST TCHAR *nativeSrc,	/* Pathname of file to be copied (native). */
   CONST TCHAR *nativeDst)	/* Pathname of file to copy to (native). */
{
    int retval = -1;

    /*
     * The copyFileProc below would throw an exception under NT if one
     * of the arguments is a char block device.
     */

    /* 
     * If 'nativeDst' is NULL, the following code can lock the process
     * up, at least under Windows2000.  Therefore we have to bail at
     * that point.
     */
459
460
461
462
463
464
465
466
467
468






469
470
471
472
473
474
475
    
    /*
     * OK, now try the copy.
     */
    
    __try {
	if ((*tclWinProcs->copyFileProc)(nativeSrc, nativeDst, 0) != FALSE) {
	    return TCL_OK;
	}
    } __except (-1) {}







    TclWinConvertError(GetLastError());
    if (Tcl_GetErrno() == EBADF) {
	Tcl_SetErrno(EACCES);
	return TCL_ERROR;
    }
    if (Tcl_GetErrno() == EACCES) {







|

|
>
>
>
>
>
>







468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
    
    /*
     * OK, now try the copy.
     */
    
    __try {
	if ((*tclWinProcs->copyFileProc)(nativeSrc, nativeDst, 0) != FALSE) {
	    retval = -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) {
	Tcl_SetErrno(EACCES);
	return TCL_ERROR;
    }
    if (Tcl_GetErrno() == EACCES) {