Corrected image size computation for comparison with partition table

This commit is contained in:
Thomas Schmitt 2010-04-18 14:12:44 +00:00
parent 9073640468
commit cc6a26b917
2 changed files with 9 additions and 43 deletions

View File

@ -1 +1 @@
#define Xorriso_timestamP "2010.04.18.100814"
#define Xorriso_timestamP "2010.04.18.141143"

View File

@ -1695,8 +1695,7 @@ int Xorriso_set_system_area(struct XorrisO *xorriso, struct burn_drive *drive,
IsoImage *img, struct isoburn_imgen_opts *sopts,
int flag)
{
int ret, options, system_area_options, iso_lba= 0;
int num_sessions= 0, num_tracks= 0, start_lba, end_lba, image_blocks;
int ret, options, system_area_options, iso_lba= -1, start_lba, image_blocks;
char volid[33];
FILE *fp= NULL;
char buf[32768], *bufpt= NULL;
@ -1704,10 +1703,6 @@ int Xorriso_set_system_area(struct XorrisO *xorriso, struct burn_drive *drive,
unsigned char *ub;
ElToritoBootImage *bootimg;
IsoFile *bootimg_node;
struct isoburn_toc_disc *disc= NULL;
struct isoburn_toc_session **sessions;
struct isoburn_toc_track **tracks;
struct burn_toc_entry toc_entry;
system_area_options= xorriso->system_area_options;
memset(buf, 0, 32768);
@ -1728,42 +1723,15 @@ int Xorriso_set_system_area(struct XorrisO *xorriso, struct burn_drive *drive,
ub= (unsigned char *) buf;
hd_lba= (ub[454] | (ub[455] << 8) | (ub[456] << 16) | (ub[457] << 24)) +
(ub[458] | (ub[459] << 8) | (ub[460] << 16) | (ub[461] << 24));
disc= isoburn_toc_drive_get_disc(drive);
if(disc == NULL)
iso_lba= -1;
else {
/* With sequential media this is the track end, not the ISO size */
end_lba= isoburn_toc_disc_get_sectors(disc);
/* So inquire start and ISO size of the last track */
iso_lba= -1;
sessions= isoburn_toc_disc_get_sessions(disc, &num_sessions);
if(num_sessions > 0)
tracks= isoburn_toc_session_get_tracks(sessions[num_sessions - 1],
&num_tracks);
if(tracks != NULL && num_tracks > 0)
isoburn_toc_track_get_entry(tracks[num_tracks - 1], &toc_entry);
if (toc_entry.extensions_valid & 1) {
ret= isoburn_toc_track_get_emul(tracks[num_tracks - 1], &start_lba,
&image_blocks, volid, 0);
if(ret > 0) {
iso_lba= start_lba + image_blocks;
} else {
start_lba= toc_entry.start_lba;
ret= isoburn_read_iso_head(drive, start_lba, &image_blocks,
volid, 1);
if(ret > 0)
iso_lba= start_lba + image_blocks;
}
}
/* <<< provisorily revoke the new size */
iso_lba = end_lba;
if(iso_lba > end_lba)
iso_lba= -1;
iso_lba= -1;
ret= isoburn_disc_get_msc1(drive, &start_lba);
if(ret > 0) {
ret= isoburn_read_iso_head(drive, start_lba, &image_blocks,
volid, 1);
if(ret > 0)
iso_lba= start_lba + image_blocks;
}
if(((off_t) iso_lba) * (off_t) 4 > hd_lba) {
system_area_options= 0;
} else if((xorriso->patch_system_area & 1) &&
@ -1834,8 +1802,6 @@ do_set:;
ex:;
if(fp != NULL && fp != stdin)
fclose(fp);
if(disc != NULL)
isoburn_toc_disc_free(disc);
return(ret);
}