Replace remaining uses of zlib crc32 with Common/Hash.h

This commit is contained in:
Pokechu22
2021-12-10 13:34:40 -08:00
parent 2652aed85c
commit 0c19f895d3
6 changed files with 38 additions and 23 deletions

View File

@ -16,13 +16,13 @@
#include <mbedtls/sha1.h>
#include <pugixml.hpp>
#include <unzip.h>
#include <zlib.h>
#include "Common/Align.h"
#include "Common/Assert.h"
#include "Common/CommonPaths.h"
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/Hash.h"
#include "Common/HttpRequest.h"
#include "Common/IOFile.h"
#include "Common/Logging/Log.h"
@ -1041,7 +1041,7 @@ void VolumeVerifier::SetUpHashing()
[](const GroupToVerify& a, const GroupToVerify& b) { return a.offset < b.offset; });
if (m_hashes_to_calculate.crc32)
m_crc32_context = crc32(0, nullptr, 0);
m_crc32_context = Common::StartCRC32();
if (m_hashes_to_calculate.md5)
{
@ -1171,9 +1171,8 @@ void VolumeVerifier::Process()
if (m_hashes_to_calculate.crc32)
{
m_crc32_future = std::async(std::launch::async, [this, byte_increment] {
// It would be nice to use crc32_z here instead of crc32, but it isn't available on Android
m_crc32_context =
crc32(m_crc32_context, m_data.data(), static_cast<unsigned int>(byte_increment));
Common::UpdateCRC32(m_crc32_context, m_data.data(), static_cast<u32>(byte_increment));
});
}