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

@ -58,8 +58,12 @@ int isoburn_new(struct isoburn **objpt, int flag)
int i, ret;
*objpt= o= (struct isoburn *) malloc(sizeof(struct isoburn));
if(o==NULL)
if(o==NULL) {
burn_msgs_submit(0x00060000,
"Cannot allocate memory for isoburn control object",
0, "FATAL", NULL);
return(-1);
}
o->drive= NULL;
o->emulation_mode= 0;
@ -276,6 +280,7 @@ int isoburn_prepare_disc_aux(struct burn_drive *d, struct burn_disc **disc,
if (state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE
&& (state != BURN_DISC_FULL || ! new_img)) {
/* unsuitable status */
burn_msgs_submit(0x00060000, "Unsuitable media state", 0, "FAILURE", NULL);
{ret= -2; goto ex;}
}
@ -322,10 +327,15 @@ int isoburn_prepare_disc_aux(struct burn_drive *d, struct burn_disc **disc,
} else {
int lba, nwa;
ret = isoburn_disc_track_lba_nwa(d, NULL, 0, &lba, &nwa);
if (ret != 1)
if (ret != 1) {
burn_msgs_submit(0x00060000, "Cannot determine next writeable address", 0,
"FAILURE", NULL);
{ret= -3; goto ex;}
}
if (nwa == 0 && state == BURN_DISC_APPENDABLE) {
/* invalid nwa */
burn_msgs_submit(0x00060000, "Encountered 0 as next writeable address", 0,
"FAILURE", NULL);
{ret= -4; goto ex;}
}
iso_write_opts_set_ms_block(wopts, nwa);
@ -347,7 +357,7 @@ int isoburn_prepare_disc_aux(struct burn_drive *d, struct burn_disc **disc,
o->fifo = burn_fifo_source_new(wsrc, 2048, fifo_chunks, 0);
burn_source_free(wsrc);
if (o->fifo == NULL) {
fprintf(stderr, "Cannot attach fifo\n");
burn_msgs_submit(0x00060000, "Cannot attach fifo", 0, "FATAL", NULL);
{ret= -1; goto ex;}
}
#endif /* ! Libisoburn_no_fifO */
@ -416,6 +426,7 @@ int isoburn_prepare_new_image(struct burn_drive *d, struct burn_disc **disc,
/* API @since 0.1.0
@param flag bit0= this is a regular end, not an abort
give up source reference
*/
int isoburn_cancel_prepared_write(struct burn_drive *d, int flag)
{
@ -432,6 +443,8 @@ int isoburn_cancel_prepared_write(struct burn_drive *d, int flag)
if(o->iso_source->version<1)
return(0);
o->iso_source->cancel(o->iso_source);
burn_source_free(o->iso_source);
o->iso_source= NULL;
return(1);
}
@ -482,8 +495,11 @@ int isoburn_ropt_new(struct isoburn_read_opts **new_o, int flag)
struct isoburn_read_opts *o;
o= (*new_o)= calloc(1, sizeof(struct isoburn_read_opts));
if(o==NULL)
if(o==NULL) {
burn_msgs_submit(0x00060000, "Cannot allocate memory for read options",
0, "FATAL", NULL);
return(-1);
}
o->norock= 0;
o->nojoliet= 0;
o->noiso1999= 1;
@ -616,8 +632,12 @@ int isoburn_igopt_new(struct isoburn_imgen_opts **new_o, int flag)
struct isoburn_imgen_opts *o;
o= (*new_o)= calloc(1, sizeof(struct isoburn_imgen_opts));
if(o==NULL)
if(o==NULL) {
burn_msgs_submit(0x00060000,
"Cannot allocate memory for image generation options",
0, "FATAL", NULL);
return(-1);
}
o->level= 2;
o->rockridge= 1;
o->joliet= 0;