Get rid of a few more style infractions.

Update NEWS.
pull/1760/head
George Baltz N3GB 2025-06-07 21:22:13 -04:00
rodzic c3d21b477e
commit 39a1a367e1
5 zmienionych plików z 25 dodań i 25 usunięć

2
NEWS
Wyświetl plik

@ -14,6 +14,8 @@ Version 5.x -- future
Version 4.7.0 Version 4.7.0
* 2025-12-01 (target) * 2025-12-01 (target)
* Reduce/repair excess output from cppcheck.sh - mostly cosmetic changes (WIP)
Output from `wc -l cppcheck.log` - 4.6.2: 981 now: 732
* Remove dead getopt code. GitHub PR #1709. (TNX Daniele Forsi) * Remove dead getopt code. GitHub PR #1709. (TNX Daniele Forsi)
* Move rig_cache to separate(calloc) storage. Prepare for other moves. * Move rig_cache to separate(calloc) storage. Prepare for other moves.
Issue #1420 Issue #1420

Wyświetl plik

@ -2170,7 +2170,6 @@ int adat_cmd_fn_set_freq(RIG *pRig)
} }
else else
{ {
// cppcheck-suppress constVariablePointer
const adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv; const adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv;
char acBuf[ ADAT_BUFSZ + 1 ]; char acBuf[ ADAT_BUFSZ + 1 ];
@ -2226,7 +2225,6 @@ int adat_cmd_fn_set_vfo(RIG *pRig)
} }
else else
{ {
// cppcheck-suppress constVariablePointer
const adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv; const adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv;
char acBuf[ ADAT_BUFSZ + 1 ]; char acBuf[ ADAT_BUFSZ + 1 ];
@ -2350,7 +2348,7 @@ int adat_cmd_fn_set_ptt(RIG *pRig)
else else
{ {
adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv; adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv;
char *pcPTTStr = NULL; const char *pcPTTStr = NULL;
// Switch PTT // Switch PTT
@ -2690,7 +2688,6 @@ const char *adat_get_info(RIG *pRig)
if (nRC == RIG_OK) if (nRC == RIG_OK)
{ {
// cppcheck-suppress constVariablePointer
const adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv; const adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv;
snprintf(acBuf, 2048, snprintf(acBuf, 2048,
@ -2774,7 +2771,6 @@ int adat_get_freq(RIG *pRig, vfo_t vfo, freq_t *freq)
} }
else else
{ {
// cppcheck-suppress constVariablePointer
const adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv; const adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv;
nRC = adat_transaction(pRig, &adat_cmd_list_get_freq); nRC = adat_transaction(pRig, &adat_cmd_list_get_freq);
@ -2932,7 +2928,6 @@ int adat_get_mode(RIG *pRig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
} }
else else
{ {
// cppcheck-suppress constVariablePointer
const adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv; const adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv;
nRC = adat_transaction(pRig, &adat_cmd_list_get_mode); nRC = adat_transaction(pRig, &adat_cmd_list_get_mode);
@ -2975,7 +2970,6 @@ int adat_get_vfo(RIG *pRig, vfo_t *vfo)
} }
else else
{ {
// cppcheck-suppress constVariablePointer
const adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv; const adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv;
nRC = adat_transaction(pRig, &adat_cmd_list_get_vfo); nRC = adat_transaction(pRig, &adat_cmd_list_get_vfo);
@ -3055,7 +3049,6 @@ int adat_get_ptt(RIG *pRig, vfo_t vfo, ptt_t *ptt)
} }
else else
{ {
// cppcheck-suppress constVariablePointer
const adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv; const adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv;
nRC = adat_transaction(pRig, &adat_cmd_list_get_ptt); nRC = adat_transaction(pRig, &adat_cmd_list_get_ptt);
@ -3316,7 +3309,6 @@ int adat_get_conf(RIG *pRig, hamlib_token_t token, char *val)
} }
else else
{ {
// cppcheck-suppress constVariablePointer
const adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv; const adat_priv_data_ptr pPriv = (adat_priv_data_ptr) STATE(pRig)->priv;
switch (token) switch (token)

Wyświetl plik

@ -269,7 +269,7 @@ typedef struct async_data_handler_priv_data_s
static int async_data_handler_start(RIG *rig); static int async_data_handler_start(RIG *rig);
static int async_data_handler_stop(RIG *rig); static int async_data_handler_stop(RIG *rig);
void *async_data_handler(void *arg); static void *async_data_handler(void *arg);
#endif #endif
#if defined(HAVE_PTHREAD) #if defined(HAVE_PTHREAD)
@ -289,7 +289,7 @@ typedef struct morse_data_handler_priv_data_s
static int morse_data_handler_start(RIG *rig); static int morse_data_handler_start(RIG *rig);
static int morse_data_handler_stop(RIG *rig); static int morse_data_handler_stop(RIG *rig);
int morse_data_handler_set_keyspd(RIG *rig, int keyspd); int morse_data_handler_set_keyspd(RIG *rig, int keyspd);
void *morse_data_handler(void *arg); static void *morse_data_handler(void *arg);
#endif #endif
/* /*
@ -390,7 +390,7 @@ MUTEX(mutex_debugmsgsave);
void add2debugmsgsave(const char *s) void add2debugmsgsave(const char *s)
{ {
char *p; const char *p;
char stmp[DEBUGMSGSAVE_SIZE]; char stmp[DEBUGMSGSAVE_SIZE];
int i, nlines; int i, nlines;
int maxmsg = DEBUGMSGSAVE_SIZE / 2; int maxmsg = DEBUGMSGSAVE_SIZE / 2;
@ -2134,7 +2134,6 @@ int rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
if (rs->tx_vfo == vfo && curr_band != last_band) if (rs->tx_vfo == vfo && curr_band != last_band)
{ {
struct rig_cache *cachep = CACHE(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s: band changing to %s\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s: band changing to %s\n", __func__,
rig_get_band_str(rig, curr_band, 0)); rig_get_band_str(rig, curr_band, 0));
band_changing = 1; band_changing = 1;
@ -4714,7 +4713,7 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
const struct rig_state *rs; const struct rig_state *rs;
struct rig_cache *cachep; struct rig_cache *cachep;
int retcode, rc2; int retcode, rc2;
vfo_t curr_vfo, tx_vfo = RIG_VFO_CURR; vfo_t curr_vfo, tx_vfo;
freq_t tfreq = 0; freq_t tfreq = 0;
if (CHECK_RIG_ARG(rig)) if (CHECK_RIG_ARG(rig))
@ -8629,7 +8628,7 @@ static int morse_data_handler_stop(RIG *rig)
#endif #endif
#if defined(HAVE_PTHREAD) #if defined(HAVE_PTHREAD)
void *async_data_handler(void *arg) static void *async_data_handler(void *arg)
{ {
struct async_data_handler_args_s *args = (struct async_data_handler_args_s *) struct async_data_handler_args_s *args = (struct async_data_handler_args_s *)
arg; arg;
@ -8725,7 +8724,7 @@ again:
#endif #endif
#if defined(HAVE_PTHREAD) #if defined(HAVE_PTHREAD)
void *morse_data_handler(void *arg) static void *morse_data_handler(void *arg)
{ {
struct morse_data_handler_args_s *args = struct morse_data_handler_args_s *args =
(struct morse_data_handler_args_s *) arg; (struct morse_data_handler_args_s *) arg;

Wyświetl plik

@ -220,7 +220,7 @@ int main(int argc, char *argv[])
ptt_type_t ptt_type = RIG_PTT_NONE; ptt_type_t ptt_type = RIG_PTT_NONE;
dcd_type_t dcd_type = RIG_DCD_NONE; dcd_type_t dcd_type = RIG_DCD_NONE;
int serial_rate = 0; int serial_rate = 0;
char *civaddr = NULL; /* NULL means no need to set conf */ const char *civaddr = NULL; /* NULL means no need to set conf */
char conf_parms[MAXCONFLEN] = ""; char conf_parms[MAXCONFLEN] = "";
int interactive; /* if no cmd on command line, switch to interactive */ int interactive; /* if no cmd on command line, switch to interactive */
int prompt = 1; /* Print prompt in rigctl */ int prompt = 1; /* Print prompt in rigctl */
@ -507,7 +507,7 @@ int main(int argc, char *argv[])
} }
my_rig->caps->ptt_type = ptt_type; my_rig->caps->ptt_type = ptt_type;
char *token = strtok(conf_parms, ","); const char *token = strtok(conf_parms, ",");
struct rig_state *rs = STATE(my_rig); struct rig_state *rs = STATE(my_rig);
while (token) while (token)
@ -564,7 +564,7 @@ int main(int argc, char *argv[])
if (ptt_type == RIG_PTT_NONE) if (ptt_type == RIG_PTT_NONE)
{ {
rig_debug(RIG_DEBUG_VERBOSE, "%s: defaulting to RTS PTT\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s: defaulting to RTS PTT\n", __func__);
my_rig->caps->ptt_type = ptt_type = RIG_PTT_SERIAL_RTS; my_rig->caps->ptt_type = RIG_PTT_SERIAL_RTS;
} }
} }
@ -690,8 +690,15 @@ int main(int argc, char *argv[])
hist_path_size = sizeof(char) * (strlen(hist_dir) + strlen(hist_file) + 1); hist_path_size = sizeof(char) * (strlen(hist_dir) + strlen(hist_file) + 1);
hist_path = (char *)calloc(hist_path_size, sizeof(char)); hist_path = (char *)calloc(hist_path_size, sizeof(char));
if (hist_path)
{
SNPRINTF(hist_path, hist_path_size, "%s%s", hist_dir, hist_file); SNPRINTF(hist_path, hist_path_size, "%s%s", hist_dir, hist_file);
} }
else
{
fprintf(stderr, "Allocation failed - no readline history\n");
}
}
if (rd_hist && hist_path) if (rd_hist && hist_path)
{ {

Wyświetl plik

@ -256,7 +256,7 @@ int main(int argc, char *argv[])
ptt_type_t ptt_type = RIG_PTT_NONE; ptt_type_t ptt_type = RIG_PTT_NONE;
dcd_type_t dcd_type = RIG_DCD_NONE; dcd_type_t dcd_type = RIG_DCD_NONE;
int serial_rate = 0; int serial_rate = 0;
char *civaddr = NULL; /* NULL means no need to set conf */ const char *civaddr = NULL; /* NULL means no need to set conf */
char conf_parms[MAXCONFLEN] = ""; char conf_parms[MAXCONFLEN] = "";
struct addrinfo hints, *result, *saved_result; struct addrinfo hints, *result, *saved_result;
@ -573,7 +573,7 @@ int main(int argc, char *argv[])
} }
my_rig->caps->ptt_type = ptt_type; my_rig->caps->ptt_type = ptt_type;
char *token = strtok(conf_parms, ","); const char *token = strtok(conf_parms, ",");
struct rig_state *rs = STATE(my_rig); struct rig_state *rs = STATE(my_rig);
while (token) while (token)
@ -643,7 +643,7 @@ int main(int argc, char *argv[])
if (ptt_type == RIG_PTT_NONE) if (ptt_type == RIG_PTT_NONE)
{ {
rig_debug(RIG_DEBUG_VERBOSE, "%s: defaulting to RTS PTT\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s: defaulting to RTS PTT\n", __func__);
my_rig->caps->ptt_type = ptt_type = RIG_PTT_SERIAL_RTS; my_rig->caps->ptt_type = RIG_PTT_SERIAL_RTS;
} }
} }