Skip to content
Snippets Groups Projects
Commit 1d623273 authored by Dominik Loidolt's avatar Dominik Loidolt
Browse files

Update cmp_tool for the compress_chunk error handling

parent 6f405478
Branches
Tags
1 merge request!30Enhanced Error Handling in Chunk Compression Functions
...@@ -731,7 +731,8 @@ static int compression_of_chunk(void *chunk, uint32_t size, void *model, struct ...@@ -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 bound = compress_chunk_cmp_size_bound(chunk, size);
uint32_t *cmp_data; uint32_t *cmp_data;
int32_t cmp_size; uint32_t cmp_size;
enum cmp_error cmp_error;
int error; int error;
if (!bound) if (!bound)
...@@ -745,10 +746,9 @@ static int compression_of_chunk(void *chunk, uint32_t size, void *model, struct ...@@ -745,10 +746,9 @@ static int compression_of_chunk(void *chunk, uint32_t size, void *model, struct
printf("Compress chunk data ... "); printf("Compress chunk data ... ");
cmp_size = compress_chunk(chunk, size, model, model, cmp_size = compress_chunk(chunk, size, model, model,
cmp_data, bound, chunk_par); cmp_data, bound, chunk_par);
cmp_error = cmp_get_error_code(cmp_size);
if (cmp_size < 0) { if (cmp_error != CMP_ERROR_NO_ERROR) {
if (cmp_size == CMP_ERROR_SMALL_BUF) fprintf(stderr, "%s\n", cmp_get_error_string(cmp_error));
fprintf(stderr, "Error: The buffer for the compressed data is too small to hold the compressed data. Try a larger buffer_length parameter.\n");
free(cmp_data); free(cmp_data);
cmp_data = NULL; cmp_data = NULL;
printf("FAILED\n"); printf("FAILED\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment