kopia lustrzana https://github.com/Hamlib/Hamlib
rodzic
da5de3cb6e
commit
e0c4988e6a
|
@ -79,6 +79,7 @@ if test $# -eq 0 ; then
|
||||||
echo "See cppcheck.log when done"
|
echo "See cppcheck.log when done"
|
||||||
echo "This takes a while to run"
|
echo "This takes a while to run"
|
||||||
cppcheck --inline-suppr \
|
cppcheck --inline-suppr \
|
||||||
|
--check-level=exhaustive
|
||||||
-I src \
|
-I src \
|
||||||
-I include \
|
-I include \
|
||||||
-I include/hamlib/ \
|
-I include/hamlib/ \
|
||||||
|
@ -91,10 +92,11 @@ if test $# -eq 0 ; then
|
||||||
$SUPPRESS \
|
$SUPPRESS \
|
||||||
$CHECK \
|
$CHECK \
|
||||||
. \
|
. \
|
||||||
--template='{file}:{line},{severity},{id},{message}'
|
--template='{file}:{line},{severity},{id},{message}' \
|
||||||
>cppcheck.log 2>&1
|
>cppcheck.log 2>&1
|
||||||
else
|
else
|
||||||
cppcheck --inline-suppr \
|
cppcheck --inline-suppr \
|
||||||
|
--check-level=exhaustive
|
||||||
-I src \
|
-I src \
|
||||||
-I include \
|
-I include \
|
||||||
-I include/hamlib/ \
|
-I include/hamlib/ \
|
||||||
|
@ -106,6 +108,6 @@ else
|
||||||
--std=c99 \
|
--std=c99 \
|
||||||
$SUPPRESS \
|
$SUPPRESS \
|
||||||
$CHECK \
|
$CHECK \
|
||||||
--template='{file}:{line},{severity},{id},{message}'
|
--template='{file}:{line},{severity},{id},{message}'\
|
||||||
"$@"
|
"$@"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -427,6 +427,7 @@ static int ar7030p_open(RIG *rig)
|
||||||
*
|
*
|
||||||
* /return 0 on success, < 0 on failure
|
* /return 0 on success, < 0 on failure
|
||||||
*/
|
*/
|
||||||
|
// cppcheck-suppress *
|
||||||
static int ar7030p_close(RIG *rig)
|
static int ar7030p_close(RIG *rig)
|
||||||
{
|
{
|
||||||
assert(NULL != rig);
|
assert(NULL != rig);
|
||||||
|
@ -1260,7 +1261,7 @@ static int ar7030p_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
return (rc);
|
return (rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// cppcheck-suppress constParameterCallback
|
// cppcheck-suppress constVariablePointer
|
||||||
static int ar7030p_get_vfo(RIG *rig, vfo_t *vfo)
|
static int ar7030p_get_vfo(RIG *rig, vfo_t *vfo)
|
||||||
{
|
{
|
||||||
int rc = RIG_OK;
|
int rc = RIG_OK;
|
||||||
|
@ -1344,6 +1345,7 @@ static int ar7030p_set_mem(RIG *rig, vfo_t vfo, int ch)
|
||||||
return (rc);
|
return (rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cppcheck-suppress constVariablePointer
|
||||||
static int ar7030p_get_mem(RIG *rig, vfo_t vfo, int *ch)
|
static int ar7030p_get_mem(RIG *rig, vfo_t vfo, int *ch)
|
||||||
{
|
{
|
||||||
int rc = RIG_OK;
|
int rc = RIG_OK;
|
||||||
|
|
|
@ -269,6 +269,7 @@ static int check_vfo(vfo_t vfo)
|
||||||
* So we'll hand craft them
|
* So we'll hand craft them
|
||||||
* xml_build takes a value and returns an xml string for FLRig
|
* xml_build takes a value and returns an xml string for FLRig
|
||||||
*/
|
*/
|
||||||
|
// cppcheck-suppress constParameterPointer
|
||||||
static char *xml_build(RIG *rig, char *cmd, char *value, char *xmlbuf,
|
static char *xml_build(RIG *rig, char *cmd, char *value, char *xmlbuf,
|
||||||
int xmlbuflen)
|
int xmlbuflen)
|
||||||
{
|
{
|
||||||
|
@ -442,8 +443,8 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: before read_string\n", __func__);
|
rig_debug(RIG_DEBUG_TRACE, "%s: before read_string\n", __func__);
|
||||||
int len = read_string(&rs->rigport, (unsigned char *) tmp_buf, sizeof(tmp_buf),
|
int len = read_string(&rs->rigport, (unsigned char *) tmp_buf, sizeof(tmp_buf),
|
||||||
delims,
|
"<methodResponse>",
|
||||||
strlen(delims), 0, 1);
|
16, 0, 1);
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: string='%s'\n", __func__, tmp_buf);
|
rig_debug(RIG_DEBUG_TRACE, "%s: string='%s'\n", __func__, tmp_buf);
|
||||||
|
|
||||||
// if our first response we should see the HTTP header
|
// if our first response we should see the HTTP header
|
||||||
|
|
|
@ -1092,14 +1092,13 @@ static int netrigctl_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
int ret;
|
int ret;
|
||||||
char cmd[CMD_MAX];
|
char cmd[CMD_MAX];
|
||||||
char buf[BUF_MAX];
|
char buf[BUF_MAX];
|
||||||
char vfostr[16] = "";
|
|
||||||
struct netrigctl_priv_data *priv;
|
struct netrigctl_priv_data *priv;
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
|
||||||
priv = (struct netrigctl_priv_data *)rig->state.priv;
|
priv = (struct netrigctl_priv_data *)rig->state.priv;
|
||||||
|
|
||||||
SNPRINTF(cmd, sizeof(cmd), "V%s %s\n", vfostr, rig_strvfo(vfo));
|
SNPRINTF(cmd, sizeof(cmd), "V %s\n", rig_strvfo(vfo));
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: cmd='%s'\n", __func__, cmd);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: cmd='%s'\n", __func__, cmd);
|
||||||
ret = netrigctl_transaction(rig, cmd, strlen(cmd), buf);
|
ret = netrigctl_transaction(rig, cmd, strlen(cmd), buf);
|
||||||
|
|
||||||
|
@ -2494,7 +2493,8 @@ static const char *netrigctl_get_info(RIG *rig)
|
||||||
static int netrigctl_send_dtmf(RIG *rig, vfo_t vfo, const char *digits)
|
static int netrigctl_send_dtmf(RIG *rig, vfo_t vfo, const char *digits)
|
||||||
{
|
{
|
||||||
int ret, len;
|
int ret, len;
|
||||||
char *cmdp, cmd[] = "\\send_dtmf ";
|
char *cmdp;
|
||||||
|
const char cmd[] = "\\send_dtmf ";
|
||||||
char buf[BUF_MAX];
|
char buf[BUF_MAX];
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
@ -2577,7 +2577,8 @@ static int netrigctl_send_voice_mem(RIG *rig, vfo_t vfo, int ch)
|
||||||
static int netrigctl_send_morse(RIG *rig, vfo_t vfo, const char *msg)
|
static int netrigctl_send_morse(RIG *rig, vfo_t vfo, const char *msg)
|
||||||
{
|
{
|
||||||
int ret, len;
|
int ret, len;
|
||||||
char *cmdp, cmd[] = "\\send_morse ";
|
char *cmdp;
|
||||||
|
const char cmd[] = "\\send_morse ";
|
||||||
char buf[BUF_MAX];
|
char buf[BUF_MAX];
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
@ -2808,7 +2809,7 @@ struct rig_caps netrigctl_caps =
|
||||||
RIG_MODEL(RIG_MODEL_NETRIGCTL),
|
RIG_MODEL(RIG_MODEL_NETRIGCTL),
|
||||||
.model_name = "NET rigctl",
|
.model_name = "NET rigctl",
|
||||||
.mfg_name = "Hamlib",
|
.mfg_name = "Hamlib",
|
||||||
.version = "20230802.0",
|
.version = "20231004.0",
|
||||||
.copyright = "LGPL",
|
.copyright = "LGPL",
|
||||||
.status = RIG_STATUS_STABLE,
|
.status = RIG_STATUS_STABLE,
|
||||||
.rig_type = RIG_TYPE_OTHER,
|
.rig_type = RIG_TYPE_OTHER,
|
||||||
|
|
|
@ -229,7 +229,7 @@ static int vfo_curr(RIG *rig, vfo_t vfo)
|
||||||
static int read_transaction(RIG *rig, char *response, int response_len)
|
static int read_transaction(RIG *rig, char *response, int response_len)
|
||||||
{
|
{
|
||||||
struct rig_state *rs = &rig->state;
|
struct rig_state *rs = &rig->state;
|
||||||
char *delims = "\n";
|
const char *delims = "\n";
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
|
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
|
||||||
|
|
|
@ -1364,7 +1364,7 @@ int elad_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
char buf[6];
|
char buf[6];
|
||||||
struct elad_priv_data *priv = rig->state.priv;
|
const struct elad_priv_data *priv = rig->state.priv;
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
|
||||||
|
|
19
src/iofunc.c
19
src/iofunc.c
|
@ -1347,7 +1347,7 @@ static int read_string_generic(hamlib_port_t *p,
|
||||||
int timeout_save = p->timeout;
|
int timeout_save = p->timeout;
|
||||||
// p->timeout = 2;
|
// p->timeout = 2;
|
||||||
result = port_wait_for_data(p, direct);
|
result = port_wait_for_data(p, direct);
|
||||||
HAMLIB_TRACE2;
|
//HAMLIB_TRACE2;
|
||||||
p->timeout = timeout_save;
|
p->timeout = timeout_save;
|
||||||
|
|
||||||
if (result == -RIG_ETIMEOUT)
|
if (result == -RIG_ETIMEOUT)
|
||||||
|
@ -1407,7 +1407,7 @@ static int read_string_generic(hamlib_port_t *p,
|
||||||
* read 1 character from the rig, (check if in stop set)
|
* read 1 character from the rig, (check if in stop set)
|
||||||
* The file descriptor must have been set up non blocking.
|
* The file descriptor must have been set up non blocking.
|
||||||
*/
|
*/
|
||||||
{
|
do {
|
||||||
#if 0
|
#if 0
|
||||||
#ifndef __MINGW32__
|
#ifndef __MINGW32__
|
||||||
// The ioctl works on Linux but not mingw
|
// The ioctl works on Linux but not mingw
|
||||||
|
@ -1417,6 +1417,7 @@ static int read_string_generic(hamlib_port_t *p,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
HAMLIB_TRACE2;
|
HAMLIB_TRACE2;
|
||||||
|
shortcut:
|
||||||
rd_count = port_read_generic(p, &rxbuffer[total_count],
|
rd_count = port_read_generic(p, &rxbuffer[total_count],
|
||||||
expected_len == 1 ? 1 : minlen, direct);
|
expected_len == 1 ? 1 : minlen, direct);
|
||||||
HAMLIB_TRACE2;
|
HAMLIB_TRACE2;
|
||||||
|
@ -1455,6 +1456,7 @@ static int read_string_generic(hamlib_port_t *p,
|
||||||
|
|
||||||
if (total_count == rxmax) { break; }
|
if (total_count == rxmax) { break; }
|
||||||
|
|
||||||
|
|
||||||
if (stopset && memchr(stopset, rxbuffer[total_count - 1], stopset_len))
|
if (stopset && memchr(stopset, rxbuffer[total_count - 1], stopset_len))
|
||||||
{
|
{
|
||||||
if (minlen == 1) { minlen = total_count; }
|
if (minlen == 1) { minlen = total_count; }
|
||||||
|
@ -1480,6 +1482,19 @@ static int read_string_generic(hamlib_port_t *p,
|
||||||
rig_debug(RIG_DEBUG_VERBOSE,
|
rig_debug(RIG_DEBUG_VERBOSE,
|
||||||
"%s: skipping single ';' chars at beginning of reply\n", __func__);
|
"%s: skipping single ';' chars at beginning of reply\n", __func__);
|
||||||
}
|
}
|
||||||
|
// special read for FLRig
|
||||||
|
if (strcmp(stopset, "/methodResponse>") == 0 || timeout_retries <= 0)
|
||||||
|
{
|
||||||
|
if (strstr((char*)rxbuffer, stopset))
|
||||||
|
{
|
||||||
|
HAMLIB_TRACE2;
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
HAMLIB_TRACE2;
|
||||||
|
goto shortcut;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Doesn't hurt anyway. But be aware, some binary protocols may have
|
* Doesn't hurt anyway. But be aware, some binary protocols may have
|
||||||
|
|
Ładowanie…
Reference in New Issue