block: vhdx: use calculate_checksum in Header::update_header

It doesn't make sense to open code the same calculation when there is
already a helper function.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu 2024-12-24 21:30:47 +00:00 committed by Rob Bradford
parent 4ea4391f45
commit 2df285effd

View File

@ -192,9 +192,7 @@ impl Header {
};
new_header.get_header_as_buffer(&mut buffer);
let mut crc = crc_any::CRC::crc32c();
crc.digest(&buffer);
new_header.checksum = crc.get_crc() as u32;
new_header.checksum = calculate_checksum(&mut buffer, size_of::<u32>());
new_header.get_header_as_buffer(&mut buffer);
f.seek(SeekFrom::Start(start))