From 177864bd132517227f225a1c99794db32ac03a3c Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 25 May 2012 10:42:26 +0200 Subject: [PATCH] Made struct iso_hfsplus_xinfo_data clonable. --- libisofs/messages.c | 4 ++++ libisofs/util.c | 20 +++++++++++++++++++- libisofs/util.h | 6 ++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/libisofs/messages.c b/libisofs/messages.c index 0bcb968..f3e3dff 100644 --- a/libisofs/messages.c +++ b/libisofs/messages.c @@ -215,6 +215,10 @@ LIBJTE_MISCONFIGURATION_ = 0; iso_px_ino_xinfo_cloner, 0); if (ret < 0) return ret; + ret = iso_node_xinfo_make_clonable(iso_hfsplus_xinfo_func, + iso_hfsplus_xinfo_cloner, 0); + if (ret < 0) + return ret; return 1; } diff --git a/libisofs/util.c b/libisofs/util.c index 3b9ef5c..8754177 100644 --- a/libisofs/util.c +++ b/libisofs/util.c @@ -2084,4 +2084,22 @@ struct iso_hfsplus_xinfo_data *iso_hfsplus_xinfo_new(int flag) 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.h b/libisofs/util.h index 6aee0db..987344c 100644 --- a/libisofs/util.h +++ b/libisofs/util.h @@ -543,6 +543,12 @@ int checksum_md5_xinfo_func(void *data, int flag); */ int checksum_md5_xinfo_cloner(void *old_data, void **new_data, int flag); +/* 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); + /* ------------------------------------------------------------------------- */