sync from upstream up to 22:14a375563e2b

This includes the following commits:

changeset:   22:14a375563e2b
summary:     chang "while" command to "type -P" in bash based configure

changeset:   21:c4bf7c0f33d2
summary:     updated codec paper for RS01 life cycle

changeset:   20:dbcaad8128aa
summary:     replaced build count with mercurial changeset

changeset:   19:fba258a6acfa
summary:     Added tag 0.79.10 for changeset 49950be5a2ef

changeset:   18:49950be5a2ef
summary:     merged some debian patches

changeset:   17:815be3929c41
summary:     merged "easy" patches from Stéphane Lesimple's version

changeset:   16:7d15f8a958cb
summary:     Made printf format strings 32/64bit safe as suggested by Stéphane;

changeset:   15:1055a53b8d6d
summary:     reorganized code for --with-gui=[yes|no] option

changeset:   14:fbe2ae12a32c
summary:     Added tag 0.79.9 for changeset f2fdd6d3a1f5

changeset:   13:f2fdd6d3a1f5
summary:     updated TODO and CHANGELOG

And other changes that were needed to resolve the (many) conflicts.
This commit is contained in:
Stéphane Lesimple
2021-10-04 21:50:50 +02:00
parent 244111e7db
commit db4d3af31d
196 changed files with 17479 additions and 15516 deletions

View File

