summaryrefslogtreecommitdiffstats
path: root/generic/tclZlib.c
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2020-04-16 13:28:49 (GMT)
committersebres <sebres@users.sourceforge.net>2020-04-16 13:28:49 (GMT)
commit28f6cfecfd4410c0dec0f0defa344e26ef8a896d (patch)
tree94a39489bcc9b408cac8e6b40954e1334fa0dbb4 /generic/tclZlib.c
parent702a7e39a7c7ac3fa677b58524962fe380ddf3fb (diff)
downloadtcl-28f6cfecfd4410c0dec0f0defa344e26ef8a896d.zip
tcl-28f6cfecfd4410c0dec0f0defa344e26ef8a896d.tar.gz
tcl-28f6cfecfd4410c0dec0f0defa344e26ef8a896d.tar.bz2
zlib: performance - set default read ahead limit to DEFAULT_BUFFER_SIZE (4K); better fix avoiding BO (replacement for [54605d16b9])
Diffstat (limited to 'generic/tclZlib.c')
-rw-r--r--generic/tclZlib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index 1ee8919..23472cf 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -2371,7 +2371,7 @@ ZlibPushSubcmd(
const char *const *pushOptions = pushDecompressOptions;
enum pushOptions {poDictionary, poHeader, poLevel, poLimit};
Tcl_Obj *headerObj = NULL, *compDictObj = NULL;
- int limit = 1, dummy;
+ int limit = DEFAULT_BUFFER_SIZE, dummy;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv, "mode channel ?options...?");
@@ -3661,6 +3661,9 @@ ZlibStackChannelTransform(
goto error;
}
cd->inAllocated = DEFAULT_BUFFER_SIZE;
+ if (cd->inAllocated < cd->readAheadLimit) {
+ cd->inAllocated = cd->readAheadLimit;
+ }
cd->inBuffer = ckalloc(cd->inAllocated);
if (cd->flags & IN_HEADER) {
if (inflateGetHeader(&cd->inStream, &cd->inHeader.header) != Z_OK) {