From ecf1778e23edc42ac6ddeb19151005ee4a08343c Mon Sep 17 00:00:00 2001
From: Yann Collet New advanced API (experimental)
typedef enum {
- ZSTD_f_zstd1 = 0, /* Normal zstd frame format, specified in zstd_compression_format.md (default) */
+ /* Question : should we have a format ZSTD_f_auto ?
+ * For the time being, it would mean exactly the same as ZSTD_f_zstd1.
+ * But, in the future, should several formats be supported,
+ * on the compression side, it would mean "default format".
+ * On the decompression side, it would mean "multi format",
+ * and ZSTD_f_zstd1 could be reserved to mean "accept *only* zstd frames".
+ * Since meaning is a little different, another option could be to define different enums for compression and decompression.
+ * This question could be kept for later, when there are actually multiple formats to support,
+ * but there is also the question of pinning enum values, and pinning value `0` is especially important */
+ ZSTD_f_zstd1 = 0, /* zstd frame format, specified in zstd_compression_format.md (default) */
ZSTD_f_zstd1_magicless, /* Variant of zstd frame format, without initial 4-bytes magic number.
* Useful to save 4 bytes per generated frame.
- * Decoder will not be able to recognise this format, requiring instructions. */
- ZSTD_f_zstd1_headerless, /* Variant of zstd frame format, without any frame header;
- * Other metadata, like block size or frame checksum, are still generated.
- * Useful to save between 6 and ZSTD_frameHeaderSize_max bytes per generated frame.
- * However, required decoding parameters will have to be saved or known by some mechanism.
- * Decoder will not be able to recognise this format, requiring instructions and parameters. */
- ZSTD_f_zstd1_block /* Generate a zstd compressed block, without any metadata.
- * Note that size of block content must be <= ZSTD_getBlockSize() <= ZSTD_BLOCKSIZE_MAX == 128 KB.
- * See ZSTD_compressBlock() for more details.
- * Resulting compressed block can be decoded with ZSTD_decompressBlock(). */
+ * Decoder cannot recognise automatically this format, requiring instructions. */
} ZSTD_format_e;
typedef enum {
@@ -1154,7 +1154,7 @@ size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, const void* prefix, size_t
void ZSTD_DCtx_reset(ZSTD_DCtx* dctx); /* Not ready yet ! */ +void ZSTD_DCtx_reset(ZSTD_DCtx* dctx);Return a DCtx to clean state. If a decompression was ongoing, any internal data not yet flushed is cancelled. All parameters are back to default values, including sticky ones. diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 47def6b3..7061d1f6 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -330,7 +330,7 @@ size_t ZSTD_CCtxParam_setParameter( switch(param) { case ZSTD_p_format : - if (value > (unsigned)ZSTD_f_zstd1_block) + if (value > (unsigned)ZSTD_f_zstd1) return ERROR(parameter_unsupported); params->format = (ZSTD_format_e)value; return 0;