kopia lustrzana https://github.com/Hamlib/Hamlib
Fix cppcheck errors and warnings
rodzic
dd3b1b71d0
commit
fade1681fa
|
@ -1061,7 +1061,6 @@ static int dummy_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
|
||||
// cppcheck-suppress *
|
||||
level1 = LVL_ATT;
|
||||
// cppcheck-suppress *
|
||||
level2 = LVL_PREAMP;
|
||||
curr->levels[idx].i = qrm + (time(NULL) % 32) + (rand() % 4)
|
||||
- curr->levels[level1].i + curr->levels[level2].i;
|
||||
|
|
|
@ -1048,7 +1048,6 @@ int aor_set_channel(RIG *rig, const channel_t *chan)
|
|||
|
||||
cmd_len += priv->format_mode(rig, aorcmd + cmd_len, chan->mode, chan->width);
|
||||
|
||||
// cppcheck-suppress *
|
||||
cmd_len += sprintf(aorcmd + cmd_len, " AT%d TM%12s%s",
|
||||
chan->levels[LVL_ATT].i ? 1 : 0, chan->channel_desc, EOM);
|
||||
|
||||
|
|
|
@ -128,7 +128,6 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
|
|||
/*
|
||||
* should check return code and that write wrote cmd_len chars!
|
||||
*/
|
||||
// cppcheck-suppress *
|
||||
Hold_Decode(rig);
|
||||
|
||||
rig_flush(&rs->rigport);
|
||||
|
@ -137,7 +136,6 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
|
|||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
// cppcheck-suppress *
|
||||
Unhold_Decode(rig);
|
||||
return retval;
|
||||
}
|
||||
|
@ -159,7 +157,6 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
|
|||
if (retval == -RIG_ETIMEOUT || retval == 0)
|
||||
{
|
||||
/* Nothing received, CI-V interface is not echoing */
|
||||
// cppcheck-suppress *
|
||||
Unhold_Decode(rig);
|
||||
return -RIG_BUSERROR;
|
||||
}
|
||||
|
@ -167,8 +164,6 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
|
|||
if (retval < 0)
|
||||
{
|
||||
/* Other error, return it */
|
||||
// cppcheck-suppress *
|
||||
Unhold_Decode(rig);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -181,7 +176,6 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
|
|||
{
|
||||
case COL:
|
||||
/* Collision */
|
||||
// cppcheck-suppress *
|
||||
Unhold_Decode(rig);
|
||||
return -RIG_BUSBUSY;
|
||||
|
||||
|
@ -192,7 +186,6 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
|
|||
default:
|
||||
/* Timeout after reading at least one character */
|
||||
/* Problem on ci-v bus? */
|
||||
// cppcheck-suppress *
|
||||
Unhold_Decode(rig);
|
||||
return -RIG_BUSERROR;
|
||||
}
|
||||
|
@ -202,7 +195,6 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
|
|||
/* Not the same length??? */
|
||||
/* Problem on ci-v bus? */
|
||||
/* Someone else got a packet in? */
|
||||
// cppcheck-suppress *
|
||||
Unhold_Decode(rig);
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
@ -212,7 +204,6 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
|
|||
/* Frames are different? */
|
||||
/* Problem on ci-v bus? */
|
||||
/* Someone else got a packet in? */
|
||||
// cppcheck-suppress *
|
||||
Unhold_Decode(rig);
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
@ -223,7 +214,6 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
|
|||
*/
|
||||
if (data_len == NULL)
|
||||
{
|
||||
// cppcheck-suppress *
|
||||
Unhold_Decode(rig);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -244,7 +234,6 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
|
|||
frm_len = read_icom_frame(&rs->rigport, buf, sizeof(buf));
|
||||
}
|
||||
|
||||
// cppcheck-suppress *
|
||||
Unhold_Decode(rig);
|
||||
|
||||
if (frm_len < 0)
|
||||
|
|
|
@ -1870,13 +1870,19 @@ int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
* Lets check for dsp filters
|
||||
*/
|
||||
|
||||
if (width && (retval = icom_get_dsp_flt(rig, *mode)) != 0)
|
||||
if (width != NULL && (retval = icom_get_dsp_flt(rig, *mode)) != 0)
|
||||
{
|
||||
*width = retval;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s returning mode=%s, width=%d\n", __func__,
|
||||
rig_strvfo(vfo), rig_strrmode(*mode), (int)*width);
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE,
|
||||
"%s: vfo=%s returning mode=%s, width not available\n", __func__,
|
||||
rig_strvfo(vfo), rig_strrmode(*mode));
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s returning mode=%s, width=%d\n", __func__,
|
||||
rig_strvfo(vfo), rig_strrmode(*mode), (int)*width);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,6 @@ static int jrc_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
|
|||
|
||||
rig_flush(&rs->rigport);
|
||||
|
||||
// cppcheck-suppress *
|
||||
Hold_Decode(rig);
|
||||
|
||||
retval = write_block(&rs->rigport, cmd, cmd_len);
|
||||
|
|
|
@ -217,8 +217,8 @@ const struct rig_caps ts950sdx_caps =
|
|||
.serial_parity = RIG_PARITY_NONE,
|
||||
.serial_handshake = RIG_HANDSHAKE_NONE,
|
||||
.write_delay = 0,
|
||||
.post_write_delay = 0,
|
||||
.timeout = 500, // this rig takes over 250ms to respond an IF command
|
||||
.post_write_delay = 50,
|
||||
.timeout = 600, // this rig takes over 250ms to respond an IF command
|
||||
.retry = 10,
|
||||
|
||||
.has_get_func = RIG_FUNC_NONE,
|
||||
|
|
|
@ -441,13 +441,11 @@ int prm80_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
switch (level)
|
||||
{
|
||||
case RIG_LEVEL_AF:
|
||||
// cppcheck-suppress *
|
||||
val->f = chan.levels[LVL_AF].f;
|
||||
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_SQL:
|
||||
// cppcheck-suppress *
|
||||
val->f = chan.levels[LVL_SQL].f;
|
||||
|
||||
break;
|
||||
|
|
|
@ -82,7 +82,6 @@ tt550_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
|
|||
* Hold_Decode keeps the asynchronous decode routine from being called
|
||||
* when we get data back from a normal command.
|
||||
*/
|
||||
// cppcheck-suppress *
|
||||
Hold_Decode(rig);
|
||||
|
||||
rig_flush(&rs->rigport);
|
||||
|
@ -91,7 +90,6 @@ tt550_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
|
|||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
// cppcheck-suppress *
|
||||
Unhold_Decode(rig);
|
||||
return retval;
|
||||
}
|
||||
|
@ -101,7 +99,6 @@ tt550_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
|
|||
*/
|
||||
if (!data || !data_len)
|
||||
{
|
||||
// cppcheck-suppress *
|
||||
Unhold_Decode(rig);
|
||||
return 0;
|
||||
}
|
||||
|
@ -120,7 +117,6 @@ tt550_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
|
|||
|
||||
*data_len = retval;
|
||||
|
||||
// cppcheck-suppress *
|
||||
Unhold_Decode(rig);
|
||||
|
||||
return RIG_OK;
|
||||
|
|
|
@ -769,7 +769,6 @@ int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
to_bcd(p->p_cmd, freq / 10, 8); /* store bcd format in in p_cmd */
|
||||
/* TODO -- fix 10Hz resolution -- FS */
|
||||
|
||||
// cppcheck-suppress *
|
||||
rig_debug(RIG_DEBUG_TRACE,
|
||||
"%s: requested freq after conversion = %"PRIll" Hz\n", __func__,
|
||||
(int64_t)from_bcd(p->p_cmd, 8) * 10);
|
||||
|
|
|
@ -443,10 +443,8 @@ int ft817_init(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
||||
// cppcheck-suppress *
|
||||
if ((rig->state.priv = calloc(1, sizeof(struct ft817_priv_data))) == NULL)
|
||||
{
|
||||
// cppcheck-suppress *
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -455,7 +453,6 @@ int ft817_init(RIG *rig)
|
|||
/* Copy complete native cmd set to private cmd storage area */
|
||||
memcpy(priv->pcs, ncmd, sizeof(ncmd));
|
||||
|
||||
// cppcheck-suppress *
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -298,10 +298,8 @@ int ft857_init(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
|
||||
|
||||
// cppcheck-suppress *
|
||||
if ((rig->state.priv = calloc(1, sizeof(struct ft857_priv_data))) == NULL)
|
||||
{
|
||||
// cppcheck-suppress *
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -310,7 +308,6 @@ int ft857_init(RIG *rig)
|
|||
/* Copy complete native cmd set to private cmd storage area */
|
||||
memcpy(priv->pcs, ncmd, sizeof(ncmd));
|
||||
|
||||
// cppcheck-suppress *
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -334,10 +334,8 @@ int ft897_init(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
||||
// cppcheck-suppress *
|
||||
if ((rig->state.priv = calloc(1, sizeof(struct ft897_priv_data))) == NULL)
|
||||
{
|
||||
// cppcheck-suppress *
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -346,7 +344,6 @@ int ft897_init(RIG *rig)
|
|||
/* Copy complete native cmd set to private cmd storage area */
|
||||
memcpy(priv->pcs, ncmd, sizeof(ncmd));
|
||||
|
||||
// cppcheck-suppress *
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -251,7 +251,6 @@ static void close_microham()
|
|||
#define NUMUHTYPES 9
|
||||
static struct uhtypes
|
||||
{
|
||||
// cppcheck-suppress *
|
||||
const char *name;
|
||||
const char *device;
|
||||
} uhtypes[NUMUHTYPES] =
|
||||
|
|
|
@ -578,7 +578,6 @@ static struct
|
|||
* utility function to convert index to bit value
|
||||
*
|
||||
*/
|
||||
// cppcheck-suppress *
|
||||
uint64_t rig_idx2setting(int i)
|
||||
{
|
||||
return ((uint64_t)1) << i;
|
||||
|
|
|
@ -49,7 +49,7 @@ extern char *readline();
|
|||
#else
|
||||
/* no readline */
|
||||
#endif /* HAVE_LIBREADLINE */
|
||||
|
||||
#warn here1
|
||||
#ifdef HAVE_READLINE_HISTORY
|
||||
# include <sys/stat.h>
|
||||
# define HST_SHRT_OPTS "iI"
|
||||
|
|
|
@ -599,7 +599,6 @@ int main(int argc, char *argv[])
|
|||
#endif
|
||||
}
|
||||
|
||||
// cppcheck-suppress *
|
||||
while (retcode == 0);
|
||||
|
||||
amp_close(my_amp); /* close port */
|
||||
|
|
|
@ -298,7 +298,6 @@ int hash_model_id_sort(struct mod_lst *a, struct mod_lst *b)
|
|||
|
||||
void hash_sort_by_model_id()
|
||||
{
|
||||
// cppcheck-suppress *
|
||||
HASH_SORT(models, hash_model_id_sort);
|
||||
}
|
||||
|
||||
|
|
|
@ -612,7 +612,6 @@ int main(int argc, char *argv[])
|
|||
#endif
|
||||
}
|
||||
|
||||
// cppcheck-suppress *
|
||||
while (retcode == 0);
|
||||
|
||||
rot_close(my_rot); /* close port */
|
||||
|
|
|
@ -70,7 +70,6 @@ int sprintf_vfo(char *str, vfo_t vfo)
|
|||
|
||||
int sprintf_mode(char *str, rmode_t mode)
|
||||
{
|
||||
// cppcheck-suppress *
|
||||
uint64_t i, len = 0;
|
||||
|
||||
*str = '\0';
|
||||
|
@ -82,7 +81,6 @@ int sprintf_mode(char *str, rmode_t mode)
|
|||
|
||||
for (i = 0; i < 63; i++)
|
||||
{
|
||||
// cppcheck-suppress *
|
||||
const char *ms = rig_strrmode(mode & (1ULL << i));
|
||||
|
||||
if (!ms || !ms[0])
|
||||
|
@ -148,7 +146,6 @@ int sprintf_ant(char *str, ant_t ant)
|
|||
|
||||
int sprintf_func(char *str, setting_t func)
|
||||
{
|
||||
// cppcheck-suppress *
|
||||
uint64_t i, len = 0;
|
||||
|
||||
*str = '\0';
|
||||
|
|
|
@ -43,27 +43,22 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* freq on 32bits test */
|
||||
f = GHz(4);
|
||||
// cppcheck-suppress *
|
||||
printf("GHz(4) = %"PRIll"\n", (int64_t)f);
|
||||
|
||||
/* freq on >32bits test */
|
||||
f = GHz(5);
|
||||
// cppcheck-suppress *
|
||||
printf("GHz(5) = %"PRIll"\n", (int64_t)f);
|
||||
|
||||
/* floating point to freq conversion test */
|
||||
f = GHz(1.3);
|
||||
// cppcheck-suppress *
|
||||
printf("GHz(1.3) = %"PRIll"\n", (int64_t)f);
|
||||
|
||||
/* floating point to freq conversion precision test */
|
||||
f = GHz(1.234567890);
|
||||
// cppcheck-suppress *
|
||||
printf("GHz(1.234567890) = %"PRIll"\n", (int64_t)f);
|
||||
|
||||
/* floating point to freq conversion precision test, with freq >32bits */
|
||||
f = GHz(123.456789012);
|
||||
// cppcheck-suppress *
|
||||
printf("GHz(123.456789012) = %"PRIll"\n", (int64_t)f);
|
||||
|
||||
return 0;
|
||||
|
|
Ładowanie…
Reference in New Issue