@@ -20,11 +20,13 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: some GUI code ***/
#include "dvdisaster.h"
#include "rs01-includes.h"
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
/***
*** Reset the verify output window
@@ -33,28 +35,28 @@
void ResetRS01VerifyWindow(Method *self)
{ RS01Widgets *wl = (RS01Widgets*)self->widgetList;
SetLabelText(GTK_LABEL(wl->cmpChkSumErrors), "-");
SetLabelText(GTK_LABEL(wl->cmpMissingSectors), "0");
SetLabelText(GTK_LABEL(wl->cmpImageMd5Sum), "-");
SetLabelText(GTK_LABEL(wl->cmpImageResult), "");
SwitchAndSetFootline(wl->cmpImageNotebook, 1, NULL, NULL);
GuiSetLabelText(wl->cmpChkSumErrors, "-");
GuiSetLabelText(wl->cmpMissingSectors, "0");
GuiSetLabelText(wl->cmpImageMd5Sum, "-");
GuiSetLabelText(wl->cmpImageResult, "");
GuiSwitchAndSetFootline(wl->cmpImageNotebook, 1, NULL, NULL);
SetLabelText(GTK_LABEL(wl->cmpEccEmptyMsg), "");
SetLabelText(GTK_LABEL(wl->cmpEccCreatedBy), "dvdisaster");
SetLabelText(GTK_LABEL(wl->cmpEccMethod), "");
SetLabelText(GTK_LABEL(wl->cmpEccRequires), "");
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "");
SetLabelText(GTK_LABEL(wl->cmpEccImgMd5Sum), "");
SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("n/a"));
SetLabelText(GTK_LABEL(wl->cmpEccBlocks), "");
SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), "");
SetLabelText(GTK_LABEL(wl->cmpEccResult), "");
SwitchAndSetFootline(wl->cmpEccNotebook, 0, NULL, NULL);
GuiSetLabelText(wl->cmpEccEmptyMsg, "");
GuiSetLabelText(wl->cmpEccCreatedBy, "dvdisaster");
GuiSetLabelText(wl->cmpEccMethod, "");
GuiSetLabelText(wl->cmpEccRequires, "");
GuiSetLabelText(wl->cmpEccMediumSectors, "");
GuiSetLabelText(wl->cmpEccImgMd5Sum, "");
GuiSetLabelText(wl->cmpEccFingerprint, _("n/a"));
GuiSetLabelText(wl->cmpEccBlocks, "");
GuiSetLabelText(wl->cmpEccMd5Sum, "");
GuiSetLabelText(wl->cmpEccResult, "");
GuiSwitchAndSetFootline(wl->cmpEccNotebook, 0, NULL, NULL);
wl->lastPercent = 0;
FillSpiral(wl->cmpSpiral, Closure->background);
DrawSpiral(wl->cmpSpiral);
GuiFillSpiral(wl->cmpSpiral, Closure->background);
GuiDrawSpiral(wl->cmpSpiral);
}
/***
@@ -76,7 +78,7 @@ static gboolean spiral_idle_func(gpointer data)
int i;
for(i=sii->from; i<=sii->to; i++)
DrawSpiralSegment(sii->cmpSpiral, sii->segColor, i-1);
GuiDrawSpiralSegment(sii->cmpSpiral, sii->segColor, i-1);
g_free(sii);
return FALSE;
@@ -92,13 +94,15 @@ void RS01AddVerifyValues(Method *method, int percent,
return;
if(newMissing)
SetLabelText(GTK_LABEL(wl->cmpMissingSectors), "<span %s>%" PRId64 "</span>",
Closure->redMarkup, totalMissing);
{ GuiSetLabelText(wl->cmpMissingSectors, "<span %s>%" PRId64 "</span>",
Closure->redMarkup, totalMissing);
}
if(newCrcErrors)
SetLabelText(GTK_LABEL(wl->cmpChkSumErrors), "<span %s>%" PRId64 "</span>",
Closure->redMarkup, totalCrcErrors);
{ GuiSetLabelText(wl->cmpChkSumErrors, "<span %s>%" PRId64 "</span>",
Closure->redMarkup, totalCrcErrors);
}
sii->cmpSpiral = wl->cmpSpiral;
sii->segColor = Closure->greenSector;
@@ -119,16 +123,16 @@ void RS01AddVerifyValues(Method *method, int percent,
static void redraw_spiral(RS01Widgets *wl)
{ int x = wl->cmpSpiral->mx - wl->cmpSpiral->diameter/2 + 10;
DrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Good sectors"), Closure->greenSector, x, 1);
GuiDrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Good sectors"), Closure->greenSector, x, 1);
DrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Sectors with CRC errors"), Closure->yellowSector, x, 2);
GuiDrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Sectors with CRC errors"), Closure->yellowSector, x, 2);
DrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Missing sectors"), Closure->redSector, x, 3);
GuiDrawSpiralLabel(wl->cmpSpiral, wl->cmpLayout,
_("Missing sectors"), Closure->redSector, x, 3);
DrawSpiral(wl->cmpSpiral);
GuiDrawSpiral(wl->cmpSpiral);
}
/*
@@ -143,11 +147,11 @@ static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer dat
/* Finish spiral initialization */
if(!wl->cmpLayout)
{ SetSpiralWidget(wl->cmpSpiral, widget);
{ GuiSetSpiralWidget(wl->cmpSpiral, widget);
wl->cmpLayout = gtk_widget_create_pango_layout(widget, NULL);
}
SetText(wl->cmpLayout, _("Missing sectors"), &w, &h);
GuiSetText(wl->cmpLayout, _("Missing sectors"), &w, &h);
size = wl->cmpSpiral->diameter + 20 + 3*(10+h); /* approx. size of spiral + labels */
wl->cmpSpiral->mx = a->width / 2;
@@ -209,7 +213,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Medium sectors:"));
GuiSetLabelText(lab, _("Medium sectors:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 0, 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpImageSectors = gtk_label_new("0");
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -217,7 +221,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Checksum errors:"));
GuiSetLabelText(lab, _("Checksum errors:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 1, 2, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpChkSumErrors = gtk_label_new("0");
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -225,7 +229,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Missing Sectors:"));
GuiSetLabelText(lab, _("Missing Sectors:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 2, 3, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpMissingSectors = gtk_label_new("0");
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -233,7 +237,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Image checksum:"));
GuiSetLabelText(lab, _("Image checksum:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 3, 4, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpImageMd5Sum = gtk_label_new("0");
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -248,7 +252,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
frame = gtk_frame_new(_utf("Image state"));
gtk_table_attach(GTK_TABLE(table), frame, 1, 2, 0, 2, GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL, 5, 5);
wl->cmpSpiral = CreateSpiral(Closure->grid, Closure->background, 10, 5, VERIFY_IMAGE_SEGMENTS);
wl->cmpSpiral = GuiCreateSpiral(Closure->grid, Closure->background, 10, 5, VERIFY_IMAGE_SEGMENTS);
d_area = wl->cmpDrawingArea = gtk_drawing_area_new();
gtk_widget_set_size_request(d_area, wl->cmpSpiral->diameter+20, -1);
gtk_container_add(GTK_CONTAINER(frame), d_area);
@@ -275,7 +279,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Created by:"));
GuiSetLabelText(lab, _("Created by:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 0, 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccCreatedBy = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -283,7 +287,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Method:"));
GuiSetLabelText(lab, _("Method:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 1, 2, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccMethod = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -291,7 +295,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Requires:"));
GuiSetLabelText(lab, _("Requires:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 2, 3, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccRequires = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -299,7 +303,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Medium sectors:"));
GuiSetLabelText(lab, _("Medium sectors:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 3, 4, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccMediumSectors = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -307,7 +311,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Image checksum:"));
GuiSetLabelText(lab, _("Image checksum:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 4, 5, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccImgMd5Sum = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -315,7 +319,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Fingerprint:"));
GuiSetLabelText(lab, _("Fingerprint:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 5, 6, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccFingerprint = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -323,7 +327,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Ecc blocks:"));
GuiSetLabelText(lab, _("Ecc blocks:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 6, 7, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccBlocks = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -331,7 +335,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
lab = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
SetLabelText(GTK_LABEL(lab), _("Ecc checksum:"));
GuiSetLabelText(lab, _("Ecc checksum:"));
gtk_table_attach(GTK_TABLE(table2), lab, 0, 1, 7, 8, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2 );
lab = wl->cmpEccMd5Sum = gtk_label_new(NULL);
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
@@ -341,7 +345,7 @@ void CreateRS01VerifyWindow(Method *self, GtkWidget *parent)
gtk_misc_set_alignment(GTK_MISC(lab), 0.0, 0.0);
gtk_table_attach(GTK_TABLE(table2), lab, 0, 2, 8, 9, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 4);
}
#endif
#endif /* WITH_GUI_YES */
/***
*** Verify the prefix.* files
@@ -356,31 +360,26 @@ static void cleanup(gpointer data)
UnregisterCleanup();
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
AllowActions(TRUE);
#endif
if(vc->image) CloseImage(vc->image);
g_free(vc);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
g_thread_exit(0);
#endif
GuiAllowActions(TRUE);
GuiExitWorkerThread();
}
/***
*** Verify entry point fpr both CLI and GUI mode
***/
void RS01Verify(Image *image)
{ verify_closure *vc = g_malloc0(sizeof(verify_closure));
Method *self = FindMethod("RS01");
#ifndef WITH_CLI_ONLY_YES
#ifdef WITH_GUI_YES
RS01Widgets *wl = (RS01Widgets*)self->widgetList;
#endif
char idigest[33],edigest[33];
gint64 excess_sectors = 0;
#ifndef WITH_CLI_ONLY_YES
char *ecc_advice = NULL;
#endif
EccHeader *eh;
gint8 method[5];
@@ -399,23 +398,17 @@ void RS01Verify(Image *image)
/*** Examine the .iso file */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpHeadline), "<big>%s</big>\n<i>%s</i>",
_("Comparing image and error correction files."),
_("- Checking image file -"));
#endif
GuiSetLabelText(wl->cmpHeadline, "<big>%s</big>\n<i>%s</i>",
_("Comparing image and error correction files."),
_("- Checking image file -"));
vc->image = image;
#ifndef WITH_CLI_ONLY_YES
if(image && image->eccFile)
{ if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpChkSumErrors), "0");
{ GuiSetLabelText(wl->cmpChkSumErrors, "0");
}
else
{ GuiSetLabelText(wl->cmpChkSumErrors, _("n/a"));
}
else
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpChkSumErrors), _("n/a"));
#endif
/* Report basic image properties */
@@ -423,42 +416,32 @@ void RS01Verify(Image *image)
if(!image || !image->file)
{ PrintLog(_("not present\n"));
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpImageNotebook, 0, NULL, NULL);
#endif
GuiSwitchAndSetFootline(wl->cmpImageNotebook, 0, NULL, NULL);
goto process_ecc;
}
if(image->inLast == 2048)
{ PrintLog(_("present, contains %" PRId64 " medium sectors.\n"), image->sectorSize);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpImageSectors), "%" PRId64 "", image->sectorSize);
#endif
GuiSetLabelText(wl->cmpImageSectors, "%" PRId64, image->sectorSize);
}
else
{ PrintLog(_("present, contains %" PRId64 " medium sectors and %d bytes.\n"),
image->sectorSize-1, image->inLast);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpImageSectors), _("%" PRId64 " sectors + %d bytes"),
GuiSetLabelText(wl->cmpImageSectors, _("%" PRId64 " sectors + %d bytes"),
image->sectorSize-1, image->inLast);
#endif
}
if(!Closure->quickVerify)
RS01ScanImage(self, image, NULL, PRINT_MODE);
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions)
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->cmpImageResult),
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
goto terminate;
{ GuiSetLabelText(wl->cmpImageResult,
_("<span %s>Aborted by user request!</span>"),
Closure->redMarkup);
}
goto terminate;
}
#endif
/*** Peek into the ecc file to get expected sector count */
@@ -469,12 +452,9 @@ void RS01Verify(Image *image)
{ diff = image->expectedSectors - image->sectorSize;
PrintLog(_("* truncated image : %" PRId64 " sectors too short\n"), diff);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpImageSectors),
_("<span %s>%" PRId64 " (%" PRId64 " sectors too short)</span>"),
Closure->redMarkup, image->sectorSize, diff);
#endif
GuiSetLabelText(wl->cmpImageSectors,
_("<span %s>%" PRId64 " (%" PRId64 " sectors too short)</span>"),
Closure->redMarkup, image->sectorSize, diff);
image->sectorsMissing += diff;
}
if(image->sectorSize > image->expectedSectors)
@@ -484,29 +464,24 @@ void RS01Verify(Image *image)
/*** Show summary of image read */
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(image->crcErrors)
SetLabelText(GTK_LABEL(wl->cmpChkSumErrors),
"<span %s>%" PRId64 "</span>", Closure->redMarkup, image->crcErrors);
if(image->sectorsMissing)
SetLabelText(GTK_LABEL(wl->cmpMissingSectors),
"<span %s>%" PRId64 "</span>", Closure->redMarkup, image->sectorsMissing);
if(image->crcErrors)
{ GuiSetLabelText(wl->cmpChkSumErrors,
"<span %s>%" PRId64 "</span>",
Closure->redMarkup, image->crcErrors);
}
if(image->sectorsMissing)
{ GuiSetLabelText(wl->cmpMissingSectors,
"<span %s>%" PRId64 "</span>",
Closure->redMarkup, image->sectorsMissing);
}
#endif
if(excess_sectors)
{ PrintLog(_("* image too long : %" PRId64 " excess sectors\n"), excess_sectors);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpImageSectors),
_("<span %s>%" PRId64 " (%" PRId64 " excess sectors)</span>"),
Closure->redMarkup, image->sectorSize, excess_sectors);
SetLabelText(GTK_LABEL(wl->cmpImageResult),
_("<span %s>Bad image.</span>"),
Closure->redMarkup);
}
#endif
GuiSetLabelText(wl->cmpImageSectors,
_("<span %s>%" PRId64 " (%" PRId64 " excess sectors)</span>"),
Closure->redMarkup, image->sectorSize, excess_sectors);
GuiSetLabelText(wl->cmpImageResult,
_("<span %s>Bad image.</span>"),
Closure->redMarkup);
}
else if(Closure->quickVerify)
{ PrintLog(_("* quick mode : image NOT scanned\n"));
@@ -519,23 +494,15 @@ void RS01Verify(Image *image)
if(!image->crcErrors)
{ PrintLog(_("- good image : all sectors present\n"
"- image md5sum : %s\n"),idigest);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpImageResult),_("<span %s>Good image.</span>"), Closure->greenMarkup);
SetLabelText(GTK_LABEL(wl->cmpImageMd5Sum), "%s", idigest);
}
#endif
GuiSetLabelText(wl->cmpImageResult,_("<span %s>Good image.</span>"), Closure->greenMarkup);
GuiSetLabelText(wl->cmpImageMd5Sum, "%s", idigest);
}
else
{ PrintLog(_("* suspicious image : all sectors present, but %" PRId64 " CRC errors\n"
"- image md5sum : %s\n"),image->crcErrors,idigest);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpImageResult), _("<span %s>Image complete, but contains checksum errors!</span>"), Closure->redMarkup);
SetLabelText(GTK_LABEL(wl->cmpImageMd5Sum), "%s", idigest);
}
#endif
GuiSetLabelText(wl->cmpImageResult, _("<span %s>Image complete, but contains checksum errors!</span>"), Closure->redMarkup);
GuiSetLabelText(wl->cmpImageMd5Sum, "%s", idigest);
}
}
else /* sectors are missing */
@@ -543,33 +510,25 @@ void RS01Verify(Image *image)
PrintLog(_("* BAD image : %" PRId64 " sectors missing\n"), image->sectorsMissing);
else PrintLog(_("* BAD image : %" PRId64 " sectors missing, %" PRId64 " CRC errors\n"),
image->sectorsMissing, image->crcErrors);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpImageResult),
GuiSetLabelText(wl->cmpImageResult,
_("<span %s>Bad image.</span>"), Closure->redMarkup);
#endif
}
}
/*** The .ecc file */
process_ecc:
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpHeadline), "<big>%s</big>\n<i>%s</i>",
_("Comparing image and error correction files."),
_("- Checking ecc file -"));
#endif
GuiSetLabelText(wl->cmpHeadline, "<big>%s</big>\n<i>%s</i>",
_("Comparing image and error correction files."),
_("- Checking ecc file -"));
PrintLog("\n%s: ", Closure->eccName);
if(!image)
{ PrintLog(_("not present\n"));
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpEccNotebook, 0,
wl->cmpEccEmptyMsg,_("No error correction file present."));
#endif
GuiSwitchAndSetFootline(wl->cmpEccNotebook, 0,
wl->cmpEccEmptyMsg,_("No error correction file present."));
goto skip_ecc;
}
@@ -595,11 +554,9 @@ process_ecc:
PrintLog(_("unusable\n"));
break;
}
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpEccNotebook, 0,
wl->cmpEccEmptyMsg,_("No error correction file present."));
#endif
GuiSwitchAndSetFootline(wl->cmpEccNotebook, 0,
wl->cmpEccEmptyMsg,_("No error correction file present."));
goto skip_ecc;
}
@@ -625,35 +582,25 @@ process_ecc:
PrintLog(format, _("created by dvdisaster"), major, minor, micro, unstable);
PrintLog("\n");
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SwitchAndSetFootline(wl->cmpEccNotebook, 1,
GuiSwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy,
format, "dvdisaster",
major, minor, micro, unstable);
}
#endif
}
else /* version format x.xx */
{ char *format = "%s-%d.%d%s";
PrintLog(format, _("created by dvdisaster"),
major, minor, unstable);
PrintLog("\n");
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy, format, "dvdisaster",
major, minor, unstable);
#endif
GuiSwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy, format, "dvdisaster",
major, minor, unstable);
}
}
else
{ PrintLog(_("created by dvdisaster-0.41.x.\n"));
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy, "dvdisaster-0.41.x");
#endif
GuiSwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy, "dvdisaster-0.41.x");
}
/* Information on RS01 properties */
@@ -663,12 +610,10 @@ process_ecc:
PrintLog(_("- method : %4s, %d roots, %4.1f%% redundancy.\n"),
method, eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMethod), _("%4s, %d roots, %4.1f%% redundancy"),
method, eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
#endif
GuiSetLabelText(wl->cmpEccMethod, _("%4s, %d roots, %4.1f%% redundancy"),
method, eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
/* Show and verify needed version */
@@ -676,12 +621,9 @@ process_ecc:
{ PrintLog(_("- requires : dvdisaster-%d.%d (good)\n"),
eh->neededVersion/10000,
(eh->neededVersion%10000)/100);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccRequires), "dvdisaster-%d.%d",
eh->neededVersion/10000,
(eh->neededVersion%10000)/100);
#endif
GuiSetLabelText(wl->cmpEccRequires, "dvdisaster-%d.%d",
eh->neededVersion/10000,
(eh->neededVersion%10000)/100);
}
else
{ PrintLog(_("* requires : dvdisaster-%d.%d (BAD)\n"
@@ -690,17 +632,13 @@ process_ecc:
eh->neededVersion/10000,
(eh->neededVersion%10000)/100);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccRequires),
"<span %s>dvdisaster-%d.%d</span>",
Closure->redMarkup,
eh->neededVersion/10000,
(eh->neededVersion%10000)/100);
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Please upgrade your version of dvdisaster!</span>"), Closure->redMarkup);
}
#endif
GuiSetLabelText(wl->cmpEccRequires,
"<span %s>dvdisaster-%d.%d</span>",
Closure->redMarkup,
eh->neededVersion/10000,
(eh->neededVersion%10000)/100);
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Please upgrade your version of dvdisaster!</span>"), Closure->redMarkup);
}
@@ -712,21 +650,15 @@ process_ecc:
if(!image->file)
{ if(!ecc_in_last)
{ PrintLog(_("- medium sectors : %" PRId64 "\n"), image->expectedSectors);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "%" PRId64 "", image->expectedSectors);
#endif
GuiSetLabelText(wl->cmpEccMediumSectors, "%" PRId64 "", image->expectedSectors);
}
else
{ PrintLog(_("- medium sectors : %" PRId64 " sectors + %d bytes\n"),
image->expectedSectors-1, ecc_in_last);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors),
_("%" PRId64 " sectors + %d bytes"),
image->expectedSectors-1, ecc_in_last);
#endif
}
GuiSetLabelText(wl->cmpEccMediumSectors,
_("%" PRId64 " sectors + %d bytes"),
image->expectedSectors-1, ecc_in_last);
}
}
if(image->file)
@@ -735,20 +667,14 @@ process_ecc:
&& (!ecc_in_last || image->inLast == eh->inLast))
{ if(!ecc_in_last)
{ PrintLog(_("- medium sectors : %" PRId64 " (good)\n"), image->expectedSectors);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "%" PRId64 "", image->expectedSectors);
#endif
GuiSetLabelText(wl->cmpEccMediumSectors, "%" PRId64, image->expectedSectors);
}
else
{ PrintLog(_("- medium sectors : %" PRId64 " sectors + %d bytes (good)\n"),
image->expectedSectors-1, ecc_in_last);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors),
_("%" PRId64 " sectors + %d bytes"),
image->expectedSectors-1, ecc_in_last);
#endif
GuiSetLabelText(wl->cmpEccMediumSectors,
_("%" PRId64 " sectors + %d bytes"),
image->expectedSectors-1, ecc_in_last);
}
}
@@ -756,40 +682,31 @@ process_ecc:
{ /* TAO case (1 or 2 sectors more than expected) */
if(image->sectorSize > image->expectedSectors && image->sectorSize - image->expectedSectors <= 2)
{ PrintLog(_("* medium sectors : %" PRId64 " (BAD, perhaps TAO/DAO mismatch)\n"), image->expectedSectors);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(!ecc_in_last)
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "<span %s>%" PRId64 "</span>",
Closure->redMarkup, image->expectedSectors);
else SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "<span %s>%" PRId64 " sectors + %d bytes</span>",
Closure->redMarkup, image->expectedSectors-1, ecc_in_last);
if(!ecc_in_last)
{ GuiSetLabelText(wl->cmpEccMediumSectors, "<span %s>%" PRId64 "</span>",
Closure->redMarkup, image->expectedSectors);
}
else
{ GuiSetLabelText(wl->cmpEccMediumSectors, "<span %s>%" PRId64 " sectors + %d bytes</span>",
Closure->redMarkup, image->expectedSectors-1, ecc_in_last);
}
#endif
}
else /* more than 2 Sectors difference */
{ if(!ecc_in_last)
{ PrintLog(_("* medium sectors : %" PRId64 " (BAD)\n"), image->expectedSectors);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "<span %s>%" PRId64 "</span>",
GuiSetLabelText(wl->cmpEccMediumSectors, "<span %s>%" PRId64 "</span>",
Closure->redMarkup, image->expectedSectors);
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Image size does not match error correction file.</span>"), Closure->redMarkup);
}
#endif
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Image size does not match error correction file.</span>"), Closure->redMarkup);
}
else /* byte size difference */
{ PrintLog(_("* medium sectors : %" PRId64 " sectors + %d bytes (BAD)\n"),
image->expectedSectors-1, ecc_in_last);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors),
GuiSetLabelText(wl->cmpEccMediumSectors,
_("<span %s>%" PRId64 " sectors + %d bytes</span>"),
Closure->redMarkup, image->expectedSectors-1, ecc_in_last);
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Image size does not match error correction file.</span>"), Closure->redMarkup);
}
#endif
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Image size does not match error correction file.</span>"), Closure->redMarkup);
}
}
}
@@ -801,56 +718,45 @@ process_ecc:
{ AsciiDigest(edigest, eh->mediumSum);
if(image && image->file && !image->sectorsMissing && !excess_sectors)
{ int n = !memcmp(eh->mediumSum, image->mediumSum, 16);
if(n) PrintLog(_("- image md5sum : %s (good)\n"),edigest);
else PrintLog(_("* image md5sum : %s (BAD)\n"),edigest);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(n) SetLabelText(GTK_LABEL(wl->cmpEccImgMd5Sum), "%s", edigest);
else
{ SetLabelText(GTK_LABEL(wl->cmpEccImgMd5Sum), "<span %s>%s</span>", Closure->redMarkup, edigest);
SetLabelText(GTK_LABEL(wl->cmpImageMd5Sum), "<span %s>%s</span>", Closure->redMarkup, idigest);
}
if(n)
{ PrintLog(_("- image md5sum : %s (good)\n"),edigest);
GuiSetLabelText(wl->cmpEccImgMd5Sum, "%s", edigest);
}
else
{ PrintLog(_("* image md5sum : %s (BAD)\n"),edigest);
GuiSetLabelText(wl->cmpEccImgMd5Sum, "<span %s>%s</span>",
Closure->redMarkup, edigest);
GuiSetLabelText(wl->cmpImageMd5Sum, "<span %s>%s</span>",
Closure->redMarkup, idigest);
}
#endif
}
else
{ PrintLog(_("- image md5sum : %s\n"),edigest);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccImgMd5Sum), "%s", edigest);
#endif
GuiSetLabelText(wl->cmpEccImgMd5Sum, "%s", edigest);
}
}
if(image && image->file)
{ if(image->fpState != FP_PRESENT)
{ PrintLog(_("* fingerprint match: NOT POSSIBLE - related sector is missing in image!\n"));
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("<span %s>missing sector prevents calculation</span>"), Closure->redMarkup);
#endif
GuiSetLabelText(wl->cmpEccFingerprint,
_("<span %s>missing sector prevents calculation</span>"),
Closure->redMarkup);
}
else
{
if(memcmp(image->imageFP, eh->mediumFP, 16))
{ PrintLog(_("* fingerprint match: MISMATCH - .iso and .ecc don't belong together!\n"));
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccFingerprint),
GuiSetLabelText(wl->cmpEccFingerprint,
_("<span %s>mismatch</span>"), Closure->redMarkup);
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Image and error correction files do not belong together!</span>"), Closure->redMarkup);
}
#endif
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Image and error correction files do not belong together!</span>"), Closure->redMarkup);
}
else
{ PrintLog(_("- fingerprint match: good\n"));
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("good"));
#endif
GuiSetLabelText(wl->cmpEccFingerprint, _("good"));
}
}
}
@@ -867,17 +773,14 @@ process_ecc:
if(ecc_expected == ecc_blocks)
{ PrintLog(_("- ecc blocks : %" PRId64 " (good)\n"),ecc_blocks);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccBlocks), "%" PRId64 "", ecc_blocks);
#endif
GuiSetLabelText(wl->cmpEccBlocks, "%" PRId64, ecc_blocks);
}
else
{ PrintLog(_("* ecc blocks : %" PRId64 " (BAD, expected %" PRId64 ")\n"),ecc_blocks,ecc_expected);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccBlocks), _("<span %s>%" PRId64 " (bad, expected %" PRId64 ")</span>"),Closure->redMarkup,ecc_blocks,ecc_expected);
#endif
{ PrintLog(_("* ecc blocks : %" PRId64 " (BAD, expected %" PRId64 ")\n"),
ecc_blocks,ecc_expected);
GuiSetLabelText(wl->cmpEccBlocks,
_("<span %s>%" PRId64 " (bad, expected %" PRId64 ")</span>"),
Closure->redMarkup,ecc_blocks,ecc_expected);
}
/*** Test ecc file against its own md5sum */
@@ -898,25 +801,18 @@ process_ecc:
count += n;
percent = (100*count)/image->eccFile->size;
if(last_percent != percent)
{
#ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode)
#endif
PrintProgress(_("- ecc md5sum : %3d%%"),percent);
#ifndef WITH_CLI_ONLY_YES
else SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), "%3d%%", percent);
#endif
{ PrintProgress(_("- ecc md5sum : %3d%%"),percent);
GuiSetLabelText(wl->cmpEccMd5Sum, "%3d%%", percent);
last_percent = percent;
}
#ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions)
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->cmpEccResult),
_("<span %s>Aborted by user request!</span>"), Closure->redMarkup);
{ GuiSetLabelText(wl->cmpEccResult,
_("<span %s>Aborted by user request!</span>"), Closure->redMarkup);
}
goto terminate;
}
#endif
}
MD5Final(digest, &md5ctxt);
@@ -924,36 +820,27 @@ process_ecc:
if(memcmp(eh->eccSum, digest, 16))
{ PrintLog(_("* ecc md5sum : BAD, ecc file may be damaged!\n"));
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), _("<span %s>bad</span>"), Closure->redMarkup);
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Error correction file may be damaged!</span>"), Closure->redMarkup);
}
#endif
GuiSetLabelText(wl->cmpEccMd5Sum, _("<span %s>bad</span>"), Closure->redMarkup);
if(!ecc_advice)
ecc_advice = g_strdup_printf(_("<span %s>Error correction file may be damaged!</span>"), Closure->redMarkup);
}
else
{ PrintLog(_("- ecc md5sum : %s (good)\n"),edigest);
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), "%s", edigest);
#endif
GuiSetLabelText(wl->cmpEccMd5Sum, "%s", edigest);
}
skip_ecc:
PrintLog("\n");
#ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode)
{ if(ecc_advice)
{ SetLabelText(GTK_LABEL(wl->cmpEccResult), "%s", ecc_advice);
g_free(ecc_advice);
}
else SetLabelText(GTK_LABEL(wl->cmpEccResult),
_("<span %s>Good error correction file.</span>"),
Closure->greenMarkup);
if(ecc_advice)
{ GuiSetLabelText(wl->cmpEccResult, "%s", ecc_advice);
g_free(ecc_advice);
}
else
{ GuiSetLabelText(wl->cmpEccResult,
_("<span %s>Good error correction file.</span>"),
Closure->greenMarkup);
}
#endif
/*** Close and clean up */