More cppcheck fixes

pull/224/head
Michael Black 2020-03-23 07:52:01 -05:00
rodzic 43d16846ea
commit 8eb09c2a38
54 zmienionych plików z 136 dodań i 70 usunięć

Wyświetl plik

@ -2,6 +2,23 @@
# Hamlib bindings using SWIG
# more information on swig at http://www.swig.org
#
#UNAME_S := $(shell uname -s)
#AM_CONDITIONAL(BUILD_OS_IS_UBUNTU, [test x"$build_os" = ubuntu])
#AM_CONDITIONAL(BUILD_OS_IS_FEDORA, [test x"$build_os" = fedora])
#ifeq ("\$(shell test -e /etc/fedora-release && echo yup)","yup")
# OS Detection for perl installation location
if BUILD_OS_IS_UBUNTU
PERLINSTALL = install_site
echo Ubuntu install=$(PERLINSTALL)
else if BUILD_OS_IS_FEDORA
PERLINSTALL = pure_vendor_install
echo Fedora install=$(PERLINSTALL)
else
PERLINSTALL = install_site
echo Default install=$(PERLINSTALL)
endif
AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/bindings $(PYTHON_CPPFLAGS) \
$(TCL_INCLUDE_SPEC)
@ -70,7 +87,7 @@ distcheck-perl: Hamlib-pl.mk
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk distcheck
install-perl: Hamlib-pl.mk
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk install_site
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk $(PERLINSTALL)
## ExtUtils::MakeMaker says uninstall is deprecated and won't remove the files
## anyway, so we'll have to figure out another way to remove the installed files.

3
bindings/perltest.pl 100644 → 100755
Wyświetl plik

@ -1,4 +1,5 @@
#!/usr/bin/perl -Iblib/arch -Iblib/lib
#!/usr/bin/perl
##!/usr/bin/perl -Iblib/arch -Iblib/lib
use Hamlib;

Wyświetl plik

@ -706,6 +706,11 @@ AS_IF([test x"${cf_with_usrp}" = "xyes"],[
AM_CONDITIONAL([HAVE_USRP], [test x"${cf_with_usrp}" = "xyes"])
AM_CONDITIONAL(BUILD_OS_IS_UBUNTU, [test x"$build_os" = ubuntu])
AM_CONDITIONAL(BUILD_OS_IS_FEDORA, [test x"$build_os" = fedora])
echo Build_OS is $build_os
## -------------------------------- ##
## Prepare rig backend dependencies ##

Wyświetl plik

@ -3,9 +3,10 @@
# There are things that could still be done...especialy in the C++ area
echo "See cppcheck.log when done"
echo "As of cppcheck v1.90 should be one message about missing include files"
echo "This takes several minutes to run"
echo "This takes several hours to run"
# We do suppress some errors which are expected or other code
# There are quite a few C++ items to take care of still if anybody cares
SUPPRESS="-i bindings -i lib/getopt.c -i lib/getopt_long.c --suppress=*:extra/gnuradio/demod.h --suppress=*:extra/gnuradio/HrAGC.h --suppress=*:extra/gnuradio/nfm.h --suppress=*:extra/gnuradio/am.h --suppress=*:extra/gnuradio/ssb.h --suppress=*:extra/gnuradio/wfm.h --suppress=*:extra/gnuradio/wfm.h --suppress=*:extra/gnuradio/HrAGC.h --suppress=knownConditionTrueFalse:tests/rotctl.c --suppress=knownConditionTrueFalse:tests/rigctl.c --suppress=knownConditionTrueFalse:tests/ampctl.c --suppress=knownConditionTrueFalse:tests/rotctl_parse.c --suppress=knownConditionTrueFalse:tests/rigctl_parse.c --suppress=knownConditionTrueFalse:tests/ampctl_parse.c"
CHECK="-D RIG_LEVEL_LINEOUT=1 -D SIGPIPE -D SIGINT -D IPV6_V6ONLY -D RIG_MODE_WFM -D ABI_VERSION=4 -D F_SETSIG=1 -U O_ASYNC -U SA_SIGINFO -U HASH_BLOOM -U HASH_EMIT_KEYS -U HASH_FUNCTION -U __USEP5P6__"
cppcheck -I src -I include -q --force --enable=all --std=c99 $SUPPRESS $CHECK . &>cppcheck.log
#CHECK="-D RIG_LEVEL_LINEOUT=1 -D SIGPIPE -D SIGINT -D IPV6_V6ONLY -D RIG_MODE_WFM -D ABI_VERSION=4 -D F_SETSIG=1 -U O_ASYNC -U SA_SIGINFO -U HASH_BLOOM -U HASH_EMIT_KEYS -U HASH_FUNCTION -U __USEP5P6__"
CHECK="-Duint64_t -D HAVE_CONFIG_H -D HAMLIB_EXPORT -D HAMLIB_EXPORT_VAR -D __WORDSIZE -D BACKEND_EXPORT -D PRId64 -D DECLARE_INITRIG_BACKEND -D DECLARE_INITRROT_BACKEND -D DECLARE_INITAMP_BACKEND -U RIG_LEVEL_LINEOUT -U O_ASYNC -U F_SETSIG -U SA_SIGINFO -U SIGPIPE -U gai_strerror -U CMSPAR -U TIOCCBRK -U TIOCSBRK -U TIOCMBIC -U TIOCMBIS -U HASH_BLOOM -U HASH_EMIT_KEYS -U HASH_FUNCTION -U IPV6_V6ONLY"
cppcheck --inline-suppr -I src -I include --include=include/config.h --include=include/hamlib/rig.h -q --force --enable=all --std=c99 $SUPPRESS $CHECK . &>cppcheck.log

Wyświetl plik

@ -872,6 +872,7 @@ int gnuradio_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
return ret;
}
// cppcheck-suppress *
DECLARE_INITRIG_BACKEND(gnuradio)
{
rig_debug(RIG_DEBUG_VERBOSE, "gnuradio: _init called\n");

Wyświetl plik

@ -299,6 +299,7 @@ int alinco_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
}
/* at least 6 digits */
// cppcheck-suppress *
freq_len = sprintf(freqbuf, AL CMD_RXFREQ "%06"PRIll EOM, (int64_t)freq);
return alinco_transaction(rig, freqbuf, freq_len, NULL, NULL);

Wyświetl plik

@ -180,6 +180,7 @@ static int format_freq(char *buf, freq_t freq)
f = f * 100 + lowhz;
// cppcheck-suppress *
return sprintf(buf, "RF%010"PRIll, f);
}
@ -1045,6 +1046,7 @@ 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);

