diff options
| author | apnadkarni <apnmbx-wits@yahoo.com> | 2025-04-28 11:30:02 (GMT) |
|---|---|---|
| committer | apnadkarni <apnmbx-wits@yahoo.com> | 2025-04-28 11:30:02 (GMT) |
| commit | 67681ec324afbb26bfed68799c99ffb0eef0c385 (patch) | |
| tree | 3ae3d4e7939f87e0dc5479d075e61825a0d27d65 | |
| parent | 8e247cc6a3b3360c6f0b2d26f722529376e6d5af (diff) | |
| download | tcl-67681ec324afbb26bfed68799c99ffb0eef0c385.zip tcl-67681ec324afbb26bfed68799c99ffb0eef0c385.tar.gz tcl-67681ec324afbb26bfed68799c99ffb0eef0c385.tar.bz2 | |
Fix cmdAH tests. See comments below.
Tcl_GetEncodingForUser will not be available until 9.1 for stubs compatibility.
In any case, as a rule, wide char API's should be used in code and tests to avoid the exact kind
of problems we are currently trying to solve with code pages.
| -rw-r--r-- | win/tclWinTest.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/win/tclWinTest.c b/win/tclWinTest.c index 01a02a5..005fb37 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.c @@ -43,7 +43,7 @@ static Tcl_ObjCmdProc TestvolumetypeCmd; static Tcl_ObjCmdProc TestwinclockCmd; static Tcl_ObjCmdProc TestwinsleepCmd; static Tcl_ObjCmdProc TestExceptionCmd; -static int TestplatformChmod(const char *nativePath, int pmode, Tcl_Encoding encoding); +static int TestplatformChmod(const char *nativePath, int pmode); static Tcl_ObjCmdProc TestchmodCmd; /* @@ -398,8 +398,7 @@ TestExceptionCmd( static int TestplatformChmod( const char *nativePath, - int pmode, - Tcl_Encoding encoding) + int pmode) { /* * Note FILE_DELETE_CHILD missing from dirWriteMask because we do @@ -445,9 +444,9 @@ TestplatformChmod( res = -1; /* Assume failure */ Tcl_DStringInit(&ds); - Tcl_UtfToExternalDString(encoding, nativePath, -1, &ds); + Tcl_UtfToChar16DString(nativePath, -1, &ds); - attr = GetFileAttributesA(Tcl_DStringValue(&ds)); + attr = GetFileAttributesW((WCHAR *)Tcl_DStringValue(&ds)); if (attr == 0xFFFFFFFF) { goto done; /* Not found */ } @@ -587,7 +586,7 @@ TestplatformChmod( * to remove inherited ACL (we need to overwrite the default ACL's in this case) */ - if (SetNamedSecurityInfoA((LPSTR)Tcl_DStringValue(&ds), SE_FILE_OBJECT, + if (SetNamedSecurityInfoW((LPWSTR)Tcl_DStringValue(&ds), SE_FILE_OBJECT, DACL_SECURITY_INFORMATION | PROTECTED_DACL_SECURITY_INFORMATION, NULL, NULL, newAcl, NULL) == ERROR_SUCCESS) { res = 0; @@ -609,7 +608,7 @@ TestplatformChmod( if (res == 0) { /* Run normal chmod command */ - res = _chmod(Tcl_DStringValue(&ds), pmode); + res = _wchmod((WCHAR*)Tcl_DStringValue(&ds), pmode); } Tcl_DStringFree(&ds); return res; @@ -642,7 +641,6 @@ TestchmodCmd( Tcl_Obj *const * objv) /* Parameter vector */ { int i, mode; - Tcl_DString ds; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "mode file ?file ...?"); @@ -653,9 +651,6 @@ TestchmodCmd( return TCL_ERROR; } - Tcl_Encoding encoding = Tcl_GetEncoding(interp, Tcl_GetEncodingNameForUser(&ds)); - Tcl_DStringFree(&ds); - for (i = 2; i < objc; i++) { Tcl_DString buffer; const char *translated; @@ -664,7 +659,7 @@ TestchmodCmd( if (translated == NULL) { return TCL_ERROR; } - if (TestplatformChmod(translated, mode, encoding) != 0) { + if (TestplatformChmod(translated, mode) != 0) { Tcl_AppendResult(interp, translated, ": ", Tcl_PosixError(interp), (char *)NULL); return TCL_ERROR; |
