summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2025-12-27 17:43:22 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2025-12-27 17:43:22 (GMT)
commit0f9810727ed2f9a8d3895f5118176e701d7028ed (patch)
treef633f6df5a27abe6796645ad20e1b2c3d7dfef28
parent4011362d9bd502484bb6a6e88d1e405ee27fe464 (diff)
parent98f74013e2f489e289ad1a7da4c87dd9715110b5 (diff)
downloadtcl-core-tip-744.zip
tcl-core-tip-744.tar.gz
tcl-core-tip-744.tar.bz2
Unbreak Linux/MacOS build. Merge trunkcore-tip-744
-rw-r--r--generic/tclCompCmdsGR.c97
-rw-r--r--generic/tclCompile.h5
-rw-r--r--generic/tclExecute.c29
-rw-r--r--generic/tclPlatDecls.h4
-rw-r--r--generic/tclStubInit.c3
-rw-r--r--tests/registry.test20
-rw-r--r--tests/winFCmd.test502
-rw-r--r--win/tclWinFCmd.c2
-rw-r--r--win/tclWinFile.c18
-rw-r--r--win/tclWinInit.c6
-rw-r--r--win/tclWinTest.c2
11 files changed, 373 insertions, 315 deletions
diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c
index c526be7..9e15d9d 100644
--- a/generic/tclCompCmdsGR.c
+++ b/generic/tclCompCmdsGR.c
@@ -16,6 +16,7 @@
#include "tclInt.h"
#include "tclCompile.h"
+#include <math.h>
/*
* Prototypes for procedures defined later in this file:
@@ -1724,6 +1725,32 @@ TclCompileLpopCmd(
*----------------------------------------------------------------------
*/
+static inline int
+TclIssueLseqArgument(
+ Tcl_Interp *interp,
+ Tcl_Token *tokenPtr,
+ int idx,
+ int flag,
+ CompileEnv *envPtr,
+ LineInformation lineInfo)
+{
+ Tcl_Obj *tmpObj = Tcl_NewObj();
+ if (TclWordKnownAtCompileTime(tokenPtr, tmpObj)) {
+ void *data;
+ int type;
+ if (Tcl_GetNumberFromObj(NULL, tmpObj, &data, &type) == TCL_OK) {
+ PUSH_TOKEN( tokenPtr, idx);
+ } else {
+ PUSH_EXPR_TOKEN( tokenPtr, idx);
+ }
+ Tcl_BounceRefCount(tmpObj);
+ return flag;
+ }
+ Tcl_BounceRefCount(tmpObj);
+ PUSH_TOKEN( tokenPtr, idx);
+ return 0;
+}
+
int
TclCompileLseqCmd(
Tcl_Interp *interp, /* Used for error reporting. */
@@ -1751,6 +1778,10 @@ TclCompileLseqCmd(
return TCL_ERROR;
}
+#define LSEQ_ARG(tokenPtr, idx, flag) \
+ flags |= TclIssueLseqArgument(interp, tokenPtr, idx, \
+ TCL_ARITHSERIES_##flag##_EVAL, envPtr, lineInfo)
+
#define IS_ANY_LSEQ_KEYWORD(tokenPtr) \
(IS_TOKEN_LITERALLY(tokenPtr, "to") \
|| IS_TOKEN_LITERALLY(tokenPtr, "..") \
@@ -1761,14 +1792,15 @@ TclCompileLseqCmd(
oneArg:
tokenPtr = TokenAfter(parsePtr->tokenPtr);
flags = (TCL_ARITHSERIES_FROM | TCL_ARITHSERIES_STEP |
- TCL_ARITHSERIES_COUNT);
+ TCL_ARITHSERIES_COUNT | TCL_ARITHSERIES_FROM_EVAL |
+ TCL_ARITHSERIES_STEP_EVAL);
if (IS_ANY_LSEQ_KEYWORD(tokenPtr)) {
return TCL_ERROR;
}
PUSH( "0"); // from
PUSH( ""); // to
PUSH( "1"); // step
- PUSH_TOKEN( tokenPtr, 1); // count
+ LSEQ_ARG( tokenPtr, 1, COUNT);
OP1( ARITH_SERIES, flags);
return TCL_OK;
@@ -1780,8 +1812,8 @@ TclCompileLseqCmd(
if (IS_ANY_LSEQ_KEYWORD(tokenPtr) || IS_ANY_LSEQ_KEYWORD(token2Ptr)) {
return TCL_ERROR;
}
- PUSH_TOKEN( tokenPtr, 1); // from
- PUSH_TOKEN( token2Ptr, 2); // to
+ LSEQ_ARG( tokenPtr, 1, FROM);
+ LSEQ_ARG( token2Ptr, 2, TO);
PUSH( ""); // step
PUSH( ""); // count
OP1( ARITH_SERIES, flags);
@@ -1797,28 +1829,30 @@ TclCompileLseqCmd(
}
if (IS_TOKEN_LITERALLY(token2Ptr, "to") || IS_TOKEN_LITERALLY(token2Ptr, "..")) {
flags = (TCL_ARITHSERIES_FROM | TCL_ARITHSERIES_TO);
- PUSH_TOKEN( tokenPtr, 1); // from
- PUSH_TOKEN( token3Ptr, 3); // to
+ LSEQ_ARG( tokenPtr, 1, FROM);
+ LSEQ_ARG( token3Ptr, 3, TO);
PUSH( ""); // step
PUSH( ""); // count
} else if (IS_TOKEN_LITERALLY(token2Ptr, "count")) {
- flags = (TCL_ARITHSERIES_FROM | TCL_ARITHSERIES_STEP | TCL_ARITHSERIES_COUNT);
- PUSH_TOKEN( tokenPtr, 1); // from
+ flags = (TCL_ARITHSERIES_FROM | TCL_ARITHSERIES_STEP | TCL_ARITHSERIES_COUNT |
+ TCL_ARITHSERIES_STEP_EVAL);
+ LSEQ_ARG( tokenPtr, 1, FROM);
PUSH( ""); // to
PUSH( "1"); // step
- PUSH_TOKEN( token3Ptr, 3); // count
+ LSEQ_ARG( token3Ptr, 3, COUNT);
} else if (IS_TOKEN_LITERALLY(token2Ptr, "by")) {
- flags = (TCL_ARITHSERIES_FROM | TCL_ARITHSERIES_STEP | TCL_ARITHSERIES_COUNT);
+ flags = (TCL_ARITHSERIES_FROM | TCL_ARITHSERIES_STEP | TCL_ARITHSERIES_COUNT |
+ TCL_ARITHSERIES_FROM_EVAL);
PUSH( "0"); // from
PUSH( ""); // to
- PUSH_TOKEN( tokenPtr, 1); // count
- PUSH_TOKEN( token3Ptr, 3); // step
+ LSEQ_ARG( tokenPtr, 1, COUNT);
+ LSEQ_ARG( token3Ptr, 3, STEP);
OP( SWAP);
} else {
flags = (TCL_ARITHSERIES_FROM | TCL_ARITHSERIES_TO | TCL_ARITHSERIES_STEP);
- PUSH_TOKEN( tokenPtr, 1); // from
- PUSH_TOKEN( token2Ptr, 2); // to
- PUSH_TOKEN( token3Ptr, 3); // step
+ LSEQ_ARG( tokenPtr, 1, FROM);
+ LSEQ_ARG( token2Ptr, 2, TO);
+ LSEQ_ARG( token3Ptr, 3, STEP);
PUSH( ""); // count
}
OP1( ARITH_SERIES, flags);
@@ -1838,28 +1872,28 @@ TclCompileLseqCmd(
if (IS_ANY_LSEQ_KEYWORD(token3Ptr)) {
return TCL_ERROR;
}
- PUSH_TOKEN( tokenPtr, 1); // from
- PUSH_TOKEN( token3Ptr, 3); // to
- PUSH_TOKEN( token4Ptr, 4); // step
+ LSEQ_ARG( tokenPtr, 1, FROM);
+ LSEQ_ARG( token3Ptr, 3, TO);
+ LSEQ_ARG( token4Ptr, 4, STEP);
PUSH( ""); // count
} else if (IS_TOKEN_LITERALLY(token2Ptr, "count")) {
flags = (TCL_ARITHSERIES_FROM | TCL_ARITHSERIES_STEP | TCL_ARITHSERIES_COUNT);
if (IS_ANY_LSEQ_KEYWORD(token3Ptr)) {
return TCL_ERROR;
}
- PUSH_TOKEN( tokenPtr, 1); // from
+ LSEQ_ARG( tokenPtr, 1, FROM);
PUSH( ""); // to
- PUSH_TOKEN( token3Ptr, 3); // count
- PUSH_TOKEN( token4Ptr, 4); // step
+ LSEQ_ARG( token3Ptr, 3, COUNT);
+ LSEQ_ARG( token4Ptr, 4, STEP);
OP( SWAP);
} else if (IS_TOKEN_LITERALLY(token3Ptr, "by")) {
flags = (TCL_ARITHSERIES_FROM | TCL_ARITHSERIES_TO | TCL_ARITHSERIES_STEP);
- if (IS_ANY_LSEQ_KEYWORD(token3Ptr)) {
+ if (IS_ANY_LSEQ_KEYWORD(token2Ptr)) {
return TCL_ERROR;
}
- PUSH_TOKEN( tokenPtr, 1); // from
- PUSH_TOKEN( token2Ptr, 2); // to
- PUSH_TOKEN( token4Ptr, 4); // step
+ LSEQ_ARG( tokenPtr, 1, FROM);
+ LSEQ_ARG( token2Ptr, 2, TO);
+ LSEQ_ARG( token4Ptr, 4, STEP);
PUSH( ""); // count
} else {
return TCL_ERROR;
@@ -1883,16 +1917,16 @@ TclCompileLseqCmd(
}
if (IS_TOKEN_LITERALLY(token2Ptr, "to") || IS_TOKEN_LITERALLY(token2Ptr, "..")) {
flags = (TCL_ARITHSERIES_FROM | TCL_ARITHSERIES_TO | TCL_ARITHSERIES_STEP);
- PUSH_TOKEN( tokenPtr, 1); // from
- PUSH_TOKEN( token3Ptr, 3); // to
- PUSH_TOKEN( token5Ptr, 5); // step
+ LSEQ_ARG( tokenPtr, 1, FROM);
+ LSEQ_ARG( token3Ptr, 3, TO);
+ LSEQ_ARG( token5Ptr, 5, STEP);
PUSH( ""); // count
} else if (IS_TOKEN_LITERALLY(token2Ptr, "count")) {
flags = (TCL_ARITHSERIES_FROM | TCL_ARITHSERIES_STEP | TCL_ARITHSERIES_COUNT);
- PUSH_TOKEN( tokenPtr, 1); // from
+ LSEQ_ARG( tokenPtr, 1, FROM);
PUSH( ""); // to
- PUSH_TOKEN( token3Ptr, 3); // count
- PUSH_TOKEN( token5Ptr, 5); // step
+ LSEQ_ARG( token3Ptr, 3, COUNT);
+ LSEQ_ARG( token5Ptr, 5, STEP);
OP( SWAP);
} else {
return TCL_ERROR;
@@ -1901,6 +1935,7 @@ TclCompileLseqCmd(
return TCL_OK;
#undef IS_ANY_LSEQ_KEYWORD
+#undef LseqArg
}
/*
diff --git a/generic/tclCompile.h b/generic/tclCompile.h
index 8bb3308..7eb6039 100644
--- a/generic/tclCompile.h
+++ b/generic/tclCompile.h
@@ -2022,6 +2022,11 @@ enum ArithSeqriesFlags {
TCL_ARITHSERIES_TO = 1 << 1, // to is defined (conventionally empty otherwise)
TCL_ARITHSERIES_STEP = 1 << 2, // step is defined (conventionally empty otherwise)
TCL_ARITHSERIES_COUNT = 1 << 3, // count is defined (conventionally empty otherwise)
+ TCL_ARITHSERIES_FROM_EVAL = 1 << 4, // from was already evaluated as an expression
+ TCL_ARITHSERIES_TO_EVAL = 1 << 5, // to was already evaluated as an expression
+ TCL_ARITHSERIES_STEP_EVAL = 1 << 6, // step was already evaluated as an expression
+ TCL_ARITHSERIES_COUNT_EVAL = 1 << 7,// count was already evaluated as an expression
+ TCL_ARITHSERIES_EVAL_MASK = 15 << 4 // all the eval bits
};
/*
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 006a57f..f2b9aa4 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -695,7 +695,8 @@ static Tcl_Obj * ExecuteExtendedUnaryMathOp(int opcode,
Tcl_Obj *valuePtr);
static void FreeExprCodeInternalRep(Tcl_Obj *objPtr);
static Tcl_Obj * GenerateArithSeries(Tcl_Interp *interp, Tcl_Obj *from,
- Tcl_Obj *to, Tcl_Obj *step, Tcl_Obj *count);
+ Tcl_Obj *to, Tcl_Obj *step, Tcl_Obj *count,
+ unsigned evalMask);
static ExceptionRange * GetExceptRangeForPc(const unsigned char *pc,
int searchMode, ByteCode *codePtr);
static const char * GetSrcInfoForPc(const unsigned char *pc,
@@ -5535,7 +5536,8 @@ TEBCresume(
DECACHE_STACK_INFO();
// Decode arguments and construct the series.
// Note that arguments may be expressions and reenter TEBC.
- objResultPtr = GenerateArithSeries(interp, from, to, step, count);
+ objResultPtr = GenerateArithSeries(interp, from, to, step, count,
+ mask & TCL_ARITHSERIES_EVAL_MASK);
CACHE_STACK_INFO();
if (objResultPtr == NULL) {
TRACE_ERROR(interp);
@@ -9246,7 +9248,9 @@ TclCompareTwoNumbers(
* ParseArithSeriesArgument --
*
* Helper for GenerateArithSeries() that encapsulates the weird calling of
- * Tcl_ExprObj() if the value isn't numeric.
+ * Tcl_ExprObj() if the value isn't numeric. Never calls Tcl_ExprObj()
+ * when alreadyPostExpr is set (which indicates that the analysis was done
+ * by the compiler).
*
* Results:
* TCL_OK if the value was numeric or a numeric-yielding expression, or
@@ -9264,10 +9268,14 @@ static inline int
ParseArithSeriesArgument(
Tcl_Interp *interp, // The interpreter.
Tcl_Obj **valuePtr, // Var holding object reference to parse/update [IN/OUT]
+ bool alreadyPostExpr, // Whether the value has already been parsed as an expression [IN]
void **ptrPtr, // Var to receive ref to number contents [OUT]
int *typePtr) // Var to receive number type [OUT]
{
Tcl_Obj *value = *valuePtr, *tmp;
+ if (alreadyPostExpr) {
+ return GetNumberFromObj(interp, value, ptrPtr, typePtr);
+ }
if (TclHasInternalRep(value, &tclExprCodeType)
|| GetNumberFromObj(NULL, value, ptrPtr, typePtr) != TCL_OK) {
if (Tcl_ExprObj(interp, value, &tmp) != TCL_OK) {
@@ -9309,7 +9317,8 @@ GenerateArithSeries(
Tcl_Obj *from, // The from value, or NULL if not supplied.
Tcl_Obj *to, // The to value, or NULL if not supplied.
Tcl_Obj *step, // The step value, or NULL if not supplied.
- Tcl_Obj *count) // The count value, or NULL if not supplied.
+ Tcl_Obj *count, // The count value, or NULL if not supplied.
+ unsigned evalMask) // Which values are already expr results.
{
Tcl_Obj *result = NULL;
int type, useDoubles = 0;
@@ -9335,7 +9344,8 @@ GenerateArithSeries(
*/
if (from) {
- if (ParseArithSeriesArgument(interp, &from, &ptr, &type) != TCL_OK) {
+ if (ParseArithSeriesArgument(interp, &from,
+ evalMask & TCL_ARITHSERIES_FROM_EVAL, &ptr, &type) != TCL_OK) {
goto cleanupOnError;
}
switch (type) {
@@ -9352,7 +9362,8 @@ GenerateArithSeries(
}
if (to) {
- if (ParseArithSeriesArgument(interp, &to, &ptr, &type) != TCL_OK) {
+ if (ParseArithSeriesArgument(interp, &to,
+ evalMask & TCL_ARITHSERIES_TO_EVAL, &ptr, &type) != TCL_OK) {
goto cleanupOnError;
}
switch (type) {
@@ -9371,7 +9382,8 @@ GenerateArithSeries(
}
if (step) {
- if (ParseArithSeriesArgument(interp, &step, &ptr, &type) != TCL_OK) {
+ if (ParseArithSeriesArgument(interp, &step,
+ evalMask & TCL_ARITHSERIES_STEP_EVAL, &ptr, &type) != TCL_OK) {
goto cleanupOnError;
}
switch (type) {
@@ -9390,7 +9402,8 @@ GenerateArithSeries(
// Convert count to integer if not already
// Almost the same as above cases except how floats are really handled.
if (count) {
- if (ParseArithSeriesArgument(interp, &count, &ptr, &type) != TCL_OK) {
+ if (ParseArithSeriesArgument(interp, &count,
+ evalMask & TCL_ARITHSERIES_COUNT_EVAL, &ptr, &type) != TCL_OK) {
goto cleanupOnError;
}
switch (type) {
diff --git a/generic/tclPlatDecls.h b/generic/tclPlatDecls.h
index 29ed685..d6b5969 100644
--- a/generic/tclPlatDecls.h
+++ b/generic/tclPlatDecls.h
@@ -131,6 +131,10 @@ extern const TclPlatStubs *tclPlatStubsPtr;
# undef Tcl_CreateFileHandler
# undef Tcl_DeleteFileHandler
# undef Tcl_GetOpenFile
+#else
+# undef Tcl_WinConvertError
+# undef Tcl_WinAppendMessageFromModule
+# undef Tcl_WinRaiseError
#endif
#ifndef MAC_OSX_TCL
# undef Tcl_MacOSXOpenVersionedBundleResources
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 1ce7440..410d21a 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -52,8 +52,9 @@
#undef TclStaticLibrary
#define TclStaticLibrary Tcl_StaticLibrary
#if !defined(_WIN32) && !defined(__CYGWIN__)
-# undef Tcl_WinConvertError
# define Tcl_WinConvertError 0
+# define Tcl_WinAppendMessageFromModule 0
+# define Tcl_WinRaiseError 0
#endif
#undef TclGetStringFromObj
#ifdef TCL_NO_DEPRECATED
diff --git a/tests/registry.test b/tests/registry.test
index 9a09607..5e8646d 100644
--- a/tests/registry.test
+++ b/tests/registry.test
@@ -763,21 +763,21 @@ test registry-12.5 {BroadcastValue} -constraints {win reg notWine} -body {
test registry-13.1 {Failure - no such key} -constraints {win reg} -body {
list \
- [catch {registry get HKEY_CURRENT_USER\\NoSuchKey blat} r d] \
- $r \
- [dict get $d -errorcode]
+ [catch {registry get HKEY_CURRENT_USER\\NoSuchKey blat} r d] \
+ $r \
+ [dict get $d -errorcode]
} -result [list 1 \
- {unable to open key "NoSuchKey": The system cannot find the file specified.} \
- {WINDOWS 0x2 {unable to open key "NoSuchKey": The system cannot find the file specified.}}]
+ {unable to open key "NoSuchKey": The system cannot find the file specified.} \
+ {WINDOWS 0x2 {unable to open key "NoSuchKey": The system cannot find the file specified.}}]
test registry-13.1 {Failure - no such value} -constraints {win reg} -body {
list \
- [catch {registry get HKEY_CURRENT_USER\\Microsoft NoSuchValue} r d] \
- $r \
- [dict get $d -errorcode]
+ [catch {registry get HKEY_CURRENT_USER\\Microsoft NoSuchValue} r d] \
+ $r \
+ [dict get $d -errorcode]
} -result [list 1 \
- {unable to get value "NoSuchValue" from key "HKEY_CURRENT_USER\Microsoft": The system cannot find the file specified.} \
- {WINDOWS 0x2 {unable to get value "NoSuchValue" from key "HKEY_CURRENT_USER\Microsoft": The system cannot find the file specified.}}]
+ {unable to get value "NoSuchValue" from key "HKEY_CURRENT_USER\Microsoft": The system cannot find the file specified.} \
+ {WINDOWS 0x2 {unable to get value "NoSuchValue" from key "HKEY_CURRENT_USER\Microsoft": The system cannot find the file specified.}}]
# cleanup
diff --git a/tests/winFCmd.test b/tests/winFCmd.test
index 59f1467..b10956f 100644
--- a/tests/winFCmd.test
+++ b/tests/winFCmd.test
@@ -36,17 +36,17 @@ testConstraint knownMsvcBug [expr {[tcl::build-info msvc] eq 0}]
testConstraint longPathAware 0
if {![catch {exec {*}[auto_execok cmd.exe] /c ver} winVer]} {
if {[regexp {(\d+)\.\d+\.(\d+)\.\d+} $winVer -> winMajor winBuild]} {
- # Must be Win 10
- if {$winMajor > 10 || ($winMajor == 10 && $winBuild >= 14393)} {
- if {[llength [info commands testlongpathsetting]]} {
- testConstraint longPathAware [testlongpathsetting]
- } else {
- catch {
- package require registry
- testConstraint longPathAware [registry get "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem" LongPathsEnabled]
- }
- }
- }
+ # Must be Win 10
+ if {$winMajor > 10 || ($winMajor == 10 && $winBuild >= 14393)} {
+ if {[llength [info commands testlongpathsetting]]} {
+ testConstraint longPathAware [testlongpathsetting]
+ } else {
+ catch {
+ package require registry
+ testConstraint longPathAware [registry get "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem" LongPathsEnabled]
+ }
+ }
+ }
}
}
unset -nocomplain winMajor winBuild winVer
@@ -1434,30 +1434,30 @@ namespace eval testlongpaths {
variable longPathRoot "[tcltest::configure -tmpdir]/longpathtest"
variable longPathComponents [lrepeat 4 $longPathComponent]
variable longPathDir [join [list $longPathRoot \
- {*}$longPathComponents] /]
+ {*}$longPathComponents] /]
variable longPathFile [string cat $longPathDir / $pathTail]
variable deepPathComponent [string repeat X\u4e2d 4]
variable deepPathComponents [lrepeat 128 $deepPathComponent]
variable deepPathDir [join [list $longPathRoot \
- {*}$deepPathComponents] /]
+ {*}$deepPathComponents] /]
variable deepPathFile [string cat $deepPathDir / $pathTail]
# Generator that only depends on parsing path syntax, not actual file system ops
proc testlongpathsyntax {id comment body args} {
- uplevel [list test $id $comment -body $body -constraints win {*}$args]
+ uplevel [list test $id $comment -body $body -constraints win {*}$args]
}
# Generator that requires actual file system ops
proc testlongpath {id comment body args} {
- uplevel [list test $id $comment -body $body \
- -constraints {win longPathAware} \
- -setup [list if {[file exists $longPathRoot]} {error "Precondition failed: $longPathRoot exists"}] \
- -cleanup {file delete -force $longPathRoot} \
- {*}$args]
+ uplevel [list test $id $comment -body $body \
+ -constraints {win longPathAware} \
+ -setup [list if {[file exists $longPathRoot]} {error "Precondition failed: $longPathRoot exists"}] \
+ -cleanup {file delete -force $longPathRoot} \
+ {*}$args]
}
proc julian {seconds} {
- clock format $seconds -format %J
+ clock format $seconds -format %J
}
# Assumes all tests will run within the same day to sanity check times
variable today [julian now]
@@ -1465,139 +1465,139 @@ namespace eval testlongpaths {
#
# Path operations - file cmdname ...
testlongpathsyntax file-dirname-longpath-0 "long path file dirname" {
- file dirname $longPathDir
+ file dirname $longPathDir
} -result [join [lrange [split $longPathDir /] 0 end-1] /]
testlongpathsyntax file-extension-longpath-0 "long path file extension" {
- file extension $longPathFile.ext
+ file extension $longPathFile.ext
} -result .ext
testlongpathsyntax file-join-longpath-0 "deep path file join" {
- file join $longPathRoot {*}$deepPathComponents $pathTail
+ file join $longPathRoot {*}$deepPathComponents $pathTail
} -result $deepPathFile
testlongpath file-join-longpath-1 "long path file join - native name" {
- file join $longPathRoot [join $longPathComponents \\] $pathTail
+ file join $longPathRoot [join $longPathComponents \\] $pathTail
} -result $longPathFile
testlongpath file-join-longpath-0 "deep path file join - relative" {
- file join {*}$deepPathComponents
+ file join {*}$deepPathComponents
} -result [join $deepPathComponents /]
testlongpathsyntax file-nativename-longpath-0 "long path nativename" {
- file nativename $longPathDir
+ file nativename $longPathDir
} -result [string map [list / \\] $longPathDir]
testlongpathsyntax file-normalize-longpath-0 "long path normalize" {
- file normalize $longPathDir
+ file normalize $longPathDir
} -constraints win -result $longPathDir
testlongpathsyntax file-normalize-longpath-1 "long path normalize - dotdot" {
- file normalize $longPathDir/../../$longPathComponent/$pathTail
+ file normalize $longPathDir/../../$longPathComponent/$pathTail
} -result [join [list $longPathRoot {*}[lrange $longPathComponents 0 end-1] $pathTail] /]
testlongpathsyntax file-normalize-longpath-2 "long path normalize - dot, native" {
- file normalize [string map [list / \\] $longPathDir/././$pathTail]
+ file normalize [string map [list / \\] $longPathDir/././$pathTail]
} -result $longPathFile
testlongpath file-normalize-longpath-3 "Long path normalize - pwd-relative name" {
- set origDir [pwd]
- file mkdir $longPathDir
- cd $longPathDir
- set path [file normalize foo]
- cd $origDir
- set path
+ set origDir [pwd]
+ file mkdir $longPathDir
+ cd $longPathDir
+ set path [file normalize foo]
+ cd $origDir
+ set path
} -result $longPathDir/foo
testlongpathsyntax file-rootname-longpath-0 "long path file rootname" {
- file rootname $longPathFile.ext
+ file rootname $longPathFile.ext
} -result $longPathFile
testlongpathsyntax file-split-longpath-0 "long path file split" {
- file split $longPathFile
+ file split $longPathFile
} -result [list {*}[file split $longPathRoot] {*}$longPathComponents $pathTail]
testlongpathsyntax file-split-longpath-1 "deep path file split - native" {
- file split [string map [list / \\] $deepPathFile]
+ file split [string map [list / \\] $deepPathFile]
} -result [list {*}[file split $longPathRoot] {*}$deepPathComponents $pathTail]
testlongpathsyntax file-tail-longpath-0 "long path file tail" {
- file tail $longPathFile.ext
+ file tail $longPathFile.ext
} -result $pathTail.ext
testlongpathsyntax file-pathtype-longpath-0 "long path type" {
- file pathtype $longPathDir
+ file pathtype $longPathDir
} -result absolute
testlongpathsyntax file-pathtype-longpath-1 "long path type - relative" {
- file pathtype [join $longPathComponents /]
+ file pathtype [join $longPathComponents /]
} -result relative
testlongpathsyntax file-pathtype-longpath-2 "long path type - volumerelative" {
- file pathtype C:[join $longPathComponents /]
+ file pathtype C:[join $longPathComponents /]
} -result volumerelative
testlongpathsyntax file-separator-longpath-0 "long path separator" {
- file separator $longPathDir
+ file separator $longPathDir
} -result \\
testlongpathsyntax file-system-longpath-0 "long path system" {
- lindex [file system $longPathDir] 0
+ lindex [file system $longPathDir] 0
} -result native
testlongpathsyntax file-tildeexpand-longpath-0 "long path tildeexpand" {
- file tildeexpand ~/[join $longPathComponents /]
+ file tildeexpand ~/[join $longPathComponents /]
} -result [join [list [file home] {*}$longPathComponents] /]
#
# File and directory operations
proc ops {path type} {
- set cpath $path-copy
- set rpath $path-renamed
- if {$type eq "dir"} {
- lappend result [file mkdir $path]
- } else {
- file mkdir [file dirname $path]
- lappend result [writeFile $path abc]
- lappend result [readFile $path]
- }
- # Note. For file owned, we only check no errors are generated since
- # ownership semantics in NTFS are quirky depending on whether files
- # created in admin mode etc.
- lappend result \
- [file exists $path] \
- [file exists $path/..] \
- [file readable $path] \
- [file writable $path] \
- [file executable $path] \
- [catch {file owned $path}] \
- [file isdirectory $path] \
- [file isfile $path] \
- [file size $path] \
- [file type $path] \
- [dict get [file stat $path] type] \
- [julian [file atime $path]] \
- [julian [file mtime $path]] \
- [file rename $path $rpath] \
- [file exists $path] \
- [file copy $rpath $cpath] \
- [file exists $cpath] \
- [file delete $rpath] \
- [file exists $rpath]
+ set cpath $path-copy
+ set rpath $path-renamed
+ if {$type eq "dir"} {
+ lappend result [file mkdir $path]
+ } else {
+ file mkdir [file dirname $path]
+ lappend result [writeFile $path abc]
+ lappend result [readFile $path]
+ }
+ # Note. For file owned, we only check no errors are generated since
+ # ownership semantics in NTFS are quirky depending on whether files
+ # created in admin mode etc.
+ lappend result \
+ [file exists $path] \
+ [file exists $path/..] \
+ [file readable $path] \
+ [file writable $path] \
+ [file executable $path] \
+ [catch {file owned $path}] \
+ [file isdirectory $path] \
+ [file isfile $path] \
+ [file size $path] \
+ [file type $path] \
+ [dict get [file stat $path] type] \
+ [julian [file atime $path]] \
+ [julian [file mtime $path]] \
+ [file rename $path $rpath] \
+ [file exists $path] \
+ [file copy $rpath $cpath] \
+ [file exists $cpath] \
+ [file delete $rpath] \
+ [file exists $rpath]
}
variable dirOpsResult [list {} 1 1 1 1 1 0 1 0 0 directory directory $today $today {} 0 {} 1 {} 0]
variable fileOpsResult [list {} abc 1 1 1 1 0 0 0 1 3 file file $today $today {} 0 {} 1 {} 0]
proc getAttrs {path} {
- set attrs [file attributes $path]
- # We do not test -shortname because Windows is unpredictable in how
- # it is constructed and whether it is constructed at all
- return [list \
- [dict get $attrs -archive] \
- [dict get $attrs -hidden] \
- [dict get $attrs -readonly] \
- [dict get $attrs -system] \
- [dict get $attrs -longname]]
+ set attrs [file attributes $path]
+ # We do not test -shortname because Windows is unpredictable in how
+ # it is constructed and whether it is constructed at all
+ return [list \
+ [dict get $attrs -archive] \
+ [dict get $attrs -hidden] \
+ [dict get $attrs -readonly] \
+ [dict get $attrs -system] \
+ [dict get $attrs -longname]]
}
variable testsDir [file normalize [file dirname [info script]]]
@@ -1607,227 +1607,227 @@ namespace eval testlongpaths {
# Test directory ops
testlongpath dirops-longpath-0 "Long path directory operations" {
- ops $longPathDir dir
+ ops $longPathDir dir
} -result $dirOpsResult
testlongpath dirops-longpath-1 "Long path directory operations - native paths" {
- ops [file nativename $longPathDir] dir
+ ops [file nativename $longPathDir] dir
} -result $dirOpsResult
testlongpath dirops-longpath-2 "Long path directory operations - deep nesting" {
- ops $deepPathDir dir
+ ops $deepPathDir dir
} -result $dirOpsResult
testlongpath dirops-longpath-2 "Long path directory operations - dot, dotdot" {
- ops $longPathDir/.././$longPathComponent dir
+ ops $longPathDir/.././$longPathComponent dir
} -result $dirOpsResult
testlongpath cd-longpath-0 "Long path directory - cd, pwd" {
- set origDir [pwd]
- file mkdir $longPathDir
- cd $longPathDir
- set newDir [pwd]
- cd $origDir
- set newDir
+ set origDir [pwd]
+ file mkdir $longPathDir
+ cd $longPathDir
+ set newDir [pwd]
+ cd $origDir
+ set newDir
} -result $longPathDir
testlongpath dir-attributes-longpath-0 "Long path directory attributes" {
- file mkdir $deepPathDir
- getAttrs $deepPathDir
+ file mkdir $deepPathDir
+ getAttrs $deepPathDir
} -result [list 0 0 0 0 $deepPathDir]
testlongpath dir-attributes-longpath-1 "Long path directory attributes - set" {
- file mkdir $longPathDir
- file attributes $longPathDir -archive 1 -hidden 1 -system 1 -readonly 1
- getAttrs $longPathDir
+ file mkdir $longPathDir
+ file attributes $longPathDir -archive 1 -hidden 1 -system 1 -readonly 1
+ getAttrs $longPathDir
} -result [list 1 1 1 1 $longPathDir]
testlongpath dir-glob-longpath-0 "Long path glob" {
- file mkdir $deepPathDir
- writeFile $deepPathFile ""
- writeFile $deepPathFile-2 ""
- lsort [glob $deepPathDir/*]
+ file mkdir $deepPathDir
+ writeFile $deepPathFile ""
+ writeFile $deepPathFile-2 ""
+ lsort [glob $deepPathDir/*]
} -result [list $deepPathFile $deepPathFile-2]
testlongpath dir-glob-longpath-1 "Long path glob -directory" {
- file mkdir $deepPathDir
- writeFile $deepPathFile ""
- writeFile $deepPathFile-2 ""
- lsort [glob -directory $deepPathDir *2]
+ file mkdir $deepPathDir
+ writeFile $deepPathFile ""
+ writeFile $deepPathFile-2 ""
+ lsort [glob -directory $deepPathDir *2]
} -result [list $deepPathFile-2]
testlongpath dir-glob-longpath-2 "Long path glob -path" {
- file mkdir $deepPathDir
- writeFile $deepPathFile ""
- writeFile $deepPathFile-2 ""
- lsort [glob -path $deepPathDir/[string index $pathTail 0] *[string range $pathTail 1 end]]
+ file mkdir $deepPathDir
+ writeFile $deepPathFile ""
+ writeFile $deepPathFile-2 ""
+ lsort [glob -path $deepPathDir/[string index $pathTail 0] *[string range $pathTail 1 end]]
} -result [list $deepPathFile]
#
# Test file ops
testlongpath fileops-longpath-0 "Long path file operations" {
- ops $longPathFile file
+ ops $longPathFile file
} -result $fileOpsResult
testlongpath fileops-longpath-1 "Long path file operations - native paths" {
- ops [file nativename $longPathFile] file
+ ops [file nativename $longPathFile] file
} -result $fileOpsResult
testlongpath fileops-longpath-2 "Long path file operations - deep nesting" {
- ops $deepPathFile file
+ ops $deepPathFile file
} -result $fileOpsResult
testlongpath fileops-longpath-2 "Long path file operations - dot, dotdot" {
- ops $longPathDir/.././$longPathComponent/$pathTail file
+ ops $longPathDir/.././$longPathComponent/$pathTail file
} -result $fileOpsResult
testlongpath file-attributes-longpath-0 "Long path file attributes" {
- file mkdir [file dirname $deepPathFile]
- close [open $deepPathFile w]
- getAttrs $deepPathFile
+ file mkdir [file dirname $deepPathFile]
+ close [open $deepPathFile w]
+ getAttrs $deepPathFile
} -result [list 1 0 0 0 $deepPathFile]
testlongpath file-attributes-longpath-1 "Long path file attributes - set" {
- file mkdir $longPathDir
- close [open $longPathFile w]
- file attributes $longPathFile -archive 0 -hidden 1 -system 1 -readonly 1
- getAttrs $longPathFile
+ file mkdir $longPathDir
+ close [open $longPathFile w]
+ file attributes $longPathFile -archive 0 -hidden 1 -system 1 -readonly 1
+ getAttrs $longPathFile
} -result [list 0 1 1 1 $longPathFile]
#
# zipfs mounts
testlongpath zipfs-mount-longpath-0 "Long path archive" {
- file mkdir $longPathDir
- set mt //zipfs:/longpathtest
- set archive [file join $longPathDir test.zip]
- file copy [file join $zipTestDir test.zip] $archive
- zipfs mount $archive $mt
- set text [readFile $mt/test]
- zipfs unmount $mt
- set text
+ file mkdir $longPathDir
+ set mt //zipfs:/longpathtest
+ set archive [file join $longPathDir test.zip]
+ file copy [file join $zipTestDir test.zip] $archive
+ zipfs mount $archive $mt
+ set text [readFile $mt/test]
+ zipfs unmount $mt
+ set text
} -result "test\n"
#
# file link
testlongpath file-link-dir-longpath-0 "Link to a long path directory" {
- file mkdir $deepPathDir
- writeFile $deepPathFile abc
- set link [file join [temporaryDirectory] dirlink]
- file link $link $deepPathDir
- set result [list [file link $link] [readFile $link/[file tail $deepPathFile]]]
- file delete $link
- set result
+ file mkdir $deepPathDir
+ writeFile $deepPathFile abc
+ set link [file join [temporaryDirectory] dirlink]
+ file link $link $deepPathDir
+ set result [list [file link $link] [readFile $link/[file tail $deepPathFile]]]
+ file delete $link
+ set result
} -result [list [file nativename $deepPathDir] abc]
testlongpath file-link-dir-longpath-1 "Long path Link to a directory" {
- set target [file join [temporaryDirectory] dirtarget]
- file mkdir $target
- writeFile $target/file.txt abc
- file mkdir $deepPathDir
- set link [file join $deepPathDir dirlink]
- file link $link $target
- set result [list [file link $link] [readFile $link/file.txt]]
- file delete -force $target
- set result
+ set target [file join [temporaryDirectory] dirtarget]
+ file mkdir $target
+ writeFile $target/file.txt abc
+ file mkdir $deepPathDir
+ set link [file join $deepPathDir dirlink]
+ file link $link $target
+ set result [list [file link $link] [readFile $link/file.txt]]
+ file delete -force $target
+ set result
} -result [list [file nativename [file join [temporaryDirectory] dirtarget]] abc]
testlongpath file-link-file-longpath-0 "Test link to a long path file" {
- file mkdir $longPathDir
- writeFile $longPathFile abc
- set link [file join [temporaryDirectory] filelink]
- file link $link $longPathFile
- set result [readFile $link]
- file delete $link
- set result
+ file mkdir $longPathDir
+ writeFile $longPathFile abc
+ set link [file join [temporaryDirectory] filelink]
+ file link $link $longPathFile
+ set result [readFile $link]
+ file delete $link
+ set result
} -result abc
testlongpath file-link-file-longpath-1 "Test long path link to a file" {
- set target [file join [temporaryDirectory] filetarget]
- writeFile $target abc
- file mkdir $deepPathDir
- set link [file join $deepPathDir filelink]
- file link $link $target
- set result [readFile $link]
- file delete -force $target
- set result
+ set target [file join [temporaryDirectory] filetarget]
+ writeFile $target abc
+ file mkdir $deepPathDir
+ set link [file join $deepPathDir filelink]
+ file link $link $target
+ set result [readFile $link]
+ file delete -force $target
+ set result
} -result abc
#
# file lstat
testlongpath file-lstat-dir-longpath-0 "Lstat link to a long path directory" {
- file mkdir $deepPathDir
- set link [file join [temporaryDirectory] dirlink]
- file link $link $deepPathDir
- set result [list [dict get [file lstat $link] type] [dict get [file stat $link] type]]
- file delete $link
- set result
+ file mkdir $deepPathDir
+ set link [file join [temporaryDirectory] dirlink]
+ file link $link $deepPathDir
+ set result [list [dict get [file lstat $link] type] [dict get [file stat $link] type]]
+ file delete $link
+ set result
} -result {link directory}
testlongpath file-lstat-dir-longpath-1 "lstat long path Link to a directory" {
- set target [file join [temporaryDirectory] dirtarget]
- file mkdir $target
- file mkdir $deepPathDir
- set link [file join $deepPathDir dirlink]
- file link $link $target
- set result [list [dict get [file lstat $link] type] [dict get [file stat $link] type]]
- file delete -force $target
- set result
+ set target [file join [temporaryDirectory] dirtarget]
+ file mkdir $target
+ file mkdir $deepPathDir
+ set link [file join $deepPathDir dirlink]
+ file link $link $target
+ set result [list [dict get [file lstat $link] type] [dict get [file stat $link] type]]
+ file delete -force $target
+ set result
} -result {link directory}
testlongpath file-lstat-file-longpath-0 "lstat link to a long path file" {
- file mkdir $longPathDir
- writeFile $longPathFile abc
- set link [file join [temporaryDirectory] filelink]
- file link $link $longPathFile
- set result [list [dict get [file lstat $link] type] [dict get [file stat $link] type]]
- file delete $link
- # Result is {file file} because file links are symbolic?
- set result
+ file mkdir $longPathDir
+ writeFile $longPathFile abc
+ set link [file join [temporaryDirectory] filelink]
+ file link $link $longPathFile
+ set result [list [dict get [file lstat $link] type] [dict get [file stat $link] type]]
+ file delete $link
+ # Result is {file file} because file links are symbolic?
+ set result
} -result {file file}
testlongpath file-lstat-file-longpath-1 "lstat long path link to a file" {
- set target [file join [temporaryDirectory] filetarget]
- writeFile $target abc
- file mkdir $deepPathDir
- set link [file join $deepPathDir filelink]
- file link $link $target
- set result [list [dict get [file lstat $link] type] [dict get [file stat $link] type]]
- file delete -force $target
- set result
+ set target [file join [temporaryDirectory] filetarget]
+ writeFile $target abc
+ file mkdir $deepPathDir
+ set link [file join $deepPathDir filelink]
+ file link $link $target
+ set result [list [dict get [file lstat $link] type] [dict get [file stat $link] type]]
+ file delete -force $target
+ set result
} -result {file file}
#
# exec and running Tcl from a deep install
if {0} {
- # CreateProcessW is not long path aware. Have to wait for Microsoft
- # to make it so.
- variable srcBinDir [file dirname [info nameofexecutable]]
- variable installDir $deepPathDir
- set deepExe [file join $installDir bin [file tail [info nameofexecutable]]]
- testlongpath exec-longpath-0 "Long path Tcl installation" {
- file mkdir $installDir/bin
- file mkdir $installDir/lib
- # Copy executables and library
- set srcdir [file dirname [info nameofexecutable]]
- file copy -force [info nameofexecutable] $deepExe
- foreach f [glob [file join $srcBinDir *.dll]] {
- file copy -force $f [file join $installDir bin]
- }
- file copy -force [file join $testsDir .. library] [file join $installDir lib/tcl[info tclversion]]
- set script [file join $installDir x.tcl]
- writeFile $script {puts [info nameofexecutable],[info library]}
- catch {set oldenv $env(TCL_LIBRARY)}
- set env(TCL_LIBRARY) [file join $installDir lib]
- set olddir [pwd]
- cd $installDir/bin
- set code [catch {exec $deepExe $script} output]
- cd $olddir
- if {[info exists oldenv]} {
- set env(TCL_LIBRARY) $oldenv
- }
- list $code $output
- } -result [list 0 $deepExe,[file join $deepPathDir lib]]
+ # CreateProcessW is not long path aware. Have to wait for Microsoft
+ # to make it so.
+ variable srcBinDir [file dirname [info nameofexecutable]]
+ variable installDir $deepPathDir
+ set deepExe [file join $installDir bin [file tail [info nameofexecutable]]]
+ testlongpath exec-longpath-0 "Long path Tcl installation" {
+ file mkdir $installDir/bin
+ file mkdir $installDir/lib
+ # Copy executables and library
+ set srcdir [file dirname [info nameofexecutable]]
+ file copy -force [info nameofexecutable] $deepExe
+ foreach f [glob [file join $srcBinDir *.dll]] {
+ file copy -force $f [file join $installDir bin]
+ }
+ file copy -force [file join $testsDir .. library] [file join $installDir lib/tcl[info tclversion]]
+ set script [file join $installDir x.tcl]
+ writeFile $script {puts [info nameofexecutable],[info library]}
+ catch {set oldenv $env(TCL_LIBRARY)}
+ set env(TCL_LIBRARY) [file join $installDir lib]
+ set olddir [pwd]
+ cd $installDir/bin
+ set code [catch {exec $deepExe $script} output]
+ cd $olddir
+ if {[info exists oldenv]} {
+ set env(TCL_LIBRARY) $oldenv
+ }
+ list $code $output
+ } -result [list 0 $deepExe,[file join $deepPathDir lib]]
}
}
namespace delete testlongpaths
@@ -1837,87 +1837,87 @@ namespace delete testlongpaths
testConstraint testwinerror [llength [info commands testwinerror]]
namespace eval testwinerror {
catch {
- variable regOut [exec {*}[auto_execok reg] query {HKCU\Control Panel\International} /v LocaleName]
- if {[regexp -nocase {en-US} $regOut]} {
- testConstraint englishLocale 1
- }
+ variable regOut [exec {*}[auto_execok reg] query {HKCU\Control Panel\International} /v LocaleName]
+ if {[regexp -nocase {en-US} $regOut]} {
+ testConstraint englishLocale 1
+ }
}
- variable pdhErrorCode 0x800007D0
+ variable pdhErrorCode 0x800007D0
proc test args {
- uplevel 1 [list ::tcltest::test {*}$args -constraints [list win englishLocale testwinerror]]
+ uplevel 1 [list ::tcltest::test {*}$args -constraints [list win englishLocale testwinerror]]
}
test winerror-appendmessage-0 "Get Windows error message" -body {
- testwinerror appendmessage 4
+ testwinerror appendmessage 4
} -result [list 1 {The system cannot open the file.}]
test winerror-appendmessage-1 "Get Windows error message with a header" -body {
- testwinerror appendmessage 4 "System error:"
+ testwinerror appendmessage 4 "System error:"
} -result [list 1 {System error: The system cannot open the file.}]
test winerror-appendmessage-2 {
- Get Windows error message with a header having trailing space
+ Get Windows error message with a header having trailing space
} -body {
- testwinerror appendmessage 4 "System error: "
+ testwinerror appendmessage 4 "System error: "
} -result [list 1 {System error: The system cannot open the file.}]
test winerror-appendmessage-3 {
- Get Windows message for non-system message id
+ Get Windows message for non-system message id
} -body {
- testwinerror appendmessage $pdhErrorCode
+ testwinerror appendmessage $pdhErrorCode
} -result [list 0 {unknown error: 0x800007d0}]
test winerror-appendmessage-4 {
- Get Windows message for non-system message id with header
+ Get Windows message for non-system message id with header
} -body {
- testwinerror appendmessage $pdhErrorCode "Non-system error:"
+ testwinerror appendmessage $pdhErrorCode "Non-system error:"
} -result [list 0 {Non-system error: unknown error: 0x800007d0}]
test winerror-appendmessage-5 {
- Get Windows message for non-system message id - no default message
+ Get Windows message for non-system message id - no default message
} -body {
- testwinerror appendmessage $pdhErrorCode "" 0
+ testwinerror appendmessage $pdhErrorCode "" 0
} -result [list 0 {}]
test winerror-appendmessage-6 {
- Get message for non-system message id
+ Get message for non-system message id
} -body {
- testwinerror appendmessage $pdhErrorCode "" 0 pdh.dll
+ testwinerror appendmessage $pdhErrorCode "" 0 pdh.dll
} -result [list 1 {Unable to connect to the specified computer or the computer is offline.}]
test winerror-appendmessage-7 {
- Get non-existent message for non-system message id
+ Get non-existent message for non-system message id
} -body {
- testwinerror appendmessage 0x123 "" 1 pdh.dll
+ testwinerror appendmessage 0x123 "" 1 pdh.dll
} -result [list 0 {unknown error: 0x123}]
test winerror-raiseerror-0 {
- Raise a Windows error
+ Raise a Windows error
} -body {
- list [catch {testwinerror raiseerror 4} m d] $m [dict get $d -errorcode]
+ list [catch {testwinerror raiseerror 4} m d] $m [dict get $d -errorcode]
} -result [list 1 {The system cannot open the file.} {WINDOWS 0x4 {The system cannot open the file.}}]
test winerror-raiseerror-1 {
- Raise a Windows error with prefix
+ Raise a Windows error with prefix
} -body {
- list [catch {testwinerror raiseerror 4 "System error:"} m d] $m [dict get $d -errorcode]
+ list [catch {testwinerror raiseerror 4 "System error:"} m d] $m [dict get $d -errorcode]
} -result [list 1 {System error: The system cannot open the file.} {WINDOWS 0x4 {System error: The system cannot open the file.}}]
test winerror-raiseerror-2 {
- Raise a Windows error with prefix with trailing space
+ Raise a Windows error with prefix with trailing space
} -body {
- list [catch {testwinerror raiseerror 4 "System error: "} m d] $m [dict get $d -errorcode]
+ list [catch {testwinerror raiseerror 4 "System error: "} m d] $m [dict get $d -errorcode]
} -result [list 1 {System error: The system cannot open the file.} {WINDOWS 0x4 {System error: The system cannot open the file.}}]
test winerror-raiseerror-3 {
- Raise a Windows error with bad error code
+ Raise a Windows error with bad error code
} -body {
- list [catch {testwinerror raiseerror $pdhErrorCode} m d] $m [dict get $d -errorcode]
+ list [catch {testwinerror raiseerror $pdhErrorCode} m d] $m [dict get $d -errorcode]
} -result [list 1 {unknown error: 0x800007d0} {WINDOWS 0x800007d0 {unknown error: 0x800007d0}}]
test winerror-raiseerror-4 {
- Raise a Windows error with non-system error code
+ Raise a Windows error with non-system error code
} -body {
- list [catch {testwinerror raiseerror $pdhErrorCode "" pdh.dll} m d] $m [dict get $d -errorcode]
+ list [catch {testwinerror raiseerror $pdhErrorCode "" pdh.dll} m d] $m [dict get $d -errorcode]
} -result [list 1 {Unable to connect to the specified computer or the computer is offline.} {WINDOWS 0x800007d0 {Unable to connect to the specified computer or the computer is offline.}}]
}
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index c0b83ce..5e258c0 100644
--- a/win/tclWinFCmd.c
+++ b/win/tclWinFCmd.c
@@ -236,7 +236,7 @@ DoRenameFile(
}
} else {
if ((dstAttr & FILE_ATTRIBUTE_DIRECTORY) == 0) {
- /*
+ /*
* MoveFileEx will actually allow this but that is not 9.0-
* behaved when emulating the Unix DoRenameFile.
*/
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index dd1c71b..85883d3 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -1525,7 +1525,7 @@ TclpGetUserHome(
}
}
if (winPathBuf) {
- result = Tcl_WCharToUtfDString(winPathBuf,
+ result = Tcl_WCharToUtfDString(winPathBuf,
winPathSize-1, bufferPtr);
rc = 1;
}
@@ -3493,10 +3493,10 @@ TclWinGetFullPathName(
* equal to capacity, the buffer was too small.
*/
if (numChars < capacity) {
- if (filePartPtrPtr != NULL) {
- *filePartPtrPtr = filePartPtr;
- }
- return fullPathPtr;
+ if (filePartPtrPtr != NULL) {
+ *filePartPtrPtr = filePartPtr;
+ }
+ return fullPathPtr;
}
/*
@@ -3507,12 +3507,12 @@ TclWinGetFullPathName(
fullPathPtr = TclWinPathResize(winPathPtr, capacity);
numChars = GetFullPathNameW(pathPtr, capacity, fullPathPtr, &filePartPtr);
if (numChars == 0 || numChars >= capacity) {
- /* Failed or still too small (shouldn't happen). */
+ /* Failed or still too small (shouldn't happen). */
goto errorReturn;
}
if (filePartPtrPtr != NULL) {
- *filePartPtrPtr = filePartPtr;
+ *filePartPtrPtr = filePartPtr;
}
return fullPathPtr;
@@ -3563,7 +3563,7 @@ TclWinGetCurrentDirectory(
* equal to capacity, the buffer was too small.
*/
if (numChars < capacity) {
- return fullPathPtr;
+ return fullPathPtr;
}
/*
@@ -3574,7 +3574,7 @@ TclWinGetCurrentDirectory(
fullPathPtr = TclWinPathResize(winPathPtr, capacity);
numChars = GetCurrentDirectoryW(capacity, fullPathPtr);
if (numChars == 0 || numChars >= capacity) {
- /* Failed or still too small (shouldn't happen). */
+ /* Failed or still too small (shouldn't happen). */
goto errorReturn;
}
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index 4823663..8e8a9df 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -104,7 +104,7 @@ TclGetWinInfoOnce(
}
tclWinInfo.longPathsSupported = 0;
- if (tclWinInfo.osVersion.dwMajorVersion > 10 ||
+ if (tclWinInfo.osVersion.dwMajorVersion > 10 ||
(tclWinInfo.osVersion.dwMajorVersion == 10 &&
tclWinInfo.osVersion.dwBuildNumber >= 14393)) {
dw = sizeof(tclWinInfo.longPathsSupported);
@@ -871,7 +871,7 @@ TclWinGetEnvironmentVariable(
* equal to capacity, the buffer was too small.
*/
if (numChars < capacity) {
- return fullPathPtr;
+ return fullPathPtr;
}
/*
@@ -882,7 +882,7 @@ TclWinGetEnvironmentVariable(
fullPathPtr = TclWinPathResize(winPathPtr, capacity);
numChars = GetEnvironmentVariableW(envName, fullPathPtr, capacity);
if (numChars == 0 || numChars >= capacity) {
- /* Failed or still too small (shouldn't happen). */
+ /* Failed or still too small (shouldn't happen). */
goto errorReturn;
}
diff --git a/win/tclWinTest.c b/win/tclWinTest.c
index 1608a1d..6446ef1 100644
--- a/win/tclWinTest.c
+++ b/win/tclWinTest.c
@@ -686,7 +686,7 @@ TestchmodCmd(
* Results:
* 1 if long path support is enabled, 0 if not.
*/
-static int
+static int
TestlongpathsettingCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp,