Merge pull request #8574 from JosJuice/volumeverifier-assert-small-file

VolumeVerifier: Improve the messages shown for files that are too small
This commit is contained in:
Léo Lam 2020-02-09 15:48:57 +01:00 committed by GitHub
commit fb0f543777
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1238,9 +1238,6 @@ void VolumeVerifier::Finish()
WaitForAsyncOperations();
ASSERT(m_content_index == m_content_offsets.size());
ASSERT(m_block_index == m_blocks.size());
if (m_calculating_any_hash)
{
if (m_hashes_to_calculate.crc32)
@ -1267,11 +1264,20 @@ void VolumeVerifier::Finish()
if (m_read_errors_occurred)
AddProblem(Severity::Medium, Common::GetStringT("Some of the data could not be read."));
bool file_too_small = false;
if (m_content_index != m_content_offsets.size() || m_block_index != m_blocks.size())
file_too_small = true;
if (IsDisc(m_volume.GetVolumeType()) &&
(m_volume.IsSizeAccurate() || m_volume.SupportsIntegrityCheck()))
{
u64 volume_size = m_volume.IsSizeAccurate() ? m_volume.GetSize() : m_biggest_verified_offset;
if (m_biggest_referenced_offset > volume_size)
file_too_small = true;
}
if (file_too_small)
{
const bool second_layer_missing =
m_biggest_referenced_offset > SL_DVD_SIZE && m_volume.GetSize() >= SL_DVD_SIZE;
@ -1284,8 +1290,6 @@ void VolumeVerifier::Finish()
"dumping program saved the disc image as several parts, you need "
"to merge them into one file.");
AddProblem(Severity::High, std::move(text));
return;
}
}
for (auto [partition, blocks] : m_block_errors)