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,6 +20,8 @@
* along with dvdisaster. If not, see <http://www.gnu.org/licenses/>.
*/
/*** src type: no GUI code ***/
#include "dvdisaster.h"
#include "scsi-layer.h"
@@ -171,13 +173,18 @@ int CheckAgainstCrcBuffer(CrcBuf *cb, gint64 idx, unsigned char *buf)
* cached CRC and md5 informaton
*/
int CrcBufValid(CrcBuf *crcbuf, Image *image, EccHeader *eh)
int CrcBufValid(CrcBuf *crcbuf, Image *image, int mode)
{
if(!crcbuf)
{ Verbose("CrcBufValid: crcbuf==NULL\n");
return FALSE;
}
if(!image)
{ Verbose("CrcBufValid: image==NULL\n");
return FALSE;
}
/* if still in building state we do not have all CRC sums */
if(crcbuf->md5State & MD5_BUILDING)
@@ -192,7 +199,50 @@ int CrcBufValid(CrcBuf *crcbuf, Image *image, EccHeader *eh)
{ Verbose("CrcBufValid: NOT complete\n");
return FALSE;
}
/* compare fingerprints of buffer and image */
if(image->fpState != 2)
{ Verbose("CrcBufValid: image fingerprint not valid (%d)\n",
image->fpState);
return FALSE;
}
if(!crcbuf->fpValid)
{ Verbose("CrcBufValid: crcbuf fingerprint not valid\n");
return FALSE;
}
if(crcbuf->fpSector != image->fpSector)
{ Verbose("CrcBufValid: crcbuf/image have different fingerprint sectors (%d/%" PRId64 ")\n",
crcbuf->fpSector, image->fpSector);
return FALSE;
}
if(memcmp(crcbuf->mediumFP, image->imageFP, 16))
{ Verbose("CrcBufValid: crcbuf/image have different fingerprints\n");
return FALSE;
}
/* additionally, compare the image sizes */
switch(mode)
{ case FULL_IMAGE:
if(image->sectorSize != crcbuf->allSectors)
{ Verbose("CrcBufValid(..., FULL_IMAGE): crcbuf/image have different size (%" PRId64 "/%" PRId64 " sectors)\n",
image->sectorSize, crcbuf->allSectors);
return FALSE;
}
break;
case DATA_SECTORS_ONLY:
if(image->sectorSize != crcbuf->dataSectors)
{ Verbose("CrcBufValid(..., DATA_SECTORS_ONLY): crcbuf/image have different size (%" PRId64 "/%" PRId64 " sectors)\n",
image->sectorSize, crcbuf->dataSectors);
return FALSE;
}
break;
}
Verbose("CrcBufValid: buffer VALID\n");
return TRUE;
}