4.45 beta

This commit is contained in:
Igor Pavlov
2007-04-17 00:00:00 +00:00
committed by Kornel Lesiński
parent d9666cf046
commit a145bfc7cf
458 changed files with 13144 additions and 18608 deletions

View File

@@ -4,12 +4,16 @@
#include "Common/StringConvert.h"
#include "Common/Buffer.h"
#include "Common/CRC.h"
#include "../../Common/StreamUtils.h"
#include "ArjIn.h"
extern "C"
{
#include "../../../../C/7zCrc.h"
}
namespace NArchive {
namespace NArj {
@@ -47,7 +51,7 @@ inline bool TestMarkerCandidate(const void *testBytes, UInt32 maxSize)
if (blockSize == 0 || blockSize > 2600)
return false;
UInt32 crcFromFile = GetUInt32FromMemLE(block + blockSize);
return (CCRC::VerifyDigest(crcFromFile, block, blockSize));
return (crcFromFile == CrcCalc(block, blockSize));
}
bool CInArchive::FindAndReadMarker(const UInt64 *searchHeaderSizeLimit)
@@ -168,7 +172,7 @@ bool CInArchive::ReadBlock()
return false;
SafeReadBytes(_block, _blockSize);
UInt32 crcFromFile = SafeReadUInt32();
if (!CCRC::VerifyDigest(crcFromFile, _block, _blockSize))
if (crcFromFile != CrcCalc(_block, _blockSize))
throw CInArchiveException(CInArchiveException::kCRCError);
return true;
}