From 14c55329eab9c2dff42fce7f06145ac6d852f699 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 17 Sep 2015 12:05:40 +0000 Subject: [PATCH] New API calls isoburn_ropt_set_truncate_mode() isoburn_ropt_get_truncate_mode() --- libisoburn/trunk/libisoburn/isoburn.c | 26 ++++++++++++++++++++ libisoburn/trunk/libisoburn/isoburn.h | 8 ++++++ libisoburn/trunk/libisoburn/isofs_wrap.c | 9 +++++++ libisoburn/trunk/libisoburn/libisoburn.h | 25 ++++++++++++++++++- libisoburn/trunk/libisoburn/libisoburn.ver | 2 ++ libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- 6 files changed, 70 insertions(+), 2 deletions(-) diff --git a/libisoburn/trunk/libisoburn/isoburn.c b/libisoburn/trunk/libisoburn/isoburn.c index 9086c6b3..a850a653 100644 --- a/libisoburn/trunk/libisoburn/isoburn.c +++ b/libisoburn/trunk/libisoburn/isoburn.c @@ -855,6 +855,8 @@ int isoburn_ropt_new(struct isoburn_read_opts **new_o, int flag) o->mode= 0444; o->dirmode= 0555; o->input_charset= NULL; + o->truncate_mode= 1; + o->truncate_length= 255; o->hasRR= 0; o->hasJoliet= 0; o->hasIso1999= 0; @@ -1053,6 +1055,30 @@ int isoburn_ropt_get_displacement(struct isoburn_read_opts *o, } +int isoburn_ropt_set_truncate_mode(struct isoburn_read_opts *o, + int mode, int length) +{ + if(mode < 0 || mode > 1) + mode= 1; + if(length < 64) + length= 64; + if(length > 255) + length= 255; + o->truncate_mode= mode; + o->truncate_length= length; + return(1); +} + + +int isoburn_ropt_get_truncate_mode(struct isoburn_read_opts *o, + int *mode, int *length) +{ + *mode= o->truncate_mode; + *length= o->truncate_length; + return(1); +} + + int isoburn_ropt_get_size_what(struct isoburn_read_opts *o, uint32_t *size, int *has_what) { diff --git a/libisoburn/trunk/libisoburn/isoburn.h b/libisoburn/trunk/libisoburn/isoburn.h index 26b0ff3f..7d6806ab 100644 --- a/libisoburn/trunk/libisoburn/isoburn.h +++ b/libisoburn/trunk/libisoburn/isoburn.h @@ -359,6 +359,14 @@ struct isoburn_read_opts { */ int auto_input_charset; + /** + * What to do in case of name longer than truncate_length: + * 0= throw FAILURE + * 1= truncate to truncate_length with MD5 of whole name at end + */ + int truncate_mode; + int truncate_length; + /* modified by the function isoburn_read_image */ unsigned int hasRR:1; /*< It will be set to 1 if RR extensions are present, to 0 if not. */ diff --git a/libisoburn/trunk/libisoburn/isofs_wrap.c b/libisoburn/trunk/libisoburn/isofs_wrap.c index 5986c8d5..9baa1a07 100644 --- a/libisoburn/trunk/libisoburn/isofs_wrap.c +++ b/libisoburn/trunk/libisoburn/isofs_wrap.c @@ -208,6 +208,10 @@ create_blank_image:; if(ret <= 0) goto ex; } + ret= iso_image_set_truncate_mode(*image, read_opts->truncate_mode, + read_opts->truncate_length); + if(ret < 0) + goto ex; {ret= 1; goto ex;} } @@ -283,6 +287,10 @@ displacement_rollover:; iso_read_opts_auto_input_charset(ropts, read_opts->auto_input_charset); iso_read_opts_load_system_area(ropts, 1); iso_read_opts_keep_import_src(ropts, 1); + ret= iso_image_set_truncate_mode(o->image, read_opts->truncate_mode, + read_opts->truncate_length); + if(ret < 0) + goto ex; ds = isoburn_data_source_new(d, read_opts->displacement, read_opts->displacement_sign, @@ -301,6 +309,7 @@ displacement_rollover:; iso_tree_set_report_callback(o->image, NULL); else iso_tree_set_report_callback(o->image, o->read_pacifier); + ret = iso_image_import(o->image, ds, ropts, &features); iso_tree_set_report_callback(o->image, NULL); iso_read_opts_free(ropts); diff --git a/libisoburn/trunk/libisoburn/libisoburn.h b/libisoburn/trunk/libisoburn/libisoburn.h index 7252b424..313cd02b 100644 --- a/libisoburn/trunk/libisoburn/libisoburn.h +++ b/libisoburn/trunk/libisoburn/libisoburn.h @@ -242,7 +242,7 @@ void isoburn_version(int *major, int *minor, int *micro); */ #define isoburn_libisofs_req_major 1 #define isoburn_libisofs_req_minor 4 -#define isoburn_libisofs_req_micro 0 +#define isoburn_libisofs_req_micro 1 /** The minimum version of libburn to be used with this version of libisoburn at compile time. @@ -1014,6 +1014,29 @@ int isoburn_ropt_get_displacement(struct isoburn_read_opts *o, of uint32_t. */ +/** Set the name truncation mode and the maximum name length for imported + file objects. + @since 1.4.2 + @param o The option set to work on + @param mode 0= Do not truncate but throw error + ISO_RR_NAME_TOO_LONG if a file name + is longer than parameter length. + 1= Truncate to length and overwrite the last + 32 bytes of that length by the hex + representation of ithe MD5 of the whole + oversized name. + Potential incomplete UTF-8 characters will + get their leading bytes replaced by '_'. + This is the default. + @param length Maximum byte count of a file name. Permissible + values are 64 to 255. Default is 255. + +*/ +int isoburn_ropt_set_truncate_mode(struct isoburn_read_opts *o, + int mode, int length); +int isoburn_ropt_get_truncate_mode(struct isoburn_read_opts *o, + int *mode, int *length); + /** After calling function isoburn_read_image() there are informations available in the option set. diff --git a/libisoburn/trunk/libisoburn/libisoburn.ver b/libisoburn/trunk/libisoburn/libisoburn.ver index 9e4ea23f..4e4e4d78 100644 --- a/libisoburn/trunk/libisoburn/libisoburn.ver +++ b/libisoburn/trunk/libisoburn/libisoburn.ver @@ -99,6 +99,7 @@ isoburn_ropt_get_displacement; isoburn_ropt_get_extensions; isoburn_ropt_get_input_charset; isoburn_ropt_get_size_what; +isoburn_ropt_get_truncate_mode; isoburn_ropt_new; isoburn_ropt_set_auto_incharset; isoburn_ropt_set_data_cache; @@ -107,6 +108,7 @@ isoburn_ropt_set_default_perms; isoburn_ropt_set_displacement; isoburn_ropt_set_extensions; isoburn_ropt_set_input_charset; +isoburn_ropt_set_truncate_mode; isoburn_set_msc1; isoburn_set_msgs_submit; isoburn_set_read_pacifier; diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index 160a82bc..03bfdca3 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2015.09.15.182031" +#define Xorriso_timestamP "2015.09.17.120554"