aboutsummaryrefslogtreecommitdiff
path: root/lib/common
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-03-03 19:43:54 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-03-04 00:58:53 +0100
commit44c81eeffe9c8820b1009a7a5c728782aa5ebf40 (patch)
tree544eceb6dc5633018e5147c88ca9b07dd0fb54d9 /lib/common
parent6f47796dc0761fac359ec59ce26c7af5154e538d (diff)
Add a generic copying mechanism to sqfs_object_t
This patch adds a deep-copy callback to sqfs_object_t and removes the copying mechanism from sqfs_compressor_t. This is also interesting for other types. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/common')
-rw-r--r--lib/common/comp_lzo.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/common/comp_lzo.c b/lib/common/comp_lzo.c
index 8d0335e..24f4009 100644
--- a/lib/common/comp_lzo.c
+++ b/lib/common/comp_lzo.c
@@ -199,7 +199,7 @@ static void lzo_get_configuration(const sqfs_compressor_t *base,
cfg->flags |= SQFS_COMP_FLAG_UNCOMPRESS;
}
-static sqfs_compressor_t *lzo_create_copy(sqfs_compressor_t *cmp)
+static sqfs_object_t *lzo_create_copy(const sqfs_object_t *cmp)
{
lzo_compressor_t *other = (lzo_compressor_t *)cmp;
lzo_compressor_t *lzo;
@@ -209,7 +209,7 @@ static sqfs_compressor_t *lzo_create_copy(sqfs_compressor_t *cmp)
return NULL;
memcpy(lzo, other, sizeof(*lzo));
- return (sqfs_compressor_t *)lzo;
+ return (sqfs_object_t *)lzo;
}
static void lzo_destroy(sqfs_object_t *base)
@@ -270,7 +270,7 @@ sqfs_compressor_t *lzo_compressor_create(const sqfs_compressor_config_t *cfg)
lzo_uncomp_block : lzo_comp_block;
base->write_options = lzo_write_options;
base->read_options = lzo_read_options;
- base->create_copy = lzo_create_copy;
+ ((sqfs_object_t *)base)->copy = lzo_create_copy;
((sqfs_object_t *)base)->destroy = lzo_destroy;
return base;
}