From: Paul Cruz Date: Tue, 11 Jul 2017 22:00:52 +0000 (-0700) Subject: added error message, updated copying dictionary into the input buffer X-Git-Tag: v1.3.1^2~13^2^2~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3c077b8c6a88e5c1f3bcfe61cc010c3f1721760;p=thirdparty%2Fzstd.git added error message, updated copying dictionary into the input buffer --- diff --git a/contrib/adaptive-compression/adapt.c b/contrib/adaptive-compression/adapt.c index 9a527ff5e..2bd1c4f95 100644 --- a/contrib/adaptive-compression/adapt.c +++ b/contrib/adaptive-compression/adapt.c @@ -270,6 +270,7 @@ static void* compressionThread(void* arg) if (currJob != 0) { /* not first job */ size_t const hSize = ZSTD_compressContinue(ctx->cctx, job->dst.start, job->dst.size, job->src.start, job->src.size); if (ZSTD_isError(hSize)) { + DISPLAY("Error: something went wrong while continuing compression\n"); job->compressedSize = hSize; ctx->threadError = 1; return arg; @@ -410,8 +411,10 @@ static int createCompressionJob(adaptCCtx* ctx, size_t srcSize, int last) /* if not on the last job, reuse data as dictionary in next job */ if (!last) { - ctx->input.filled = srcSize; - memmove(ctx->input.buffer.start, ctx->input.buffer.start + ctx->input.filled, srcSize); + size_t const newDictSize = srcSize; + size_t const oldDictSize = ctx->input.filled; + memmove(ctx->input.buffer.start, ctx->input.buffer.start + oldDictSize + srcSize - newDictSize, newDictSize); + ctx->input.filled = newDictSize; } return 0; }