summaryrefslogtreecommitdiffstats
path: root/generic/tclZlib.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-06-07 07:12:47 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-06-07 07:12:47 (GMT)
commitead79a6f602323485474451f0e652db7f176c902 (patch)
treea98e38ed7b315ca11a40b7b4af0b7737065ad285 /generic/tclZlib.c
parent392486c0fc59117de0084c05adc0a3b7e5c22125 (diff)
downloadtcl-ead79a6f602323485474451f0e652db7f176c902.zip
tcl-ead79a6f602323485474451f0e652db7f176c902.tar.gz
tcl-ead79a6f602323485474451f0e652db7f176c902.tar.bz2
compressing transforms now work with dictionaries, even if raw
Diffstat (limited to 'generic/tclZlib.c')
-rw-r--r--generic/tclZlib.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index 585b500..544ba50 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -1237,6 +1237,22 @@ Tcl_ZlibStreamGet(
}
}
+ /*
+ * When dealing with a raw stream, we set the dictionary here, once.
+ * (You can't do it in response to getting Z_NEED_DATA as raw streams
+ * don't ever issue that.)
+ */
+
+ if (zshPtr->format == TCL_ZLIB_FORMAT_RAW && zshPtr->compDictObj) {
+ e = SetInflateDictionary(&zshPtr->stream, zshPtr->compDictObj);
+ if (e != Z_OK) {
+ ConvertError(zshPtr->interp, e, zshPtr->stream.adler);
+ return TCL_ERROR;
+ }
+ Tcl_DecrRefCount(zshPtr->compDictObj);
+ zshPtr->compDictObj = NULL;
+ }
+
e = inflate(&zshPtr->stream, zshPtr->flush);
if (e == Z_NEED_DICT && zshPtr->compDictObj) {
e = SetInflateDictionary(&zshPtr->stream, zshPtr->compDictObj);