kopia lustrzana https://github.com/Hamlib/Hamlib
Fix cppcheck warnings in tentec
rodzic
9ce5a51a05
commit
616edd5cca
|
@ -294,13 +294,14 @@ int tt538_init(RIG *rig)
|
|||
{
|
||||
struct tt538_priv_data *priv;
|
||||
|
||||
priv = (struct tt538_priv_data *) malloc(sizeof(struct tt538_priv_data));
|
||||
rig->state.priv = (struct tt538_priv_data *) malloc(sizeof(struct tt538_priv_data));
|
||||
|
||||
if (!priv)
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
priv = rig->state.priv;
|
||||
|
||||
memset(priv, 0, sizeof(struct tt538_priv_data));
|
||||
|
||||
|
@ -309,7 +310,6 @@ int tt538_init(RIG *rig)
|
|||
*/
|
||||
priv->ch = 0;
|
||||
priv->vfo_curr = RIG_VFO_A;
|
||||
rig->state.priv = (rig_ptr_t)priv;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -330,13 +330,14 @@ int tt588_init(RIG *rig)
|
|||
struct tt588_priv_data *priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s:\n", __func__);
|
||||
priv = (struct tt588_priv_data *) malloc(sizeof(struct tt588_priv_data));
|
||||
rig->state.priv = (struct tt588_priv_data *) malloc(sizeof(struct tt588_priv_data));
|
||||
|
||||
if (!priv)
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
priv = rig->state.priv;
|
||||
|
||||
memset(priv, 0, sizeof(struct tt588_priv_data));
|
||||
|
||||
|
@ -345,7 +346,6 @@ int tt588_init(RIG *rig)
|
|||
*/
|
||||
priv->ch = 0;
|
||||
priv->vfo_curr = RIG_VFO_A;
|
||||
rig->state.priv = (rig_ptr_t)priv;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -297,21 +297,17 @@ int rx331_init(RIG *rig)
|
|||
{
|
||||
struct rx331_priv_data *priv;
|
||||
|
||||
priv = (struct rx331_priv_data *)malloc(sizeof(struct rx331_priv_data));
|
||||
rig->state.priv = (struct rx331_priv_data *)malloc(sizeof(struct rx331_priv_data));
|
||||
|
||||
if (!priv)
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
priv = rig->state.priv;
|
||||
|
||||
memset(priv, 0, sizeof(struct rx331_priv_data));
|
||||
|
||||
/*
|
||||
* set arbitrary initial status
|
||||
*/
|
||||
rig->state.priv = (rig_ptr_t)priv;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -111,14 +111,16 @@ int tentec_init(RIG *rig)
|
|||
{
|
||||
struct tentec_priv_data *priv;
|
||||
|
||||
priv = (struct tentec_priv_data *)malloc(sizeof(struct tentec_priv_data));
|
||||
rig->state.priv = (struct tentec_priv_data *)malloc(sizeof(struct tentec_priv_data));
|
||||
|
||||
if (!priv)
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
|
||||
memset(priv, 0, sizeof(struct tentec_priv_data));
|
||||
|
||||
/*
|
||||
|
@ -132,8 +134,6 @@ int tentec_init(RIG *rig)
|
|||
priv->agc = RIG_AGC_MEDIUM; /* medium */
|
||||
priv->lnvol = priv->spkvol = 0.0; /* mute */
|
||||
|
||||
rig->state.priv = (rig_ptr_t)priv;
|
||||
|
||||
/* tentec_tuning_factor_calc needs rig->state.priv */
|
||||
tentec_tuning_factor_calc(rig);
|
||||
|
||||
|
|
|
@ -367,9 +367,9 @@ tt550_init(RIG *rig)
|
|||
{
|
||||
struct tt550_priv_data *priv;
|
||||
|
||||
priv = (struct tt550_priv_data *) malloc(sizeof(struct tt550_priv_data));
|
||||
rig->state.priv = (struct tt550_priv_data *) malloc(sizeof(struct tt550_priv_data));
|
||||
|
||||
if (!priv)
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
/*
|
||||
* whoops! memory shortage!
|
||||
|
@ -377,6 +377,8 @@ tt550_init(RIG *rig)
|
|||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
|
||||
memset(priv, 0, sizeof(struct tt550_priv_data));
|
||||
|
||||
/*
|
||||
|
@ -393,7 +395,6 @@ tt550_init(RIG *rig)
|
|||
priv->lineout = priv->spkvol = 0.0; /* mute */
|
||||
priv->stepsize = 100; /* default to 100Hz tuning step */
|
||||
|
||||
rig->state.priv = (rig_ptr_t) priv;
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue