New API call iso_read_opts_set_joliet_map(), new default joliet_map=stripped

This commit is contained in:
Thomas Schmitt 2020-11-22 14:14:49 +01:00
parent cece6fb371
commit c068a19a8c
3 changed files with 46 additions and 4 deletions

View File

@ -103,13 +103,21 @@ struct iso_read_opts
* If neither Rock Ridge nor Joliet is used, the ECMA-119 names are mapped
* according to one of these rules
* 0 = unmapped: show name as recorded in ECMA-119 directory record
* (not suitable for writing them to a new ISO filesystem)
* (not suitable for writing it to a new ISO filesystem)
* 1 = stripped: like unmapped, but strip off trailing ";1" or ".;1"
* 2 = uppercase: like stripped, but {a-z} mapped to {A-Z}
* 3 = lowercase: like stripped, but {A-Z} mapped to {a-z}
*/
unsigned int ecma119_map : 2;
/**
* If Joliet is used, apply one of these mapping rules:
* 0 = unmapped: show name as recorded in Joliet directory record
* (not suitable for writing it to a new ISO filesystem)
* 1 = stripped: strip off trailing ";1" or ".;1"
*/
unsigned int joliet_map : 1;
uid_t uid; /**< Default uid when no RR */
gid_t gid; /**< Default uid when no RR */
mode_t dir_mode; /**< Default mode when no RR (only permissions) */
@ -309,6 +317,7 @@ typedef struct
int truncate_mode;
int truncate_length;
unsigned int ecma119_map : 2;
unsigned int joliet_map : 1;
/** Whether AAIP info shall be loaded if it is present.
* 1 = yes , 0 = no
@ -1960,9 +1969,10 @@ invalid_zf:
/* remove trailing version number */
len = strlen(name);
ecma119_map = fsdata->ecma119_map;
if (fsdata->iso_root_block == fsdata->svd_root_block)
ecma119_map = 0;
ecma119_map = fsdata->joliet_map;
else
ecma119_map = fsdata->ecma119_map;
if (ecma119_map >= 1 && ecma119_map <= 3 &&
len > 2 && name[len-2] == ';' && name[len-1] == '1') {
if (len > 3 && name[len-3] == '.') {
@ -3107,6 +3117,7 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
data->truncate_mode = opts->truncate_mode;
data->truncate_length = opts->truncate_length;
data->ecma119_map = opts->ecma119_map;
data->joliet_map = opts->joliet_map;
if (data->input_charset == NULL) {
if (opts->input_charset != NULL) {
@ -6273,6 +6284,7 @@ int iso_read_opts_new(IsoReadOpts **opts, int profile)
ropts->dir_mode = 0555;
ropts->noaaip = 1;
ropts->ecma119_map = 1;
ropts->joliet_map = 1;
ropts->nomd5 = 1;
ropts->load_system_area = 0;
ropts->keep_import_src = 0;
@ -6377,6 +6389,16 @@ int iso_read_opts_set_ecma119_map(IsoReadOpts *opts, int ecma119_map)
return ISO_SUCCESS;
}
int iso_read_opts_set_joliet_map(IsoReadOpts *opts, int joliet_map)
{
if (opts == NULL)
return ISO_NULL_POINTER;
if (joliet_map < 0 || joliet_map > 1)
return 0;
opts->joliet_map = joliet_map;
return ISO_SUCCESS;
}
int iso_read_opts_set_default_uid(IsoReadOpts *opts, uid_t uid)
{
if (opts == NULL) {

View File

@ -3074,7 +3074,7 @@ int iso_read_opts_set_preferjoliet(IsoReadOpts *opts, int preferjoliet);
* @param ecma119_map
* The conversion mode to apply:
* 0 = unmapped: Take name as recorded in ECMA-119 directory record
* (not suitable for writing them to a new ISO filesystem)
* (not suitable for writing it to a new ISO filesystem)
* 1 = stripped: Like unmapped, but strip off trailing ";1" or ".;1"
* 2 = uppercase: Like stripped, but map {a-z} to {A-Z}
* 3 = lowercase: Like stripped, but map {A-Z} to {a-z}
@ -3087,6 +3087,25 @@ int iso_read_opts_set_preferjoliet(IsoReadOpts *opts, int preferjoliet);
*/
int iso_read_opts_set_ecma119_map(IsoReadOpts *opts, int ecma119_map);
/**
* How to convert Joliet file names.
*
* @param opts
* The option set to be manipulated
* @param ecma119_map
* The conversion mode to apply:
* 0 = unmapped: Take name as recorded in Joliet directory record
* (not suitable for writing it to a new ISO filesystem)
* 1 = stripped: Strip off trailing ";1" or ".;1"
* @return
* ISO_SUCCESS if joliet_map was accepted
* 0 if the value was out of range
* < 0 if other error
*
* @since 1.5.4
*/
int iso_read_opts_set_joliet_map(IsoReadOpts *opts, int joliet_map);
/**
* Set default uid for files when RR extensions are not present.
*

View File

@ -245,6 +245,7 @@ iso_read_opts_set_default_permissions;
iso_read_opts_set_default_uid;
iso_read_opts_set_ecma119_map;
iso_read_opts_set_input_charset;
iso_read_opts_set_joliet_map;
iso_read_opts_set_new_inos;
iso_read_opts_set_no_aaip;
iso_read_opts_set_no_iso1999;