diff options
| author | sebres <sebres@users.sourceforge.net> | 2025-08-25 23:17:15 (GMT) |
|---|---|---|
| committer | sebres <sebres@users.sourceforge.net> | 2025-08-25 23:17:15 (GMT) |
| commit | 029911a41387d4067a4232968d6488c98e30baea (patch) | |
| tree | e320eb44c55956564af3eda638faf497aaee64a3 | |
| parent | ac8205c8eed06a2a1ba2f3d3111601f454146e35 (diff) | |
| parent | 4478afff2aa58272cd2300927f054c710c4cc1c1 (diff) | |
| download | tcl-029911a41387d4067a4232968d6488c98e30baea.zip tcl-029911a41387d4067a4232968d6488c98e30baea.tar.gz tcl-029911a41387d4067a4232968d6488c98e30baea.tar.bz2 | |
merge 9.0
| -rw-r--r-- | generic/tclEncoding.c | 8 | ||||
| -rw-r--r-- | generic/tclZipfs.c | 52 |
2 files changed, 21 insertions, 39 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 0f19716..00cd044 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -996,15 +996,15 @@ Tcl_SetSystemEncoding( ((Encoding *)encoding)->refCount += 1; } else { encoding = Tcl_GetEncoding(interp, name); + if (encoding == NULL) { + Tcl_MutexUnlock(&encodingMutex); + return TCL_ERROR; + } if (encoding == systemEncoding) { FreeEncoding(encoding); Tcl_MutexUnlock(&encodingMutex); return TCL_OK; } - if (encoding == NULL) { - Tcl_MutexUnlock(&encodingMutex); - return TCL_ERROR; - } } assert(encoding != systemEncoding); diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index ca0cd30..df9b99e 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -6384,7 +6384,7 @@ ZipfsAppHookFindTclInit( if (zipfs_literal_tcl_library) { return TCL_ERROR; } - if (TclZipfs_Mount(NULL, archive, ZIPFS_ZIP_MOUNT, NULL)) { + if (TclZipfs_Mount(NULL, archive, ZIPFS_ZIP_MOUNT, NULL) != TCL_OK) { /* Either the file doesn't exist or it is not a zip archive */ return TCL_ERROR; } @@ -6526,17 +6526,19 @@ TclZipfs_AppHook( archive = Tcl_GetNameOfExecutable(); TclZipfs_Init(NULL); /* - * Look for init.tcl in one of the locations mounted later in this - * function. Errors ignored as other locations may be available. + * After mount, we'll look for init.tcl in one of the mounted locations. + * Thereby errors ignored as other locations may be available. */ - if (TclZipfsLocateTclLibrary() == TCL_OK) { - (void) TclZipfsInitEncodingDirs(); - } - if (!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) { - int found; + if (TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL) == TCL_OK) { Tcl_Obj *vfsInitScript; + if (!zipfs_literal_tcl_library) { + if (TclZipfsLocateTclLibrary() == TCL_OK) { + (void) TclZipfsInitEncodingDirs(); + } + } + TclNewLiteralStringObj(vfsInitScript, ZIPFS_APP_MOUNT "/main.tcl"); Tcl_IncrRefCount(vfsInitScript); if (Tcl_FSAccess(vfsInitScript, F_OK) == 0) { @@ -6549,21 +6551,6 @@ TclZipfs_AppHook( Tcl_DecrRefCount(vfsInitScript); } - /* - * Set Tcl Encodings - */ - - if (!zipfs_literal_tcl_library) { - TclNewLiteralStringObj(vfsInitScript, - ZIPFS_APP_MOUNT "/tcl_library/init.tcl"); - Tcl_IncrRefCount(vfsInitScript); - found = Tcl_FSAccess(vfsInitScript, F_OK); - Tcl_DecrRefCount(vfsInitScript); - if (found == TCL_OK) { - zipfs_literal_tcl_library = ZIPFS_APP_MOUNT "/tcl_library"; - return result; - } - } #ifdef SUPPORT_BUILTIN_ZIP_INSTALL } else if (*argcPtr > 1) { /* @@ -6595,10 +6582,15 @@ TclZipfs_AppHook( Tcl_SetStartupScript(vfsInitScript, NULL); } return result; - } else if (!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) { - int found; + } else if (TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL) == TCL_OK) { Tcl_Obj *vfsInitScript; + if (!zipfs_literal_tcl_library) { + if (TclZipfsLocateTclLibrary() == TCL_OK) { + (void) TclZipfsInitEncodingDirs(); + } + } + TclNewLiteralStringObj(vfsInitScript, ZIPFS_APP_MOUNT "/main.tcl"); Tcl_IncrRefCount(vfsInitScript); if (Tcl_FSAccess(vfsInitScript, F_OK) == 0) { @@ -6610,16 +6602,6 @@ TclZipfs_AppHook( } else { Tcl_DecrRefCount(vfsInitScript); } - /* Set Tcl Encodings */ - TclNewLiteralStringObj(vfsInitScript, - ZIPFS_APP_MOUNT "/tcl_library/init.tcl"); - Tcl_IncrRefCount(vfsInitScript); - found = Tcl_FSAccess(vfsInitScript, F_OK); - Tcl_DecrRefCount(vfsInitScript); - if (found == TCL_OK) { - zipfs_literal_tcl_library = ZIPFS_APP_MOUNT "/tcl_library"; - return result; - } } #ifdef _WIN32 Tcl_DStringFree(&ds); |
