diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-06-04 07:24:52 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-06-04 07:24:52 +0200 |
commit | b6d0bcbf1fa9c8088578c959f442e219f590ebf9 (patch) | |
tree | 2aaffddd7c46e1850b651796797c8df18622b14e /lib/sqfs/comp/zstd.c | |
parent | 30597cc7c5d566f671c84c025de97cb1fc2d242e (diff) |
Cleanup: Pull compression level parameter out into compressor config
Every compressor (except LC4) has a compression level parameter. This
commit pulls the compression level field out into the generic
configuration structure and applies some code clean ups as a result
from this.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/comp/zstd.c')
-rw-r--r-- | lib/sqfs/comp/zstd.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/sqfs/comp/zstd.c b/lib/sqfs/comp/zstd.c index 18289fe..af5bd84 100644 --- a/lib/sqfs/comp/zstd.c +++ b/lib/sqfs/comp/zstd.c @@ -101,7 +101,7 @@ static void zstd_get_configuration(const sqfs_compressor_t *base, cfg->id = SQFS_COMP_ZSTD; cfg->block_size = zstd->block_size; - cfg->opt.zstd.level = zstd->level; + cfg->level = zstd->level; if (base->do_block == zstd_uncomp_block) cfg->flags |= SQFS_COMP_FLAG_UNCOMPRESS; @@ -143,10 +143,8 @@ int zstd_compressor_create(const sqfs_compressor_config_t *cfg, if (cfg->flags & ~SQFS_COMP_FLAG_GENERIC_ALL) return SQFS_ERROR_UNSUPPORTED; - if (cfg->opt.zstd.level < 1 || - cfg->opt.zstd.level > ZSTD_maxCLevel()) { + if (cfg->level < 1 || cfg->level > (unsigned int)ZSTD_maxCLevel()) return SQFS_ERROR_UNSUPPORTED; - } zstd = calloc(1, sizeof(*zstd)); base = (sqfs_compressor_t *)zstd; @@ -154,7 +152,7 @@ int zstd_compressor_create(const sqfs_compressor_config_t *cfg, return SQFS_ERROR_ALLOC; zstd->block_size = cfg->block_size; - zstd->level = cfg->opt.zstd.level; + zstd->level = cfg->level; zstd->zctx = ZSTD_createCCtx(); if (zstd->zctx == NULL) { free(zstd); |