Wyświetl plik

@ -1237,6 +1237,7 @@ int elad_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return -RIG_EINVAL;
}
// cppcheck-suppress *
snprintf(freqbuf, sizeof(freqbuf), "F%c%011"PRIll, vfo_letter, (int64_t)freq);
err = elad_transaction(rig, freqbuf, NULL, 0);

Wyświetl plik

@ -290,6 +290,7 @@ static int set_band(RIG *rig, freq_t freq)
ret = write_latch(rig, L_BAND, 1 << band, 0x3f);
// cppcheck-suppress *
rig_debug(RIG_DEBUG_VERBOSE, "%s %"PRIll" band %d\n", __func__, (int64_t)freq,
band);

Wyświetl plik

@ -158,6 +158,7 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
if (retval == -RIG_ETIMEOUT || retval == 0)
{
/* Nothing recieved, CI-V interface is not echoing */
// cppcheck-suppress *
Unhold_Decode(rig);
return -RIG_BUSERROR;
}
@ -165,6 +166,7 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
if (retval < 0)
{
/* Other error, return it */
// cppcheck-suppress *
Unhold_Decode(rig);
return retval;
}
@ -178,6 +180,7 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
{
case COL:
/* Collision */
// cppcheck-suppress *
Unhold_Decode(rig);
return -RIG_BUSBUSY;
@ -188,6 +191,7 @@ 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;
}
@ -197,6 +201,7 @@ 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;
}
@ -206,6 +211,7 @@ 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;
}
@ -216,6 +222,7 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
*/
if (data_len == NULL)
{
// cppcheck-suppress *
Unhold_Decode(rig);
return RIG_OK;
}
@ -234,7 +241,7 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
// And try again
frm_len = read_icom_frame(&rs->rigport, buf, sizeof(buf));
}
// cppcheck-suppress *
Unhold_Decode(rig);
if (frm_len < 0)

Wyświetl plik

