Revert "Add a way to disable check of chunk min size"
authorJonathan Dieter <jdieter@gmail.com>
Sat, 18 Sep 2021 15:28:18 +0000 (16:28 +0100)
committerJonathan Dieter <jdieter@gmail.com>
Sat, 18 Sep 2021 15:28:18 +0000 (16:28 +0100)
This reverts commit e3fdd8210610ebe21a44a226888b519672e18986.

include/zck.h.in
src/lib/comp/comp.c
src/lib/zck.c
src/lib/zck_private.h
src/zck.c

index 57ee9cfa7e957b9f13bd6ea6bfdd145f8974dc27..a053b303c43a15d7b291362dd31bde6ee20b4db7 100644 (file)
@@ -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 */
index 193ea092d24fab701e19c1d66e8471107382bd9d..8cb7fa0083429548081bf458e1c9eaa000bc218f 100644 (file)
@@ -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;
     }
index 2cd051277eb011a5fedb9fad0003e69d84532f50..9cffcdfbae8ba151ba1413c204422da7b0156032 100644 (file)
@@ -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 */
index d1a40a78540f87e5e71fcea0c2fd106bcde91442..d21f8c55141230e2d33b4481aeb1fcfe1e1342cf 100644 (file)
@@ -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;
index a4bf7302182e575b647ad6ceda57455035b5f9bf..9d8f01e79d07aa979125d6b51131268adf17c3c4 100644 (file)
--- 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);
         }