From: Jonathan Dieter Date: Wed, 21 Mar 2018 19:06:25 +0000 (+0200) Subject: Add index size to download amount since we're guaranteed to have to X-Git-Tag: archive/raspbian/1.1.9+ds1-1+rpi1~1^2~352 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6b6f196c9d89f2bc2bcc85f04382d58de10ccbbf;p=zchunk.git Add index size to download amount since we're guaranteed to have to download the target index Signed-off-by: Jonathan Dieter --- diff --git a/src/zck_delta_size.c b/src/zck_delta_size.c index 17a48ea..2a13141 100644 --- a/src/zck_delta_size.c +++ b/src/zck_delta_size.c @@ -85,9 +85,11 @@ int main (int argc, char *argv[]) { zckIndex *src_idx = src_info->first; if(memcmp(tgt_idx->digest, src_idx->digest, zck_get_chunk_digest_size(zck_tgt)) != 0) printf("WARNING: Dicts don't match\n"); - int dl_size = 0; - int total_size = 0; - int matched_chunks = 0; + ssize_t dl_size = zck_get_header_length(zck_tgt); + if(dl_size < 0) + exit(1); + ssize_t total_size = 0; + ssize_t matched_chunks = 0; while(tgt_idx) { int found = False; src_idx = src_info->first; @@ -107,8 +109,8 @@ int main (int argc, char *argv[]) { total_size += tgt_idx->length; tgt_idx = tgt_idx->next; } - printf("Would download %i of %i bytes\n", dl_size, total_size); - printf("Matched %i of %lu chunks\n", matched_chunks, zck_get_index_count(zck_tgt)); + printf("Would download %li of %li bytes\n", dl_size, total_size); + printf("Matched %li of %lu chunks\n", matched_chunks, zck_get_index_count(zck_tgt)); zck_free(&zck_tgt); zck_free(&zck_src); }