[Box Backup-dev] bug in box query
Nick Knight
boxbackup-dev@fluffy.co.uk
Sat, 22 Jul 2006 20:20:08 +0100
Hello all,
I am not fully aware of how the blocks work in box, so I have done a
little fix because running a compare on a 5GB file was causing problems.
I have added the following to BackupStoreFile.cpp
bool BackupStoreFile::CompareFileContentsAgainstBlockIndex(const char
*Filename, IOStream &rBlockIndex, int Timeout)
{
.....
if(sectionSize !=3D sizeof(entryEnc))
{
THROW_EXCEPTION(BackupStoreException,
BlockEntryEncodingDidntGiveExpectedLength)
}
// Size of block
int32_t blockClearSize =3D ntohl(entryEnc.mSize);
//BUG - Nick Knight 22-07-2006
//if(blockClearSize < 0 || blockClearSize >
(BACKUP_FILE_MAX_BLOCK_SIZE + 1024))
//Question from nick, if you look at the
algorithm to calculate block size, then
//as it doubles every iteration of a while loop
and the check to get out is=20
//if it is bigger then theoretically it can be
double this figure...
if(blockClearSize < 0 || blockClearSize >
(BACKUP_FILE_MAX_BLOCK_SIZE * 2))
{
THROW_EXCEPTION(BackupStoreException,
BadBackupStoreFile)
}
totalSizeInBlockIndex +=3D blockClearSize;
// Make sure there's enough memory allocated to
load the block in
if(dataSize < blockClearSize)
Is what I have changed correct??
Thanks
Nick