mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-08 22:05:20 +00:00
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:
parent
4ea4391f45
commit
2df285effd
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user