From 72bc62366d1b4f9958a94480a172af773a93f72b Mon Sep 17 00:00:00 2001 From: George Baltz N3GB Date: Mon, 28 Jul 2025 19:31:20 -0400 Subject: [PATCH] A few more cppcheck messages silenced --- rigs/anytone/anytone.c | 14 +++++++++----- rigs/drake/drake.c | 10 +++++----- rotators/androidsensor/androidsensor.cpp | 1 - rotators/indi/indi_wrapper.cpp | 12 ------------ src/network.c | 6 +++--- tests/rigmatrix.c | 3 +-- tests/rigmem.c | 4 ++-- tests/rotctl_parse.c | 12 ++++++------ tests/test2038.c | 2 +- tests/testnet.c | 4 ++-- tests/testtrn.c | 2 +- 11 files changed, 30 insertions(+), 40 deletions(-) diff --git a/rigs/anytone/anytone.c b/rigs/anytone/anytone.c index 24b94282b..3945d08f6 100644 --- a/rigs/anytone/anytone.c +++ b/rigs/anytone/anytone.c @@ -46,7 +46,7 @@ // --------------------------------------------------------------------------- #include "anytone.h" -int anytone_transaction(RIG *rig, unsigned char *cmd, int cmd_len, +static int anytone_transaction(RIG *rig, unsigned char *cmd, int cmd_len, unsigned char *reply, int reply_len, int expected_len); DECLARE_INITRIG_BACKEND(anytone) @@ -94,7 +94,7 @@ DECLARE_PROBERIG_BACKEND(anytone) // AnyTone needs a keep-alive to emulate the MIC // Apparently to keep the rig from getting stuck in PTT if mic disconnects -void *anytone_thread(void *vrig) +static void *anytone_thread(void *vrig) { RIG *rig = (RIG *)vrig; hamlib_port_t *rp = RIGPORT(rig); @@ -135,7 +135,7 @@ void *anytone_thread(void *vrig) // --------------------------------------------------------------------------- // anytone_send // --------------------------------------------------------------------------- -int anytone_send(RIG *rig, +static int anytone_send(RIG *rig, unsigned char *cmd, int cmd_len) { int retval = RIG_OK; @@ -154,7 +154,7 @@ int anytone_send(RIG *rig, // --------------------------------------------------------------------------- // anytone_receive // --------------------------------------------------------------------------- -int anytone_receive(RIG *rig, unsigned char *buf, int buf_len, int expected) +static int anytone_receive(RIG *rig, unsigned char *buf, int buf_len, int expected) { int retval = RIG_OK; hamlib_port_t *rp = RIGPORT(rig); @@ -178,7 +178,7 @@ int anytone_receive(RIG *rig, unsigned char *buf, int buf_len, int expected) // --------------------------------------------------------------------------- // anytone_transaction // --------------------------------------------------------------------------- -int anytone_transaction(RIG *rig, unsigned char *cmd, int cmd_len, +static int anytone_transaction(RIG *rig, unsigned char *cmd, int cmd_len, unsigned char *reply, int reply_len, int expected_len) { int retval = RIG_OK; @@ -293,8 +293,12 @@ int anytone_open(RIG *rig) int anytone_close(RIG *rig) { int retval = RIG_OK; + anytone_priv_data_t *p = STATE(rig)->priv; ENTERFUNC; + + // Tell thread to give up + p->runflag = 0; char *cmd = "+ADATA:00,000\r\n"; anytone_transaction(rig, (unsigned char *)cmd, strlen(cmd), NULL, 0, 0); diff --git a/rigs/drake/drake.c b/rigs/drake/drake.c index db1c30a66..0fe7d5f66 100644 --- a/rigs/drake/drake.c +++ b/rigs/drake/drake.c @@ -62,9 +62,9 @@ */ void drake_fix_string(char* inStr) { - char chChkAry[3] = {0x20, 0x0d, 0x0a}; - char* chRepAry[3] = {"", "", ""}; - char* chPos; + const char chChkAry[3] = {0x20, 0x0d, 0x0a}; + const char* chRepAry[3] = {"", "", ""}; + const char* chPos; int newLen; int offset; int i; @@ -108,7 +108,7 @@ void drake_trans_rept(char* hdrStr, char* sentStr, int sentLen, char* recdStr, i { char sent[BUFSZ]; char recd[BUFSZ]; - char nullStr[7] = {'<','N','U','L','L','>',0x00}; + const char nullStr[7] = {'<','N','U','L','L','>',0x00}; int i; //in most cases each string is a buffer, so we need to ensure both command and response @@ -1583,7 +1583,7 @@ DECLARE_PROBERIG_BACKEND(drake) close(port->fd); - if (retval != RIG_OK || id_len <= 0 || id_len >= BUFSZ) + if (retval != RIG_OK || id_len <= 1 || id_len >= BUFSZ) { return RIG_MODEL_NONE; } diff --git a/rotators/androidsensor/androidsensor.cpp b/rotators/androidsensor/androidsensor.cpp index cff44d409..d970647be 100644 --- a/rotators/androidsensor/androidsensor.cpp +++ b/rotators/androidsensor/androidsensor.cpp @@ -143,7 +143,6 @@ const struct rot_caps androidsensor_rot_caps = /* ************************************************************************* */ -// cppcheck-suppress syntaxError DECLARE_INITROT_BACKEND(androidsensor) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); diff --git a/rotators/indi/indi_wrapper.cpp b/rotators/indi/indi_wrapper.cpp index c766c8af2..0ae8f1758 100644 --- a/rotators/indi/indi_wrapper.cpp +++ b/rotators/indi/indi_wrapper.cpp @@ -462,9 +462,7 @@ int RotINDIClient::setPosition(azimuth_t az, elevation_t el) return RIG_OK; } -// cppcheck-suppress unusedFunction void RotINDIClient::removeDevice(INDI::BaseDevice *dp) {} -// cppcheck-suppress unusedFunction void RotINDIClient::newProperty(INDI::Property *property) { std::string name(property->getName()); @@ -491,13 +489,9 @@ void RotINDIClient::newProperty(INDI::Property *property) mEl = property->getNumber()->np[1].value; } } -// cppcheck-suppress unusedFunction void RotINDIClient::removeProperty(INDI::Property *property) {} -// cppcheck-suppress unusedFunction void RotINDIClient::newBLOB(IBLOB *bp) {} -// cppcheck-suppress unusedFunction void RotINDIClient::newSwitch(ISwitchVectorProperty *svp) {} -// cppcheck-suppress unusedFunction void RotINDIClient::newNumber(INumberVectorProperty *nvp) { std::string name(nvp->name); @@ -508,22 +502,16 @@ void RotINDIClient::newNumber(INumberVectorProperty *nvp) mEl = nvp->np[1].value; } } -// cppcheck-suppress unusedFunction void RotINDIClient::newMessage(INDI::BaseDevice *dp, int messageID) {} -// cppcheck-suppress unusedFunction void RotINDIClient::newText(ITextVectorProperty *tvp) {} -// cppcheck-suppress unusedFunction void RotINDIClient::newLight(ILightVectorProperty *lvp) {} -// cppcheck-suppress unusedFunction void RotINDIClient::newDevice(INDI::BaseDevice *dp) {} -// cppcheck-suppress unusedFunction void RotINDIClient::serverConnected() { rig_debug(RIG_DEBUG_VERBOSE, "indi: server connected\n"); } -// cppcheck-suppress unusedFunction void RotINDIClient::serverDisconnected(int exit_code) { rig_debug(RIG_DEBUG_VERBOSE, "indi: server disconnected\n"); diff --git a/src/network.c b/src/network.c index 0d37e392f..4c6242712 100644 --- a/src/network.c +++ b/src/network.c @@ -1000,7 +1000,7 @@ static int multicast_publisher_read_packet(multicast_publisher_args return (RIG_OK); } -void *multicast_publisher(void *arg) +static void *multicast_publisher(void *arg) { unsigned char spectrum_data[HAMLIB_MAX_SPECTRUM_DATA]; char snapshot_buffer[HAMLIB_MAX_SNAPSHOT_PACKET_SIZE]; @@ -1257,7 +1257,7 @@ int is_wireless() #include #include -int is_networked(char *ipv4, int ipv4_length) +static int is_networked(char *ipv4, int ipv4_length) { struct ifaddrs *interfaces, *iface; char addr_str[INET_ADDRSTRLEN]; @@ -1345,7 +1345,7 @@ int is_wireless() #endif #endif -void *multicast_receiver(void *arg) +static void *multicast_receiver(void *arg) { char data[4096]; char ip4[INET6_ADDRSTRLEN]; diff --git a/tests/rigmatrix.c b/tests/rigmatrix.c index f574143ea..cb2f198da 100644 --- a/tests/rigmatrix.c +++ b/tests/rigmatrix.c @@ -34,7 +34,7 @@ static setting_t bitmap_func, bitmap_level, bitmap_parm, bitmap_vfo_ops; -int create_png_range(const freq_range_t rx_range_list[], +static int create_png_range(const freq_range_t rx_range_list[], const freq_range_t tx_range_list[], int num); int print_caps_sum(struct rig_caps *caps, void *data) @@ -566,7 +566,6 @@ static void draw_range(const freq_range_t range_list[], } } - static int create_png_range(const freq_range_t rx_range_list[], const freq_range_t tx_range_list[], int num) diff --git a/tests/rigmem.c b/tests/rigmem.c index 8b2c9cfb8..84b8eaf68 100644 --- a/tests/rigmem.c +++ b/tests/rigmem.c @@ -58,7 +58,7 @@ void usage(); void version(); static int set_conf(RIG *rig, char *conf_parms); -int clear_chans(RIG *rig, const char *infilename); +static int clear_chans(RIG *rig, const char *infilename); /* * Reminder: when adding long options, @@ -450,7 +450,7 @@ static int set_conf(RIG *rig, char *conf_parms) /* * Pretty nasty, clears everything you have in rig memory */ -int clear_chans(RIG *rig, const char *infilename) +static int clear_chans(RIG *rig, const char *infilename) { int i, j, ret; channel_t chan; diff --git a/tests/rotctl_parse.c b/tests/rotctl_parse.c index 09b27c56f..9c0553e2f 100644 --- a/tests/rotctl_parse.c +++ b/tests/rotctl_parse.c @@ -246,7 +246,7 @@ struct test_table test_list[] = }; -struct test_table *find_cmd_entry(int cmd) +static struct test_table *find_cmd_entry(int cmd) { int i; @@ -286,7 +286,7 @@ struct mod_lst struct mod_lst *models = NULL; /* Add model information to the hash */ -void hash_add_model(int id, +static void hash_add_model(int id, const char *mfg_name, const char *model_name, const char *version, @@ -309,20 +309,20 @@ void hash_add_model(int id, /* Hash sorting functions */ -int hash_model_id_sort(const struct mod_lst *a, const struct mod_lst *b) +static int hash_model_id_sort(const struct mod_lst *a, const struct mod_lst *b) { return (a->id > b->id); } -void hash_sort_by_model_id() +static void hash_sort_by_model_id() { HASH_SORT(models, hash_model_id_sort); } /* Delete hash */ -void hash_delete_all() +static void hash_delete_all() { struct mod_lst *current_model, *tmp = NULL; @@ -372,7 +372,7 @@ static void rp_getline(const char *s) /* * TODO: use Lex? */ -char parse_arg(const char *arg) +static char parse_arg(const char *arg) { int i; diff --git a/tests/test2038.c b/tests/test2038.c index cb439548c..d7337008c 100644 --- a/tests/test2038.c +++ b/tests/test2038.c @@ -6,7 +6,7 @@ Does fail when compiled with gcc -m32 -o test2038 test2038.c #include #include -int test2038(void) +static int test2038(void) { time_t x; diff --git a/tests/testnet.c b/tests/testnet.c index ab11f0dd9..aff0b9a62 100644 --- a/tests/testnet.c +++ b/tests/testnet.c @@ -25,7 +25,7 @@ # include #endif -int rig_network_addr(char *hoststr, char *portstr) +static int rig_network_addr(char *hoststr, char *portstr) { struct in6_addr serveraddr; @@ -73,7 +73,7 @@ int rig_network_addr(char *hoststr, char *portstr) return 0; } -int test_host(char *hoststr, char host[256], char port[6]) +static int test_host(char *hoststr, char host[256], char port[6]) { int status; char host2[256], port2[6]; diff --git a/tests/testtrn.c b/tests/testtrn.c index ce3793acd..2333d8e0e 100644 --- a/tests/testtrn.c +++ b/tests/testtrn.c @@ -14,7 +14,7 @@ #define SERIAL_PORT "/dev/ttyS0" -int myfreq_event(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg) +static int myfreq_event(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg) { int *count_ptr = (int *) arg;