Fix cppcheck warnings in tentec

pull/174/head
Michael Black 2020-01-13 12:12:05 -06:00
rodzic 9ce5a51a05
commit 616edd5cca
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6599353EC683404D
5 zmienionych plików z 17 dodań i 20 usunięć

Wyświetl plik

@ -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;
}

Wyświetl plik

@ -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;
}

Wyświetl plik

@ -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;
}

Wyświetl plik

@ -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);

Wyświetl plik

@ -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;
}