VolumeVerifier: Fix read_succeeded condition

We shouldn't set m_read_errors_occurred to true just because
is_data_needed was false.
This commit is contained in:
JosJuice 2022-07-28 09:32:11 +02:00
parent 97100290ee
commit 14c1a1c658
1 changed files with 7 additions and 7 deletions

View File

@ -1158,9 +1158,9 @@ void VolumeVerifier::Process()
} }
const bool is_data_needed = m_calculating_any_hash || content_read || group_read; const bool is_data_needed = m_calculating_any_hash || content_read || group_read;
const bool read_succeeded = is_data_needed && ReadChunkAndWaitForAsyncOperations(bytes_to_read); const bool read_failed = is_data_needed && !ReadChunkAndWaitForAsyncOperations(bytes_to_read);
if (!read_succeeded) if (read_failed)
{ {
ERROR_LOG_FMT(DISCIO, "Read failed at {:#x} to {:#x}", m_progress, m_progress + bytes_to_read); ERROR_LOG_FMT(DISCIO, "Read failed at {:#x} to {:#x}", m_progress, m_progress + bytes_to_read);
@ -1198,8 +1198,8 @@ void VolumeVerifier::Process()
if (content_read) if (content_read)
{ {
m_content_future = std::async(std::launch::async, [this, read_succeeded, content] { m_content_future = std::async(std::launch::async, [this, read_failed, content] {
if (!read_succeeded || !m_volume.CheckContentIntegrity(content, m_data, m_ticket)) if (read_failed || !m_volume.CheckContentIntegrity(content, m_data, m_ticket))
{ {
AddProblem(Severity::High, Common::FmtFormatT("Content {0:08x} is corrupt.", content.id)); AddProblem(Severity::High, Common::FmtFormatT("Content {0:08x} is corrupt.", content.id));
} }
@ -1210,7 +1210,7 @@ void VolumeVerifier::Process()
if (group_read) if (group_read)
{ {
m_group_future = std::async(std::launch::async, [this, read_succeeded, m_group_future = std::async(std::launch::async, [this, read_failed,
group_index = m_group_index] { group_index = m_group_index] {
const GroupToVerify& group = m_groups[group_index]; const GroupToVerify& group = m_groups[group_index];
u64 offset_in_group = 0; u64 offset_in_group = 0;
@ -1219,8 +1219,8 @@ void VolumeVerifier::Process()
{ {
const u64 block_offset = group.offset + offset_in_group; const u64 block_offset = group.offset + offset_in_group;
if (read_succeeded && m_volume.CheckBlockIntegrity( if (!read_failed && m_volume.CheckBlockIntegrity(
block_index, m_data.data() + offset_in_group, group.partition)) block_index, m_data.data() + offset_in_group, group.partition))
{ {
m_biggest_verified_offset = m_biggest_verified_offset =
std::max(m_biggest_verified_offset, block_offset + VolumeWii::BLOCK_TOTAL_SIZE); std::max(m_biggest_verified_offset, block_offset + VolumeWii::BLOCK_TOTAL_SIZE);