summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorW. Felix Handte <w@felixhandte.com>2018-04-27 17:57:10 (GMT)
committerW. Felix Handte <w@felixhandte.com>2018-04-27 17:57:10 (GMT)
commit7d11e344130a16a529e3ee15a16a10f2e67faa3c (patch)
tree84af98a77ecbac1ebd48e505aa43f1e6408c16e0
parent00909b27b1acaa22f02cfcb8dd7798c7638046e4 (diff)
downloadlz4-7d11e344130a16a529e3ee15a16a10f2e67faa3c.zip
lz4-7d11e344130a16a529e3ee15a16a10f2e67faa3c.tar.gz
lz4-7d11e344130a16a529e3ee15a16a10f2e67faa3c.tar.bz2
Rename LZ4F_applyCDict() -> LZ4F_initStream()
-rw-r--r--lib/lz4frame.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/lz4frame.c b/lib/lz4frame.c
index 4d6d39c..e2be990 100644
--- a/lib/lz4frame.c
+++ b/lib/lz4frame.c
@@ -528,7 +528,15 @@ LZ4F_errorCode_t LZ4F_freeCompressionContext(LZ4F_compressionContext_t LZ4F_comp
}
-static void LZ4F_applyCDict(void* ctx,
+/**
+ * This function prepares the internal LZ4(HC) stream for a new compression,
+ * resetting the context and attaching the dictionary, if there is one.
+ *
+ * It needs to be called at the beginning of each independent compression
+ * stream (i.e., at the beginning of a frame in blockLinked mode, or at the
+ * beginning of each block in blockIndependent mode).
+ */
+static void LZ4F_initStream(void* ctx,
const LZ4F_CDict* cdict,
int level) {
if (level < LZ4HC_CLEVEL_MIN) {
@@ -610,7 +618,7 @@ size_t LZ4F_compressBegin_usingCDict(LZ4F_cctx* cctxPtr,
cctxPtr->cdict = cdict;
if (cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked) {
/* frame init only for blockLinked : blockIndependent will be init at each block */
- LZ4F_applyCDict(cctxPtr->lz4CtxPtr, cdict, cctxPtr->prefs.compressionLevel);
+ LZ4F_initStream(cctxPtr->lz4CtxPtr, cdict, cctxPtr->prefs.compressionLevel);
}
/* Magic Number */
@@ -705,7 +713,7 @@ static size_t LZ4F_makeBlock(void* dst, const void* src, size_t srcSize,
static int LZ4F_compressBlock(void* ctx, const char* src, char* dst, int srcSize, int dstCapacity, int level, const LZ4F_CDict* cdict)
{
int const acceleration = (level < -1) ? -level : 1;
- LZ4F_applyCDict(ctx, cdict, level);
+ LZ4F_initStream(ctx, cdict, level);
if (cdict) {
return LZ4_compress_fast_continue((LZ4_stream_t*)ctx, src, dst, srcSize, dstCapacity, acceleration);
} else {
@@ -722,7 +730,7 @@ static int LZ4F_compressBlock_continue(void* ctx, const char* src, char* dst, in
static int LZ4F_compressBlockHC(void* ctx, const char* src, char* dst, int srcSize, int dstCapacity, int level, const LZ4F_CDict* cdict)
{
- LZ4F_applyCDict(ctx, cdict, level);
+ LZ4F_initStream(ctx, cdict, level);
if (cdict) {
return LZ4_compress_HC_continue((LZ4_streamHC_t*)ctx, src, dst, srcSize, dstCapacity);
}