From b07d60bbfc730f3a9d2e859c24c68dfa470cf539 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 3 Jul 2012 18:56:26 +0200 Subject: [PATCH] Moved some functions from util.c to hfsplus.c --- libisofs/hfsplus.c | 40 ++++++++++++++++++++++++++++++++++++++++ libisofs/util.c | 39 --------------------------------------- 2 files changed, 40 insertions(+), 39 deletions(-) diff --git a/libisofs/hfsplus.c b/libisofs/hfsplus.c index de8fc31..ff0102f 100644 --- a/libisofs/hfsplus.c +++ b/libisofs/hfsplus.c @@ -1988,3 +1988,43 @@ int hfsplus_tail_writer_create(Ecma119Image *target) return ISO_SUCCESS; } + + +/* API */ +int iso_hfsplus_xinfo_func(void *data, int flag) +{ + if (flag == 1 && data != NULL) + free(data); + return 1; +} + +/* API */ +struct iso_hfsplus_xinfo_data *iso_hfsplus_xinfo_new(int flag) +{ + struct iso_hfsplus_xinfo_data *o; + + o = calloc(1, sizeof(struct iso_hfsplus_xinfo_data)); + if (o == NULL) + return NULL; + o->version = 0; + return o; +} + +/* The iso_node_xinfo_cloner function which gets associated to + * iso_hfsplus_xinfo_func by iso_init() resp. iso_init_with_flag() via + * iso_node_xinfo_make_clonable() + */ +int iso_hfsplus_xinfo_cloner(void *old_data, void **new_data, int flag) +{ + *new_data = NULL; + if (flag) + return ISO_XINFO_NO_CLONE; + if (old_data == NULL) + return 0; + *new_data = iso_hfsplus_xinfo_new(0); + if(*new_data == NULL) + return ISO_OUT_OF_MEM; + memcpy(*new_data, old_data, sizeof(struct iso_hfsplus_xinfo_data)); + return ISO_SUCCESS; +} + diff --git a/libisofs/util.c b/libisofs/util.c index df5273b..26bdfbf 100644 --- a/libisofs/util.c +++ b/libisofs/util.c @@ -2078,42 +2078,3 @@ void *iso_alloc_mem(size_t size, size_t count, int flag) } -/* API, >>> ts B20525 : should finally go to hfplus.c */ -int iso_hfsplus_xinfo_func(void *data, int flag) -{ - if (flag == 1 && data != NULL) - free(data); - return 1; -} - - -/* API, >>> ts B20525 : should finally go to hfplus.c */ -struct iso_hfsplus_xinfo_data *iso_hfsplus_xinfo_new(int flag) -{ - struct iso_hfsplus_xinfo_data *o; - - o = calloc(1, sizeof(struct iso_hfsplus_xinfo_data)); - if (o == NULL) - return NULL; - o->version = 0; - return o; -} - -/* The iso_node_xinfo_cloner function which gets associated to - * iso_hfsplus_xinfo_func by iso_init() resp. iso_init_with_flag() via - * iso_node_xinfo_make_clonable() - */ -int iso_hfsplus_xinfo_cloner(void *old_data, void **new_data, int flag) -{ - *new_data = NULL; - if (flag) - return ISO_XINFO_NO_CLONE; - if (old_data == NULL) - return 0; - *new_data = iso_hfsplus_xinfo_new(0); - if(*new_data == NULL) - return ISO_OUT_OF_MEM; - memcpy(*new_data, old_data, sizeof(struct iso_hfsplus_xinfo_data)); - return ISO_SUCCESS; -} -