Pre-computing size of data file content area and publishing it to

writers as Ecma119Image.filesrc_blocks.
This commit is contained in:
2012-06-05 21:29:52 +02:00
parent a3285f6e5d
commit cb3a6f8bb0
4 changed files with 80 additions and 16 deletions

View File

@ -1894,6 +1894,8 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
target->gpt_backup_end = 0;
target->gpt_max_entries = 0;
target->filesrc_blocks = 0;
/*
* 2. Based on those options, create needed writers: iso, joliet...
* Each writer inits its structures and stores needed info into
@ -1973,14 +1975,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
}
}
/* create writer for HFS+ structure */
if (target->hfsplus) {
ret = hfsplus_writer_create(target);
if (ret < 0) {
goto target_cleanup;
}
}
/* create writer for ISO 9660:1999 structure */
if (target->iso1999) {
ret = iso1999_writer_create(target);
@ -2008,6 +2002,16 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
goto target_cleanup;
}
/* create writer for HFS+/FAT structure */
/* Impotant: It must be created directly before iso_file_src_writer_create.
*/
if (target->hfsplus) {
ret = hfsplus_writer_create(target);
if (ret < 0) {
goto target_cleanup;
}
}
/* create writer for file contents */
ret = iso_file_src_writer_create(target);
if (ret < 0) {
@ -2077,6 +2081,15 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
}
/* At least the FAT computation needs to know the size of filesrc data
in advance. So this call produces target->filesrc_blocks and
relative extent addresses, which get absolute in
filesrc_writer_compute_data_blocks().
*/
ret = filesrc_writer_pre_compute(target->writers[file_src_writer_index]);
if (ret < 0)
goto target_cleanup;
/*
* 3.
* Call compute_data_blocks() in each Writer.