1
0
mirror of https://github.com/facebook/zstd.git synced 2025-07-29 11:21:22 +03:00

[examples] Clean up and comment the examples

This commit is contained in:
Nick Terrell
2019-04-05 18:11:17 -07:00
parent 1dfe37fea9
commit 1d0c1707d1
11 changed files with 143 additions and 141 deletions

View File

@ -9,12 +9,11 @@
*/
#include <stdlib.h> // malloc, free, exit
#include <stdio.h> // fprintf, perror, feof, fopen, etc.
#include <string.h> // strlen, memset, strcat
#define ZSTD_STATIC_LINKING_ONLY // TODO: Remove once the API is stable
#include <stdio.h> // printf
#include <stdlib.h> // free
#include <string.h> // memset, strcat, strlen
#include <zstd.h> // presumes zstd library is installed
#include "utils.h"
#include "common.h" // Helper functions, CHECK(), and CHECK_ZSTD()
static void compressFile_orDie(const char* fname, const char* outName, int cLevel)
@ -75,7 +74,8 @@ static void compressFile_orDie(const char* fname, const char* outName, int cLeve
*/
finished = lastChunk ? (remaining == 0) : (input.pos == input.size);
} while (!finished);
assert(input.pos == input.size);
CHECK(input.pos == input.size,
"Impossible: zstd only returns 0 when the input is completely consumed!");
}
ZSTD_freeCCtx(cctx);