From 1d623273e6ed8e8a7dcc5c3a7d69d51ca9f2818b Mon Sep 17 00:00:00 2001 From: Dominik Loidolt <dominik.loidolt@univie.ac.at> Date: Thu, 18 Apr 2024 14:34:08 +0200 Subject: [PATCH] Update cmp_tool for the compress_chunk error handling --- programs/cmp_tool.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/programs/cmp_tool.c b/programs/cmp_tool.c index 8f77e62..aaa947d 100644 --- a/programs/cmp_tool.c +++ b/programs/cmp_tool.c @@ -731,7 +731,8 @@ static int compression_of_chunk(void *chunk, uint32_t size, void *model, struct { uint32_t bound = compress_chunk_cmp_size_bound(chunk, size); uint32_t *cmp_data; - int32_t cmp_size; + uint32_t cmp_size; + enum cmp_error cmp_error; int error; if (!bound) @@ -745,10 +746,9 @@ static int compression_of_chunk(void *chunk, uint32_t size, void *model, struct printf("Compress chunk data ... "); cmp_size = compress_chunk(chunk, size, model, model, cmp_data, bound, chunk_par); - - if (cmp_size < 0) { - if (cmp_size == CMP_ERROR_SMALL_BUF) - fprintf(stderr, "Error: The buffer for the compressed data is too small to hold the compressed data. Try a larger buffer_length parameter.\n"); + cmp_error = cmp_get_error_code(cmp_size); + if (cmp_error != CMP_ERROR_NO_ERROR) { + fprintf(stderr, "%s\n", cmp_get_error_string(cmp_error)); free(cmp_data); cmp_data = NULL; printf("FAILED\n"); -- GitLab