mirror of
https://github.com/Hamlib/Hamlib.git
synced 2024-09-21 18:37:18 +00:00
Fix always false cppcheck warnings
https://github.com/Hamlib/Hamlib/issues/1351
This commit is contained in:
parent
93af897753
commit
71f8b3b8c9
@ -85,28 +85,7 @@ DECLARE_PROBERIG_BACKEND(anytone)
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
retval = RIG_MODEL_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
char acBuf[ ANYTONE_RESPSZ + 1 ];
|
||||
int nRead = 0;
|
||||
|
||||
memset(acBuf, 0, ANYTONE_RESPSZ + 1);
|
||||
|
||||
close(port->fd);
|
||||
|
||||
if ((retval != RIG_OK || nRead < 0))
|
||||
{
|
||||
retval = RIG_MODEL_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "Received ID = %s.",
|
||||
acBuf);
|
||||
|
||||
retval = RIG_MODEL_ADT_200A;
|
||||
}
|
||||
retval = -RIG_EIO;
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "hamlib/rig.h"
|
||||
|
||||
#define BACKEND_VER "20230530"
|
||||
#define BACKEND_VER "20231001"
|
||||
|
||||
#define ANYTONE_RESPSZ 64
|
||||
|
||||
|
@ -1275,13 +1275,19 @@ static int thd72_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
|
||||
static int thd72_parse_channel(int kind, const char *buf, channel_t *chan)
|
||||
{
|
||||
int tmp;
|
||||
int n;
|
||||
char c;
|
||||
const char *data;
|
||||
|
||||
if (kind == 0) { data = buf + 5; }
|
||||
else { data = buf + 7; }
|
||||
|
||||
sscanf(data, "%"SCNfreq, &chan->freq);
|
||||
n = sscanf(data, "%"SCNfreq, &chan->freq);
|
||||
if (n != 1)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: error scanning %s\n", __func__, data);
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
c = data[46]; // mode
|
||||
|
||||
if (c >= '0' && c <= '2')
|
||||
@ -1304,12 +1310,22 @@ static int thd72_parse_channel(int kind, const char *buf, channel_t *chan)
|
||||
chan->rptr_shift = thd72_rshf_table[c - '0'];
|
||||
}
|
||||
|
||||
sscanf(data + 37, "%ld", &chan->rptr_offs);
|
||||
n = sscanf(data + 37, "%ld", &chan->rptr_offs);
|
||||
if (n != 1)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: error scanning data[37]%s\n", __func__, data);
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
c = data[17]; // Tone status
|
||||
|
||||
if (c != '0')
|
||||
{
|
||||
sscanf(data + 25, "%d", &tmp);
|
||||
n = sscanf(data + 25, "%d", &tmp);
|
||||
if (n != 1)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: error scanning data[25]%s\n", __func__, data);
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
||||
if (tmp > 0 && tmp < 42)
|
||||
{
|
||||
@ -1325,7 +1341,12 @@ static int thd72_parse_channel(int kind, const char *buf, channel_t *chan)
|
||||
|
||||
if (c != '0')
|
||||
{
|
||||
sscanf(data + 28, "%d", &tmp);
|
||||
n = sscanf(data + 28, "%d", &tmp);
|
||||
if (n != 1)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: error scanning data[28]%s\n", __func__, data);
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
||||
if (tmp > 0 && tmp < 42)
|
||||
{
|
||||
@ -1341,7 +1362,12 @@ static int thd72_parse_channel(int kind, const char *buf, channel_t *chan)
|
||||
|
||||
if (c != '0')
|
||||
{
|
||||
sscanf(data + 31, "%d", &tmp);
|
||||
n = sscanf(data + 31, "%d", &tmp);
|
||||
if (n != 1)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: error scanning data[31]%s\n", __func__, data);
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
chan->dcs_code = tmp;
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user