Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch tip-400-impl Through [e1ad1c7bd0] Excluding Merge-Ins
This is equivalent to a diff from d04f1fc81a to e1ad1c7bd0
|
2012-04-17
| ||
| 07:42 | Working towards the channel transform config options. check-in: dec545b884 user: dkf tags: tip-400-impl | |
|
2012-04-15
| ||
| 21:05 | Refactor some [zlib] subcommands into their own functions check-in: e1ad1c7bd0 user: dkf tags: tip-400-impl | |
| 14:07 | Remove some low-value C stack frames. check-in: daf94de0ca user: dkf tags: trunk | |
| 10:12 | merge trunk check-in: bd9cd15006 user: dkf tags: tip-400-impl | |
| 10:07 | * generic/tclZlib.c (ZlibTransformSetOption): [Bug 3517696]: Make flushing work correctly in a pus... check-in: d04f1fc81a user: dkf tags: trunk | |
|
2012-04-13
| ||
| 22:29 | sync win/rules.vc with Tk version check-in: ead472afb0 user: jan.nijtmans tags: trunk | |
Changes to generic/tcl.decls.
| ︙ | |||
2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 | 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 | + + + + |
declare 628 {
void *Tcl_FindSymbol(Tcl_Interp *interp, Tcl_LoadHandle handle,
const char *symbol)
}
declare 629 {
int Tcl_FSUnloadFile(Tcl_Interp *interp, Tcl_LoadHandle handlePtr)
}
declare 630 {
void* Tcl_ZlibStreamGetZstreamp(Tcl_ZlibStream zshandle)
}
# ----- BASELINE -- FOR -- 8.6.0 ----- #
##############################################################################
# Define the platform specific public Tcl interface. These functions are only
# available on the designated platform.
|
| ︙ |
Changes to generic/tclDecls.h.
| ︙ | |||
1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 | 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 | + + |
void *procPtrs, Tcl_LoadHandle *handlePtr);
/* 628 */
EXTERN void * Tcl_FindSymbol(Tcl_Interp *interp,
Tcl_LoadHandle handle, const char *symbol);
/* 629 */
EXTERN int Tcl_FSUnloadFile(Tcl_Interp *interp,
Tcl_LoadHandle handlePtr);
/* 630 */
EXTERN void* Tcl_ZlibStreamGetZstreamp(Tcl_ZlibStream zshandle);
typedef struct TclStubHooks {
const struct TclPlatStubs *tclPlatStubs;
const struct TclIntStubs *tclIntStubs;
const struct TclIntPlatStubs *tclIntPlatStubs;
} TclStubHooks;
|
| ︙ | |||
2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 | 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 | + |
Tcl_Obj * (*tcl_GetStartupScript) (const char **encodingPtr); /* 623 */
int (*tcl_CloseEx) (Tcl_Interp *interp, Tcl_Channel chan, int flags); /* 624 */
int (*tcl_NRExprObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Obj *resultPtr); /* 625 */
int (*tcl_NRSubstObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 626 */
int (*tcl_LoadFile) (Tcl_Interp *interp, Tcl_Obj *pathPtr, const char *const symv[], int flags, void *procPtrs, Tcl_LoadHandle *handlePtr); /* 627 */
void * (*tcl_FindSymbol) (Tcl_Interp *interp, Tcl_LoadHandle handle, const char *symbol); /* 628 */
int (*tcl_FSUnloadFile) (Tcl_Interp *interp, Tcl_LoadHandle handlePtr); /* 629 */
void* (*tcl_ZlibStreamGetZstreamp) (Tcl_ZlibStream zshandle); /* 630 */
} TclStubs;
#ifdef __cplusplus
extern "C" {
#endif
extern const TclStubs *tclStubsPtr;
#ifdef __cplusplus
|
| ︙ | |||
3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 | 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 | + + | (tclStubsPtr->tcl_NRSubstObj) /* 626 */ #define Tcl_LoadFile \ (tclStubsPtr->tcl_LoadFile) /* 627 */ #define Tcl_FindSymbol \ (tclStubsPtr->tcl_FindSymbol) /* 628 */ #define Tcl_FSUnloadFile \ (tclStubsPtr->tcl_FSUnloadFile) /* 629 */ #define Tcl_ZlibStreamGetZstreamp \ (tclStubsPtr->tcl_ZlibStreamGetZstreamp) /* 630 */ #endif /* defined(USE_TCL_STUBS) */ /* !END!: Do not edit above this line. */ #if defined(USE_TCL_STUBS) # undef Tcl_CreateInterp |
| ︙ |
Changes to generic/tclStubInit.c.
| ︙ | |||
1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 | 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 | + |
Tcl_GetStartupScript, /* 623 */
Tcl_CloseEx, /* 624 */
Tcl_NRExprObj, /* 625 */
Tcl_NRSubstObj, /* 626 */
Tcl_LoadFile, /* 627 */
Tcl_FindSymbol, /* 628 */
Tcl_FSUnloadFile, /* 629 */
Tcl_ZlibStreamGetZstreamp, /* 630 */
};
/* !END!: Do not edit above this line. */
|
Changes to generic/tclZlib.c.
| ︙ | |||
60 61 62 63 64 65 66 67 68 69 70 71 72 73 | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | + + + + + |
int format; /* Flags from the TCL_ZLIB_FORMAT_* */
int level; /* Default 5, 0-9 */
int flush; /* Stores the flush param for deferred the
* decompression. */
int wbits; /* The encoded compression mode, so we can
* restart the stream if necessary. */
Tcl_Command cmd; /* Token for the associated Tcl command. */
Tcl_Obj *compDictObj; /* Byte-array object containing compression
* dictionary (not dictObj!) to use if
* necessary. */
GzipHeader *gzHeaderPtr; /* If we've allocated a gzip header
* structure. */
} ZlibStreamHandle;
/*
* Structure used for stacked channel compression and decompression.
*/
typedef struct {
|
| ︙ | |||
86 87 88 89 90 91 92 93 94 95 96 97 98 99 | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | + + + |
int inAllocated, outAllocated;
/* Sizes of working buffers. */
GzipHeader inHeader; /* Header read from input stream, when
* decompressing a gzip stream. */
GzipHeader outHeader; /* Header to write to an output stream, when
* compressing a gzip stream. */
Tcl_TimerToken timer; /* Timer used for keeping events fresh. */
Tcl_Obj *compDictObj; /* Byte-array object containing compression
* dictionary (not dictObj!) to use if
* necessary. */
} ZlibChannelData;
/*
* Value bits for the flags field. Definitions are:
* ASYNC - Whether this is an asynchronous channel.
* IN_HEADER - Whether the inHeader field has been registered with
* the input compressor.
|
| ︙ | |||
135 136 137 138 139 140 141 142 143 | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | + + - + + + + | static Tcl_ObjCmdProc ZlibCmd; static Tcl_ObjCmdProc ZlibStreamCmd; static void ConvertError(Tcl_Interp *interp, int code); static void ExtractHeader(gz_header *headerPtr, Tcl_Obj *dictObj); static int GenerateHeader(Tcl_Interp *interp, Tcl_Obj *dictObj, GzipHeader *headerPtr, int *extraSizePtr); static int ZlibPushSubcmd(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static Tcl_Channel ZlibStackChannelTransform(Tcl_Interp *interp, int mode, int format, int level, |
| ︙ | |||
205 206 207 208 209 210 211 212 213 214 215 216 217 218 | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | + |
switch (code) {
case Z_STREAM_ERROR: codeStr = "STREAM"; break;
case Z_DATA_ERROR: codeStr = "DATA"; break;
case Z_MEM_ERROR: codeStr = "MEM"; break;
case Z_BUF_ERROR: codeStr = "BUF"; break;
case Z_VERSION_ERROR: codeStr = "VERSION"; break;
case Z_NEED_DICT: codeStr = "NEED_DICT"; break;
default:
codeStr = "unknown";
codeStr2 = codeStrBuf;
sprintf(codeStrBuf, "%d", code);
break;
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(zError(code), -1));
|
| ︙ | |||
290 291 292 293 294 295 296 | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | + - + + + - + + |
} else if (value != NULL) {
valueStr = Tcl_GetStringFromObj(value, &len);
Tcl_UtfToExternal(NULL, latin1enc, valueStr, len, 0, NULL,
headerPtr->nativeCommentBuf, MAX_COMMENT_LEN-1, NULL, &len,
NULL);
headerPtr->nativeCommentBuf[len] = '\0';
headerPtr->header.comment = (Bytef *) headerPtr->nativeCommentBuf;
if (extraSizePtr != NULL) {
|
| ︙ | |||
433 434 435 436 437 438 439 440 441 442 443 444 445 446 | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
Tcl_NewStringObj(headerPtr->text ? "text" : "binary", -1));
}
if (latin1enc != NULL) {
Tcl_FreeEncoding(latin1enc);
}
}
static int
SetInflateDictionary(
z_streamp strm,
Tcl_Obj *compDictObj)
{
if (compDictObj != NULL) {
int length;
unsigned char *bytes = Tcl_GetByteArrayFromObj(compDictObj, &length);
return inflateSetDictionary(strm, bytes, (unsigned) length);
}
return Z_OK;
}
static int
SetDeflateDictionary(
z_streamp strm,
Tcl_Obj *compDictObj)
{
if (compDictObj != NULL) {
int length;
unsigned char *bytes = Tcl_GetByteArrayFromObj(compDictObj, &length);
return deflateSetDictionary(strm, bytes, (unsigned) length);
}
return Z_OK;
}
/*
*----------------------------------------------------------------------
*
* Tcl_ZlibStreamInit --
*
* This command initializes a (de)compression context/handle for
|
| ︙ | |||
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 | 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 | + + + + + + + + + + |
Tcl_ZlibStream *zshandlePtr)
{
int wbits = 0;
int e;
ZlibStreamHandle *zshPtr = NULL;
Tcl_DString cmdname;
Tcl_CmdInfo cmdinfo;
GzipHeader *gzHeaderPtr = NULL;
switch (mode) {
case TCL_ZLIB_STREAM_DEFLATE:
/*
* Compressed format is specified by the wbits parameter. See zlib.h
* for details.
*/
switch (format) {
case TCL_ZLIB_FORMAT_RAW:
wbits = WBITS_RAW;
break;
case TCL_ZLIB_FORMAT_GZIP:
wbits = WBITS_GZIP;
if (dictObj) {
gzHeaderPtr = ckalloc(sizeof(GzipHeader));
memset(gzHeaderPtr, 0, sizeof(GzipHeader));
if (GenerateHeader(interp, dictObj, gzHeaderPtr,
NULL) != TCL_OK) {
ckfree(gzHeaderPtr);
return TCL_ERROR;
}
}
break;
case TCL_ZLIB_FORMAT_ZLIB:
wbits = WBITS_ZLIB;
break;
default:
Tcl_Panic("incorrect zlib data format, must be "
"TCL_ZLIB_FORMAT_ZLIB, TCL_ZLIB_FORMAT_GZIP or "
|
| ︙ | |||
512 513 514 515 516 517 518 519 520 521 522 523 524 525 | 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | + + + + + + + + |
switch (format) {
case TCL_ZLIB_FORMAT_RAW:
wbits = WBITS_RAW;
break;
case TCL_ZLIB_FORMAT_GZIP:
wbits = WBITS_GZIP;
gzHeaderPtr = ckalloc(sizeof(GzipHeader));
memset(gzHeaderPtr, 0, sizeof(GzipHeader));
gzHeaderPtr->header.name = (Bytef *)
gzHeaderPtr->nativeFilenameBuf;
gzHeaderPtr->header.name_max = MAXPATHLEN - 1;
gzHeaderPtr->header.comment = (Bytef *)
gzHeaderPtr->nativeCommentBuf;
gzHeaderPtr->header.name_max = MAX_COMMENT_LEN - 1;
break;
case TCL_ZLIB_FORMAT_ZLIB:
wbits = WBITS_ZLIB;
break;
case TCL_ZLIB_FORMAT_AUTO:
wbits = WBITS_AUTODETECT;
break;
|
| ︙ | |||
538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 | 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 | + + + + + + + + + + + + + + + + |
zshPtr->interp = interp;
zshPtr->mode = mode;
zshPtr->format = format;
zshPtr->level = level;
zshPtr->wbits = wbits;
zshPtr->currentInput = NULL;
zshPtr->streamEnd = 0;
zshPtr->compDictObj = NULL;
zshPtr->gzHeaderPtr = gzHeaderPtr;
memset(&zshPtr->stream, 0, sizeof(z_stream));
/*
* No output buffer available yet
*/
if (mode == TCL_ZLIB_STREAM_DEFLATE) {
e = deflateInit2(&zshPtr->stream, level, Z_DEFLATED, wbits,
MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY);
if (e == Z_OK && zshPtr->gzHeaderPtr) {
e = deflateSetHeader(&zshPtr->stream,
&zshPtr->gzHeaderPtr->header);
}
if (e == Z_OK && zshPtr->compDictObj) {
e = SetDeflateDictionary(&zshPtr->stream, zshPtr->compDictObj);
}
} else {
e = inflateInit2(&zshPtr->stream, wbits);
if (e == Z_OK && zshPtr->gzHeaderPtr) {
e = inflateGetHeader(&zshPtr->stream,
&zshPtr->gzHeaderPtr->header);
}
if (format==TCL_ZLIB_FORMAT_RAW && zshPtr->compDictObj && e==Z_OK) {
e = SetInflateDictionary(&zshPtr->stream, zshPtr->compDictObj);
}
}
if (e != Z_OK) {
ConvertError(interp, e);
goto error;
}
|
| ︙ | |||
613 614 615 616 617 618 619 | 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | + - + + + + + + + |
*/
if (zshandlePtr) {
*zshandlePtr = (Tcl_ZlibStream) zshPtr;
}
return TCL_OK;
|
| ︙ | |||
721 722 723 724 725 726 727 728 729 730 731 732 733 734 | 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | + + + + + + |
}
if (zshPtr->outData) {
Tcl_DecrRefCount(zshPtr->outData);
}
if (zshPtr->currentInput) {
Tcl_DecrRefCount(zshPtr->currentInput);
}
if (zshPtr->compDictObj) {
Tcl_DecrRefCount(zshPtr->compDictObj);
}
if (zshPtr->gzHeaderPtr) {
ckfree(zshPtr->gzHeaderPtr);
}
ckfree(zshPtr);
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | |||
773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 | 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 | + + + + + + + |
/*
* No output buffer available yet.
*/
if (zshPtr->mode == TCL_ZLIB_STREAM_DEFLATE) {
e = deflateInit2(&zshPtr->stream, zshPtr->level, Z_DEFLATED,
zshPtr->wbits, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY);
if (e == Z_OK && zshPtr->compDictObj) {
e = SetDeflateDictionary(&zshPtr->stream, zshPtr->compDictObj);
}
} else {
e = inflateInit2(&zshPtr->stream, zshPtr->wbits);
if (zshPtr->format == TCL_ZLIB_FORMAT_RAW && zshPtr->compDictObj
&& e == Z_OK) {
e = SetInflateDictionary(&zshPtr->stream, zshPtr->compDictObj);
}
}
if (e != Z_OK) {
ConvertError(zshPtr->interp, e);
/* TODO:cleanup */
return TCL_ERROR;
}
|
| ︙ | |||
867 868 869 870 871 872 873 874 875 876 877 878 879 880 | 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 | + + + + + + + + + + + + + + + + + + + + + |
Tcl_ZlibStreamChecksum(
Tcl_ZlibStream zshandle) /* As obtained from Tcl_ZlibStreamInit */
{
ZlibStreamHandle *zshPtr = (ZlibStreamHandle *) zshandle;
return zshPtr->stream.adler;
}
/*
*----------------------------------------------------------------------
*
* Tcl_ZlibStreamGetZstreamp --
*
* Return the z_streamp for the stream (though not typed as such, so as
* to avoid type interface poisoning). Shouldn't be used to poke around
* excessively.
*
*----------------------------------------------------------------------
*/
void *
Tcl_ZlibStreamGetZstreamp(
Tcl_ZlibStream zshandle)
{
ZlibStreamHandle *zshPtr = (ZlibStreamHandle *) zshandle;
return &zshPtr->stream;
}
/*
*----------------------------------------------------------------------
*
* Tcl_ZlibStreamPut --
*
* Add data to the stream for compression or decompression from a
|
| ︙ | |||
1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 | 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 | + + + + + + |
*/
Tcl_ListObjReplace(NULL, zshPtr->inData, 0, 1, 0, NULL);
}
}
e = inflate(&zshPtr->stream, zshPtr->flush);
if (e == Z_NEED_DICT && zshPtr->compDictObj) {
e = SetInflateDictionary(&zshPtr->stream, zshPtr->compDictObj);
if (e == Z_OK) {
e = inflate(&zshPtr->stream, zshPtr->flush);
}
};
Tcl_ListObjLength(NULL, zshPtr->inData, &listLen);
while ((zshPtr->stream.avail_out > 0)
&& (e == Z_OK || e == Z_BUF_ERROR) && (listLen > 0)) {
/*
* State: We have not satisfied the request yet and there may be
* more to inflate.
|
| ︙ | |||
1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 | 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 | + + + + + + |
listLen--;
/*
* And call inflate again.
*/
e = inflate(&zshPtr->stream, zshPtr->flush);
if (e == Z_NEED_DICT && zshPtr->compDictObj) {
e = SetInflateDictionary(&zshPtr->stream,zshPtr->compDictObj);
if (e == Z_OK) {
e = inflate(&zshPtr->stream, zshPtr->flush);
}
}
}
if (zshPtr->stream.avail_out > 0) {
Tcl_SetByteArrayLength(data,
existing + count - zshPtr->stream.avail_out);
}
if (!(e==Z_OK || e==Z_STREAM_END || e==Z_BUF_ERROR)) {
Tcl_SetByteArrayLength(data, existing);
|
| ︙ | |||
1579 1580 1581 1582 1583 1584 1585 | 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 | - + - - + - - - - - - - - |
static int
ZlibCmd(
ClientData notUsed,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
|
| ︙ | |||
1749 1750 1751 1752 1753 1754 1755 | 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 | - + + + |
}
if (buffersize < 16 || buffersize > 65536) {
goto badBuffer;
}
}
return Tcl_ZlibInflate(interp, TCL_ZLIB_FORMAT_ZLIB, objv[2],
buffersize, NULL);
|
| ︙ | |||
1796 1797 1798 1799 1800 1801 1802 1803 | 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 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 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 | + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
headerDictObj, TCL_LEAVE_ERR_MSG) == NULL) {
if (headerDictObj) {
TclDecrRefCount(headerDictObj);
}
return TCL_ERROR;
}
return TCL_OK;
}
case CMD_STREAM: /* stream deflate/inflate/...gunzip \
|
| ︙ | |||
2299 2300 2301 2302 2303 2304 2305 | 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 | - + - - - - + + + - |
}
if (cd->outStream.avail_out != (unsigned) cd->outAllocated) {
if (Tcl_WriteRaw(cd->parent, cd->outBuffer,
cd->outAllocated - cd->outStream.avail_out) < 0) {
/* TODO: is this the right way to do errors on close?
* Note: when close is called from FinalizeIOSubsystem
* then interp may be NULL */
|
| ︙ | |||
2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 | 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 | + + + + + + |
cd->inStream.next_out = (Bytef *) buf;
cd->inStream.avail_out = toRead;
if (cd->inStream.next_in == NULL) {
goto doReadFirst;
}
while (1) {
e = inflate(&cd->inStream, flush);
if (e == Z_NEED_DICT && cd->compDictObj) {
e = SetInflateDictionary(&cd->inStream, cd->compDictObj);
if (e == Z_OK) {
continue;
}
}
if ((e == Z_STREAM_END) || (e==Z_OK && cd->inStream.avail_out==0)) {
return toRead - cd->inStream.avail_out;
}
/*
* Z_BUF_ERROR can be ignored as per http://www.zlib.net/zlib_how.html
*
|
| ︙ | |||
2469 2470 2471 2472 2473 2474 2475 | 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 | - + + + + + |
Tcl_Interp *interp,
const char *optionName,
const char *value)
{
ZlibChannelData *cd = instanceData;
Tcl_DriverSetOptionProc *setOptionProc =
Tcl_ChannelSetOptionProc(Tcl_GetChannelType(cd->parent));
|
| ︙ | |||
2535 2536 2537 2538 2539 2540 2541 | 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 | - + |
Tcl_Interp *interp,
const char *optionName,
Tcl_DString *dsPtr)
{
ZlibChannelData *cd = instanceData;
Tcl_DriverGetOptionProc *getOptionProc =
Tcl_ChannelGetOptionProc(Tcl_GetChannelType(cd->parent));
|
| ︙ | |||
2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 | 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 | + + + + |
Tcl_DStringAppendElement(dsPtr, "-checksum");
Tcl_DStringAppendElement(dsPtr, buf);
} else {
Tcl_DStringAppend(dsPtr, buf, -1);
return TCL_OK;
}
}
if (optionName == NULL || strcmp(optionName, "-dictionary") == 0) {
// TODO dictionary option
}
/*
* The "header" option, which is only valid on inflating gzip channels,
* reports the header that has been read from the start of the stream.
*/
if ((cd->flags & IN_HEADER) && ((optionName == NULL) ||
|
| ︙ | |||
2721 2722 2723 2724 2725 2726 2727 | 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 | - + + + + - - - + + + + + + + |
int format, /* One of the TCL_ZLIB_FORMAT_* values that
* indicates what compressed format to allow.
* TCL_ZLIB_FORMAT_AUTO is only supported for
* decompressing transforms. */
int level, /* What compression level to use. Ignored for
* decompressing transforms. */
Tcl_Channel channel, /* The channel to attach to. */
|
| ︙ | |||
2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 | 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 | + + + + + + |
cd->outBuffer = ckalloc(cd->outAllocated);
if (cd->flags & OUT_HEADER) {
e = deflateSetHeader(&cd->outStream, &cd->outHeader.header);
if (e != Z_OK) {
goto error;
}
}
if (cd->compDictObj) {
e = SetDeflateDictionary(&cd->outStream, cd->compDictObj);
if (e != Z_OK) {
goto error;
}
}
}
chan = Tcl_StackChannel(interp, &zlibChannelType, cd,
Tcl_GetChannelMode(channel), channel);
if (chan == NULL) {
goto error;
}
|
| ︙ | |||
2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 | 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 | + + + |
ckfree(cd->inBuffer);
inflateEnd(&cd->inStream);
}
if (cd->outBuffer) {
ckfree(cd->outBuffer);
deflateEnd(&cd->outStream);
}
if (cd->compDictObj) {
Tcl_DecrRefCount(cd->compDictObj);
}
ckfree(cd);
return NULL;
}
/*
*----------------------------------------------------------------------
* Finally, the TclZlibInit function. Used to install the zlib API.
|
| ︙ | |||
2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 | 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 | + + + + + + + |
Tcl_ZlibAdler32(
unsigned int adler,
const char *buf,
int len)
{
return 0;
}
void *
Tcl_ZlibStreamGetZstreamp(
Tcl_ZlibStream zshandle)
{
return NULL;
}
#endif /* HAVE_ZLIB */
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* End:
*/
|