Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | minor improvements in zipfs::mkimg command |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
2ea6747885a440eae1798be59f0029a5 |
User & Date: | chw 2016-11-06 10:25:27.724 |
Context
2016-11-06
| ||
12:11 | small tweak to make BLT compile on aarch64 check-in: c38ed56751 user: chw tags: trunk | |
10:25 | minor improvements in zipfs::mkimg command check-in: 2ea6747885 user: chw tags: trunk | |
2016-11-05
| ||
12:42 | prepare new release check-in: 6ffd5c2f66 user: chw tags: trunk, Bonfire Night | |
Changes
Changes to jni/tcl/generic/zipfs.c.
︙ | ︙ | |||
2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 | (Tcl_SetChannelOption(interp, out, "-translation", "binary") != TCL_OK) || (Tcl_SetChannelOption(interp, out, "-encoding", "binary") != TCL_OK)) { Tcl_DecrRefCount(list); Tcl_Close(interp, out); return TCL_ERROR; } if (isImg) { ZipFile zf0; const char *imgName; if (isList) { imgName = (objc > 4) ? Tcl_GetString(objv[4]) : Tcl_GetNameOfExecutable(); } else { imgName = (objc > 5) ? Tcl_GetString(objv[5]) : Tcl_GetNameOfExecutable(); } | > > > > < < < < < | > | | > | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 | (Tcl_SetChannelOption(interp, out, "-translation", "binary") != TCL_OK) || (Tcl_SetChannelOption(interp, out, "-encoding", "binary") != TCL_OK)) { Tcl_DecrRefCount(list); Tcl_Close(interp, out); return TCL_ERROR; } if (pwlen <= 0) { pw = NULL; pwlen = 0; } if (isImg) { ZipFile zf0; const char *imgName; if (isList) { imgName = (objc > 4) ? Tcl_GetString(objv[4]) : Tcl_GetNameOfExecutable(); } else { imgName = (objc > 5) ? Tcl_GetString(objv[5]) : Tcl_GetNameOfExecutable(); } if (pwlen) { i = 0; len = pwlen; while (len > 0) { int ch = pw[len - 1]; pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; i++; len--; } pwbuf[i] = i; ++i; pwbuf[i++] = (char) ZIP_PASSWORD_END_SIG; pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 8); pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 16); pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 24); pwbuf[i] = '\0'; } if (ZipFSOpenArchive(interp, imgName, 0, &zf0) == TCL_OK) { i = Tcl_Write(out, (char *) zf0.data, zf0.baseoffsp); if (i != zf0.baseoffsp) { memset(pwbuf, 0, sizeof (pwbuf)); Tcl_DecrRefCount(list); Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); Tcl_Close(interp, out); ZipFSCloseArchive(interp, &zf0); return TCL_ERROR; } ZipFSCloseArchive(interp, &zf0); } else { int k, n, m; Tcl_Channel in; const char *errMsg = "seek error"; /* * Fall back to read it as plain file which * hopefully is a static tclsh or wish binary * with proper zipfs infrastructure built in. */ Tcl_ResetResult(interp); in = Tcl_OpenFileChannel(interp, imgName, "r", 0644); if (in == NULL) { memset(pwbuf, 0, sizeof (pwbuf)); Tcl_DecrRefCount(list); Tcl_Close(interp, out); return TCL_ERROR; } Tcl_SetChannelOption(interp, in, "-translation", "binary"); Tcl_SetChannelOption(interp, in, "-encoding", "binary"); i = Tcl_Seek(in, 0, SEEK_END); if (i == -1) { cperr: memset(pwbuf, 0, sizeof (pwbuf)); Tcl_DecrRefCount(list); Tcl_SetObjResult(interp, Tcl_NewStringObj(errMsg, -1)); Tcl_Close(interp, out); Tcl_Close(interp, in); return TCL_ERROR; } Tcl_Seek(in, 0, SEEK_SET); k = 0; while (k < i) { m = i - k; if (m > sizeof (buf)) { m = sizeof (buf); } n = Tcl_Read(in, buf, m); if (n == -1) { errMsg = "read error"; goto cperr; } else if (n == 0) { break; } m = Tcl_Write(out, buf, n); if (m != n) { errMsg = "write error"; goto cperr; } k += m; } Tcl_Close(interp, in); } len = strlen(pwbuf); if (len > 0) { i = Tcl_Write(out, pwbuf, len); if (i != len) { Tcl_DecrRefCount(list); Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); Tcl_Close(interp, out); |
︙ | ︙ | |||
2210 2211 2212 2213 2214 2215 2216 | } Tcl_DecrRefCount(list); hPtr = Tcl_FirstHashEntry(&fileHash, &search); while (hPtr != NULL) { z = (ZipEntry *) Tcl_GetHashValue(hPtr); Tcl_Free((char *) z); Tcl_DeleteHashEntry(hPtr); | | | 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 | } Tcl_DecrRefCount(list); hPtr = Tcl_FirstHashEntry(&fileHash, &search); while (hPtr != NULL) { z = (ZipEntry *) Tcl_GetHashValue(hPtr); Tcl_Free((char *) z); Tcl_DeleteHashEntry(hPtr); hPtr = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&fileHash); return ret; } /* *------------------------------------------------------------------------- |
︙ | ︙ |
jni/tcl/library/tzdata/America/Resolute became a regular file.
︙ | ︙ |
jni/tcl/tests/tcltest.test became a regular file.
︙ | ︙ |