summaryrefslogtreecommitdiffstats
path: root/lib/lz4frame.c
diff options
context:
space:
mode:
authorW. Felix Handte <w@felixhandte.com>2018-03-21 18:49:47 (GMT)
committerW. Felix Handte <w@felixhandte.com>2018-04-20 00:54:35 (GMT)
commitfdeead0b09188213e51e037edcf9c9daf88d25c4 (patch)
treedc19adae782e95db3085d54ebf0bd2966f3fbe66 /lib/lz4frame.c
parenta992d11fc2204b7cb0a70962aa5911a58ed4918c (diff)
downloadlz4-fdeead0b09188213e51e037edcf9c9daf88d25c4.zip
lz4-fdeead0b09188213e51e037edcf9c9daf88d25c4.tar.gz
lz4-fdeead0b09188213e51e037edcf9c9daf88d25c4.tar.bz2
Set dictCtx Rather than memcpy'ing Ctx
Diffstat (limited to 'lib/lz4frame.c')
-rw-r--r--lib/lz4frame.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/lz4frame.c b/lib/lz4frame.c
index 0000023..821cb49 100644
--- a/lib/lz4frame.c
+++ b/lib/lz4frame.c
@@ -549,12 +549,9 @@ static void LZ4F_applyCDict(void* ctx,
LZ4_resetStream_fast((LZ4_stream_t *)ctx);
LZ4_attach_dictionary((LZ4_stream_t *)ctx, cdict ? cdict->fastCtx : NULL);
} else {
- if (cdict) {
- memcpy(ctx, cdict->HCCtx, sizeof(*cdict->HCCtx));
- LZ4_setCompressionLevel((LZ4_streamHC_t*)ctx, level);
- } else {
- LZ4_resetStreamHC((LZ4_streamHC_t*)(ctx), level);
- }
+ LZ4HC_CCtx_internal *internal_ctx = &((LZ4_streamHC_t *)ctx)->internal_donotuse;
+ LZ4_resetStreamHC((LZ4_streamHC_t*)ctx, level);
+ internal_ctx->dictCtx = cdict ? &(cdict->HCCtx->internal_donotuse) : NULL;
}
}