From: Jonathan Dieter Date: Sat, 5 Feb 2022 16:26:08 +0000 (+0000) Subject: Fix types when printing X-Git-Tag: archive/raspbian/1.2.1+ds1-1+rpi1^2~7^2~1^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=151dcf023a42212fecb86d7a85ff776a69166447;p=zchunk.git Fix types when printing Signed-off-by: Jonathan Dieter --- diff --git a/src/lib/comp/comp.c b/src/lib/comp/comp.c index b2b5384..1fb1db4 100644 --- a/src/lib/comp/comp.c +++ b/src/lib/comp/comp.c @@ -104,8 +104,8 @@ static size_t comp_read_from_dc(zckCtx *zck, zckComp *comp, char *dst, memcpy(dst, comp->dc_data+comp->dc_data_loc, dl_size); comp->dc_data_loc += dl_size; if(dl_size > 0) - zck_log(ZCK_LOG_DEBUG, "Reading %lu bytes from decompressed buffer", - dl_size); + zck_log(ZCK_LOG_DEBUG, "Reading %llu bytes from decompressed buffer", + (long long unsigned) dl_size); return dl_size; } @@ -120,8 +120,8 @@ static bool comp_add_to_data(zckCtx *zck, zckComp *comp, const char *src, zck_log(ZCK_LOG_ERROR, "OOM in %s", __func__); return false; } - zck_log(ZCK_LOG_DEBUG, "Adding %lu bytes to compressed buffer", - src_size); + zck_log(ZCK_LOG_DEBUG, "Adding %llu bytes to compressed buffer", + (long long unsigned) src_size); memcpy(comp->data + comp->data_size, src, src_size); comp->data_size += src_size; comp->data_loc += src_size; @@ -189,31 +189,31 @@ bool comp_init(zckCtx *zck) { if(zck->mode == ZCK_MODE_WRITE) { if(zck->chunk_min_size == 0) { zck->chunk_min_size = CHUNK_DEFAULT_MIN; - zck_log(ZCK_LOG_DEBUG, "Using default minimum chunk size of %lu", - zck->chunk_min_size); + zck_log(ZCK_LOG_DEBUG, "Using default minimum chunk size of %llu", + (long long unsigned) zck->chunk_min_size); } if(zck->chunk_max_size == 0) { zck->chunk_max_size = CHUNK_DEFAULT_MAX; - zck_log(ZCK_LOG_DEBUG, "Using default maximum chunk size of %lu", - zck->chunk_max_size); + zck_log(ZCK_LOG_DEBUG, "Using default maximum chunk size of %llu", + (long long unsigned) zck->chunk_max_size); } if(zck->manual_chunk == 0) { zck_log(ZCK_LOG_DEBUG, "Using buzhash algorithm for chunking"); zck->buzhash_width = DEFAULT_BUZHASH_WIDTH; zck->buzhash_match_bits = DEFAULT_BUZHASH_BITS; update_buzhash_bits(zck); - zck_log(ZCK_LOG_DEBUG, "Setting average chunk size to %lu", - zck->buzhash_bitmask + 1); + zck_log(ZCK_LOG_DEBUG, "Setting average chunk size to %llu", + (long long unsigned) zck->buzhash_bitmask + 1); zck->chunk_auto_min = (zck->buzhash_bitmask + 1) / 4; if(zck->chunk_auto_min < zck->chunk_min_size) zck->chunk_auto_min = zck->chunk_min_size; - zck_log(ZCK_LOG_DEBUG, "Setting automatic minimum chunk size to %lu", - zck->chunk_auto_min); + zck_log(ZCK_LOG_DEBUG, "Setting automatic minimum chunk size to %llu", + (long long unsigned) zck->chunk_auto_min); zck->chunk_auto_max = (zck->buzhash_bitmask + 1) * 4; if(zck->chunk_auto_max > zck->chunk_max_size) zck->chunk_auto_max = zck->chunk_max_size; - zck_log(ZCK_LOG_DEBUG, "Setting automatic maximum chunk size to %lu", - zck->chunk_auto_max); + zck_log(ZCK_LOG_DEBUG, "Setting automatic maximum chunk size to %llu", + (long long unsigned) zck->chunk_auto_max); } } @@ -338,7 +338,7 @@ bool comp_ioption(zckCtx *zck, zck_ioption option, ssize_t value) { return false; } zck->chunk_min_size = value; - zck_log(ZCK_LOG_DEBUG, "Setting minimum chunk size to %li", value); + zck_log(ZCK_LOG_DEBUG, "Setting minimum chunk size to %lli", (long long) value); return true; /* Maximum chunk size */ @@ -353,7 +353,7 @@ bool comp_ioption(zckCtx *zck, zck_ioption option, ssize_t value) { return false; } zck->chunk_max_size = value; - zck_log(ZCK_LOG_DEBUG, "Setting maximum chunk size to %li", value); + zck_log(ZCK_LOG_DEBUG, "Setting maximum chunk size to %lli", (long long) value); return true; } else { @@ -378,7 +378,7 @@ bool comp_soption(zckCtx *zck, zck_soption option, const void *value, return false; } if(option == ZCK_COMP_DICT) { - zck_log(ZCK_LOG_DEBUG, "Adding dictionary of size %li", length); + zck_log(ZCK_LOG_DEBUG, "Adding dictionary of size %lli", (long long) length); zck->comp.dict = (char *)value; zck->comp.dict_size = length; } else { @@ -404,10 +404,10 @@ bool comp_add_to_dc(zckCtx *zck, zckComp *comp, const char *src, return false; } if(comp->dc_data_loc != 0) - zck_log(ZCK_LOG_DEBUG, "Freeing %lu bytes from decompressed buffer", - comp->dc_data_loc); - zck_log(ZCK_LOG_DEBUG, "Adding %lu bytes to decompressed buffer", - src_size); + zck_log(ZCK_LOG_DEBUG, "Freeing %llu bytes from decompressed buffer", + (long long unsigned) comp->dc_data_loc); + zck_log(ZCK_LOG_DEBUG, "Adding %llu bytes to decompressed buffer", + (long long unsigned) src_size); memcpy(temp, comp->dc_data + comp->dc_data_loc, comp->dc_data_size - comp->dc_data_loc); free(comp->dc_data); @@ -445,7 +445,7 @@ ssize_t comp_read(zckCtx *zck, char *dst, size_t dst_size, bool use_dict) { } bool finished_rd = false; bool finished_dc = false; - zck_log(ZCK_LOG_DEBUG, "Trying to read %lu bytes", dst_size); + zck_log(ZCK_LOG_DEBUG, "Trying to read %llu bytes", (long long unsigned) dst_size); while(dc < dst_size) { /* Get bytes from decompressed buffer */ ssize_t rb = comp_read_from_dc(zck, &(zck->comp), dst+dc, dst_size-dc); @@ -652,7 +652,7 @@ ssize_t ZCK_PUBLIC_API zck_end_chunk(zckCtx *zck) { free(dst); return -1; } - zck_log(ZCK_LOG_DDEBUG, "Finished chunk size: %lu", data_size); + zck_log(ZCK_LOG_DDEBUG, "Finished chunk size: %llu", (long long unsigned) data_size); free(dst); return data_size; } diff --git a/src/lib/comp/zstd/zstd.c b/src/lib/comp/zstd/zstd.c index 74a43fc..a12ddfe 100644 --- a/src/lib/comp/zstd/zstd.c +++ b/src/lib/comp/zstd/zstd.c @@ -218,8 +218,10 @@ static bool end_dchunk(zckCtx *zck, zckComp *comp, const bool use_dict, return false; } size_t retval = 0; - zck_log(ZCK_LOG_DEBUG, "Decompressing %lu bytes to %lu bytes", src_size, - fd_size); + zck_log(ZCK_LOG_DEBUG, "Decompressing %llu bytes to %llu bytes", + (long long unsigned) src_size, + (long long unsigned) fd_size + ); if(use_dict && comp->ddict_ctx) { zck_log(ZCK_LOG_DEBUG, "Running decompression using dict"); retval = ZSTD_decompress_usingDDict(comp->dctx, dst, fd_size, src, diff --git a/src/lib/dl/dl.c b/src/lib/dl/dl.c index 635fc02..5d4b359 100644 --- a/src/lib/dl/dl.c +++ b/src/lib/dl/dl.c @@ -108,7 +108,7 @@ static int dl_write(zckDL *dl, const char *at, size_t length) { dl->write_in_chunk -= wb; if(!hash_update(dl->zck, &(dl->zck->check_chunk_hash), at, wb)) return -1; - zck_log(ZCK_LOG_DEBUG, "Writing %lu bytes", wb); + zck_log(ZCK_LOG_DEBUG, "Writing %llu bytes", (long long unsigned) wb); dl->dl_chunk_data += wb; } return wb; @@ -158,8 +158,10 @@ static bool write_and_verify_chunk(zckCtx *src, zckCtx *tgt, tgt_idx->valid = -1; } else { tgt_idx->valid = 1; - zck_log(ZCK_LOG_DEBUG, "Wrote %lu bytes at %lu", - tgt_idx->comp_length, tgt_idx->start); + zck_log(ZCK_LOG_DEBUG, "Wrote %llu bytes at %llu", + (long long unsigned) tgt_idx->comp_length, + (long long unsigned) tgt_idx->start + ); } free(digest); return true; @@ -429,7 +431,10 @@ size_t ZCK_PUBLIC_API zck_write_zck_header_cb(void *ptr, size_t l, size_t c, size_t wb = 0; dl->dl += l*c; size_t loc = tell_data(dl->zck); - zck_log(ZCK_LOG_DEBUG, "Downloading %lu bytes to position %lu", l*c, loc); + zck_log(ZCK_LOG_DEBUG, "Downloading %llu bytes to position %llu", + (long long unsigned) l*c, + (long long unsigned) loc + ); wb = write(dl->zck->fd, ptr, l*c); if(dl->write_cb) return dl->write_cb(ptr, l, c, dl->write_data); diff --git a/src/lib/dl/multipart.c b/src/lib/dl/multipart.c index 6786835..d0cbd5a 100644 --- a/src/lib/dl/multipart.c +++ b/src/lib/dl/multipart.c @@ -216,7 +216,10 @@ size_t multipart_extract(zckDL *dl, char *b, size_t l) { rend = rend*10 + (size_t)(c[0] - 48); i = j; - zck_log(ZCK_LOG_DEBUG, "Download range: %lu-%lu", rstart, rend); + zck_log(ZCK_LOG_DEBUG, "Download range: %llu-%llu", + (long long unsigned) rstart, + (long long unsigned) rend + ); mp->length = rend-rstart+1; mp->state = 1; } diff --git a/src/lib/dl/range.c b/src/lib/dl/range.c index d35076c..d4f7426 100644 --- a/src/lib/dl/range.c +++ b/src/lib/dl/range.c @@ -163,9 +163,10 @@ char ZCK_PUBLIC_API *zck_get_range_char(zckCtx *zck, zckRange *range) { int count = 0; zckRangeItem *ri = range->first; while(ri) { - int length = snprintf(output+loc, buf_size-loc, "%lu-%lu,", - (long unsigned)ri->start, - (long unsigned)ri->end); + int length = snprintf(output+loc, buf_size-loc, "%llu-%llu,", + (long long unsigned)ri->start, + (long long unsigned)ri->end + ); if(length < 0) { set_fatal_error(zck, "Unable to get range: %s", strerror(errno)); free(output); diff --git a/src/lib/hash/hash.c b/src/lib/hash/hash.c index 01a1059..967051a 100644 --- a/src/lib/hash/hash.c +++ b/src/lib/hash/hash.c @@ -256,7 +256,9 @@ bool hash_update(zckCtx *zck, zckHash *hash, const char *message, return true; if(message == NULL) { set_error(zck, - "Hash data is supposed to have %lu bytes, but is NULL", size); + "Hash data is supposed to have %llu bytes, but is NULL", + (long long unsigned) size + ); return false; } if(size == 0) { diff --git a/src/lib/header.c b/src/lib/header.c index da52e61..5b8393b 100644 --- a/src/lib/header.c +++ b/src/lib/header.c @@ -81,8 +81,8 @@ static bool read_header_from_file(zckCtx *zck) { loaded = zck->header_size - zck->lead_size; /* Read header from file */ - zck_log(ZCK_LOG_DEBUG, "Reading the rest of the header: %lu bytes", - zck->header_length); + zck_log(ZCK_LOG_DEBUG, "Reading the rest of the header: %llu bytes", + (long long unsigned) zck->header_length); if(loaded < zck->header_length) { if(!read_data(zck, header + loaded, zck->header_length - loaded)) return false; @@ -233,7 +233,7 @@ static bool read_sig(zckCtx *zck) { if(zck->header_size > zck->lead_size + zck->preface_size + zck->index_size + length) - zck_log(ZCK_LOG_WARNING, "There are %lu unused bytes in the header"); + zck_log(ZCK_LOG_WARNING, "There are unused bytes in the header"); zck->sig_size = length; zck->sig_string = header; @@ -280,7 +280,11 @@ static bool preface_create(zckCtx *zck) { zck->preface_string = header; zck->preface_size = length; - zck_log(ZCK_LOG_DEBUG, "Generated preface: %lu bytes", zck->preface_size); + zck_log( + ZCK_LOG_DEBUG, + "Generated preface: %llu bytes", + (long long unsigned) zck->preface_size + ); return true; } @@ -304,7 +308,11 @@ static bool sig_create(zckCtx *zck) { } zck->sig_string = header; zck->sig_size = length; - zck_log(ZCK_LOG_DEBUG, "Generated signatures: %lu bytes", zck->sig_size); + zck_log( + ZCK_LOG_DEBUG, + "Generated signatures: %llu bytes", + (long long unsigned) zck->sig_size + ); return true; } @@ -336,7 +344,11 @@ static bool lead_create(zckCtx *zck) { zck->lead_string = header; zck->lead_size = length; - zck_log(ZCK_LOG_DEBUG, "Generated lead: %lu bytes", zck->lead_size); + zck_log( + ZCK_LOG_DEBUG, + "Generated lead: %llu bytes", + (long long unsigned) zck->lead_size + ); return true; } @@ -370,8 +382,11 @@ bool header_create(zckCtx *zck) { zck->index_size + zck->sig_size; /* Merge everything into one large string */ - zck_log(ZCK_LOG_DEBUG, "Merging into header: %lu bytes", - zck->data_offset); + zck_log( + ZCK_LOG_DEBUG, + "Merging into header: %llu bytes", + (long long unsigned) zck->data_offset + ); zck->header = zmalloc(zck->data_offset); if (!zck->header) { zck_log(ZCK_LOG_ERROR, "OOM in %s", __func__); @@ -423,8 +438,11 @@ bool header_create(zckCtx *zck) { bool write_header(zckCtx *zck) { VALIDATE_WRITE_BOOL(zck); - zck_log(ZCK_LOG_DEBUG, "Writing header: %lu bytes", - zck->lead_size); + zck_log( + ZCK_LOG_DEBUG, + "Writing header: %llu bytes", + (long long unsigned) zck->lead_size + ); if(!write_data(zck, zck->fd, zck->header, zck->header_size)) return false; return true; @@ -538,10 +556,12 @@ static bool read_lead(zckCtx *zck) { hash_reset(&(zck->hash_type)); free(zck->header_digest); zck->header_digest = NULL; - set_error(zck, - "Header length (%lu) doesn't match requested header length " - "(%lu)", zck->header_length + length, - zck->prep_hdr_size); + set_error( + zck, + "Header length (%llu) doesn't match requested header length (%llu)", + (long long unsigned) zck->header_length + length, + (long long unsigned) zck->prep_hdr_size + ); return false; } /* Store pre-header */ @@ -549,7 +569,11 @@ static bool read_lead(zckCtx *zck) { zck->header_size = lead; zck->lead_string = header; zck->lead_size = length; - zck_log(ZCK_LOG_DEBUG, "Parsed lead: %lu bytes", length); + zck_log( + ZCK_LOG_DEBUG, + "Parsed lead: %llu bytes", + (long long unsigned) length + ); return true; } diff --git a/src/lib/index/index_create.c b/src/lib/index/index_create.c index 956d11c..1a23517 100644 --- a/src/lib/index/index_create.c +++ b/src/lib/index/index_create.c @@ -153,7 +153,11 @@ bool index_create(zckCtx *zck) { } zck->index_string = index; zck->index_size = index_size; - zck_log(ZCK_LOG_DEBUG, "Generated index: %lu bytes", zck->index_size); + zck_log( + ZCK_LOG_DEBUG, + "Generated index: %llu bytes", + (long long unsigned) zck->index_size + ); return true; } diff --git a/src/lib/index/index_read.c b/src/lib/index/index_read.c index 22593b0..6ec0a8d 100644 --- a/src/lib/index/index_read.c +++ b/src/lib/index/index_read.c @@ -164,7 +164,11 @@ zckChunk ZCK_PUBLIC_API *zck_get_chunk(zckCtx *zck, size_t number) { if(idx->number == number) return idx; } - zck_log(ZCK_LOG_WARNING, "Chunk %lu not found", number); + zck_log( + ZCK_LOG_WARNING, + "Chunk %llu not found", + (long long unsigned) number + ); return NULL; } diff --git a/src/lib/io.c b/src/lib/io.c index 6e5ebc7..67586c1 100644 --- a/src/lib/io.c +++ b/src/lib/io.c @@ -94,8 +94,13 @@ int seek_data(zckCtx *zck, off_t offset, int whence) { } else { wh_str = "using unknown measurement"; } - set_error(zck, "Unable to seek to %lu %s: %s", offset, wh_str, - strerror(errno)); + set_error( + zck, + "Unable to seek to %llu %s: %s", + (long long unsigned) offset, + wh_str, + strerror(errno) + ); return false; } return true; diff --git a/src/lib/zck.c b/src/lib/zck.c index eec127b..15a672e 100644 --- a/src/lib/zck.c +++ b/src/lib/zck.c @@ -272,10 +272,13 @@ bool ZCK_PUBLIC_API zck_set_soption(zckCtx *zck, zck_soption option, const char } if(chk_type.digest_size*2 != length) { free(data); - set_fatal_error(zck, "Hash digest size mismatch for header " - "validation\n" - "Expected: %i\nProvided: %lu", - chk_type.digest_size*2, length); + set_fatal_error( + zck, + "Hash digest size mismatch for header validation\n" + "Expected: %i\nProvided: %llu", + chk_type.digest_size*2, + (long long unsigned) length + ); return false; } zck_log(ZCK_LOG_DEBUG, "Setting expected hash to (%s)%.*s", @@ -316,8 +319,8 @@ bool ZCK_PUBLIC_API zck_set_ioption(zckCtx *zck, zck_ioption option, ssize_t val } else if(option == ZCK_VAL_HEADER_HASH_TYPE) { VALIDATE_READ_BOOL(zck); if(value < 0) { - set_error(zck, "Header hash type can't be less than zero: %li", - value); + set_error(zck, "Header hash type can't be less than zero: %lli", + (long long) value); return false; } /* Make sure that header hash type is set before the header digest, @@ -332,8 +335,8 @@ bool ZCK_PUBLIC_API zck_set_ioption(zckCtx *zck, zck_ioption option, ssize_t val VALIDATE_READ_BOOL(zck); if(value < 0) { set_error(zck, - "Header size validation can't be less than zero: %li", - value); + "Header size validation can't be less than zero: %lli", + (long long) value); return false; } zck->prep_hdr_size = value; @@ -343,7 +346,11 @@ bool ZCK_PUBLIC_API zck_set_ioption(zckCtx *zck, zck_ioption option, ssize_t val /* Hash options */ } else if(option < 100) { /* Currently no hash options other than setting hash type, so bail */ - set_error(zck, "Unknown option %lu", value); + set_error( + zck, + "Unknown option %llu", + (long long unsigned) value + ); return false; /* Compression options */ diff --git a/src/unzck.c b/src/unzck.c index 2392139..2b6ad96 100644 --- a/src/unzck.c +++ b/src/unzck.c @@ -188,8 +188,8 @@ int main (int argc, char *argv[]) { LOG_ERROR("%s", zck_get_error(zck)); else LOG_ERROR( - "Dict size doesn't match expected size: %li != %li\n", - read_size, dict_size); + "Dict size doesn't match expected size: %lli != %lli\n", + (long long) read_size, (long long) dict_size); goto error2; } if(write(dst_fd, data, dict_size) != dict_size) { @@ -238,7 +238,10 @@ int main (int argc, char *argv[]) { goto error2; } if(arguments.log_level <= ZCK_LOG_INFO) - LOG_ERROR("Decompressed %lu bytes\n", (unsigned long)total); + LOG_ERROR( + "Decompressed %llu bytes\n", + (long long unsigned) total + ); good_exit = true; error2: free(data); diff --git a/src/zck.c b/src/zck.c index 87c0811..da7a1fb 100644 --- a/src/zck.c +++ b/src/zck.c @@ -344,10 +344,11 @@ int main (int argc, char *argv[]) { exit(1); } if(arguments.log_level <= ZCK_LOG_INFO) { - LOG_ERROR("Wrote %lu bytes in %lu chunks\n", - (unsigned long)(zck_get_data_length(zck) + - zck_get_header_length(zck)), - (long)zck_get_chunk_count(zck)); + LOG_ERROR( + "Wrote %llu bytes in %llu chunks\n", + (long long unsigned) (zck_get_data_length(zck) + zck_get_header_length(zck)), + (long long unsigned) zck_get_chunk_count(zck) + ); } zck_free(&zck); diff --git a/src/zck_delta_size.c b/src/zck_delta_size.c index 65f3c8d..0f267ca 100644 --- a/src/zck_delta_size.c +++ b/src/zck_delta_size.c @@ -191,10 +191,10 @@ int main (int argc, char *argv[]) { } total_size += zck_get_chunk_comp_size(tgt_idx); } - printf("Would download %li of %li bytes\n", (long)dl_size, - (long)total_size); - printf("Matched %li of %lu chunks\n", (long)matched_chunks, - (long unsigned)zck_get_chunk_count(zck_tgt)); + printf("Would download %lli of %lli bytes\n", (long long) dl_size, + (long long) total_size); + printf("Matched %lli of %llu chunks\n", (long long) matched_chunks, + (long long unsigned) zck_get_chunk_count(zck_tgt)); zck_free(&zck_tgt); zck_free(&zck_src); } diff --git a/src/zck_dl.c b/src/zck_dl.c index 432c257..7b2f770 100644 --- a/src/zck_dl.c +++ b/src/zck_dl.c @@ -228,13 +228,18 @@ int dl_bytes(dlCtx *dl_ctx, char *url, size_t bytes, size_t start, return retval; if(log_level <= ZCK_LOG_DEBUG) - LOG_ERROR("Downloading %lu bytes at position %lu\n", - (unsigned long)start+bytes-*buffer_len, - (unsigned long)*buffer_len); + LOG_ERROR( + "Downloading %llu bytes at position %llu\n", + (long long unsigned) start+bytes-*buffer_len, + (long long unsigned) *buffer_len + ); *buffer_len += start + bytes - *buffer_len; if(lseek(fd, start, SEEK_SET) == -1) { - LOG_ERROR("Seek to byte %lu of temporary file failed: %s\n", - (unsigned long)start, strerror(errno)); + LOG_ERROR( + "Seek to byte %llu of temporary file failed: %s\n", + (long long unsigned) start, + strerror(errno) + ); return 0; } } @@ -310,8 +315,10 @@ int main (int argc, char *argv[]) { CURL *curl_ctx = curl_easy_init(); if(!curl_ctx) { - LOG_ERROR("Unable to allocate %lu bytes for curl context\n", - (unsigned long)sizeof(CURL)); + LOG_ERROR( + "Unable to allocate %llu bytes for curl context\n", + (long long unsigned)sizeof(CURL) + ); exit(10); } @@ -386,8 +393,10 @@ int main (int argc, char *argv[]) { } if(retval == 1) { printf("Missing chunks: 0\n"); - printf("Downloaded %lu bytes\n", - (long unsigned)zck_dl_get_bytes_downloaded(dl)); + printf( + "Downloaded %llu bytes\n", + (long long unsigned) zck_dl_get_bytes_downloaded(dl) + ); if(ftruncate(dst_fd, zck_get_length(zck_tgt)) < 0) { perror(NULL); exit_val = 10; @@ -444,8 +453,8 @@ int main (int argc, char *argv[]) { } } } - printf("Downloaded %lu bytes\n", - (long unsigned)zck_dl_get_bytes_downloaded(dl)); + printf("Downloaded %llu bytes\n", + (long long unsigned) zck_dl_get_bytes_downloaded(dl)); if(ftruncate(dst_fd, zck_get_length(zck_tgt)) < 0) { perror(NULL); exit_val = 10; diff --git a/src/zck_gen_zdict.c b/src/zck_gen_zdict.c index afa4dfe..f8e87d9 100644 --- a/src/zck_gen_zdict.c +++ b/src/zck_gen_zdict.c @@ -261,15 +261,18 @@ int main (int argc, char *argv[]) { LOG_ERROR("%s", zck_get_error(zck)); else LOG_ERROR( - "Chunk %li size doesn't match expected size: %li != %li\n", - zck_get_chunk_number(idx), read_size, chunk_size); + "Chunk %lli size doesn't match expected size: %lli != %lli\n", + (long long) zck_get_chunk_number(idx), + (long long) read_size, + (long long) chunk_size + ); goto error2; } char *dict_block = calloc(strlen(dir) + strlen(out_name) + 12, 1); assert(dict_block); - snprintf(dict_block, strlen(dir) + strlen(out_name) + 12, "%s/%s.%li", - dir, out_name, zck_get_chunk_number(idx)); + snprintf(dict_block, strlen(dir) + strlen(out_name) + 12, "%s/%s.%lli", + dir, out_name, (long long) zck_get_chunk_number(idx)); int dst_fd = open(dict_block, O_TRUNC | O_WRONLY | O_CREAT | O_BINARY, 0666); if(dst_fd < 0) { LOG_ERROR("Unable to open %s", dict_block); diff --git a/src/zck_read_header.c b/src/zck_read_header.c index c439205..8654af1 100644 --- a/src/zck_read_header.c +++ b/src/zck_read_header.c @@ -155,15 +155,15 @@ int main (int argc, char *argv[]) { if(!arguments.quiet) { printf("Overall checksum type: %s\n", zck_hash_name_from_type(zck_get_full_hash_type(zck))); - printf("Header size: %lu\n", zck_get_header_length(zck)); + printf("Header size: %llu\n", (long long unsigned) zck_get_header_length(zck)); char *digest = zck_get_header_digest(zck); printf("Header checksum: %s\n", digest); - free(digest); - printf("Data size: %lu\n", zck_get_data_length(zck)); + free(digest); + printf("Data size: %llu\n", (long long unsigned) zck_get_data_length(zck)); digest = zck_get_data_digest(zck); printf("Data checksum: %s\n", digest); free(digest); - printf("Chunk count: %lu\n", (long unsigned)zck_get_chunk_count(zck)); + printf("Chunk count: %llu\n", (long long unsigned) zck_get_chunk_count(zck)); printf("Chunk checksum type: %s\n", zck_hash_name_from_type(zck_get_chunk_hash_type(zck))); } if(!arguments.quiet && arguments.show_chunks) @@ -191,13 +191,13 @@ int main (int argc, char *argv[]) { (((int)zck_get_chunk_digest_size(zck) * 2) - (int)strlen("Checksum")), ' '); } - printf("%12lu %s %s %12lu %12lu %12lu", - (long unsigned)zck_get_chunk_number(chk), + printf("%12llu %s %s %12llu %12llu %12llu", + (long long unsigned)zck_get_chunk_number(chk), digest, digest_uncompressed, - (long unsigned)zck_get_chunk_start(chk), - (long unsigned)zck_get_chunk_comp_size(chk), - (long unsigned)zck_get_chunk_size(chk)); + (long long unsigned)zck_get_chunk_start(chk), + (long long unsigned)zck_get_chunk_comp_size(chk), + (long long unsigned)zck_get_chunk_size(chk)); if(arguments.verify) { if(zck_get_chunk_valid(chk) == 1) printf(" +"); diff --git a/test/empty.c b/test/empty.c index 3b67940..d32fff0 100644 --- a/test/empty.c +++ b/test/empty.c @@ -99,7 +99,7 @@ int main (int argc, char *argv[]) { memset(data, 0, 1000); len = zck_read(zck, data, 1000); if(len > 0) { - printf("%li bytes read, but file should be empty\n", (long)len); + printf("%lli bytes read, but file should be empty\n", (long long) len); exit(1); } if(!zck_close(zck)) diff --git a/test/optelems.c b/test/optelems.c index f6d5316..a61b8f7 100644 --- a/test/optelems.c +++ b/test/optelems.c @@ -62,7 +62,7 @@ int main (int argc, char *argv[]) { memset(data, 0, 1000); ssize_t len = zck_read(zck, data, 1000); if(len > 0) { - printf("%li bytes read, but file should be empty\n", (long)len); + printf("%lli bytes read, but file should be empty\n", (long long) len); exit(1); } if(!zck_close(zck)) diff --git a/test/read_single_chunk.c b/test/read_single_chunk.c index 6d19799..0e63d8c 100644 --- a/test/read_single_chunk.c +++ b/test/read_single_chunk.c @@ -79,19 +79,19 @@ int main (int argc, char *argv[]) { zck_free(&zck); exit(1); } - ssize_t chunk_size = zck_get_chunk_size(chunk); + long long chunk_size = (long long) zck_get_chunk_size(chunk); if(chunk_size < 0) { printf("%s", zck_get_error(zck)); zck_free(&zck); exit(1); } char *data = calloc(chunk_size, 1); - ssize_t read_size = zck_get_chunk_data(chunk, data, chunk_size); + long long read_size = (long long) zck_get_chunk_data(chunk, data, chunk_size); if(read_size != chunk_size) { if(read_size < 0) printf("%s", zck_get_error(zck)); else - printf("chunk size didn't match expected size: %li != %li\n", + printf("chunk size didn't match expected size: %lli != %lli\n", read_size, chunk_size); free(data); zck_free(&zck); diff --git a/test/read_single_comp_chunk.c b/test/read_single_comp_chunk.c index 61ecedc..21701ed 100644 --- a/test/read_single_comp_chunk.c +++ b/test/read_single_comp_chunk.c @@ -68,19 +68,19 @@ int main (int argc, char *argv[]) { zck_free(&zck); exit(1); } - ssize_t chunk_size = zck_get_chunk_comp_size(chunk); + long long chunk_size = (long long) zck_get_chunk_comp_size(chunk); if(chunk_size < 0) { printf("%s", zck_get_error(zck)); zck_free(&zck); exit(1); } char *data = calloc(chunk_size, 1); - ssize_t read_size = zck_get_chunk_comp_data(chunk, data, chunk_size); + long long read_size = (long long) zck_get_chunk_comp_data(chunk, data, chunk_size); if(read_size != chunk_size) { if(read_size < 0) printf("%s", zck_get_error(zck)); else - printf("chunk size didn't match expected size: %li != %li\n", + printf("chunk size didn't match expected size: %lli != %lli\n", read_size, chunk_size); free(data); zck_free(&zck);