Merge pull request #3395 from terrelln/2022-12-21-deprecated-test

[tests] Remove deprecated function from longmatch.c test
This commit is contained in:
Yann Collet 2022-12-28 15:49:50 -08:00 committed by GitHub
commit bcbd395c1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,27 +36,27 @@ compress(ZSTD_CStream *ctx, ZSTD_outBuffer out, const void *data, size_t size)
int main(int argc, const char** argv) int main(int argc, const char** argv)
{ {
ZSTD_CStream* ctx; ZSTD_CStream* ctx;
ZSTD_parameters params; unsigned windowLog = 18;
size_t rc;
unsigned windowLog;
(void)argc; (void)argc;
(void)argv; (void)argv;
/* Create stream */ /* Create stream */
ctx = ZSTD_createCStream(); ctx = ZSTD_createCCtx();
if (!ctx) { return 1; } if (!ctx) { return 1; }
/* Set parameters */ /* Set parameters */
memset(&params, 0, sizeof(params)); if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_windowLog, windowLog)))
params.cParams.windowLog = 18; return 2;
params.cParams.chainLog = 13; if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_chainLog, 13)))
params.cParams.hashLog = 14; return 2;
params.cParams.searchLog = 1; if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_hashLog, 14)))
params.cParams.minMatch = 7; return 2;
params.cParams.targetLength = 16; if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_searchLog, 1)))
params.cParams.strategy = ZSTD_fast; return 2;
windowLog = params.cParams.windowLog; if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_minMatch, 7)))
/* Initialize stream */ return 2;
rc = ZSTD_initCStream_advanced(ctx, NULL, 0, params, 0); if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_targetLength, 16)))
if (ZSTD_isError(rc)) { return 2; } return 2;
if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_strategy, ZSTD_fast)))
return 2;
{ {
U64 compressed = 0; U64 compressed = 0;
const U64 toCompress = ((U64)1) << 33; const U64 toCompress = ((U64)1) << 33;
@ -97,5 +97,6 @@ int main(int argc, const char** argv)
free(srcBuffer); free(srcBuffer);
free(dstBuffer); free(dstBuffer);
} }
ZSTD_freeCCtx(ctx);
return 0; return 0;
} }