Warn of volid length for Joliet only if more than 16 characters (was: 16 bytes)

This commit is contained in:
Thomas Schmitt 2021-08-28 18:12:15 +02:00
parent 5011a5f7b0
commit 7dc45e3311
4 changed files with 65 additions and 4 deletions

View File

@ -57,6 +57,7 @@
#include "lib_mgt.h"
#include "iso_manip.h"
#include "write_run.h"
int Xorriso_abort(struct XorrisO *xorriso, int flag)
@ -1042,3 +1043,45 @@ int Xorriso_set_libisofs_now(struct XorrisO *xorriso, int flag)
return(ret);
}
/* Frontend to isoburn_conv_name_chars()
@param flag bit0= File name.
Do not omit version number if it would appear.
*/
int Xorriso_conv_name_chars(struct XorrisO *xorriso, char *name,
char **result, size_t *result_len,
int name_space, int flag)
{
int ret, relax_mem;
struct isoburn_imgen_opts *sopts= NULL;
*result= NULL;
*result_len= 0;
relax_mem= xorriso->relax_compliance;
ret= isoburn_igopt_new(&sopts, 0);
if(ret<=0) {
Xorriso_process_msg_queues(xorriso, 0);
ret= -1; goto ex;
}
if(!(flag & 1))
xorriso->relax_compliance|= isoburn_igopt_omit_version_numbers;
ret= Xorriso_make_iso_write_opts(xorriso, NULL, sopts, 0);
if(ret <= 0) {
ret= -1; goto ex;
}
ret= isoburn_conv_name_chars(sopts, name, strlen(name), result, result_len,
name_space);
if(ret <= 0) {
Xorriso_process_msg_queues(xorriso, 0);
ret= 0; goto ex;
}
ret= 1;
ex:;
isoburn_igopt_destroy(&sopts, 0);
xorriso->relax_compliance= relax_mem;
return(ret);
}

View File

@ -2083,6 +2083,8 @@ int Xorriso_option_version(struct XorrisO *xorriso, int flag)
int Xorriso_option_volid(struct XorrisO *xorriso, char *volid, int flag)
{
int warn_shell= 0, warn_ecma= 0, i, ret;
char *result= NULL;
size_t result_len= 0;
static char shell_chars[]= {
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-+=:.,~@"};
static char ecma_chars[]= {"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"};
@ -2104,9 +2106,20 @@ int Xorriso_option_volid(struct XorrisO *xorriso, char *volid, int flag)
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
}
if(xorriso->do_joliet && strlen(volid)>16 && !(flag & 1)) {
sprintf(xorriso->info_text,
"-volid text is too long for Joliet (%d > 16)",(int) strlen(volid));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
ret= Xorriso_conv_name_chars(xorriso, volid, &result, &result_len, 2, 0);
if(result != NULL)
free(result); /* just want the result_len */
xorriso->info_text[0]= 0;
if(ret <= 0) {
sprintf(xorriso->info_text,
"Cannot determine length of -volid text in Joliet character set");
} else if(result_len > 32) {
sprintf(xorriso->info_text,
"-volid text is too long for Joliet (%d > 16)",
(int) (result_len + 1) / 2);
}
if(xorriso->info_text[0])
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
}
if(warn_ecma && !(flag & 1)) {
sprintf(xorriso->info_text,

View File

@ -1 +1 @@
#define Xorriso_timestamP "2021.06.04.155151"
#define Xorriso_timestamP "2021.08.28.161158"

View File

@ -676,5 +676,10 @@ int Xorriso_set_libisofs_now(struct XorrisO *xorriso, int flag);
int Xorriso_obtain_indev_readsize(struct XorrisO *xorriso, uint32_t *blocks,
int flag);
/* Frontend to isoburn_conv_name_chars() */
int Xorriso_conv_name_chars(struct XorrisO *xorriso, char *name,
char **result, size_t *result_len,
int name_space, int flag);
#endif /* Xorrisoburn_includeD */