New (yet inofficial) -as mkisofs option -hfsplus-file-creator-type

This commit is contained in:
2012-05-25 08:45:56 +00:00
parent a59ecdf456
commit dfb1f5c5e7
4 changed files with 85 additions and 7 deletions

View File

@ -3460,3 +3460,61 @@ set_error:;
return(1);
}
int Xorriso_hfsplus_file_creator_type(struct XorrisO *xorriso, char *path,
void *in_node,
char *creator, char *hfs_type, int flag)
{
int ret;
IsoNode *node;
struct iso_hfsplus_xinfo_data *hfs_data;
if(in_node == NULL) {
ret= Xorriso_node_from_path(xorriso, NULL, path, &node, 0);
if(ret <= 0)
return(ret);
} else
node= (IsoNode *) in_node;
hfs_data= iso_hfsplus_xinfo_new(0);
if(hfs_data == NULL) {
Xorriso_no_malloc_memory(xorriso, NULL, 0);
return(-1);
}
if(strlen(creator) != 4 || strlen(hfs_type) != 4) {
strcat(xorriso->info_text,
"HFS+ file creator code or type code are not exactly 4 characters long");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
memcpy(hfs_data->creator_code, creator, 4);
memcpy(hfs_data->type_code, hfs_type, 4);
ret= iso_node_remove_xinfo(node, iso_hfsplus_xinfo_func);
Xorriso_process_msg_queues(xorriso, 0);
if(ret < 0) {
Xorriso_report_iso_error(xorriso, path, ret,
"Cannot overwrite HFS+ creator and type of ISO node",
0, "FAILURE", 1);
goto failure;
}
ret= iso_node_add_xinfo(node, iso_hfsplus_xinfo_func, (void *) hfs_data);
Xorriso_process_msg_queues(xorriso, 0);
if(ret < 0) {
Xorriso_report_iso_error(xorriso, path, ret,
"Cannot attach HFS+ creator and type to ISO node", 0, "FAILURE", 1);
goto failure;
} else if(ret == 0) {
strcat(xorriso->info_text,
"Programm error: iso_node_add_xinfo refuses to attach HFS+ creator and type");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
goto failure;
}
Xorriso_set_change_pending(xorriso, 0);
return(1);
failure:
iso_hfsplus_xinfo_func(hfs_data, 1);
return(0);
}