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/gzip.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/gzip.c')
-rw-r--r-- | lib/sqfs/comp/gzip.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/sqfs/comp/gzip.c b/lib/sqfs/comp/gzip.c index d702da1..9be84db 100644 --- a/lib/sqfs/comp/gzip.c +++ b/lib/sqfs/comp/gzip.c @@ -53,7 +53,7 @@ static void gzip_get_configuration(const sqfs_compressor_t *base, cfg->id = SQFS_COMP_GZIP; cfg->flags = gzip->opt.strategies; cfg->block_size = gzip->block_size; - cfg->opt.gzip.level = gzip->opt.level; + cfg->level = gzip->opt.level; cfg->opt.gzip.window_size = gzip->opt.window; if (!gzip->compress) @@ -259,8 +259,8 @@ int gzip_compressor_create(const sqfs_compressor_config_t *cfg, return SQFS_ERROR_UNSUPPORTED; } - if (cfg->opt.gzip.level < SQFS_GZIP_MIN_LEVEL || - cfg->opt.gzip.level > SQFS_GZIP_MAX_LEVEL) { + if (cfg->level < SQFS_GZIP_MIN_LEVEL || + cfg->level > SQFS_GZIP_MAX_LEVEL) { return SQFS_ERROR_UNSUPPORTED; } @@ -275,7 +275,7 @@ int gzip_compressor_create(const sqfs_compressor_config_t *cfg, if (gzip == NULL) return SQFS_ERROR_ALLOC; - gzip->opt.level = cfg->opt.gzip.level; + gzip->opt.level = cfg->level; gzip->opt.window = cfg->opt.gzip.window_size; gzip->opt.strategies = cfg->flags & SQFS_COMP_FLAG_GZIP_ALL; gzip->compress = (cfg->flags & SQFS_COMP_FLAG_UNCOMPRESS) == 0; @@ -288,7 +288,7 @@ int gzip_compressor_create(const sqfs_compressor_config_t *cfg, ((sqfs_object_t *)base)->destroy = gzip_destroy; if (gzip->compress) { - ret = deflateInit2(&gzip->strm, cfg->opt.gzip.level, + ret = deflateInit2(&gzip->strm, cfg->level, Z_DEFLATED, cfg->opt.gzip.window_size, 8, Z_DEFAULT_STRATEGY); } else { |