From: Jonathan Dieter Date: Sat, 18 Sep 2021 15:28:18 +0000 (+0100) Subject: Revert "Add a way to disable check of chunk min size" X-Git-Tag: archive/raspbian/1.2.1+ds1-1+rpi1^2~7^2~1^2~18^2~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c938487d3a14a151494727bc93f3fec914117b8e;p=zchunk.git Revert "Add a way to disable check of chunk min size" This reverts commit e3fdd8210610ebe21a44a226888b519672e18986. --- diff --git a/include/zck.h.in b/include/zck.h.in index 57ee9cf..a053b30 100644 --- a/include/zck.h.in +++ b/include/zck.h.in @@ -27,7 +27,6 @@ typedef enum zck_ioption { ZCK_VAL_HEADER_HASH_TYPE, /* Set what the header hash type *should* be */ ZCK_VAL_HEADER_LENGTH, /* Set what the header length *should* be */ ZCK_UNCOMP_HEADER, /* Header should contain uncompressed size, too */ - ZCK_NO_MIN_CHUNKSIZE, /* No check for min size */ ZCK_COMP_TYPE = 100, /* Set compression type using zck_comp */ ZCK_MANUAL_CHUNK, /* Disable auto-chunking */ ZCK_CHUNK_MIN, /* Minimum chunk size when manual chunking */ diff --git a/src/lib/comp/comp.c b/src/lib/comp/comp.c index 193ea09..8cb7fa0 100644 --- a/src/lib/comp/comp.c +++ b/src/lib/comp/comp.c @@ -604,7 +604,7 @@ ssize_t PUBLIC zck_write(zckCtx *zck, const char *src, const size_t src_size) { "chunk"); else zck_log(ZCK_LOG_DDEBUG, "Automatically ending chunk"); - if(!zck->no_check_min_size && zck->comp.dc_data_size < zck->chunk_auto_min) { + if(zck->comp.dc_data_size < zck->chunk_auto_min) { zck_log(ZCK_LOG_DDEBUG, "Chunk too small, refusing to end chunk"); continue; @@ -627,7 +627,7 @@ ssize_t PUBLIC zck_end_chunk(zckCtx *zck) { if(!zck->comp.started && !comp_init(zck)) return -1; - if(!zck->no_check_min_size && zck->comp.dc_data_size < zck->chunk_min_size) { + if(zck->comp.dc_data_size < zck->chunk_min_size) { zck_log(ZCK_LOG_DDEBUG, "Chunk too small, refusing to end chunk"); return zck->comp.dc_data_size; } diff --git a/src/lib/zck.c b/src/lib/zck.c index 2cd0512..9cffcdf 100644 --- a/src/lib/zck.c +++ b/src/lib/zck.c @@ -314,8 +314,6 @@ bool PUBLIC zck_set_ioption(zckCtx *zck, zck_ioption option, ssize_t value) { } else if(option == ZCK_UNCOMP_HEADER) { zck->has_uncompressed_source = 1; - } else if(option == ZCK_NO_MIN_CHUNKSIZE) { - zck->no_check_min_size = 1; /* Hash options */ } else if(option < 100) { /* Currently no hash options other than setting hash type, so bail */ diff --git a/src/lib/zck_private.h b/src/lib/zck_private.h index d1a40a7..d21f8c5 100644 --- a/src/lib/zck_private.h +++ b/src/lib/zck_private.h @@ -272,7 +272,6 @@ struct zckCtx { int has_streams; int has_optional_elems; int has_uncompressed_source; - int no_check_min_size; char *read_buf; size_t read_buf_size; diff --git a/src/zck.c b/src/zck.c index a4bf730..9d8f01e 100644 --- a/src/zck.c +++ b/src/zck.c @@ -230,8 +230,7 @@ int main (int argc, char *argv[]) { } if(arguments.uncompressed) { - if(!zck_set_ioption(zck, ZCK_UNCOMP_HEADER, 1) || - (!zck_set_ioption(zck, ZCK_NO_MIN_CHUNKSIZE, 1))) { + if(!zck_set_ioption(zck, ZCK_UNCOMP_HEADER, 1)) { dprintf(STDERR_FILENO, "%s\n", zck_get_error(zck)); exit(1); }