Gave up obsoleted macros and their code branches

This commit is contained in:
Thomas Schmitt 2008-03-26 09:21:30 +00:00
parent c0cb462641
commit 235bd14598
2 changed files with 10 additions and 184 deletions

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.03.25.170747" #define Xorriso_timestamP "2008.03.26.092120"

View File

@ -21,8 +21,6 @@
#include <fcntl.h> #include <fcntl.h>
#define Xorriso_on_libisofs_after_0_6_2 yes
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
@ -267,19 +265,11 @@ int Xorriso_get_drive_handles(struct XorrisO *xorriso,
int Xorriso__sev_to_text(int severity, char **severity_name, int Xorriso__sev_to_text(int severity, char **severity_name,
int flag) int flag)
{ {
#ifdef Xorriso_on_libisofs_after_0_6_2
int ret; int ret;
#else
#ifdef Xorriso_on_libburn_after_0_4_2
int ret;
#endif
#endif
#ifdef Xorriso_on_libisofs_after_0_6_2
ret= iso_sev_to_text(severity, severity_name); ret= iso_sev_to_text(severity, severity_name);
if(ret>0) if(ret>0)
return(ret); return(ret);
#endif /* Xorriso_on_libisofs_after_0_6_2 */
#ifdef Xorriso_on_libburn_after_0_4_2 #ifdef Xorriso_on_libburn_after_0_4_2
ret= burn_sev_to_text(severity, severity_name, 0); ret= burn_sev_to_text(severity, severity_name, 0);
if(ret>0) if(ret>0)
@ -329,11 +319,9 @@ int Xorriso__text_to_sev(char *severity_name, int *severity_number, int flag)
{ {
int ret= 1; int ret= 1;
#ifdef Xorriso_on_libisofs_after_0_6_2
ret= iso_text_to_sev(severity_name, severity_number); ret= iso_text_to_sev(severity_name, severity_number);
if(ret>0) if(ret>0)
return(ret); return(ret);
#endif /* Xorriso_on_libisofs_after_0_6_2 */
#ifndef Xorriso_on_libburn_after_0_4_2 #ifndef Xorriso_on_libburn_after_0_4_2
if(severity_name[0]==0) if(severity_name[0]==0)
@ -847,11 +835,6 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
IsoImage *image = NULL; IsoImage *image = NULL;
ElToritoBootImage *bootimg; ElToritoBootImage *bootimg;
#ifdef NIX
char profile_name[80];
int padding= 0, img_sectors, media_space, profile;
#endif
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to write", 2); "on attempt to write", 2);
if(ret<=0) if(ret<=0)
@ -973,8 +956,6 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
if(ret<=0) if(ret<=0)
goto ex; goto ex;
#ifndef NIX
ret= Xorriso_sanitize_image_size(xorriso, drive, disc, burn_options, flag&1); ret= Xorriso_sanitize_image_size(xorriso, drive, disc, burn_options, flag&1);
if(ret<=0 || (flag&1)) { if(ret<=0 || (flag&1)) {
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
@ -986,54 +967,6 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
goto ex; goto ex;
} }
#else
ret= img_sectors= burn_disc_get_sectors(disc);
if(flag&1)
goto ex;
sessions= burn_disc_get_sessions(disc, &num_sessions);
if(sessions==NULL || num_sessions < 1) {
no_track:;
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,"Program error : no track in prepared disc");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
isoburn_cancel_prepared_write(source_drive, drive, 0);
{ret= -1; goto ex;}
}
tracks= burn_session_get_tracks(sessions[0], &num_tracks);
if(tracks==NULL || num_tracks < 1)
goto no_track;
padding= 0;
ret= burn_disc_get_profile(drive, &profile, profile_name);
padding= xorriso->padding / 2048;
if(xorriso->padding > padding * 2048)
padding++;
if(profile==0x09 || profile==0x0a) { /* CD-R , CD-RW */
if(img_sectors + padding < Xorriso_cd_min_track_sizE) {
padding= Xorriso_cd_min_track_sizE - img_sectors;
sprintf(xorriso->info_text,
"Expanded track to minimum size of %d sectors",
Xorriso_cd_min_track_sizE);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
}
}
burn_track_define_data(tracks[0], 0, padding * 2048, 0, BURN_MODE1);
Xorriso_process_msg_queues(xorriso,0);
media_space= isoburn_disc_available_space(drive, burn_options) / (off_t) 2048;
if(media_space < img_sectors + padding) {
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,"Image size %ds exceeds free space on media %ds",
img_sectors + padding, media_space);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
isoburn_cancel_prepared_write(source_drive, drive, 0);
{ret= 0; goto ex;}
}
#endif /* NIX */
xorriso->run_state= 1; /* Indicate that burning has started */ xorriso->run_state= 1; /* Indicate that burning has started */
isoburn_disc_write(burn_options, disc); isoburn_disc_write(burn_options, disc);
burn_write_opts_free(burn_options); burn_write_opts_free(burn_options);
@ -1438,8 +1371,7 @@ int Xorriso_transfer_properties(struct XorrisO *xorriso, struct stat *stbuf,
} }
/* Ticket 132 : Former workaround for missing feature iso_tree_add_new_node() /*
which is now available and gets used here.
@param flag bit3= cut_out_node: offset and size are valid @param flag bit3= cut_out_node: offset and size are valid
*/ */
int Xorriso_tree_graft_node(struct XorrisO *xorriso, IsoImage *volume, int Xorriso_tree_graft_node(struct XorrisO *xorriso, IsoImage *volume,
@ -1450,52 +1382,13 @@ int Xorriso_tree_graft_node(struct XorrisO *xorriso, IsoImage *volume,
{ {
int ret; int ret;
#ifdef Xorriso_workaround_ticket_132
int wa_ret, i;
char wa_name[256];
IsoDir *hdir;
ret= iso_tree_add_node(volume, dir, disk_path, node);
if(ret==ISO_NODE_NAME_NOT_UNIQUE) {
wa_ret= ISO_NODE_NAME_NOT_UNIQUE;
for(i= 0; wa_ret==ISO_NODE_NAME_NOT_UNIQUE && i<2000000000; i++) {
sprintf(wa_name, "xorriso_works_around_what_is_not_a_bug_try_%d", i);
wa_ret= iso_tree_add_new_dir(dir, wa_name, &hdir);
}
if(wa_ret<0)
goto cannot_add;
ret= iso_tree_add_node(volume, hdir, disk_path, node);
if(ret>0) {
ret= iso_node_set_name(*node, img_name);
if(ret<0) {
Xorriso_process_msg_queues(xorriso,0);
Xorriso_report_iso_error(xorriso, nominal_target, 0,
"Cannot set name", 0, "FAILURE", 1);
return(ret);
}
iso_node_take(*node);
ret= iso_dir_add_node(dir, *node, 0);
}
iso_node_remove((IsoNode *) hdir);
}
#else /* Xorriso_workaround_ticket_132 */
if(flag&8) if(flag&8)
ret= iso_tree_add_new_cut_out_node(volume, dir, img_name, disk_path, ret= iso_tree_add_new_cut_out_node(volume, dir, img_name, disk_path,
offset, cut_size, node); offset, cut_size, node);
else else
ret= iso_tree_add_new_node(volume, dir, img_name, disk_path, node); ret= iso_tree_add_new_node(volume, dir, img_name, disk_path, node);
#endif /* Xorriso_workaround_ticket_132 */
if(ret<0) { if(ret<0) {
#ifdef Xorriso_workaround_ticket_132
cannot_add:;
#endif /* Xorriso_workaround_ticket_132 */
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
Xorriso_report_iso_error(xorriso, nominal_source, ret, Xorriso_report_iso_error(xorriso, nominal_source, ret,
"Cannot add node to tree", 0, "FAILURE", 1|2); "Cannot add node to tree", 0, "FAILURE", 1|2);
@ -1701,18 +1594,9 @@ cannot_lstat:;
{ret= 0; goto was_problem;} {ret= 0; goto was_problem;}
} }
} else { } else {
#ifdef NIX
ret= iso_tree_add_node(volume, dir, srcpt, &node);
if(ret<0) {
Xorriso_report_iso_error(xorriso, "", ret,
"Cannot add node to tree", 0, "FAILURE", 1|2);
goto was_problem;
}
#else
ret= Xorriso_tree_graft_node(xorriso, volume, dir, srcpt, img_name, ret= Xorriso_tree_graft_node(xorriso, volume, dir, srcpt, img_name,
"", img_path, (off_t) 0, (off_t) 0, "", img_path, (off_t) 0, (off_t) 0,
&node, 0); &node, 0);
#endif
} }
} }
if(node==NULL) { if(node==NULL) {
@ -1933,17 +1817,6 @@ int Xorriso_graft_in(struct XorrisO *xorriso, void *boss_iter,
} }
if(S_ISDIR(stbuf.st_mode)) { if(S_ISDIR(stbuf.st_mode)) {
is_dir= 1; is_dir= 1;
#ifdef NIX
} else if(!(S_ISREG(stbuf.st_mode) || S_ISLNK(stbuf.st_mode))) {
Xorriso_process_msg_queues(xorriso,0);
Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0);
sprintf(xorriso->info_text,
"Source file '%s' is of non-supported file type", disk_path);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
#endif /* NIX */
} else { } else {
l= strlen(img_path); l= strlen(img_path);
if(l>0) if(l>0)
@ -2059,19 +1932,6 @@ attach_source:;
} else } else
disk_path_pt= disk_path; disk_path_pt= disk_path;
#ifdef NIX
ret= iso_tree_add_node(volume, dir, disk_path_pt, &node);
if(ret<0) {
Xorriso_process_msg_queues(xorriso,0);
Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0);
Xorriso_report_iso_error(xorriso, img_path, ret, "Cannot create node",
0, "FAILURE", 1);
sprintf(xorriso->info_text, "Grafting failed: %s = %s",
Text_shellsafe(img_path,sfe,0), Text_shellsafe(disk_path,sfe2,0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
#else
ret= Xorriso_tree_graft_node(xorriso, volume, dir, disk_path_pt, apt, ret= Xorriso_tree_graft_node(xorriso, volume, dir, disk_path_pt, apt,
disk_path, img_path, disk_path, img_path,
offset, cut_size, &node, flag&8); offset, cut_size, &node, flag&8);
@ -2081,7 +1941,6 @@ attach_source:;
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0); return(0);
} }
#endif
xorriso->volset_change_pending= 1; xorriso->volset_change_pending= 1;
iso_node_set_name(node, apt); iso_node_set_name(node, apt);
@ -2228,6 +2087,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
struct burn_drive *drive; struct burn_drive *drive;
enum burn_disc_status s; enum burn_disc_status s;
char mem_text[80]; char mem_text[80];
off_t start_byte= 0;
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to print Table Of Content", flag&2); "on attempt to print Table Of Content", flag&2);
@ -2291,17 +2151,8 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
disc= burn_drive_get_disc(drive); disc= burn_drive_get_disc(drive);
if (disc==NULL) { if (disc==NULL) {
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
#define Xorriso_with_isoburn_get_min_start_bytE 1
#ifdef Xorriso_with_isoburn_get_min_start_bytE
{ off_t start_byte= 0;
ret= isoburn_get_min_start_byte(drive, &start_byte, 0); ret= isoburn_get_min_start_byte(drive, &start_byte, 0);
nwa= start_byte / 2048; nwa= start_byte / 2048;
}
#else
ret= isoburn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa);
#endif
if(ret<=0) { if(ret<=0) {
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
if(flag&1) if(flag&1)
@ -2750,10 +2601,6 @@ cannot_iter:;
} }
/*
*/
#define Xorriso_rmi_findi_iteR yes
/* @param boss_iter If not NULL then this is an iterator suitable for /* @param boss_iter If not NULL then this is an iterator suitable for
iso_dir_iter_remove() which is then to be used instead iso_dir_iter_remove() which is then to be used instead
of iso_node_remove(). of iso_node_remove().
@ -2777,19 +2624,15 @@ int Xorriso_rmi(struct XorrisO *xorriso, void *boss_iter, off_t boss_mem,
IsoDirIter *iter= NULL; IsoDirIter *iter= NULL;
IsoImage *volume; IsoImage *volume;
char *sub_name, *name; char *sub_name, *name;
char *sfe= NULL, *sub_path= NULL;
off_t mem;
IsoNode **node_array= NULL;
int node_count, node_idx;
#ifdef Xorriso_fat_local_meM #ifdef Xorriso_fat_local_meM
char sfe[5*SfileadrL], sub_path[2*SfileadrL]; char sfe[5*SfileadrL], sub_path[2*SfileadrL];
#else #else
char *sfe= NULL, *sub_path= NULL;
off_t mem;
#ifdef Xorriso_rmi_findi_iteR
IsoNode **node_array= NULL;
int node_count, node_idx;
#endif /* ! Xorriso_rmi_findi_iteR */
/* Avoiding large local memory objects in order to save stack space */ /* Avoiding large local memory objects in order to save stack space */
sfe= malloc(5*SfileadrL); sfe= malloc(5*SfileadrL);
sub_path= malloc(2*SfileadrL); sub_path= malloc(2*SfileadrL);
@ -2846,17 +2689,10 @@ int Xorriso_rmi(struct XorrisO *xorriso, void *boss_iter, off_t boss_mem,
/* Iterate over subordinates and delete them */ /* Iterate over subordinates and delete them */
mem= boss_mem; mem= boss_mem;
#ifdef Xorriso_rmi_findi_iteR
ret= Xorriso_findi_iter(xorriso, (IsoDir *) victim_node, &mem, ret= Xorriso_findi_iter(xorriso, (IsoDir *) victim_node, &mem,
&iter, &node_array, &node_count, &node_idx, &iter, &node_array, &node_count, &node_idx,
&node, 1|2); &node, 1|2);
if(ret<=0) { if(ret<=0) {
#else
ret= iso_dir_get_children((IsoDir *) victim_node, &iter);
Xorriso_process_msg_queues(xorriso,0);
if(ret<0) {
#endif /* ! Xorriso_rmi_findi_iteR */
cannot_create_iter:; cannot_create_iter:;
Xorriso_cannot_create_iter(xorriso, ret, 0); Xorriso_cannot_create_iter(xorriso, ret, 0);
ret= -1; goto ex; ret= -1; goto ex;
@ -2868,8 +2704,6 @@ cannot_create_iter:;
sub_path[pl]= 0; sub_path[pl]= 0;
} }
sub_name= sub_path+pl; sub_name= sub_path+pl;
#ifdef Xorriso_rmi_findi_iteR
while(1) { while(1) {
ret= Xorriso_findi_iter(xorriso, (IsoDir *) victim_node, &mem, &iter, ret= Xorriso_findi_iter(xorriso, (IsoDir *) victim_node, &mem, &iter,
&node_array, &node_count, &node_idx, &node, 0); &node_array, &node_count, &node_idx, &node, 0);
@ -2877,11 +2711,6 @@ cannot_create_iter:;
goto ex; goto ex;
if(ret==0 || xorriso->request_to_abort) if(ret==0 || xorriso->request_to_abort)
break; break;
#else
while(iso_dir_iter_next(iter, &node) == 1
&& !xorriso->request_to_abort) {
#endif
name= (char *) iso_node_get_name(node); name= (char *) iso_node_get_name(node);
if(Xorriso_much_too_long(xorriso, pl+1+strlen(name), 0)<=0) if(Xorriso_much_too_long(xorriso, pl+1+strlen(name), 0)<=0)
{ret= 0; goto rm_r_problem_handler;} {ret= 0; goto rm_r_problem_handler;}
@ -3021,14 +2850,8 @@ ex:;
free(sub_path); free(sub_path);
#endif /* ! Xorriso_fat_local_meM */ #endif /* ! Xorriso_fat_local_meM */
#ifdef Xorriso_rmi_findi_iteR
Xorriso_findi_iter(xorriso, (IsoDir *) victim_node, &mem, &iter, Xorriso_findi_iter(xorriso, (IsoDir *) victim_node, &mem, &iter,
&node_array, &node_count, &node_idx, &node, (1<<31)); &node_array, &node_count, &node_idx, &node, (1<<31));
#else
if(iter!=NULL)
iso_dir_iter_free(iter);
#endif /* ! Xorriso_rmi_findi_iteR */
return(ret); return(ret);
} }
@ -4756,6 +4579,9 @@ int Xorriso_iso_file_open(struct XorrisO *xorriso, char *pathname,
IsoFile *filenode= NULL; IsoFile *filenode= NULL;
IsoStream *iso_stream= NULL; IsoStream *iso_stream= NULL;
/* for debugging
#define Libisofs_lba_tesT yes
*/
#ifdef Libisofs_lba_tesT #ifdef Libisofs_lba_tesT
uint32_t lba; uint32_t lba;
#endif #endif