diff --git a/rigs/kenwood/elecraft.c b/rigs/kenwood/elecraft.c index 16ef7c418..4849217b9 100644 --- a/rigs/kenwood/elecraft.c +++ b/rigs/kenwood/elecraft.c @@ -22,6 +22,7 @@ * the complete text of the GNU Lesser Public License version 2.1. * */ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include #include @@ -77,9 +78,9 @@ const struct confparams elecraft_ext_levels[] = /* Private function declarations */ -int verify_kenwood_id(RIG *rig, char *id); -int elecraft_get_extension_level(RIG *rig, const char *cmd, int *ext_level); -int elecraft_get_firmware_revision_level(RIG *rig, const char *cmd, +static int verify_kenwood_id(RIG *rig, char *id); +static int elecraft_get_extension_level(RIG *rig, const char *cmd, int *ext_level); +static int elecraft_get_firmware_revision_level(RIG *rig, const char *cmd, char *fw_rev, size_t fw_rev_sz); /* Shared backend function definitions */ @@ -419,10 +420,10 @@ int elecraft_close(RIG *rig) /* Tests for Kenwood ID string of "017" */ -int verify_kenwood_id(RIG *rig, char *id) +static int verify_kenwood_id(RIG *rig, char *id) { int err; - char *idptr; + const char *idptr; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -472,11 +473,11 @@ int verify_kenwood_id(RIG *rig, char *id) /* Determines K2 and K3 extension level */ -int elecraft_get_extension_level(RIG *rig, const char *cmd, int *ext_level) +static int elecraft_get_extension_level(RIG *rig, const char *cmd, int *ext_level) { int err, i; char buf[KENWOOD_MAX_BUF_LEN]; - char *bufptr; + const char *bufptr; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -511,7 +512,7 @@ int elecraft_get_extension_level(RIG *rig, const char *cmd, int *ext_level) /* Determine firmware revision level */ -int elecraft_get_firmware_revision_level(RIG *rig, const char *cmd, +static int elecraft_get_firmware_revision_level(RIG *rig, const char *cmd, char *fw_rev, size_t fw_rev_sz) { int err; diff --git a/rigs/kenwood/flex.c b/rigs/kenwood/flex.c index d1f66e483..f5181fc3c 100644 --- a/rigs/kenwood/flex.c +++ b/rigs/kenwood/flex.c @@ -23,6 +23,7 @@ * the complete text of the GNU Lesser Public License version 2.1. * */ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include @@ -31,10 +32,10 @@ /* Private helper functions */ -int verify_flexradio_id(RIG *rig, char *id) +static int verify_flexradio_id(RIG *rig, char *id) { int err; - char *idptr; + const char *idptr; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); diff --git a/rigs/kenwood/flex6xxx.c b/rigs/kenwood/flex6xxx.c index dd145a368..ae13e96d7 100644 --- a/rigs/kenwood/flex6xxx.c +++ b/rigs/kenwood/flex6xxx.c @@ -22,6 +22,7 @@ * the complete text of the GNU Lesser Public License version 2.1. * */ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include #include @@ -321,7 +322,7 @@ static int powersdr_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, static int flex6k_find_width(rmode_t mode, pbwidth_t width, int *ridx) { - int *w_a; // Width array, these are all ordered in descending order! + const int *w_a; // Width array, these are all ordered in descending order! int idx = 0; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -372,7 +373,7 @@ static int flex6k_find_width(rmode_t mode, pbwidth_t width, int *ridx) static int powersdr_find_width(rmode_t mode, pbwidth_t width, int *ridx) { - int *w_a; // Width array, these are all ordered in descending order! + const int *w_a; // Width array, these are all ordered in descending order! int idx = 0; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -576,7 +577,7 @@ static int powersdr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) /* * flex6k_get_ptt */ -int flex6k_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) +static int flex6k_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { const char *ptt_cmd; int err; @@ -604,7 +605,7 @@ int flex6k_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) return RIG_OK; } -int flex6k_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) +static int flex6k_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { const char *ptt_cmd; char response[16] = ""; @@ -642,7 +643,7 @@ int flex6k_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) /* * powersdr_set_level */ -int powersdr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) +static int powersdr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { char cmd[KENWOOD_MAX_BUF_LEN]; int retval; @@ -741,7 +742,7 @@ int powersdr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) /* * flek6k_set_level */ -int flex6k_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) +static int flex6k_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { char cmd[KENWOOD_MAX_BUF_LEN]; int retval; @@ -778,10 +779,10 @@ int flex6k_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) /* * flex6k_get_level */ -int flex6k_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) +static int flex6k_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { char lvlbuf[KENWOOD_MAX_BUF_LEN]; - char *cmd; + const char *cmd; int retval; int len, ans; @@ -840,10 +841,10 @@ int flex6k_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) /* * powersdr_get_level */ -int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) +static int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { char lvlbuf[KENWOOD_MAX_BUF_LEN]; - char *cmd; + const char *cmd; int retval; int len, ans; rmode_t mode; @@ -1143,7 +1144,7 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) return RIG_OK; } -int powersdr_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) +static int powersdr_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { char cmd[KENWOOD_MAX_BUF_LEN]; @@ -1174,10 +1175,10 @@ int powersdr_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) return kenwood_transaction(rig, cmd, NULL, 0); } -int powersdr_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) +static int powersdr_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { char lvlbuf[KENWOOD_MAX_BUF_LEN]; - char *cmd; + const char *cmd; int retval; int len, ans; @@ -1234,7 +1235,7 @@ int powersdr_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) return RIG_OK; } -int powersdr_set_parm(RIG *rig, setting_t parm, value_t val) +static int powersdr_set_parm(RIG *rig, setting_t parm, value_t val) { ENTERFUNC; char cmd[KENWOOD_MAX_BUF_LEN]; @@ -1263,7 +1264,7 @@ int powersdr_set_parm(RIG *rig, setting_t parm, value_t val) RETURNFUNC(retval); } -int powersdr_get_parm(RIG *rig, setting_t parm, value_t *val) +static int powersdr_get_parm(RIG *rig, setting_t parm, value_t *val) { char cmd[KENWOOD_MAX_BUF_LEN]; char buf[KENWOOD_MAX_BUF_LEN]; diff --git a/rigs/kenwood/k2.c b/rigs/kenwood/k2.c index ba88c0028..904012efb 100644 --- a/rigs/kenwood/k2.c +++ b/rigs/kenwood/k2.c @@ -21,6 +21,7 @@ * the complete text of the GNU Lesser Public License version 2.1. * */ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include #include @@ -95,16 +96,16 @@ struct k2_filt_lst_s k2_fwmd_cw; struct k2_filt_lst_s k2_fwmd_rtty; /* K2 specific rig_caps API function declarations */ -int k2_open(RIG *rig); -int k2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); -int k2_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); -int k2_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t *val); -int k2_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); +static int k2_open(RIG *rig); +static int k2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); +static int k2_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); +static int k2_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t *val); +static int k2_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); /* Private function declarations */ -int k2_probe_mdfw(RIG *rig, struct kenwood_priv_data *priv); -int k2_mdfw_rest(RIG *rig, const char *mode, const char *fw); -int k2_pop_fw_lst(RIG *rig, const char *cmd); +static int k2_probe_mdfw(RIG *rig, struct kenwood_priv_data *priv); +static int k2_mdfw_rest(RIG *rig, const char *mode, const char *fw); +static int k2_pop_fw_lst(RIG *rig, const char *cmd); /* @@ -258,7 +259,7 @@ struct rig_caps k2_caps = /* k2_open() * */ -int k2_open(RIG *rig) +static int k2_open(RIG *rig) { int err; struct kenwood_priv_data *priv = STATE(rig)->priv; @@ -289,7 +290,7 @@ int k2_open(RIG *rig) * wider than the passed value and sets the radio accordingly. */ -int k2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) +static int k2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { int err; @@ -425,12 +426,12 @@ int k2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) * by the radio and returns it to the caller. */ -int k2_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) +static int k2_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { int err; char buf[KENWOOD_MAX_BUF_LEN]; char tmp[16]; - char *bufptr; + const char *bufptr; pbwidth_t temp_w; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -491,7 +492,7 @@ int k2_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) * STRING: val.cs for set, val.s for get * CHECKBUTTON: val.i 0/1 */ -int k2_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t *val) +static int k2_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t *val) { char buf[KENWOOD_MAX_BUF_LEN]; int err; @@ -544,7 +545,7 @@ int k2_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t *val) /* Probes for mode and filter settings, based on information * by Chris Bryant, G3WIE. */ -int k2_probe_mdfw(RIG *rig, struct kenwood_priv_data *priv) +static int k2_probe_mdfw(RIG *rig, struct kenwood_priv_data *priv) { int err, i, c; char buf[KENWOOD_MAX_BUF_LEN]; @@ -678,7 +679,7 @@ int k2_probe_mdfw(RIG *rig, struct kenwood_priv_data *priv) /* Restore mode, filter, and ext_lvl to original values */ -int k2_mdfw_rest(RIG *rig, const char *mode, const char *fw) +static int k2_mdfw_rest(RIG *rig, const char *mode, const char *fw) { int err; @@ -720,7 +721,7 @@ int k2_mdfw_rest(RIG *rig, const char *mode, const char *fw) /* Populate k2_filt_lst_s structure for each mode */ -int k2_pop_fw_lst(RIG *rig, const char *cmd) +static int k2_pop_fw_lst(RIG *rig, const char *cmd) { int err, f; char fcmd[16]; @@ -806,7 +807,7 @@ int k2_pop_fw_lst(RIG *rig, const char *cmd) return RIG_OK; } -int k2_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) +static int k2_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { char buf[32]; diff --git a/rigs/kenwood/k3.c b/rigs/kenwood/k3.c index da0541059..29423315b 100644 --- a/rigs/kenwood/k3.c +++ b/rigs/kenwood/k3.c @@ -21,6 +21,7 @@ * the complete text of the GNU Lesser Public License version 2.1. * */ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include #include @@ -143,47 +144,43 @@ static struct kenwood_priv_caps k3_priv_caps = /* K3 specific function declarations */ -int k3_set_freq(RIG *rig, vfo_t vfo, freq_t freq); -int k3_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); -int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); -int k3_get_vfo(RIG *rig, vfo_t *vfo); -int k3_set_vfo(RIG *rig, vfo_t vfo); -int k3_set_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t val); -int k3_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t *val); -int k3_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit); -int k3_set_xit(RIG *rig, vfo_t vfo, shortfreq_t rit); -int k3_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width); -int k3_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, +static int k3_set_freq(RIG *rig, vfo_t vfo, freq_t freq); +static int k3_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); +static int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); +static int k3_get_vfo(RIG *rig, vfo_t *vfo); +static int k3_set_vfo(RIG *rig, vfo_t vfo); +static int k3_set_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t val); +static int k3_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t *val); +static int k3_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit); +static int k3_set_xit(RIG *rig, vfo_t vfo, shortfreq_t rit); +static int k3_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width); +static int k3_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width); -int k3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); -int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); -int kx3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); -int kx3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); -int k3_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); -int k3_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); -int k3_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); -int k3_power2mW(RIG *rig, unsigned int *mwpower, float power, freq_t freq, +static int k3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); +static int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); +static int kx3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); +static int kx3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); +static int k3_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); +static int k3_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); +static int k3_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); +static int k3_power2mW(RIG *rig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode); /* Private helper functions */ int set_rit_xit(RIG *rig, shortfreq_t rit); -int k3_set_nb_level(RIG *rig, float dsp_nb, float if_nb); -int k3_get_nb_level(RIG *rig, float *dsp_nb, float *if_nb); -int k3_get_bar_graph_level(RIG *rig, float *smeter, float *pwr, float *alc, +static int k3_set_nb_level(RIG *rig, float dsp_nb, float if_nb); +static int k3_get_nb_level(RIG *rig, float *dsp_nb, float *if_nb); +static int k3_get_bar_graph_level(RIG *rig, float *smeter, float *pwr, float *alc, int *mode_tx); -int k4_get_bar_graph_level(RIG *rig, float *swr, float *pwr, float *alc, +static int k4_get_bar_graph_level(RIG *rig, float *swr, float *pwr, float *alc, int *mode_tx); -int kx3_get_bar_graph_level(RIG *rig, float *level); -int k3_send_voice_mem(RIG *rig, vfo_t vfo, int ch); -int k3_stop_voice_mem(RIG *rig, vfo_t vfo); -int k3_stop_morse(RIG *rig, vfo_t vfo); /* K4 functions */ -int k4_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); -int k4_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); -int k4_send_voice_mem(RIG *rig, vfo_t vfo, int ch); -int k4_stop_voice_mem(RIG *rig, vfo_t vfo); -int k4_stop_morse(RIG *rig, vfo_t vfo); +static int k4_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); +static int k4_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); +static int k4_send_voice_mem(RIG *rig, vfo_t vfo, int ch); +static int k4_stop_voice_mem(RIG *rig, vfo_t vfo); +static int k4_stop_morse(RIG *rig, vfo_t vfo); /* * K3 rig capabilities. @@ -194,28 +191,11 @@ int k4_stop_morse(RIG *rig, vfo_t vfo); * Part of info comes from http://www.elecraft.com/K2_Manual_Download_Page.htm#K3 * look for K3 Programmer's Reference PDF */ -int kx3_get_bar_graph_level(RIG *rig, float *level); -int k3_send_voice_mem(RIG *rig, vfo_t vfo, int ch); -int k3_stop_voice_mem(RIG *rig, vfo_t vfo); -int k3_stop_morse(RIG *rig, vfo_t vfo); +static int kx3_get_bar_graph_level(RIG *rig, float *level); +static int k3_send_voice_mem(RIG *rig, vfo_t vfo, int ch); +static int k3_stop_voice_mem(RIG *rig, vfo_t vfo); +static int k3_stop_morse(RIG *rig, vfo_t vfo); -/* K4 functions */ -int k4_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); -int k4_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); -int k4_send_voice_mem(RIG *rig, vfo_t vfo, int ch); -int k4_stop_voice_mem(RIG *rig, vfo_t vfo); -int k4_stop_morse(RIG *rig, vfo_t vfo); - -/* - * K3 rig capabilities. - * This kit can recognize a large subset of TS-570/K2 commands and has many - * extensions of its own. Extension backend functions to standard Kenwood - * command are defined in elecraft.c (shared with K2) and in this file. - * - * Part of info comes from http://www.elecraft.com/K2_Manual_Download_Page.htm#K3 - * look for K3 Programmer's Reference PDF - * - */ struct rig_caps k3_caps = { RIG_MODEL(RIG_MODEL_K3), @@ -1037,14 +1017,14 @@ struct rig_caps kx2_caps = * RIG_MODE_PKTUSB and RIG_MODE_PKTLSB can be supported. */ -int k3_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) +static int k3_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { char buf[KENWOOD_MAX_BUF_LEN]; int err; rmode_t temp_m; pbwidth_t temp_w; - char *cmd_data = "DT"; - char *cmd_bw = "BW"; + const char *cmd_data = "DT"; + const char *cmd_bw = "BW"; int cmd_bw_len = 6; const struct kenwood_priv_data *priv = STATE(rig)->priv; @@ -1191,7 +1171,7 @@ int k3_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) * mapping seems most likely to cover the user requirements. */ -int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) +static int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { int err, err2; char cmd_m[5]; @@ -1396,7 +1376,7 @@ int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) * We just emulate them so rigctl can work correctly. */ -int k3_set_vfo(RIG *rig, vfo_t vfo) +static int k3_set_vfo(RIG *rig, vfo_t vfo) { ENTERFUNC; @@ -1406,7 +1386,7 @@ int k3_set_vfo(RIG *rig, vfo_t vfo) RETURNFUNC(RIG_OK); } -int k3_get_vfo(RIG *rig, vfo_t *vfo) +static int k3_get_vfo(RIG *rig, vfo_t *vfo) { ENTERFUNC; @@ -1427,7 +1407,7 @@ int k3_get_vfo(RIG *rig, vfo_t *vfo) * See Private Elecraft extra levels definitions in elecraft.c and * private token #define in elecraft.h */ -int k3_set_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t val) +static int k3_set_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t val) { char buf[10]; @@ -1476,7 +1456,7 @@ int k3_set_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t val) * STRING: val.cs for set, val.s for get * CHECKBUTTON: val.i 0/1 */ -int k3_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t *val) +static int k3_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t *val) { char buf[KENWOOD_MAX_BUF_LEN]; int err; @@ -1544,7 +1524,7 @@ int k3_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t *val) * k3_set_rit() -- Differs from from generic Kenwood function as K3 can set * RIT to an arbitrary offset. When rit == 0, the RIT offset is cleared. */ -int k3_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) +static int k3_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { int err; @@ -1565,7 +1545,7 @@ int k3_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) * k3_set_xit() -- Differs from from generic Kenwood function as K3 can set * XIT to an arbitrary offset. When rit == 0, the XIT offset is cleared. */ -int k3_set_xit(RIG *rig, vfo_t vfo, shortfreq_t rit) +static int k3_set_xit(RIG *rig, vfo_t vfo, shortfreq_t rit) { int err; @@ -1585,7 +1565,7 @@ int k3_set_xit(RIG *rig, vfo_t vfo, shortfreq_t rit) /* * The K3 *always* uses VFOB for TX. */ -int k3_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width) +static int k3_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width) { struct kenwood_priv_caps *caps = kenwood_caps(rig); char buf[32]; @@ -1761,7 +1741,7 @@ int k3_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width) /* The K3 *always* uses VFOB for TX. */ -int k3_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, +static int k3_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width) { char buf[KENWOOD_MAX_BUF_LEN]; @@ -1919,7 +1899,7 @@ static int k3_get_maxpower(RIG *rig) return maxpower; } -int k3_power2mW(RIG *rig, +static int k3_power2mW(RIG *rig, unsigned int *mwpower, float power, freq_t freq, @@ -1931,7 +1911,7 @@ int k3_power2mW(RIG *rig, return RIG_OK; } -int k3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) +static int k3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { char levelbuf[16]; int kenwood_val; @@ -2050,7 +2030,7 @@ int k3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) /* * Handle S-meter (SM, SMH) level locally and pass rest to kenwood_get_level() */ -int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) +static int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { char levelbuf[16]; int retval; @@ -2395,7 +2375,7 @@ int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) return RIG_OK; } -int kx3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) +static int kx3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { int ival; char cmdbuf[32]; @@ -2425,7 +2405,7 @@ int kx3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) return k3_set_level(rig, vfo, level, val); } -int kx3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) +static int kx3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int retval; float f; @@ -2515,7 +2495,7 @@ int kx3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) } -int k3_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) +static int k3_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { char buf[10]; @@ -2555,7 +2535,7 @@ int k3_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) return kenwood_transaction(rig, buf, NULL, 0); } -int k3_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) +static int k3_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { char buf[32]; ENTERFUNC; @@ -2593,7 +2573,7 @@ int k3_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) * on the K3. Those functions are handled here and others are passed * through to kenwood_get_func(). */ -int k3_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) +static int k3_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -2674,7 +2654,7 @@ int set_rit_xit(RIG *rig, shortfreq_t rit) return RIG_OK; } -int k3_set_nb_level(RIG *rig, float dsp_nb, float if_nb) +static int k3_set_nb_level(RIG *rig, float dsp_nb, float if_nb) { char levelbuf[16]; int dsp_nb_raw = 0; @@ -2722,7 +2702,7 @@ int k3_set_nb_level(RIG *rig, float dsp_nb, float if_nb) return kenwood_transaction(rig, levelbuf, NULL, 0); } -int k3_get_nb_level(RIG *rig, float *dsp_nb, float *if_nb) +static int k3_get_nb_level(RIG *rig, float *dsp_nb, float *if_nb) { char levelbuf[16]; int retval; @@ -2780,7 +2760,7 @@ int k4_get_bar_graph_level(RIG *rig, float *swr, float *pwr, float *alc, return RIG_OK; } -int k3_get_bar_graph_level(RIG *rig, float *smeter, float *pwr, float *alc, +static int k3_get_bar_graph_level(RIG *rig, float *smeter, float *pwr, float *alc, int *mode_tx) { char levelbuf[16]; @@ -2878,7 +2858,7 @@ int k3_get_bar_graph_level(RIG *rig, float *smeter, float *pwr, float *alc, return RIG_OK; } -int kx3_get_bar_graph_level(RIG *rig, float *level) +static int kx3_get_bar_graph_level(RIG *rig, float *level) { char levelbuf[16]; int retval; @@ -2992,7 +2972,7 @@ int k4_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) // K3S band memory needs some time to do its thing after freq change // K3 probably does too // But what about the K4? -int k3_set_freq(RIG *rig, vfo_t vfo, freq_t freq) +static int k3_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { int retval; freq_t tfreq; @@ -3012,9 +2992,9 @@ int k3_set_freq(RIG *rig, vfo_t vfo, freq_t freq) return retval; } -int k3_send_voice_mem(RIG *rig, vfo_t vfo, int ch) +static int k3_send_voice_mem(RIG *rig, vfo_t vfo, int ch) { - char *cmd; + const char *cmd; int retval; if (ch < 1 || ch > 4) @@ -3038,7 +3018,7 @@ int k3_send_voice_mem(RIG *rig, vfo_t vfo, int ch) return retval; } -int k3_stop_voice_mem(RIG *rig, vfo_t vfo) +static int k3_stop_voice_mem(RIG *rig, vfo_t vfo) { int retval; retval = kenwood_transaction(rig, "SWT37;", NULL, 0); @@ -3075,7 +3055,7 @@ int k4_stop_morse(RIG *rig, vfo_t vfo) return retval; } -int k3_stop_morse(RIG *rig, vfo_t vfo) +static int k3_stop_morse(RIG *rig, vfo_t vfo) { int retval; char cmd[32]; diff --git a/rigs/kenwood/ts890s.c b/rigs/kenwood/ts890s.c index 74f3c22b5..db9aa255a 100644 --- a/rigs/kenwood/ts890s.c +++ b/rigs/kenwood/ts890s.c @@ -44,7 +44,8 @@ static int kenwood_ts890_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { - char levelbuf[16], *command_string; + char levelbuf[16]; + const char *command_string; int kenwood_val, retval; gran_t *level_info; @@ -117,7 +118,7 @@ static int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, size_t ack_len, ack_len_expected, len; int levelint; int retval; - char *command_string; + const char *command_string; gran_t *level_info; level_info = &rig->caps->level_gran[rig_setting2idx(level)]; @@ -475,13 +476,13 @@ static int ts890s_get_split_vfo(RIG *rig, vfo_t rxvfo, split_t *split, { char buf[4]; int retval; - vfo_t tvfo; struct rig_state *rs = STATE(rig); struct kenwood_priv_data *priv = rs->priv; if (RIG_OK == (retval = kenwood_safe_transaction(rig, "FT", buf, sizeof(buf), 3))) { + vfo_t tvfo; if ('0' == buf[2]) { tvfo = RIG_VFO_A; diff --git a/src/misc.c b/src/misc.c index 0a59f1499..8b3c0372c 100644 --- a/src/misc.c +++ b/src/misc.c @@ -17,6 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ /** * \addtogroup rig_internal @@ -383,7 +384,7 @@ int millis_to_dot10ths(int millis, int wpm) int HAMLIB_API sprintf_freq(char *str, int str_len, freq_t freq) { double f; - char *hz; + const char *hz; int decplaces = 10; int retval; @@ -2763,7 +2764,7 @@ void errmsg(int err, char *s, const char *func, const char *file, int line) rigerror(err)); } -uint32_t CRC32_function(uint8_t *buf, uint32_t len) +uint32_t CRC32_function(const uint8_t *buf, uint32_t len) { uint32_t crc; @@ -2893,7 +2894,7 @@ const char *rig_get_band_str(RIG *rig, hamlib_band_t band, int which) rig_debug(RIG_DEBUG_VERBOSE, "%s: bandlist=%s\n", __func__, bandlist); int n = 0; char *p = strchr(bandlist, '(') + 1; - char *token; + const char *token; if (p == NULL) { @@ -2941,7 +2942,7 @@ hamlib_band_t rig_get_band(RIG *rig, freq_t freq, int band) rig_debug(RIG_DEBUG_VERBOSE, "%s: bandlist=%s\n", __func__, bandlist); // e.g. BANDSELECT(BAND160M,BAND80M,BANDUNUSED,BAND40M) char *p = strchr(bandlist, '(') + 1; - char *token; + const char *token; if (p == NULL) { @@ -3000,7 +3001,7 @@ int rig_get_band_rig(RIG *rig, freq_t freq, const char *band) } char *p = strchr(bandlist, '(') + 1; - char *token; + const char *token; if (p == NULL) { diff --git a/src/misc.h b/src/misc.h index 31ff966ec..8e2e57001 100644 --- a/src/misc.h +++ b/src/misc.h @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef _MISC_H #define _MISC_H 1 @@ -122,7 +123,7 @@ extern HAMLIB_EXPORT(vfo_t) vfo_fixup2a(RIG *rig, vfo_t vfo, split_t split, cons extern HAMLIB_EXPORT(int) parse_hoststr(char *hoststr, int hoststr_len, char host[256], char port[6]); -extern HAMLIB_EXPORT(uint32_t) CRC32_function(uint8_t *buf, uint32_t len); +extern HAMLIB_EXPORT(uint32_t) CRC32_function(const uint8_t *buf, uint32_t len); extern HAMLIB_EXPORT(char *)date_strget(char *buf, int buflen, int localtime);