From 8dfaca25a3948b21e4da6cbdb4a991ca6bca9e53 Mon Sep 17 00:00:00 2001 From: Jonathan Dieter Date: Sat, 5 Feb 2022 16:08:45 +0000 Subject: [PATCH] Make clear that compressed chunk checksum can be 0s Also, fix a small bug Signed-off-by: Jonathan Dieter --- src/unzck.c | 2 +- zchunk_format.txt | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/unzck.c b/src/unzck.c index 2b6ad96..fd4af6f 100644 --- a/src/unzck.c +++ b/src/unzck.c @@ -200,7 +200,7 @@ int main (int argc, char *argv[]) { int ret = zck_get_chunk_valid(dict); if(ret < 1) { if(ret == -1) - LOG_ERROR("Data checksum failed verification\n"); + LOG_ERROR("Dictionary checksum failed verification\n"); else LOG_ERROR("%s", zck_get_error(zck)); goto error2; diff --git a/zchunk_format.txt b/zchunk_format.txt index ecaf278..d1dfe48 100644 --- a/zchunk_format.txt +++ b/zchunk_format.txt @@ -179,6 +179,9 @@ Chunk checksum This is the checksum of the compressed chunk, used to detect whether any two chunks are identical. + NOTE: If flag 2 is set, this checksum must be set to 0s if and only if this + particular chunk is stored uncompressed in the file. + NOTE: Uncompressed chunk checksum will only exist if flag 2 is set to 1 Uncompressed chunk checksum This is the checksum of the uncompressed chunk, used to detect whether a chunk @@ -187,7 +190,10 @@ Uncompressed chunk checksum Chunk length This is an integer containing the length of the chunk. -Uncompressed dict length + NOTE: If flag 2 is set and this particular chunk is stored uncompressed, this + must be the same as the uncompressed chunk length + +Uncompressed chunk length This is an integer containing the length of the chunk after it has been decompressed. -- 2.30.2