From: Joel Rosdahl Date: Thu, 4 Jul 2019 07:35:05 +0000 (+0200) Subject: Allow NULL checksum parameter for common_header_initialize_for_reading X-Git-Tag: v4.0~907 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=7839217088c70393654dfc597a3d2fdca5afa90b;p=thirdparty%2Fccache.git Allow NULL checksum parameter for common_header_initialize_for_reading --- diff --git a/src/common_header.c b/src/common_header.c index 69fde2188..c2f1e97a2 100644 --- a/src/common_header.c +++ b/src/common_header.c @@ -130,8 +130,10 @@ bool common_header_initialize_for_reading( return false; } - XXH64_reset(checksum, 0); - XXH64_update(checksum, header_bytes, sizeof(header_bytes)); + if (checksum) { + XXH64_reset(checksum, 0); + XXH64_update(checksum, header_bytes, sizeof(header_bytes)); + } *decompr_state = (*decompressor)->init(input, checksum); if (!*decompr_state) { diff --git a/src/common_header.h b/src/common_header.h index b2daa5099..f4d23d25f 100644 --- a/src/common_header.h +++ b/src/common_header.h @@ -50,7 +50,7 @@ bool common_header_initialize_for_writing( // decompressor_state: State for the decompressor. Should be NULL if // decompressor is NULL. // checksum: Checksum state that will be updated with the read bytes. -// Pass NULL if decompressor is NULL. +// May be NULL for no checksumming. bool common_header_initialize_for_reading( struct common_header *header, FILE *input,