From 9e6d2911e13cab246b66e8bf500542217e4ef280 Mon Sep 17 00:00:00 2001 From: Dominik Loidolt <dominik.loidolt@univie.ac.at> Date: Thu, 16 Jan 2025 12:00:55 +0100 Subject: [PATCH] Refactor: Improve coding style consistency - cmp_io.c: Added missing header includes and adjusted brace usage for better readability. - cmp_tool.c: Improved comment formatting and removed redundant else blocks. - cmp_tool_integration_test.py: Removed unnecessary print statements. --- programs/cmp_io.c | 7 +++++-- programs/cmp_tool.c | 10 +++++----- test/cmp_tool/cmp_tool_integration_test.py | 1 - 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/programs/cmp_io.c b/programs/cmp_io.c index f4938dc..653f8fe 100644 --- a/programs/cmp_io.c +++ b/programs/cmp_io.c @@ -18,6 +18,7 @@ * @warning this part of the software is not intended to run on-board on the ICU. */ +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -553,7 +554,8 @@ int cmp_mode_parse(const char *cmp_mode_str, enum cmp_mode *cmp_mode) } } return -1; - } else { + } + { uint32_t read_val; if (atoui32(cmp_mode_str, cmp_mode_str, &read_val)) @@ -916,7 +918,8 @@ static int parse_info(FILE *fp, struct cmp_info *info) fprintf(stderr, "%s: Error read in cmp_mode_used.\n", PROGRAM_NAME); return -1; - } else { + } + { uint32_t tmp; if (atoui32(token1, token2, &tmp)) diff --git a/programs/cmp_tool.c b/programs/cmp_tool.c index bae19f9..a0f1180 100644 --- a/programs/cmp_tool.c +++ b/programs/cmp_tool.c @@ -122,14 +122,14 @@ static const struct option long_options[] = { static const char *output_prefix = DEFAULT_OUTPUT_PREFIX; /* if non zero additional RDCU parameters are included in the compression - * configuration and decompression information files */ + * configuration and decompression information files + */ static int add_rdcu_pars; /* if non zero generate RDCU setup packets */ static int rdcu_pkt_mode; -/* file name of the last compression information file to generate parallel RDCU - * setup packets */ +/* file name of the last compression information file to generate parallel RDCU setup packets */ static const char *last_info_file_name; /* option flags for file IO */ @@ -628,8 +628,8 @@ static int guess_cmp_pars(struct rdcu_cfg *rcfg, struct cmp_par *chunk_par, if (cmp_is_error(result)) return -1; - else - cmp_size_bit = 8 * result; + + cmp_size_bit = 8 * result; printf("DONE\n"); printf("Write the guessed compression chunk parameters to file %s.par ... ", output_prefix); diff --git a/test/cmp_tool/cmp_tool_integration_test.py b/test/cmp_tool/cmp_tool_integration_test.py index c4856c4..5f80ab1 100755 --- a/test/cmp_tool/cmp_tool_integration_test.py +++ b/test/cmp_tool/cmp_tool_integration_test.py @@ -1311,7 +1311,6 @@ def test_model_fiel_erros(): returncode, stdout, stderr = call_cmp_tool( " -c "+cfg_file_name+" -d "+data_file_name + " -m "+model_file_name+" -o "+output_prefix) assert(returncode == EXIT_FAILURE) - print(stdout) assert(stdout == CMP_START_STR_CMP + "Importing configuration file %s ... DONE\n" % (cfg_file_name) + "Importing data file %s ... DONE\n" % (data_file_name) + -- GitLab