Imported Upstream version 0.72.3

This commit is contained in:
TANIGUCHI Takaki
2012-03-06 11:08:15 +09:00
parent 205701b3de
commit 30255c97b3
713 changed files with 13953 additions and 28840 deletions

50
udf.c
View File

@@ -1,5 +1,5 @@
/* dvdisaster: Additional error correction for optical media.
* Copyright (C) 2004-2010 Carsten Gnoerlich.
* Copyright (C) 2004-2011 Carsten Gnoerlich.
* Project home page: http://www.dvdisaster.com
* Email: carsten@dvdisaster.com -or- cgnoerlich@fsfe.org
*
@@ -52,7 +52,8 @@ static int try_sector(DeviceHandle *dh, gint64 pos, EccHeader **ehptr, unsigned
this modulo makes no sense for write-once media.
However if the medium is rewriteable, there might be trash
data behind the image. So finding an invalid sector
does not imply there is not RS02 data present. */
does not imply there is no RS02 data present.
Added workaround: Avoid misrecognizing RS03 images */
if(strncmp((char*)eh->cookie, "*dvdisaster*RS02", 16))
{ if(dh->rewriteable)
@@ -65,7 +66,7 @@ static int try_sector(DeviceHandle *dh, gint64 pos, EccHeader **ehptr, unsigned
}
}
else Verbose("udf/try_sector: header at %lld: magic cookie found\n", (long long int)pos);
/* Calculate CRC */
recorded_crc = eh->selfCRC;
@@ -130,9 +131,10 @@ static int try_sector(DeviceHandle *dh, gint64 pos, EccHeader **ehptr, unsigned
static void no_rs02_cb(GtkWidget *widget, gpointer data)
{ int state = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
Closure->examineRS02 = !state;
if(state) Closure->querySize = 1;
else Closure->querySize = 2;
UpdatePrefsExhaustiveSearch();
UpdatePrefsQuerySize();
}
static void insert_buttons(GtkDialog *dialog)
@@ -166,6 +168,7 @@ EccHeader* FindHeaderInMedium(DeviceHandle *dh, gint64 max_sectors)
gint64 header_modulo;
int read_count = 0;
int answered_continue = FALSE;
int warning_shown = FALSE;
/*** Quick search at fixed offsets relative to ISO filesystem */
@@ -243,6 +246,13 @@ EccHeader* FindHeaderInMedium(DeviceHandle *dh, gint64 max_sectors)
if(answer) goto bail_out;
answered_continue = TRUE;
}
if(!Closure->guiMode && !warning_shown)
{ PrintCLI(_("\nSearching this medium for error correction data may take a long time.\n"
"If you are certain that this medium was not augmented with RS02 error correction\n"
"data, you might wish to abort this command and re-run with the option\n"
"--query-size=udf\n"));
warning_shown = TRUE;
}
}
goto check_next_header;
case TRY_NEXT_MODULO:
@@ -618,7 +628,7 @@ static IsoInfo* examine_primary_vd(unsigned char *buf)
return ii;
}
static IsoInfo* examine_iso(DeviceHandle *dh, LargeFile *image)
static IsoInfo* examine_iso(DeviceHandle *dh)
{ AlignedBuffer *ab = CreateAlignedBuffer(2048);
unsigned char *buf = ab->buf;
IsoInfo *ii = NULL;
@@ -629,19 +639,12 @@ static IsoInfo* examine_iso(DeviceHandle *dh, LargeFile *image)
Verbose(" Examining the ISO file system...\n");
/*** Iterate over the volume decriptors */
if(image)
if(!LargeSeek(image, 2048*16))
{ Verbose(" * Could not seek to sector 16");
return NULL;
}
for(sector=16; sector<32; sector++)
{ if(Closure->stopActions)
continue;
if(dh) status = ReadSectorsFast(dh, buf, sector, 1);
else status = !LargeRead(image, buf, 2048);
status = ReadSectorsFast(dh, buf, sector, 1);
if(status)
{ Verbose(" Sector %2d: unreadable\n", sector);
@@ -690,27 +693,20 @@ finished:
***/
IsoInfo* ExamineUDF(DeviceHandle *dh, LargeFile *image)
{ IsoInfo *ii;
int ExamineUDF(DeviceHandle *dh)
{
Verbose("\nExamineUDF(%s)\n",dh->devinfo);
if(!dh && !image) return NULL;
if(dh) Verbose("\nExamineUDF(Device: %s)\n", dh->devinfo);
if(image) Verbose("\nExamineUDF(File: %s)\n", image->path);
ii = examine_iso(dh, image);
if(dh) dh->isoInfo = ii;
dh->isoInfo = examine_iso(dh);
Verbose(" Examining the UDF file system...\n");
Verbose(" not yet implemented.\n\n");
/* Try to find the root header at a fixed offset to the ISO filesystem end. */
if(dh)
dh->rs02Size = MediumLengthFromRS02(dh, 0);
dh->rs02Size = MediumLengthFromRS02(dh, 0);
return ii;
return TRUE;
}
/***