Browse Source

Change burn_source implementation to fit libburn requirements.

master
Vreixo Formoso Lopes 15 years ago
parent
commit
6546f1a197
  1. 17
      libisofs/ecma119.c

17
libisofs/ecma119.c

@ -867,10 +867,19 @@ bs_read(struct burn_source *bs, unsigned char *buf, int size)
{
struct ecma119_write_target *t = (struct ecma119_write_target*)bs->data;
assert(size == t->block_size);
if (size != t->block_size) {
printf("[ERROR] You can only read in %d chunks\n", t->block_size);
return -1;
}
if (t->curblock >= t->vol_space_size) {
return 0;
/* total_size could be setted by libburn */
if ( t->curblock >= (t->total_size / (off_t) t->block_size) ) {
/* we pad the image */
memset(buf, 0, size);
return size;
}
return -1;
}
if (t->state_data_valid)
write_data_chunk(t, buf);
@ -908,8 +917,10 @@ bs_free_data(struct burn_source *bs)
t->state_files.src->close(t->state_files.src);
}
int bs_set_size(struct burn_source *source, off_t size)
int bs_set_size(struct burn_source *bs, off_t size)
{
struct ecma119_write_target *t = (struct ecma119_write_target*)bs->data;
t->total_size = size;
return 1;
}

Loading…
Cancel
Save