Inserted problem messages where libisoburn API produces own failures

This commit is contained in:
2008-02-04 18:47:17 +00:00
parent de2a2025dd
commit 0752efbef1
6 changed files with 86 additions and 36 deletions

View File

@ -255,7 +255,7 @@ int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[],
if(conv_ret<=0) {
sprintf(msg, "Unsuitable drive address: '%s'\n",adr);
msg[BURN_MSGS_MESSAGE_LEN-1]= 0;
burn_msgs_submit(0, msg, 0, "SORRY", NULL);
burn_msgs_submit(0x00060000, msg, 0, "SORRY", NULL);
ret= 0; goto ex;
}
@ -309,8 +309,11 @@ int isoburn_find_emulator(struct isoburn **pt,
ret= isoburn_find_by_drive(pt, drive, 0);
if(ret<=0)
return(0);
if((*pt)->emulation_mode==-1)
if((*pt)->emulation_mode==-1) {
burn_msgs_submit(0x00060000,
"Unsuitable drive and media state", 0, "FAILURE", NULL);
return(-1);
}
if((*pt)->emulation_mode==0)
return(0);
return(1);
@ -388,8 +391,11 @@ int isoburn_disc_get_msc1(struct burn_drive *d, int *start_lba)
#endif
if(isoburn_disc_get_status(d)!=BURN_DISC_APPENDABLE &&
isoburn_disc_get_status(d)!=BURN_DISC_FULL)
isoburn_disc_get_status(d)!=BURN_DISC_FULL) {
burn_msgs_submit(0x00060000,
"Media contains no recognizable data", 0, "SORRY",NULL);
return(0);
}
ret= isoburn_find_emulator(&o, d, 0);
if(ret<0)
return(0);
@ -454,7 +460,7 @@ void isoburn_disc_write(struct burn_write_opts *opts, struct burn_disc *disc)
write_type= burn_write_opts_auto_write_type(opts, disc, reasons, 0);
if (write_type == BURN_WRITE_NONE) {
sprintf(msg, "Failed to find a suitable write mode:\n%s", reasons);
burn_msgs_submit(0, msg, 0, "SORRY", NULL);
burn_msgs_submit(0x00060000, msg, 0, "SORRY", NULL);
if(o!=NULL)
o->wrote_well= 0;
/* To cause a negative reply with burn_drive_wrote_well() */
@ -531,8 +537,12 @@ int isoburn_set_start_byte(struct isoburn *o, off_t value, int flag)
ret= burn_disc_get_multi_caps(drive, BURN_WRITE_NONE, &caps, 0);
if(ret<=0)
goto ex;
if(!caps->start_adr)
if(!caps->start_adr) {
burn_msgs_submit(0x00060000,
"Cannot set start byte address with this type of media",
0, "FAILURE", NULL);
{ret= 0; goto ex;}
}
o->min_start_byte= value;
if(value % caps->start_alignment)
value+= caps->start_alignment - (value % caps->start_alignment);
@ -557,7 +567,7 @@ int isoburn_get_min_start_byte(struct burn_drive *d, off_t *start_byte,
ret= isoburn_find_emulator(&o, d, 0);
if(ret<0)
return(-1);
if(ret==0)
if(ret==0)
return(0);
*start_byte= o->min_start_byte;
if(o->min_start_byte<=0)
@ -701,11 +711,13 @@ int isoburn_report_iso_error(int iso_error_code, char msg_text[], int os_errno,
int error_code, iso_sev, min_sev, ret;
char *sev_text_pt, *msg_text_pt= NULL;
/* <<< delete as soon as replacement appears in libisofs */
error_code= 0x00050000;
/* It would have been neat ...
#define ISO_ERR_CODE(e) (e & 0x0000FFFF)
error_code= 0x00050000 | ISO_ERR_CODE(iso_error_code);
*/
if(iso_error_code<0)
msg_text_pt= (char *) iso_error_to_msg(iso_error_code);
if(msg_text_pt==NULL)