Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #10909 from JosJuice/volume-verifier-read-succeeded
VolumeVerifier: Fix read_succeeded condition
  • Loading branch information
lioncash committed Jul 28, 2022
2 parents 1ea0c77 + 14c1a1c commit e10d662
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Source/Core/DiscIO/VolumeVerifier.cpp
Expand Up @@ -1158,9 +1158,9 @@ void VolumeVerifier::Process()
}

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);

Expand Down Expand Up @@ -1198,8 +1198,8 @@ void VolumeVerifier::Process()

if (content_read)
{
m_content_future = std::async(std::launch::async, [this, read_succeeded, content] {
if (!read_succeeded || !m_volume.CheckContentIntegrity(content, m_data, m_ticket))
m_content_future = std::async(std::launch::async, [this, read_failed, content] {
if (read_failed || !m_volume.CheckContentIntegrity(content, m_data, m_ticket))
{
AddProblem(Severity::High, Common::FmtFormatT("Content {0:08x} is corrupt.", content.id));
}
Expand All @@ -1210,7 +1210,7 @@ void VolumeVerifier::Process()

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] {
const GroupToVerify& group = m_groups[group_index];
u64 offset_in_group = 0;
Expand All @@ -1219,8 +1219,8 @@ void VolumeVerifier::Process()
{
const u64 block_offset = group.offset + offset_in_group;

if (read_succeeded && m_volume.CheckBlockIntegrity(
block_index, m_data.data() + offset_in_group, group.partition))
if (!read_failed && m_volume.CheckBlockIntegrity(
block_index, m_data.data() + offset_in_group, group.partition))
{
m_biggest_verified_offset =
std::max(m_biggest_verified_offset, block_offset + VolumeWii::BLOCK_TOTAL_SIZE);
Expand Down

0 comments on commit e10d662

Please sign in to comment.