mirror of
https://github.com/Hamlib/Hamlib.git
synced 2024-09-21 10:27:18 +00:00
Fix more cppcheck items
This commit is contained in:
parent
e2354333f3
commit
8d15c04727
@ -1264,7 +1264,6 @@ static int ar7030p_set_vfo(RIG *rig, vfo_t vfo)
|
||||
static int ar7030p_get_vfo(RIG *rig, vfo_t *vfo)
|
||||
{
|
||||
int rc = RIG_OK;
|
||||
// cppcheck-suppress constVariablePointer
|
||||
struct ar7030p_priv_data *priv = (struct ar7030p_priv_data *) rig->state.priv;
|
||||
|
||||
assert(NULL != vfo);
|
||||
@ -1349,7 +1348,6 @@ static int ar7030p_get_mem(RIG *rig, vfo_t vfo, int *ch)
|
||||
{
|
||||
int rc = RIG_OK;
|
||||
|
||||
// cppcheck-suppress constVariablePointer
|
||||
struct ar7030p_priv_data *priv = (struct ar7030p_priv_data *) rig->state.priv;
|
||||
const channel_t *curr = priv->curr;
|
||||
|
||||
|
@ -85,6 +85,12 @@ int usrp_close(RIG *rig)
|
||||
{
|
||||
struct usrp_priv_data *priv = static_cast<struct usrp_priv_data*>rig->state.priv;
|
||||
|
||||
if (!priv)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: priv == NULL?\n", __func__);
|
||||
return -RIG_EARG;
|
||||
}
|
||||
|
||||
delete priv->urx;
|
||||
|
||||
return RIG_OK;
|
||||
@ -97,6 +103,12 @@ int usrp_set_conf(RIG *rig, token_t token, const char *val)
|
||||
{
|
||||
struct usrp_priv_data *priv = static_cast<struct usrp_priv_data*>rig->state.priv;
|
||||
|
||||
if (!priv)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: priv == NULL?\n", __func__);
|
||||
return -RIG_EARG;
|
||||
}
|
||||
|
||||
switch(token) {
|
||||
case TOK_IFMIXFREQ:
|
||||
sscanf(val, "%"SCNfreq, &priv->if_mix_freq);
|
||||
@ -116,6 +128,12 @@ int usrp_get_conf(RIG *rig, token_t token, char *val)
|
||||
{
|
||||
const struct usrp_priv_data *priv = static_cast<struct usrp_priv_data*>rig->state.priv;
|
||||
|
||||
if (!priv)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: priv == NULL?\n", __func__);
|
||||
return -RIG_EARG;
|
||||
}
|
||||
|
||||
switch(token) {
|
||||
case TOK_IFMIXFREQ:
|
||||
sprintf(val, "%"PRIfreq, priv->if_mix_freq);
|
||||
@ -133,6 +151,12 @@ int usrp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
const struct usrp_priv_data *priv = static_cast<struct usrp_priv_data*>rig->state.priv;
|
||||
int chan = 0;
|
||||
|
||||
if (!priv)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: priv == NULL?\n", __func__);
|
||||
return -RIG_EARG;
|
||||
}
|
||||
|
||||
if (!priv->urx->set_rx_freq (chan, freq))
|
||||
return -RIG_EPROTO;
|
||||
|
||||
@ -145,6 +169,12 @@ int usrp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
const struct usrp_priv_data *priv = static_cast<struct usrp_priv_data*>rig->state.priv;
|
||||
int chan = 0;
|
||||
|
||||
if (!priv)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: priv == NULL?\n", __func__);
|
||||
return -RIG_EARG;
|
||||
}
|
||||
|
||||
*freq = priv->urx->rx_freq (chan);
|
||||
|
||||
return RIG_OK;
|
||||
|
@ -361,6 +361,7 @@ static int easycomm_rot_set_level(ROT *rot, setting_t level, value_t val)
|
||||
* Get Info
|
||||
* returns the model name string
|
||||
*/
|
||||
// cppcheck-suppress constParameterCallback
|
||||
static const char *easycomm_rot_get_info(ROT *rot)
|
||||
{
|
||||
const struct rot_caps *rc;
|
||||
|
@ -120,6 +120,7 @@ saebrtrack_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||
* Get Info
|
||||
* returns the model name string
|
||||
*/
|
||||
// cppcheck-suppress constParameterCallback
|
||||
static const char *saebrtrack_rot_get_info(ROT *rot)
|
||||
{
|
||||
const struct rot_caps *rc;
|
||||
|
@ -223,7 +223,7 @@ static int ts7400_rot_reset(ROT *rot, rot_reset_t reset)
|
||||
|
||||
static int ts7400_rot_move(ROT *rot, int direction, int speed)
|
||||
{
|
||||
const struct ts7400_rot_priv_data *priv = (struct ts7400_rot_priv_data *)
|
||||
struct ts7400_rot_priv_data const *priv = (struct ts7400_rot_priv_data *)
|
||||
rot->state.priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#include "resource.h"
|
||||
#include "Resource.h"
|
||||
|
@ -415,6 +415,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
#ifdef HAVE_LIBREADLINE
|
||||
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (interactive && prompt && have_rl)
|
||||
{
|
||||
rl_readline_name = "rotctl";
|
||||
@ -470,6 +471,7 @@ int main(int argc, char *argv[])
|
||||
exitcode = 2;
|
||||
}
|
||||
}
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
while (retcode == 0 || retcode == 2);
|
||||
|
||||
#ifdef HAVE_LIBREADLINE
|
||||
|
@ -1474,6 +1474,7 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, const char *argv[], int arg
|
||||
rot_debug(RIG_DEBUG_TRACE, "%s: NETROTCTL_RET %d\n", __func__, retcode);
|
||||
fprintf(fout, NETROTCTL_RET "%d\n", retcode);
|
||||
// ext_resp = 0; // not used ?
|
||||
// cppcheck-suppress unreadVariable
|
||||
resp_sep = '\n';
|
||||
}
|
||||
else
|
||||
@ -1501,6 +1502,7 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, const char *argv[], int arg
|
||||
{
|
||||
rot_debug(RIG_DEBUG_TRACE, "%s: NETROTCTL_RET 0\n", __func__);
|
||||
fprintf(fout, NETROTCTL_RET "0\n");
|
||||
// cppcheck-suppress unreadVariable
|
||||
resp_sep = '\n';
|
||||
}
|
||||
}
|
||||
|
@ -621,6 +621,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
#else
|
||||
handle_socket(arg);
|
||||
retcode = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user