kopia lustrzana https://github.com/Hamlib/Hamlib
Fix cppcheck warnings
rodzic
92bfb3bf22
commit
dc92ae7843
|
@ -283,18 +283,18 @@ int ar3030_init(RIG *rig)
|
|||
{
|
||||
struct ar3030_priv_data *priv;
|
||||
|
||||
priv = malloc(sizeof(struct ar3030_priv_data));
|
||||
rig->state.priv = malloc(sizeof(struct ar3030_priv_data));
|
||||
|
||||
if (!priv)
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
|
||||
priv->curr_ch = 99; /* huh! FIXME: get_mem in open() ? */
|
||||
priv->curr_vfo = RIG_VFO_A;
|
||||
|
||||
rig->state.priv = priv;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -137,16 +137,18 @@ static int dra818_setvolume(RIG *rig)
|
|||
|
||||
int dra818_init(RIG *rig)
|
||||
{
|
||||
struct dra818_priv *priv = calloc(sizeof(*priv), 1);
|
||||
struct dra818_priv *priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: dra818_init called\n", __func__);
|
||||
|
||||
if (!priv)
|
||||
rig->state.priv = calloc(sizeof(*priv), 1);
|
||||
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
rig->state.priv = priv;
|
||||
priv = rig->state.priv;
|
||||
|
||||
switch (rig->caps->rig_model)
|
||||
{
|
||||
|
|
|
@ -104,15 +104,15 @@ int drake_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
|
|||
int drake_init(RIG *rig)
|
||||
{
|
||||
struct drake_priv_data *priv;
|
||||
priv = malloc(sizeof(struct drake_priv_data));
|
||||
rig->state.priv = malloc(sizeof(struct drake_priv_data));
|
||||
|
||||
if (!priv)
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
priv = rig->state.priv;
|
||||
|
||||
priv->curr_ch = 0;
|
||||
rig->state.priv = priv;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -524,19 +524,19 @@ int elad_init(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
priv = malloc(sizeof(struct elad_priv_data));
|
||||
rig->state.priv = malloc(sizeof(struct elad_priv_data));
|
||||
|
||||
if (priv == NULL)
|
||||
if (rig->state.priv == NULL)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
priv = rig->state.priv;
|
||||
|
||||
memset(priv, 0x00, sizeof(struct elad_priv_data));
|
||||
strcpy(priv->verify_cmd, RIG_MODEL_XG3 == rig->caps->rig_model ? ";" : "ID;");
|
||||
priv->split = RIG_SPLIT_OFF;
|
||||
priv->trn_state = -1;
|
||||
priv->curr_mode = 0;
|
||||
rig->state.priv = priv;
|
||||
|
||||
/* default mode_table */
|
||||
if (caps->mode_table == NULL)
|
||||
|
|
|
@ -583,19 +583,19 @@ int kenwood_init(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called, version %s\n", __func__, BACKEND_VER);
|
||||
|
||||
priv = malloc(sizeof(struct kenwood_priv_data));
|
||||
rig->state.priv = malloc(sizeof(struct kenwood_priv_data));
|
||||
|
||||
if (priv == NULL)
|
||||
if (rig->state.priv == NULL)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
priv = rig->state.priv;
|
||||
|
||||
memset(priv, 0x00, sizeof(struct kenwood_priv_data));
|
||||
strcpy(priv->verify_cmd, RIG_MODEL_XG3 == rig->caps->rig_model ? ";" : "ID;");
|
||||
priv->split = RIG_SPLIT_OFF;
|
||||
priv->trn_state = -1;
|
||||
priv->curr_mode = 0;
|
||||
rig->state.priv = priv;
|
||||
|
||||
/* default mode_table */
|
||||
if (caps->mode_table == NULL)
|
||||
|
|
|
@ -1121,9 +1121,6 @@ void uh_close_radio()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef XXREMOVEDXX
|
||||
// Not referenced anywhere
|
||||
void uh_close_wkey()
|
||||
{
|
||||
uh_wkey_in_use = 0;
|
||||
|
@ -1133,7 +1130,6 @@ void uh_close_wkey()
|
|||
close_microham();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int uh_open_ptt()
|
||||
{
|
||||
|
|
|
@ -214,17 +214,18 @@ int tt585_init(RIG *rig)
|
|||
{
|
||||
struct tt585_priv_data *priv;
|
||||
|
||||
priv = (struct tt585_priv_data *) malloc(sizeof(struct tt585_priv_data));
|
||||
rig->state.priv = (struct tt585_priv_data *) malloc(sizeof(struct tt585_priv_data));
|
||||
|
||||
if (!priv)
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
|
||||
memset(priv, 0, sizeof(struct tt585_priv_data));
|
||||
|
||||
rig->state.priv = priv;
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -594,30 +594,29 @@ const struct rig_caps ft1000mpmkvfld_caps =
|
|||
|
||||
int ft1000mp_init(RIG *rig)
|
||||
{
|
||||
struct ft1000mp_priv_data *p;
|
||||
struct ft1000mp_priv_data *priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called \n", __func__);
|
||||
|
||||
|
||||
p = (struct ft1000mp_priv_data *) calloc(1, sizeof(struct ft1000mp_priv_data));
|
||||
rig->state.priv = (struct ft1000mp_priv_data *) calloc(1, sizeof(struct ft1000mp_priv_data));
|
||||
|
||||
if (!p) /* whoops! memory shortage! */
|
||||
if (!rig->state.priv) /* whoops! memory shortage! */
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
priv = rig->state.priv;
|
||||
|
||||
/*
|
||||
* Copy native cmd set to private cmd storage area
|
||||
*/
|
||||
memcpy(p->pcs, ncmd, sizeof(ncmd));
|
||||
memcpy(priv->pcs, ncmd, sizeof(ncmd));
|
||||
|
||||
/* TODO: read pacing from preferences */
|
||||
p->pacing = FT1000MP_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
|
||||
p->read_update_delay =
|
||||
priv->pacing = FT1000MP_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
|
||||
priv->read_update_delay =
|
||||
FT1000MP_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */
|
||||
p->current_vfo = RIG_VFO_A; /* default to VFO_A ? */
|
||||
|
||||
rig->state.priv = (void *)p;
|
||||
priv->current_vfo = RIG_VFO_A; /* default to VFO_A ? */
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -324,19 +324,19 @@ const struct rig_caps ft897_caps =
|
|||
|
||||
int ft897_init(RIG *rig)
|
||||
{
|
||||
struct ft897_priv_data *p;
|
||||
struct ft897_priv_data *priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
||||
if ((p = calloc(1, sizeof(struct ft897_priv_data))) == NULL)
|
||||
if ((rig->state.priv = calloc(1, sizeof(struct ft897_priv_data))) == NULL)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
/* Copy complete native cmd set to private cmd storage area */
|
||||
memcpy(p->pcs, ncmd, sizeof(ncmd));
|
||||
priv = rig->state.priv;
|
||||
|
||||
rig->state.priv = (void *) p;
|
||||
/* Copy complete native cmd set to private cmd storage area */
|
||||
memcpy(priv->pcs, ncmd, sizeof(ncmd));
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue