From 8eb09c2a38779e09d37e7f4c9673224ed280b9ea Mon Sep 17 00:00:00 2001 From: Michael Black Date: Mon, 23 Mar 2020 07:52:01 -0500 Subject: [PATCH] More cppcheck fixes --- bindings/Makefile.am | 19 ++++++++++++++++++- bindings/perltest.pl | 3 ++- configure.ac | 5 +++++ cppcheck.sh | 7 ++++--- extra/gnuradio/gnuradio.cc | 1 + rigs/alinco/alinco.c | 1 + rigs/aor/aor.c | 2 ++ rigs/elad/elad.c | 1 + rigs/flexradio/sdr1k.c | 1 + rigs/icom/frame.c | 9 ++++++++- rigs/kenwood/ic10.c | 3 +-- rigs/kenwood/th.c | 1 + rigs/kenwood/thd72.c | 1 + rigs/kenwood/thd74.c | 1 + rigs/kenwood/tmd710.c | 10 +++++----- rigs/kenwood/tmv7.c | 1 + rigs/kenwood/ts711.c | 4 ++-- rigs/kenwood/ts811.c | 4 ++-- rigs/kenwood/ts990s.c | 14 +++++++------- rigs/kenwood/xg3.c | 4 ++-- rigs/kit/hiqsdr.c | 2 +- rigs/kit/si570avrusb.c | 2 +- rigs/pcr/pcr.c | 1 + rigs/prm80/prm80.c | 4 ++-- rigs/rs/gp2000.c | 1 + rigs/rs/rs.c | 1 + rigs/skanti/trp8255.c | 2 +- rigs/tentec/orion.c | 1 + rigs/tentec/rx331.c | 14 +++++++------- rigs/tentec/tt550.c | 4 ++++ rigs/winradio/g313-posix.c | 4 ++-- rigs/yaesu/ft100.c | 1 + rigs/yaesu/ft1000d.c | 1 + rigs/yaesu/ft1000mp.c | 1 + rigs/yaesu/ft747.c | 1 + rigs/yaesu/ft767gx.c | 22 +++++++++++----------- rigs/yaesu/ft817.c | 5 +++-- rigs/yaesu/ft840.c | 1 + rigs/yaesu/ft847.c | 1 + rigs/yaesu/ft857.c | 5 +++-- rigs/yaesu/ft890.c | 1 + rigs/yaesu/ft897.c | 5 +++-- rigs/yaesu/ft900.c | 1 + rigs/yaesu/ft920.c | 1 + rigs/yaesu/ft990.c | 1 + rigs/yaesu/newcat.c | 1 + src/misc.c | 2 +- src/parallel.c | 1 + tests/dumpcaps.c | 6 +++--- tests/dumpmem.c | 12 ++++++------ tests/memcsv.c | 3 ++- tests/memload.c | 2 ++ tests/sprintflst.c | 2 +- tests/testrig.c | 2 +- 54 files changed, 136 insertions(+), 70 deletions(-) mode change 100644 => 100755 bindings/perltest.pl diff --git a/bindings/Makefile.am b/bindings/Makefile.am index 3533b9bd5..152034f9c 100644 --- a/bindings/Makefile.am +++ b/bindings/Makefile.am @@ -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. diff --git a/bindings/perltest.pl b/bindings/perltest.pl old mode 100644 new mode 100755 index 310d657c2..93250739b --- a/bindings/perltest.pl +++ b/bindings/perltest.pl @@ -1,4 +1,5 @@ -#!/usr/bin/perl -Iblib/arch -Iblib/lib +#!/usr/bin/perl +##!/usr/bin/perl -Iblib/arch -Iblib/lib use Hamlib; diff --git a/configure.ac b/configure.ac index 0f8a67a55..a64c0979e 100644 --- a/configure.ac +++ b/configure.ac @@ -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 ## diff --git a/cppcheck.sh b/cppcheck.sh index 510219955..11bde31c4 100755 --- a/cppcheck.sh +++ b/cppcheck.sh @@ -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 diff --git a/extra/gnuradio/gnuradio.cc b/extra/gnuradio/gnuradio.cc index 5e414cd4b..dc3f4d4e2 100644 --- a/extra/gnuradio/gnuradio.cc +++ b/extra/gnuradio/gnuradio.cc @@ -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"); diff --git a/rigs/alinco/alinco.c b/rigs/alinco/alinco.c index 9164794cd..daa2ec1fe 100644 --- a/rigs/alinco/alinco.c +++ b/rigs/alinco/alinco.c @@ -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); diff --git a/rigs/aor/aor.c b/rigs/aor/aor.c index 9d80f88a5..9bbeca051 100644 --- a/rigs/aor/aor.c +++ b/rigs/aor/aor.c @@ -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); diff --git a/rigs/elad/elad.c b/rigs/elad/elad.c index 1d25543ee..b50e42adf 100644 --- a/rigs/elad/elad.c +++ b/rigs/elad/elad.c @@ -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); diff --git a/rigs/flexradio/sdr1k.c b/rigs/flexradio/sdr1k.c index f61a02172..a2425759f 100644 --- a/rigs/flexradio/sdr1k.c +++ b/rigs/flexradio/sdr1k.c @@ -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); diff --git a/rigs/icom/frame.c b/rigs/icom/frame.c index d784bb5a6..95fb17174 100644 --- a/rigs/icom/frame.c +++ b/rigs/icom/frame.c @@ -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) diff --git a/rigs/kenwood/ic10.c b/rigs/kenwood/ic10.c index b11da7ce8..7ee57e50e 100644 --- a/rigs/kenwood/ic10.c +++ b/rigs/kenwood/ic10.c @@ -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 /* diff --git a/rigs/kenwood/th.c b/rigs/kenwood/th.c index 9ffa69438..470b6989f 100644 --- a/rigs/kenwood/th.c +++ b/rigs/kenwood/th.c @@ -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); diff --git a/rigs/kenwood/thd72.c b/rigs/kenwood/thd72.c index a9ef7de9c..2be686437 100644 --- a/rigs/kenwood/thd72.c +++ b/rigs/kenwood/thd72.c @@ -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); diff --git a/rigs/kenwood/thd74.c b/rigs/kenwood/thd74.c index 2526b7931..2f61b90ca 100644 --- a/rigs/kenwood/thd74.c +++ b/rigs/kenwood/thd74.c @@ -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); diff --git a/rigs/kenwood/tmd710.c b/rigs/kenwood/tmd710.c index 4866b9ce4..2c0f83eda 100644 --- a/rigs/kenwood/tmd710.c +++ b/rigs/kenwood/tmd710.c @@ -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; } diff --git a/rigs/kenwood/tmv7.c b/rigs/kenwood/tmv7.c index 20b244535..87d3e9ba5 100644 --- a/rigs/kenwood/tmv7.c +++ b/rigs/kenwood/tmv7.c @@ -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); diff --git a/rigs/kenwood/ts711.c b/rigs/kenwood/ts711.c index 142bf654f..e070c84f4 100644 --- a/rigs/kenwood/ts711.c +++ b/rigs/kenwood/ts711.c @@ -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; } diff --git a/rigs/kenwood/ts811.c b/rigs/kenwood/ts811.c index 2a4d3b558..772477520 100644 --- a/rigs/kenwood/ts811.c +++ b/rigs/kenwood/ts811.c @@ -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; } diff --git a/rigs/kenwood/ts990s.c b/rigs/kenwood/ts990s.c index 70b3b0612..839692012 100644 --- a/rigs/kenwood/ts990s.c +++ b/rigs/kenwood/ts990s.c @@ -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; } diff --git a/rigs/kenwood/xg3.c b/rigs/kenwood/xg3.c index e9097ccfe..a80a82f08 100644 --- a/rigs/kenwood/xg3.c +++ b/rigs/kenwood/xg3.c @@ -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; } diff --git a/rigs/kit/hiqsdr.c b/rigs/kit/hiqsdr.c index 8deabfa29..f2a051796 100644 --- a/rigs/kit/hiqsdr.c +++ b/rigs/kit/hiqsdr.c @@ -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) diff --git a/rigs/kit/si570avrusb.c b/rigs/kit/si570avrusb.c index 62a5850e8..80fd88f57 100644 --- a/rigs/kit/si570avrusb.c +++ b/rigs/kit/si570avrusb.c @@ -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; diff --git a/rigs/pcr/pcr.c b/rigs/pcr/pcr.c index 1d26cff4b..434b8c991 100644 --- a/rigs/pcr/pcr.c +++ b/rigs/pcr/pcr.c @@ -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, diff --git a/rigs/prm80/prm80.c b/rigs/prm80/prm80.c index a3a99f397..03b6efc65 100644 --- a/rigs/prm80/prm80.c +++ b/rigs/prm80/prm80.c @@ -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__, diff --git a/rigs/rs/gp2000.c b/rigs/rs/gp2000.c index 3ca25f941..b04c2e662 100644 --- a/rigs/rs/gp2000.c +++ b/rigs/rs/gp2000.c @@ -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, diff --git a/rigs/rs/rs.c b/rigs/rs/rs.c index 7576c54b1..e7a34a030 100644 --- a/rigs/rs/rs.c +++ b/rigs/rs/rs.c @@ -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); diff --git a/rigs/skanti/trp8255.c b/rigs/skanti/trp8255.c index c7a559b03..d9483ba47 100644 --- a/rigs/skanti/trp8255.c +++ b/rigs/skanti/trp8255.c @@ -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; diff --git a/rigs/tentec/orion.c b/rigs/tentec/orion.c index d96c9f167..33bb3b2f9 100644 --- a/rigs/tentec/orion.c +++ b/rigs/tentec/orion.c @@ -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); diff --git a/rigs/tentec/rx331.c b/rigs/tentec/rx331.c index 6bdb30b76..506b3c192 100644 --- a/rigs/tentec/rx331.c +++ b/rigs/tentec/rx331.c @@ -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; diff --git a/rigs/tentec/tt550.c b/rigs/tentec/tt550.c index d699b6ccd..7598bf834 100644 --- a/rigs/tentec/tt550.c +++ b/rigs/tentec/tt550.c @@ -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; diff --git a/rigs/winradio/g313-posix.c b/rigs/winradio/g313-posix.c index 378f01205..4e6da5a9d 100644 --- a/rigs/winradio/g313-posix.c +++ b/rigs/winradio/g313-posix.c @@ -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) { diff --git a/rigs/yaesu/ft100.c b/rigs/yaesu/ft100.c index d963d3804..0680201ff 100644 --- a/rigs/yaesu/ft100.c +++ b/rigs/yaesu/ft100.c @@ -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; diff --git a/rigs/yaesu/ft1000d.c b/rigs/yaesu/ft1000d.c index 7090c4c77..c1a53ea81 100644 --- a/rigs/yaesu/ft1000d.c +++ b/rigs/yaesu/ft1000d.c @@ -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); diff --git a/rigs/yaesu/ft1000mp.c b/rigs/yaesu/ft1000mp.c index 27d0efb75..1044115d9 100644 --- a/rigs/yaesu/ft1000mp.c +++ b/rigs/yaesu/ft1000mp.c @@ -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); diff --git a/rigs/yaesu/ft747.c b/rigs/yaesu/ft747.c index 712b3176e..027982cdb 100644 --- a/rigs/yaesu/ft747.c +++ b/rigs/yaesu/ft747.c @@ -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); diff --git a/rigs/yaesu/ft767gx.c b/rigs/yaesu/ft767gx.c index 0879d23c9..cf5894225 100644 --- a/rigs/yaesu/ft767gx.c +++ b/rigs/yaesu/ft767gx.c @@ -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) diff --git a/rigs/yaesu/ft817.c b/rigs/yaesu/ft817.c index 7e4f33256..f91a60811 100644 --- a/rigs/yaesu/ft817.c +++ b/rigs/yaesu/ft817.c @@ -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) { diff --git a/rigs/yaesu/ft840.c b/rigs/yaesu/ft840.c index 4a548b22a..89986c275 100644 --- a/rigs/yaesu/ft840.c +++ b/rigs/yaesu/ft840.c @@ -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); diff --git a/rigs/yaesu/ft847.c b/rigs/yaesu/ft847.c index 7e6667081..20b09bc11 100644 --- a/rigs/yaesu/ft847.c +++ b/rigs/yaesu/ft847.c @@ -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); diff --git a/rigs/yaesu/ft857.c b/rigs/yaesu/ft857.c index d9d467aca..7255e1e4d 100644 --- a/rigs/yaesu/ft857.c +++ b/rigs/yaesu/ft857.c @@ -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) { diff --git a/rigs/yaesu/ft890.c b/rigs/yaesu/ft890.c index 6e767be0b..be9719d58 100644 --- a/rigs/yaesu/ft890.c +++ b/rigs/yaesu/ft890.c @@ -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); diff --git a/rigs/yaesu/ft897.c b/rigs/yaesu/ft897.c index fc3ea0b3f..bc9e7d1f5 100644 --- a/rigs/yaesu/ft897.c +++ b/rigs/yaesu/ft897.c @@ -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) { diff --git a/rigs/yaesu/ft900.c b/rigs/yaesu/ft900.c index 9019aba50..f1311403a 100644 --- a/rigs/yaesu/ft900.c +++ b/rigs/yaesu/ft900.c @@ -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); diff --git a/rigs/yaesu/ft920.c b/rigs/yaesu/ft920.c index 989f9e833..618987114 100644 --- a/rigs/yaesu/ft920.c +++ b/rigs/yaesu/ft920.c @@ -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); diff --git a/rigs/yaesu/ft990.c b/rigs/yaesu/ft990.c index 04eb022f7..c4bf15c09 100644 --- a/rigs/yaesu/ft990.c +++ b/rigs/yaesu/ft990.c @@ -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); diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 102a24894..1669c51e9 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -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__, diff --git a/src/misc.c b/src/misc.c index a81e3d962..f0b951152 100644 --- a/src/misc.c +++ b/src/misc.c @@ -573,7 +573,7 @@ static struct */ uint64_t rig_idx2setting(int i) { - return 1ULL << i; + return ((uint64_t)1) << i; } /** diff --git a/src/parallel.c b/src/parallel.c index 02d002637..f2858ee92 100644 --- a/src/parallel.c +++ b/src/parallel.c @@ -132,6 +132,7 @@ int par_open(hamlib_port_t *port) #endif #if defined (__WIN64__) || defined(__WIN32__) + // cppcheck-suppress * HANDLE handle; #endif diff --git a/tests/dumpcaps.c b/tests/dumpcaps.c index 32981c843..b8699f20c 100644 --- a/tests/dumpcaps.c +++ b/tests/dumpcaps.c @@ -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) diff --git a/tests/dumpmem.c b/tests/dumpmem.c index 57d09811f..d21573075 100644 --- a/tests/dumpmem.c +++ b/tests/dumpmem.c @@ -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: "); diff --git a/tests/memcsv.c b/tests/memcsv.c index d0ce5a0dd..ad159bd77 100644 --- a/tests/memcsv.c +++ b/tests/memcsv.c @@ -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); diff --git a/tests/memload.c b/tests/memload.c index cea21aa79..e1a7a1ee9 100644 --- a/tests/memload.c +++ b/tests/memload.c @@ -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) diff --git a/tests/sprintflst.c b/tests/sprintflst.c index 74704fd3b..0cbe87924 100644 --- a/tests/sprintflst.c +++ b/tests/sprintflst.c @@ -43,7 +43,7 @@ int sprintf_vfo(char *str, vfo_t vfo) { - int i, len = 0; + unsigned int i, len = 0; *str = '\0'; diff --git a/tests/testrig.c b/tests/testrig.c index a1c123787..96b83036b 100644 --- a/tests/testrig.c +++ b/tests/testrig.c @@ -15,7 +15,7 @@ # include "config.h" #endif -#define SERIAL_PORT "/dev/ttyS0" +#define SERIAL_PORT "/dev/ttyUSB0" int main(int argc, char *argv[])