Bug fix: -toc reported wrong track LBA with overwritable media with unrecognized content (pseudo-closed)

This commit is contained in:
Thomas Schmitt 2023-01-09 15:45:00 +01:00
parent 1a39dc6903
commit 3afa1d5191
2 changed files with 15 additions and 9 deletions

View File

@ -1,7 +1,7 @@
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2021 Thomas Schmitt, <scdbackup@gmx.net> Copyright 2007-2023 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
@ -1069,7 +1069,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
struct burn_multi_caps *caps= NULL; struct burn_multi_caps *caps= NULL;
struct burn_drive *drive; struct burn_drive *drive;
enum burn_disc_status s; enum burn_disc_status s;
char mem_text[80], *num_free_text; char mem_text[80], *num_free_text, *num_data_text;
off_t start_byte= 0, num_free= 0, size; off_t start_byte= 0, num_free= 0, size;
unsigned dummy; unsigned dummy;
struct isoburn_toc_disc *disc= NULL; struct isoburn_toc_disc *disc= NULL;
@ -1281,12 +1281,16 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
lba= num_blocks; lba= num_blocks;
} }
if(drive_role == 5)
num_data_text= "occupied";
else
num_data_text= "readable";
if(drive_role == 4 || is_bdr_pow) if(drive_role == 4 || is_bdr_pow)
num_free_text = "unused"; num_free_text = "unused";
else else
num_free_text = "writable"; num_free_text = "writable";
sprintf(respt, "Media blocks : %d readable , %d %s , %d overall\n", sprintf(respt, "Media blocks : %d %s , %d %s , %d overall\n",
num_data, (int) num_free, num_free_text, lba); num_data, num_data_text, (int) num_free, num_free_text, lba);
Xorriso_toc_line(xorriso, flag & 8); Xorriso_toc_line(xorriso, flag & 8);
if(overburn_blocks > 0) { if(overburn_blocks > 0) {
sprintf(respt, "Overburnt by : %d blocks\n", overburn_blocks); sprintf(respt, "Overburnt by : %d blocks\n", overburn_blocks);
@ -1341,10 +1345,11 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
if (disc==NULL) { if (disc==NULL) {
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
nwa= 0;
if(drive_role == 5 && s == BURN_DISC_APPENDABLE) { if(drive_role == 5 && s == BURN_DISC_APPENDABLE) {
ret= burn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa); ret= burn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa);
if(ret != 1) if(ret != 1)
lba= 0; nwa= 0;
} else { } else {
ret= isoburn_get_min_start_byte(drive, &start_byte, 0); ret= isoburn_get_min_start_byte(drive, &start_byte, 0);
nwa= start_byte / 2048; nwa= start_byte / 2048;
@ -1381,10 +1386,11 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
} else { } else {
num_data_from_format= 1; num_data_from_format= 1;
} }
nwa= lba + size / 2048; num_data= size / 2048;
num_data= nwa - lba; if(num_data == 0 && drive_role == 5 && s == BURN_DISC_APPENDABLE)
num_data= nwa;
sprintf(respt, "%13s: %3d , %9d , %9ds , \n", sprintf(respt, "%13s: %3d , %9d , %9ds , \n",
typetext, 1, lba, num_data); typetext, 1, 0, num_data);
} }
if(!(flag&1)) if(!(flag&1))
Xorriso_toc_line(xorriso, flag & 8); Xorriso_toc_line(xorriso, flag & 8);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2022.12.28.083915" #define Xorriso_timestamP "2023.01.09.144346"