New API calls isoburn_ropt_set_truncate_mode() isoburn_ropt_get_truncate_mode()

This commit is contained in:
Thomas Schmitt 2015-09-17 12:05:40 +00:00
parent 2c2d695c16
commit 14c55329ea
6 changed files with 70 additions and 2 deletions

View File

@ -855,6 +855,8 @@ int isoburn_ropt_new(struct isoburn_read_opts **new_o, int flag)
o->mode= 0444; o->mode= 0444;
o->dirmode= 0555; o->dirmode= 0555;
o->input_charset= NULL; o->input_charset= NULL;
o->truncate_mode= 1;
o->truncate_length= 255;
o->hasRR= 0; o->hasRR= 0;
o->hasJoliet= 0; o->hasJoliet= 0;
o->hasIso1999= 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, int isoburn_ropt_get_size_what(struct isoburn_read_opts *o,
uint32_t *size, int *has_what) uint32_t *size, int *has_what)
{ {

View File

@ -359,6 +359,14 @@ struct isoburn_read_opts {
*/ */
int auto_input_charset; 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 */ /* modified by the function isoburn_read_image */
unsigned int hasRR:1; /*< It will be set to 1 if RR extensions are present, unsigned int hasRR:1; /*< It will be set to 1 if RR extensions are present,
to 0 if not. */ to 0 if not. */

View File

@ -208,6 +208,10 @@ create_blank_image:;
if(ret <= 0) if(ret <= 0)
goto ex; 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;} {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_auto_input_charset(ropts, read_opts->auto_input_charset);
iso_read_opts_load_system_area(ropts, 1); iso_read_opts_load_system_area(ropts, 1);
iso_read_opts_keep_import_src(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, ds = isoburn_data_source_new(d, read_opts->displacement,
read_opts->displacement_sign, read_opts->displacement_sign,
@ -301,6 +309,7 @@ displacement_rollover:;
iso_tree_set_report_callback(o->image, NULL); iso_tree_set_report_callback(o->image, NULL);
else else
iso_tree_set_report_callback(o->image, o->read_pacifier); iso_tree_set_report_callback(o->image, o->read_pacifier);
ret = iso_image_import(o->image, ds, ropts, &features); ret = iso_image_import(o->image, ds, ropts, &features);
iso_tree_set_report_callback(o->image, NULL); iso_tree_set_report_callback(o->image, NULL);
iso_read_opts_free(ropts); iso_read_opts_free(ropts);

View File

@ -242,7 +242,7 @@ void isoburn_version(int *major, int *minor, int *micro);
*/ */
#define isoburn_libisofs_req_major 1 #define isoburn_libisofs_req_major 1
#define isoburn_libisofs_req_minor 4 #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 /** The minimum version of libburn to be used with this version of libisoburn
at compile time. at compile time.
@ -1014,6 +1014,29 @@ int isoburn_ropt_get_displacement(struct isoburn_read_opts *o,
of uint32_t. 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 /** After calling function isoburn_read_image() there are informations
available in the option set. available in the option set.

View File

@ -99,6 +99,7 @@ isoburn_ropt_get_displacement;
isoburn_ropt_get_extensions; isoburn_ropt_get_extensions;
isoburn_ropt_get_input_charset; isoburn_ropt_get_input_charset;
isoburn_ropt_get_size_what; isoburn_ropt_get_size_what;
isoburn_ropt_get_truncate_mode;
isoburn_ropt_new; isoburn_ropt_new;
isoburn_ropt_set_auto_incharset; isoburn_ropt_set_auto_incharset;
isoburn_ropt_set_data_cache; isoburn_ropt_set_data_cache;
@ -107,6 +108,7 @@ isoburn_ropt_set_default_perms;
isoburn_ropt_set_displacement; isoburn_ropt_set_displacement;
isoburn_ropt_set_extensions; isoburn_ropt_set_extensions;
isoburn_ropt_set_input_charset; isoburn_ropt_set_input_charset;
isoburn_ropt_set_truncate_mode;
isoburn_set_msc1; isoburn_set_msc1;
isoburn_set_msgs_submit; isoburn_set_msgs_submit;
isoburn_set_read_pacifier; isoburn_set_read_pacifier;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2015.09.15.182031" #define Xorriso_timestamP "2015.09.17.120554"