From 16a57525884b3d1445d48ac56918530fe0efa562 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Thu, 8 Dec 2016 17:28:26 -0800 Subject: [PATCH] streaming example uses stable API --- examples/streaming_compression.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/streaming_compression.c b/examples/streaming_compression.c index 108a63c8..4c2c1a1d 100644 --- a/examples/streaming_compression.c +++ b/examples/streaming_compression.c @@ -7,11 +7,9 @@ */ -#include // malloc, exit -#include // fprintf, perror, feof -#include // strerror -#include // errno -#define ZSTD_STATIC_LINKING_ONLY // streaming API defined as "experimental" for the time being +#include // malloc, free, exit +#include // fprintf, perror, feof, fopen, etc. +#include // strlen, memset, strcat #include // presumes zstd library is installed @@ -82,7 +80,7 @@ static void compressFile_orDie(const char* fname, const char* outName, int cLeve ZSTD_outBuffer output = { buffOut, buffOutSize, 0 }; toRead = ZSTD_compressStream(cstream, &output , &input); /* toRead is guaranteed to be <= ZSTD_CStreamInSize() */ if (ZSTD_isError(toRead)) { fprintf(stderr, "ZSTD_compressStream() error : %s \n", ZSTD_getErrorName(toRead)); exit(12); } - if (toRead > buffInSize) toRead = buffInSize; /* Safely handle when `buffInSize` is manually changed to a smaller value */ + if (toRead > buffInSize) toRead = buffInSize; /* Safely handle case when `buffInSize` is manually changed to a value < ZSTD_CStreamInSize()*/ fwrite_orDie(buffOut, output.pos, fout); } }