From c1e6dcf0105b2b1affe7aa1d794af7f09f017002 Mon Sep 17 00:00:00 2001 From: George Baltz N3GB Date: Wed, 30 Jul 2025 15:11:53 -0400 Subject: [PATCH] More cppcheck stuff in amplifiers/ and rotators/ --- amplifiers/elecraft/kpa.c | 2 +- amplifiers/gemini/gemini.c | 8 ++++---- rotators/apex/apex.c | 2 +- rotators/easycomm/easycomm.c | 7 +++++-- rotators/gs232a/gs232.c | 1 - rotators/gs232a/gs232a.c | 2 +- rotators/gs232a/gs232b.c | 4 ++-- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/amplifiers/elecraft/kpa.c b/amplifiers/elecraft/kpa.c index f0b0eab55..4b9a6a79b 100644 --- a/amplifiers/elecraft/kpa.c +++ b/amplifiers/elecraft/kpa.c @@ -566,7 +566,7 @@ int kpa_get_powerstat(AMP *amp, powerstat_t *status) int kpa_set_powerstat(AMP *amp, powerstat_t status) { int retval; - char *cmd = NULL; + const char *cmd = NULL; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); diff --git a/amplifiers/gemini/gemini.c b/amplifiers/gemini/gemini.c index b95b77200..58da33581 100644 --- a/amplifiers/gemini/gemini.c +++ b/amplifiers/gemini/gemini.c @@ -134,7 +134,7 @@ const char *gemini_get_info(AMP *amp) return rc->model_name; } -int gemini_status_parse(AMP *amp) +static int gemini_status_parse(AMP *amp) { int retval, n = 0; char *p; @@ -204,7 +204,7 @@ int gemini_get_freq(AMP *amp, freq_t *freq) int gemini_set_freq(AMP *amp, freq_t freq) { int retval; - char *cmd; + const char *cmd; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -268,7 +268,7 @@ int gemini_get_level(AMP *amp, setting_t level, value_t *val) int gemini_set_level(AMP *amp, setting_t level, value_t val) { - char *cmd = "?"; + const char *cmd = "?"; int retval; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -340,7 +340,7 @@ int gemini_get_powerstat(AMP *amp, powerstat_t *status) int gemini_set_powerstat(AMP *amp, powerstat_t status) { int retval; - char *cmd = NULL; + const char *cmd = NULL; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); diff --git a/rotators/apex/apex.c b/rotators/apex/apex.c index e85d62012..aa9fe89ca 100644 --- a/rotators/apex/apex.c +++ b/rotators/apex/apex.c @@ -43,12 +43,12 @@ static int apex_get_string(ROT *rot, char *s, int maxlen) static void *apex_read(void *arg) { ROT *rot = arg; - int retval = 0; char data[64]; int expected_return_length = 63; while (1) { + int retval; retval = apex_get_string(rot, data, expected_return_length); if (strstr(data, "")) diff --git a/rotators/easycomm/easycomm.c b/rotators/easycomm/easycomm.c index 4f7113e12..70d1b5f65 100644 --- a/rotators/easycomm/easycomm.c +++ b/rotators/easycomm/easycomm.c @@ -50,9 +50,9 @@ static int easycomm_transaction(ROT *rot, const char *cmdstr, char *data, size_t data_len) { - hamlib_port_t *rotp = ROTPORT(rot); + hamlib_port_t *rotp; int retval; - int retry = rot->caps->retry; + int retry; rig_debug(RIG_DEBUG_TRACE, "%s called: %s\n", __func__, cmdstr); @@ -61,6 +61,9 @@ easycomm_transaction(ROT *rot, const char *cmdstr, char *data, size_t data_len) return -RIG_EINVAL; } + rotp = ROTPORT(rot); + retry = rot->caps->retry; + do { rig_flush(rotp); diff --git a/rotators/gs232a/gs232.c b/rotators/gs232a/gs232.c index bc95989c5..26b6c125e 100644 --- a/rotators/gs232a/gs232.c +++ b/rotators/gs232a/gs232.c @@ -225,7 +225,6 @@ gs232_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { rig_debug(RIG_DEBUG_WARN, "%s: rotor didn't send CR...assuming it won't in the future\n", __func__); - retval = RIG_OK; expected = 11; // we won't expect the CR ROTPORT(rot)->retry = 3; } diff --git a/rotators/gs232a/gs232a.c b/rotators/gs232a/gs232a.c index 068ed3052..7b73fa84d 100644 --- a/rotators/gs232a/gs232a.c +++ b/rotators/gs232a/gs232a.c @@ -276,7 +276,7 @@ static int gs232a_rot_set_level(ROT *rot, setting_t level, value_t val) } /* between 1 (slowest) and 4 (fastest) */ - SNPRINTF(cmdstr, sizeof(cmdstr), "X%u" EOM, speed); + SNPRINTF(cmdstr, sizeof(cmdstr), "X%d" EOM, speed); retval = gs232a_transaction(rot, cmdstr, NULL, 0, 1); if (retval != RIG_OK) diff --git a/rotators/gs232a/gs232b.c b/rotators/gs232a/gs232b.c index 8275a9ca8..030205816 100644 --- a/rotators/gs232a/gs232b.c +++ b/rotators/gs232a/gs232b.c @@ -294,10 +294,10 @@ static int gs232b_rot_set_level(ROT *rot, setting_t level, value_t val) switch (level) { - int retval; case ROT_LEVEL_SPEED: { + int retval; int speed = val.i; if (speed < 1) @@ -310,7 +310,7 @@ static int gs232b_rot_set_level(ROT *rot, setting_t level, value_t val) } /* between 1 (slowest) and 4 (fastest) */ - SNPRINTF(cmdstr, sizeof(cmdstr), "X%u" EOM, speed); + SNPRINTF(cmdstr, sizeof(cmdstr), "X%d" EOM, speed); retval = gs232b_transaction(rot, cmdstr, NULL, 0, 1); if (retval != RIG_OK)