summaryrefslogtreecommitdiffstats
path: root/generic/tclZlib.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-05-01 08:29:11 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-05-01 08:29:11 (GMT)
commita0fbc952a8b199b3bc07bf4dbef4d504a9eae73e (patch)
treef1f1b08d636e42a846a20c89cb041ff56a8bb0a7 /generic/tclZlib.c
parent8ee166780cbfe234c62b815deec072a75c5dc9ad (diff)
downloadtcl-a0fbc952a8b199b3bc07bf4dbef4d504a9eae73e.zip
tcl-a0fbc952a8b199b3bc07bf4dbef4d504a9eae73e.tar.gz
tcl-a0fbc952a8b199b3bc07bf4dbef4d504a9eae73e.tar.bz2
first actual test of doing something with a compression dictionary
Diffstat (limited to 'generic/tclZlib.c')
-rw-r--r--generic/tclZlib.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index a1b8afc..1fe5b05 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -2272,11 +2272,7 @@ ZlibPushSubcmd(
}
if (ZlibStackChannelTransform(interp, mode, format, level, chan,
- headerObj, NULL) == NULL) {
- return TCL_ERROR;
- }
- if ((compDictObj != NULL) && (Tcl_SetChannelOption(interp, chan,
- "-dictionary", TclGetString(compDictObj)) != TCL_OK)) {
+ headerObj, compDictObj) == NULL) {
return TCL_ERROR;
}
Tcl_SetObjResult(interp, objv[3]);
@@ -2762,6 +2758,7 @@ ZlibTransformSetOption( /* not used */
if (optionName && (strcmp(optionName, "-dictionary") == 0)
&& (cd->format != TCL_ZLIB_FORMAT_GZIP)) {
Tcl_Obj *compDictObj;
+ int code;
TclNewStringObj(compDictObj, value, strlen(value));
Tcl_IncrRefCount(compDictObj);
@@ -2770,7 +2767,14 @@ ZlibTransformSetOption( /* not used */
TclDecrRefCount(cd->compDictObj);
}
cd->compDictObj = compDictObj;
- // TODO: consider whether to apply immediately
+ if (cd->mode == TCL_ZLIB_STREAM_DEFLATE) {
+ code = SetDeflateDictionary(&cd->outStream, compDictObj);
+ if (code != Z_OK) {
+ ConvertError(interp, code);
+ return TCL_ERROR;
+ }
+ }
+ return TCL_OK;
}
if (haveFlushOpt && optionName && strcmp(optionName, "-flush") == 0) {