@ -417,6 +417,7 @@ int ic10_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return -RIG_EINVAL;
}
// cppcheck-suppress *
freq_len = sprintf(freqbuf, "F%c%011"PRIll";", vfo_letter, (int64_t)freq);
retval = ic10_transaction(rig, freqbuf, freq_len, ackbuf, &ack_len);
@ -502,7 +503,6 @@ int ic10_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
}
#ifdef XXREMOVEDXX
// Not referenced anywhere
/*
* ic10_set_ptt
@ -531,7 +531,6 @@ int ic10_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
return retval;
}
#endif
/*

Wyświetl plik

@ -242,6 +242,7 @@ th_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
step = freq_sent >= MHz(470) ? 4 : step;
freq_sent = freq_sent >= MHz(470) ? (round(freq_sent / 10000) * 10000) :
freq_sent;
// cppcheck-suppress *
sprintf(buf, "FQ %011"PRIll",%X", (int64_t) freq_sent, step);
return kenwood_transaction(rig, buf, NULL, 0);

Wyświetl plik

@ -456,6 +456,7 @@ static int thd72_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
rig_debug(RIG_DEBUG_VERBOSE, "%s: tsindex=%d, stepsize=%d\n", __func__, tsindex,
(int)ts);
freq = roundl(freq / ts) * ts;
// cppcheck-suppress *
sprintf(fbuf, "%010"PRIll, (int64_t)freq);
memcpy(buf + 5, fbuf, 10);
retval = kenwood_simple_transaction(rig, buf, 52);

Wyświetl plik

@ -391,6 +391,7 @@ static int thd74_round_freq(RIG *rig, vfo_t vfo, freq_t freq)
r = round((double)f / (double)ts);
r = ts * r;
// cppcheck-suppress *
rig_debug(RIG_DEBUG_TRACE,
"%s: rounded %"PRIll" to %"PRIll" because stepsize:%d\n",
__func__, f, (int64_t)r, (int)ts);

Wyświetl plik

@ -625,7 +625,7 @@ static int tmd710_scan_me(char *buf, tmd710_me *me_struct)
int retval;
retval = num_sscanf(buf,
"ME %x,%"SCNfreq",%x,%x,%x,%x,%x,%x,%d,%d,%d,%d,%d,%"SCNfreq",%d,%d",
"ME %x,%"SCNfreq",%x,%x,%x,%x,%x,%x,%u,%u,%u,%u,%u,%"SCNfreq",%u,%u",
&me_struct->channel, &me_struct->freq,
&me_struct->step, &me_struct->shift,
&me_struct->reverse, &me_struct->tone,
@ -684,7 +684,7 @@ int tmd710_push_me(RIG *rig, tmd710_me *me_struct)
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
snprintf(cmdbuf, sizeof(cmdbuf),
"ME %03d,%010.0f,%1d,%1d,%1d,%1d,%1d,%1d,%02d,%02d,%03d,%08d,%1d,%010.0f,%1d,%1d",
"ME %03u,%010.0f,%1u,%1u,%1u,%1u,%1u,%1u,%02u,%02u,%03u,%08u,%1u,%010.0f,%1u,%1u",
me_struct->channel, me_struct->freq,
me_struct->step, me_struct->shift,
me_struct->reverse, me_struct->tone,
@ -800,7 +800,7 @@ int tmd710_push_fo(RIG *rig, vfo_t vfo, tmd710_fo *fo_struct)
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
snprintf(cmdbuf, sizeof(cmdbuf),
"FO %1d,%010.0f,%1d,%1d,%1d,%1d,%1d,%1d,%02d,%02d,%03d,%08d,%1d",
"FO %1u,%010.0f,%1u,%1u,%1u,%1u,%1u,%1u,%02d,%02d,%03d,%08d,%1d",
fo_struct->vfo, fo_struct->freq,
fo_struct->step, fo_struct->shift,
fo_struct->reverse, fo_struct->tone,
@ -1075,7 +1075,7 @@ static int tmd710_find_ctcss_index(RIG *rig, tone_t tone, uint32_t *ctcss_index)
if (stepind == -1)
{
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported tone value '%d'\n", __func__, tone);
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported tone value '%u'\n", __func__, tone);
return -RIG_EINVAL;
}
@ -1723,7 +1723,7 @@ int tmd710_set_vfo(RIG *rig, vfo_t vfo)
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported VFO %d\n", __func__, vfo);
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported VFO %s\n", __func__, rig_strvfo(vfo));
return -RIG_EVFO;
}

Wyświetl plik

@ -782,6 +782,7 @@ int tmv7_set_channel(RIG *rig, const channel_t *chan)
if (chan->tx_freq != RIG_FREQ_NONE)
{
req[5] = '1';
// cppcheck-suppress *
sprintf(membuf, "%s,%011"PRIll",%01d", req, (int64_t)chan->tx_freq, step);
retval = kenwood_transaction(rig, membuf, NULL, 0);

Wyświetl plik

@ -85,8 +85,8 @@ ts711_set_vfo(RIG *rig, vfo_t vfo)
case RIG_VFO_CURR: return RIG_OK;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n",
__func__, vfo);
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n",
__func__, rig_strvfo(vfo));
return -RIG_EINVAL;
}

Wyświetl plik

@ -71,8 +71,8 @@ ts811_set_vfo(RIG *rig, vfo_t vfo)
case RIG_VFO_CURR: return RIG_OK;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n",
__func__, vfo);
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n",
__func__, rig_strvfo(vfo));
return -RIG_EINVAL;
}

Wyświetl plik

@ -396,7 +396,7 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__, vfo);
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", __func__, rig_strvfo(vfo));
return -RIG_EINVAL;
}
@ -414,7 +414,7 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_VFO_SUB: v = '1'; break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__, vfo);
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", __func__, rig_strvfo(vfo));
return -RIG_EINVAL;
}
@ -461,7 +461,7 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_VFO_SUB: v = '1'; break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__, vfo);
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", __func__, rig_strvfo(vfo));
return -RIG_EINVAL;
}
@ -490,7 +490,7 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_VFO_SUB: v = '1'; break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__, vfo);
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", __func__, rig_strvfo(vfo));
return -RIG_EINVAL;
}
@ -519,7 +519,7 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_VFO_SUB: v = '1'; break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__, vfo);
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", __func__, rig_strvfo(vfo));
return -RIG_EINVAL;
}
@ -607,7 +607,7 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_VFO_SUB: v = '1'; break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__, vfo);
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", __func__, rig_strvfo(vfo));
return -RIG_EINVAL;
}
@ -703,7 +703,7 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_VFO_SUB: v = '1'; break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__, vfo);
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", __func__, rig_strvfo(vfo));
return -RIG_EINVAL;
}

Wyświetl plik

@ -387,7 +387,7 @@ int xg3_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__, vfo);
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", __func__, rig_strvfo(vfo));
return -RIG_EINVAL;
}
@ -440,7 +440,7 @@ int xg3_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__, vfo);
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", __func__, rig_strvfo(vfo));
return -RIG_EINVAL;
}

Wyświetl plik

@ -508,7 +508,7 @@ int hiqsdr_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv;
int ret = RIG_OK;
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %d\n",
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %u\n",
__func__, ant);
if (ant == RIG_ANT_2)

Wyświetl plik

@ -1379,7 +1379,7 @@ int si570xxxusb_get_freq_by_value(RIG *rig, vfo_t vfo, freq_t *freq)
iFreq = getLongWord(buffer);
rig_debug(RIG_DEBUG_VERBOSE,
"%s: Freq raw: %02x%02x%02x%02x endian converted: %d\n",
"%s: Freq raw: %02x%02x%02x%02x endian converted: %u\n",
__func__, buffer[0], buffer[1], buffer[2], buffer[3], iFreq);
*freq = (((double)iFreq / (1UL << 21)) / priv->multiplier) * 1e6;

Wyświetl plik

@ -762,6 +762,7 @@ pcr_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
priv = (struct pcr_priv_data *) rig->state.priv;
rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
// cppcheck-supress *
freq_len = sprintf((char *) buf, "K%c%010" PRIll "0%c0%c00",
is_sub_rcvr(rig, vfo) ? '1' : '0',
(int64_t) freq,

Wyświetl plik

@ -433,12 +433,12 @@ int prm80_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_AF:
val->f = chan.levels[LVL_AF].f;
return RIG_OK;
break;
case RIG_LEVEL_SQL:
val->f = chan.levels[LVL_SQL].f;
return RIG_OK;
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported set_level %s\n", __func__,

Wyświetl plik

@ -114,6 +114,7 @@ gp2000_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s,freq=%.0f\n", __func__,
rig_strvfo(vfo), freq);
// cppcheck-suppress *
freq_len =
snprintf(freqbuf, sizeof(freqbuf), BOM "F%" PRIll ",%" PRIll EOM,
(int64_t) freq,

Wyświetl plik

@ -101,6 +101,7 @@ int rs_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
char freqbuf[32];
int freq_len, retval;
// cppcheck-suppress *
freq_len = sprintf(freqbuf, BOM "FREQ %"PRIll EOM, (int64_t)freq);
retval = rs_transaction(rig, freqbuf, freq_len, NULL, NULL);

Wyświetl plik

@ -462,7 +462,7 @@ int cu_set_parm(RIG *rig, setting_t parm, value_t val)
case RIG_PARM_TIME:
/* zap seconds */
val.i /= 60;
cmd_len = sprintf(cmdbuf, "f%02u%02u"CR,
cmd_len = sprintf(cmdbuf, "f%02d%02d"CR,
val.i / 60, val.i % 60);
break;

Wyświetl plik

@ -401,6 +401,7 @@ int tt565_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
#ifdef TT565_ASCII_FREQ
/* Use ASCII mode to set frequencies */
// cppcheck-suppress *
cmd_len = sprintf(cmdbuf, "*%cF%"PRIll EOM,
which_vfo(rig, vfo),
(int64_t)freq);

Wyświetl plik

@ -255,7 +255,7 @@ static int rx331_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
serial_flush(&rs->rigport);
num_snprintf(str, BUFSZ, "$%i%s", priv->receiver_id, cmd);
num_snprintf(str, BUFSZ, "$%u%s", priv->receiver_id, cmd);
retval = write_block(&rs->rigport, str, strlen(str));
if (retval != RIG_OK)
@ -398,7 +398,7 @@ int rx331_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
int freq_len, retval;
char freqbuf[16];
freq_len = num_sprintf(freqbuf, "$%iF%.6f" EOM,
freq_len = num_sprintf(freqbuf, "$%uF%.6f" EOM,
priv->receiver_id, freq / 1e6);
retval = write_block(&rs->rigport, freqbuf, freq_len);
@ -480,7 +480,7 @@ int rx331_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
/*
* Set DETECTION MODE and IF FILTER
*/
mdbuf_len = num_sprintf(mdbuf, "$%iD%cI%.02f" EOM, priv->receiver_id,
mdbuf_len = num_sprintf(mdbuf, "$%uD%cI%.02f" EOM, priv->receiver_id,
dmode, (float)width / 1e3);
}
else
@ -488,7 +488,7 @@ int rx331_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
/*
* Set DETECTION MODE
*/
mdbuf_len = num_sprintf(mdbuf, "$%iD%c" EOM, priv->receiver_id, dmode);
mdbuf_len = num_sprintf(mdbuf, "$%uD%c" EOM, priv->receiver_id, dmode);
}
retval = write_block(&rs->rigport, mdbuf, mdbuf_len);
@ -613,18 +613,18 @@ int rx331_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
break;
case RIG_LEVEL_NOTCHF:
cmd_len = num_sprintf(cmdbuf, "$%iN%f" EOM, priv->receiver_id,
cmd_len = num_sprintf(cmdbuf, "$%uN%f" EOM, priv->receiver_id,
((float)val.i) / 1e3);
break;
case RIG_LEVEL_IF:
cmd_len = num_sprintf(cmdbuf, "$%iP%f" EOM, priv->receiver_id,
cmd_len = num_sprintf(cmdbuf, "$%uP%f" EOM, priv->receiver_id,
((float)val.i) / 1e3);
break;
case RIG_LEVEL_CWPITCH:
/* only in CW mode */
cmd_len = num_sprintf(cmdbuf, "$%iB%f" EOM, priv->receiver_id,
cmd_len = num_sprintf(cmdbuf, "$%uB%f" EOM, priv->receiver_id,
((float)val.i) / 1e3);
break;

Wyświetl plik

@ -82,6 +82,7 @@ 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);
serial_flush(&rs->rigport);
@ -90,6 +91,7 @@ tt550_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
if (retval != RIG_OK)
{
// cppcheck-suppress *
Unhold_Decode(rig);
return retval;
}
@ -99,6 +101,7 @@ tt550_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
*/
if (!data || !data_len)
{
// cppcheck-suppress *
Unhold_Decode(rig);
return 0;
}
@ -117,6 +120,7 @@ tt550_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
*data_len = retval;
// cppcheck-suppress *
Unhold_Decode(rig);
return RIG_OK;

Wyświetl plik

@ -438,7 +438,7 @@ int g313_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
case RIG_LEVEL_ATT:
ret = GetAttenuator(priv->hRadio, &value);
rig_debug(RIG_DEBUG_VERBOSE, "%s: ret: %d Attenuator: %u\n", __func__, ret,
rig_debug(RIG_DEBUG_VERBOSE, "%s: ret: %d Attenuator: %d\n", __func__, ret,
value);
if (ret)
@ -451,7 +451,7 @@ int g313_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_AGC:
ret = GetAGC(priv->hRadio, &value);
rig_debug(RIG_DEBUG_VERBOSE, "%s: ret: %d AGC: %u\n", __func__, ret, value);
rig_debug(RIG_DEBUG_VERBOSE, "%s: ret: %d AGC: %d\n", __func__, ret, value);
if (ret)
{

Wyświetl plik

@ -516,6 +516,7 @@ int ft100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
rig_debug(RIG_DEBUG_VERBOSE, "ft100: d1=%"PRIfreq" d2=%"PRIfreq"\n", d1, d2);
// cppcheck-suppress *
rig_debug(RIG_DEBUG_VERBOSE, "ft100: get_freq= %8"PRIll" \n", (int64_t)d2);
*freq = d2;

Wyświetl plik

@ -3454,6 +3454,7 @@ int ft1000d_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
/* store bcd format in in p_cmd */
to_bcd(priv->p_cmd, freq / 10, FT1000D_BCD_DIAL);
// cppcheck-suppress *
rig_debug(RIG_DEBUG_TRACE,
"%s: requested freq after conversion = %"PRIll" Hz\n",
__func__, (int64_t)from_bcd(priv->p_cmd, FT1000D_BCD_DIAL) * 10);

Wyświetl plik

@ -736,6 +736,7 @@ 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);

Wyświetl plik

@ -427,6 +427,7 @@ int ft747_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
though the rig will internally then round to 25 Hz steps */
to_bcd(p->p_cmd, (freq + 5) / 10, 8);
// cppcheck-suppress *
rig_debug(RIG_DEBUG_VERBOSE,
"%s: requested freq after conversion = %"PRIll" Hz \n", __func__,
(int64_t)from_bcd(p->p_cmd, 8) * 10);

Wyświetl plik

@ -863,8 +863,8 @@ int ft767_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
return RIG_OK;
default:
rig_debug(RIG_DEBUG_ERR, "%s: error, unknown vfo value %d\n", __func__,
curr_vfo);
rig_debug(RIG_DEBUG_ERR, "%s: error, unknown vfo value %s\n", __func__,
rig_strvfo(curr_vfo));
return RIG_OK;
}
}
@ -966,8 +966,8 @@ int ft767_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
return RIG_OK;
default:
rig_debug(RIG_DEBUG_ERR, "%s: error, unknown vfo value %d\n", __func__,
curr_vfo);
rig_debug(RIG_DEBUG_ERR, "%s: error, unknown vfo value %s\n", __func__,
rig_strvfo(curr_vfo));
return RIG_OK;
}
}
@ -1026,8 +1026,8 @@ int ft767_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
return RIG_OK;
default:
rig_debug(RIG_DEBUG_ERR, "%s: error, unknown vfo value %d\n", __func__,
curr_vfo);
rig_debug(RIG_DEBUG_ERR, "%s: error, unknown vfo value %s\n", __func__,
rig_strvfo(curr_vfo));
return RIG_OK;
}
}
@ -1130,8 +1130,8 @@ int ft767_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
return RIG_OK;
default:
rig_debug(RIG_DEBUG_ERR, "%s: error, unknown vfo value %d\n", __func__,
curr_vfo);
rig_debug(RIG_DEBUG_ERR, "%s: error, unknown vfo value %s\n", __func__,
rig_strvfo(curr_vfo));
return RIG_OK;
}
}
@ -1341,8 +1341,8 @@ int ft767_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
default:
/* we don't know how to deal with MEM, anything else is an error */
/* TODO make sure this is what we want to do here */
rig_debug(RIG_DEBUG_ERR, "%s: current vfo is %d with split\n", __func__,
curr_vfo);
rig_debug(RIG_DEBUG_ERR, "%s: current vfo is %s with split\n", __func__,
rig_strvfo(curr_vfo));
return -RIG_EINVAL;
break;
}
@ -1581,7 +1581,7 @@ int ft767_set_split(RIG *rig, unsigned int split)
/* See whether we need to toggle */
curr_split = priv->update_data[STATUS_FLAGS] & STATUS_MASK_SPLIT;
rig_debug(RIG_DEBUG_TRACE, "%s called curr_split = %d, split = %d\n", __func__,
rig_debug(RIG_DEBUG_TRACE, "%s called curr_split = %u, split = %u\n", __func__,
curr_split, split);
if (curr_split ^ split)

Wyświetl plik

@ -305,6 +305,7 @@ 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)
{
return -RIG_ENOMEM;
@ -1088,7 +1089,7 @@ int ft817_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code)
return -RIG_ENTARGET;
}
rig_debug(RIG_DEBUG_VERBOSE, "ft817: set DCS code (%d)\n", code);
rig_debug(RIG_DEBUG_VERBOSE, "ft817: set DCS code (%u)\n", code);
if (code == 0)
{
@ -1120,7 +1121,7 @@ int ft817_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code)
return -RIG_ENTARGET;
}
rig_debug(RIG_DEBUG_VERBOSE, "ft817: set DCS sql (%d)\n", code);
rig_debug(RIG_DEBUG_VERBOSE, "ft817: set DCS sql (%u)\n", code);
if (code == 0)
{

Wyświetl plik

@ -1894,6 +1894,7 @@ static int ft840_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
/* store bcd format in in p_cmd */
to_bcd(priv->p_cmd, freq / 10, FT840_BCD_DIAL);
// cppcheck-suppress *
rig_debug(RIG_DEBUG_TRACE,
"%s: requested freq after conversion = %"PRIll" Hz\n",
__func__, (int64_t)from_bcd(priv->p_cmd, FT840_BCD_DIAL) * 10);

Wyświetl plik

@ -719,6 +719,7 @@ int ft847_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
to_bcd_be(p_cmd, freq / 10, 8); /* store bcd format in in p_cmd */
// cppcheck-suppress *
rig_debug(RIG_DEBUG_VERBOSE,
"%s: requested freq after conversion = %"PRIll" Hz \n", __func__,
(int64_t)from_bcd_be(p_cmd, 8) * 10);

Wyświetl plik

@ -295,6 +295,7 @@ 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)
{
return -RIG_ENOMEM;
@ -1145,7 +1146,7 @@ int ft857_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code)
return -RIG_ENTARGET;
}
rig_debug(RIG_DEBUG_VERBOSE, "ft857: set DCS code (%d)\n", code);
rig_debug(RIG_DEBUG_VERBOSE, "ft857: set DCS code (%u)\n", code);
if (code == 0)
{
@ -1203,7 +1204,7 @@ int ft857_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code)
return -RIG_ENTARGET;
}
rig_debug(RIG_DEBUG_VERBOSE, "ft857: set DCS sql (%d)\n", code);
rig_debug(RIG_DEBUG_VERBOSE, "ft857: set DCS sql (%u)\n", code);
if (code == 0)
{

Wyświetl plik

@ -1833,6 +1833,7 @@ static int ft890_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
/* store bcd format in in p_cmd */
to_bcd(priv->p_cmd, freq / 10, FT890_BCD_DIAL);
// cppcheck-suppress *
rig_debug(RIG_DEBUG_TRACE,
"%s: requested freq after conversion = %"PRIll" Hz\n",
__func__, (int64_t)from_bcd(priv->p_cmd, FT890_BCD_DIAL) * 10);

Wyświetl plik

@ -328,6 +328,7 @@ 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)
{
return -RIG_ENOMEM;
@ -1161,7 +1162,7 @@ int ft897_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code)
return -RIG_ENTARGET;
}
rig_debug(RIG_DEBUG_VERBOSE, "ft897: set DCS code (%d)\n", code);
rig_debug(RIG_DEBUG_VERBOSE, "ft897: set DCS code (%u)\n", code);
if (code == 0)
{
@ -1219,7 +1220,7 @@ int ft897_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code)
return -RIG_ENTARGET;
}
rig_debug(RIG_DEBUG_VERBOSE, "ft897: set DCS sql (%d)\n", code);
rig_debug(RIG_DEBUG_VERBOSE, "ft897: set DCS sql (%u)\n", code);
if (code == 0)
{

Wyświetl plik

@ -1835,6 +1835,7 @@ static int ft900_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
/* store bcd format in in p_cmd */
to_bcd(priv->p_cmd, freq / 10, FT900_BCD_DIAL);
// cppcheck-suppress *
rig_debug(RIG_DEBUG_TRACE,
"%s: requested freq after conversion = %"PRIll" Hz\n",
__func__, (int64_t)from_bcd(priv->p_cmd, FT900_BCD_DIAL) * 10);

Wyświetl plik

@ -2556,6 +2556,7 @@ static int ft920_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
/* store bcd format in in p_cmd */
to_bcd(priv->p_cmd, freq / 10, FT920_BCD_DIAL);
// cppcheck-suppress *
rig_debug(RIG_DEBUG_TRACE,
"%s: requested freq after conversion = %"PRIll" Hz\n",
__func__, (int64_t)from_bcd(priv->p_cmd, FT920_BCD_DIAL) * 10);

Wyświetl plik

@ -3374,6 +3374,7 @@ int ft990_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
/* store bcd format in in p_cmd */
to_bcd(priv->p_cmd, freq / 10, FT990_BCD_DIAL);
// cppcheck-suppress *
rig_debug(RIG_DEBUG_TRACE,
"%s: requested freq after conversion = %"PRIll" Hz\n",
__func__, (int64_t)from_bcd(priv->p_cmd, FT990_BCD_DIAL) * 10);

Wyświetl plik

@ -601,6 +601,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
newcat_get_vfo_mode(rig, &vfo_mode);
}
// cppcheck-suppress *
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "F%c%0*"PRIll"%c", c,
priv->width_frequency, (int64_t)freq, cat_term);
rig_debug(RIG_DEBUG_TRACE, "%s:%d cmd_str = %s\n", __func__, __LINE__,

Wyświetl plik

@ -573,7 +573,7 @@ static struct
*/
uint64_t rig_idx2setting(int i)
{
return 1ULL << i;
return ((uint64_t)1) << i;
}
/**

Wyświetl plik

@ -132,6 +132,7 @@ int par_open(hamlib_port_t *port)
#endif
#if defined (__WIN64__) || defined(__WIN32__)
// cppcheck-suppress *
HANDLE handle;
#endif

Wyświetl plik

@ -61,7 +61,7 @@ int dumpcaps(RIG *rig, FILE *fout)
caps = rig->caps;
fprintf(fout, "Caps dump for model: %d\n", caps->rig_model);
fprintf(fout, "Caps dump for model: %u\n", caps->rig_model);
fprintf(fout, "Model name:\t%s\n", caps->model_name);
fprintf(fout, "Mfg name:\t%s\n", caps->mfg_name);
fprintf(fout, "Backend version:\t%s\n", caps->version);
@ -295,7 +295,7 @@ int dumpcaps(RIG *rig, FILE *fout)
for (i = 0; caps->ctcss_list && i < 60 && caps->ctcss_list[i] != 0; i++)
{
fprintf(fout,
" %d.%1d",
" %u.%1u",
caps->ctcss_list[i] / 10, caps->ctcss_list[i] % 10);
}
@ -314,7 +314,7 @@ int dumpcaps(RIG *rig, FILE *fout)
for (i = 0; caps->dcs_list && i < 128 && caps->dcs_list[i] != 0; i++)
{
fprintf(fout, " %d", caps->dcs_list[i]);
fprintf(fout, " %u", caps->dcs_list[i]);
}
if (i == 0)

Wyświetl plik

@ -181,7 +181,7 @@ int dump_chan(RIG *rig, int chan_num)
sprintf_freq(freqbuf, chan.width);
printf("Width: %s\n", freqbuf);
printf("VFO: %d\n", chan.vfo);
printf("VFO: %s\n", rig_strvfo(chan.vfo));
printf("Split: %d\n", chan.split);
sprintf_freq(freqbuf, chan.tx_freq);
@ -195,7 +195,7 @@ int dump_chan(RIG *rig, int chan_num)
sprintf_freq(freqbuf, chan.rptr_offs);
printf("Offset: %s%s\n", chan.rptr_offs > 0 ? "+" : "", freqbuf);
printf("Antenna: %d\n", chan.ant);
printf("Antenna: %u\n", chan.ant);
sprintf_freq(freqbuf, chan.tuning_step);
printf("Step: %s\n", freqbuf);
@ -205,10 +205,10 @@ int dump_chan(RIG *rig, int chan_num)
sprintf_freq(freqbuf, chan.xit);
printf("XIT: %s%s\n", chan.xit > 0 ? "+" : "", freqbuf);
printf("CTCSS: %d.%dHz\n", chan.ctcss_tone / 10, chan.ctcss_tone % 10);
printf("CTCSSsql: %d.%dHz\n", chan.ctcss_sql / 10, chan.ctcss_sql % 10);
printf("DCS: %d.%d\n", chan.dcs_code / 10, chan.dcs_code % 10);
printf("DCSsql: %d.%d\n", chan.dcs_sql / 10, chan.dcs_sql % 10);
printf("CTCSS: %u.%uHz\n", chan.ctcss_tone / 10, chan.ctcss_tone % 10);
printf("CTCSSsql: %u.%uHz\n", chan.ctcss_sql / 10, chan.ctcss_sql % 10);
printf("DCS: %u.%u\n", chan.dcs_code / 10, chan.dcs_code % 10);
printf("DCSsql: %u.%u\n", chan.dcs_sql / 10, chan.dcs_sql % 10);
printf("Name: %s\n", chan.channel_desc);
printf("Functions: ");

Wyświetl plik

@ -351,7 +351,7 @@ int csv_parm_save(RIG *rig, const char *outfilename)
{
int i, ret;
FILE *f;
setting_t parm, get_parm = all ? 0x7fffffff : rig->state.has_get_parm;
setting_t get_parm = all ? 0x7fffffff : rig->state.has_get_parm;
f = fopen(outfilename, "w");
@ -379,6 +379,7 @@ int csv_parm_save(RIG *rig, const char *outfilename)
{
const char *ms;
value_t val;
setting_t parm;
parm = get_parm & rig_idx2setting(i);
ms = rig_strparm(parm);

Wyświetl plik

@ -155,6 +155,8 @@ int set_chan(RIG *rig, channel_t *chan, xmlNodePtr node)
}
}
if (i == CHANLSTSIZ) { return -RIG_EINVAL; }
fprintf(stderr, "node %d %d\n", n, i);
if (rig->state.chan_list[i].mem_caps.bank_num)

Wyświetl plik

@ -43,7 +43,7 @@
int sprintf_vfo(char *str, vfo_t vfo)
{
int i, len = 0;
unsigned int i, len = 0;
*str = '\0';

Wyświetl plik

@ -15,7 +15,7 @@
# include "config.h"
#endif
#define SERIAL_PORT "/dev/ttyS0"
#define SERIAL_PORT "/dev/ttyUSB0"
int main(int argc, char *argv[])