kopia lustrzana https://github.com/Hamlib/Hamlib
Fix prints/scanf argument mismatches idenfitied by cppcheck
https://github.com/Hamlib/Hamlib/issues/1351pull/1392/head
rodzic
18d016a2a2
commit
0484dc08c8
|
@ -1048,7 +1048,7 @@ int kenwood_open(RIG *rig)
|
|||
{
|
||||
int retval;
|
||||
vfo_t tx_vfo;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: found the right driver for %s(%d)\n",
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: found the right driver for %s(%u)\n",
|
||||
__func__, rig->caps->model_name, rig->caps->rig_model);
|
||||
/* get current AI state so it can be restored */
|
||||
kenwood_get_trn(rig, &priv->trn_state); /* ignore errors */
|
||||
|
|
|
@ -72,8 +72,8 @@ th_decode_event(RIG *rig)
|
|||
int step, shift, rev, tone, ctcss, tonefq, ctcssfq;
|
||||
|
||||
retval = num_sscanf(asyncbuf,
|
||||
"BUF %d,%"SCNfreq",%X,%d,%d,%d,%d,,%d,,%d,%"SCNfreq",%d",
|
||||
&vfo, &freq, &step, &shift, &rev, &tone,
|
||||
"BUF %u,%"SCNfreq",%X,%d,%d,%d,%d,,%d,,%d,%"SCNfreq",%d",
|
||||
&vfo, &freq, (unsigned int*)&step, &shift, &rev, &tone,
|
||||
&ctcss, &tonefq, &ctcssfq, &offset, &mode);
|
||||
|
||||
if (retval != 11)
|
||||
|
@ -87,7 +87,7 @@ th_decode_event(RIG *rig)
|
|||
vfo = (vfo == 0) ? RIG_VFO_A : RIG_VFO_B;
|
||||
mode = (mode == 0) ? RIG_MODE_FM : RIG_MODE_AM;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: Buffer (vfo %d, freq %"PRIfreq" Hz, mode %d)\n",
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: Buffer (vfo %u, freq %"PRIfreq" Hz, mode %d)\n",
|
||||
__func__, vfo, freq, mode);
|
||||
|
||||
/* Callback execution */
|
||||
|
@ -113,7 +113,7 @@ th_decode_event(RIG *rig)
|
|||
|
||||
vfo_t vfo;
|
||||
int lev;
|
||||
retval = sscanf(asyncbuf, "SM %d,%d", &vfo, &lev);
|
||||
retval = sscanf(asyncbuf, "SM %u,%d", &vfo, &lev);
|
||||
|
||||
if (retval != 2)
|
||||
{
|
||||
|
@ -144,7 +144,7 @@ th_decode_event(RIG *rig)
|
|||
vfo_t vfo;
|
||||
int busy;
|
||||
|
||||
retval = sscanf(asyncbuf, "BY %d,%d", &vfo, &busy);
|
||||
retval = sscanf(asyncbuf, "BY %u,%d", &vfo, &busy);
|
||||
|
||||
if (retval != 2)
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ th_decode_event(RIG *rig)
|
|||
{
|
||||
|
||||
vfo_t vfo;
|
||||
retval = sscanf(asyncbuf, "BC %d", &vfo);
|
||||
retval = sscanf(asyncbuf, "BC %u", &vfo);
|
||||
|
||||
if (retval != 1)
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ th_decode_event(RIG *rig)
|
|||
|
||||
vfo = (vfo == 0) ? RIG_VFO_A : RIG_VFO_B;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: VFO event - vfo = %d\n", __func__, vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: VFO event - vfo = %u\n", __func__, vfo);
|
||||
|
||||
if (rig->callbacks.vfo_event)
|
||||
{
|
||||
|
@ -269,7 +269,7 @@ th_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
return retval;
|
||||
}
|
||||
|
||||
retval = num_sscanf(buf, "FQ %"SCNfreq",%x", freq, &step);
|
||||
retval = num_sscanf(buf, "FQ %"SCNfreq",%x", freq, (unsigned*)&step);
|
||||
|
||||
if (retval != 2)
|
||||
{
|
||||
|
@ -664,7 +664,7 @@ int tm_set_vfo_bc2(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 %u\n", __func__, vfo);
|
||||
return -RIG_EVFO;
|
||||
}
|
||||
|
||||
|
@ -1454,7 +1454,7 @@ th_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
|
|||
/* verify tone index for TH-7DA rig */
|
||||
if (tone_idx == 0 || tone_idx == 2 || tone_idx > 39)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected CTCSS tone no (%04d)\n",
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected CTCSS tone no (%04u)\n",
|
||||
__func__, tone_idx);
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
@ -1532,7 +1532,7 @@ th_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone)
|
|||
/* verify tone index for TH-7DA rig */
|
||||
if (tone_idx == 0 || tone_idx == 2 || tone_idx > 39)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected CTCSS no (%04d)\n",
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected CTCSS no (%04u)\n",
|
||||
__func__, tone_idx);
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
@ -2499,7 +2499,7 @@ int th_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
|
|||
{
|
||||
char cmd[6];
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: ant = %d\n", __func__, ant);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: ant = %u\n", __func__, ant);
|
||||
|
||||
switch (ant)
|
||||
{
|
||||
|
@ -2548,7 +2548,7 @@ int th_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, value_t *option,
|
|||
|
||||
*ant_curr = RIG_ANT_N(buf[4] - '0');
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: ant = %d\n", __func__, *ant_curr);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: ant = %u\n", __func__, *ant_curr);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -815,10 +815,10 @@ static int tmd710_scan_me(char *buf, tmd710_me *me_struct)
|
|||
|
||||
retval = num_sscanf(buf,
|
||||
"ME %x,%"SCNfreq",%x,%x,%x,%x,%x,%x,%d,%d,%d,%d,%d,%"SCNfreq",%d,%d",
|
||||
&me_struct->channel, &me_struct->freq,
|
||||
&me_struct->step, &me_struct->shift,
|
||||
&me_struct->reverse, &me_struct->tone,
|
||||
&me_struct->ct, &me_struct->dcs,
|
||||
(unsigned int*)&me_struct->channel, &me_struct->freq,
|
||||
(unsigned int*)&me_struct->step, &me_struct->shift,
|
||||
(unsigned int*)&me_struct->reverse, (unsigned int*)&me_struct->tone,
|
||||
(unsigned int*)&me_struct->ct, (unsigned int*)&me_struct->dcs,
|
||||
&me_struct->tone_freq, &me_struct->ct_freq,
|
||||
&me_struct->dcs_val, &me_struct->offset,
|
||||
&me_struct->mode, &me_struct->tx_freq,
|
||||
|
@ -963,10 +963,10 @@ int tmd710_pull_fo(RIG *rig, vfo_t vfo, tmd710_fo *fo_struct)
|
|||
}
|
||||
|
||||
retval = num_sscanf(buf, "FO %x,%"SCNfreq",%x,%x,%x,%x,%x,%x,%d,%d,%d,%d,%d",
|
||||
&fo_struct->vfo, &fo_struct->freq,
|
||||
&fo_struct->step, &fo_struct->shift,
|
||||
&fo_struct->reverse, &fo_struct->tone,
|
||||
&fo_struct->ct, &fo_struct->dcs,
|
||||
(unsigned int*)&fo_struct->vfo, &fo_struct->freq,
|
||||
(unsigned int*)&fo_struct->step, (unsigned int*)&fo_struct->shift,
|
||||
(unsigned int*)&fo_struct->reverse, (unsigned int*)&fo_struct->tone,
|
||||
(unsigned int*)&fo_struct->ct, (unsigned int*)&fo_struct->dcs,
|
||||
&fo_struct->tone_freq, &fo_struct->ct_freq,
|
||||
&fo_struct->dcs_val, &fo_struct->offset,
|
||||
&fo_struct->mode);
|
||||
|
@ -1006,10 +1006,10 @@ int tmd710_push_fo(RIG *rig, vfo_t vfo, tmd710_fo *fo_struct)
|
|||
}
|
||||
|
||||
retval = num_sscanf(buf, "FO %x,%"SCNfreq",%x,%x,%x,%x,%x,%x,%d,%d,%d,%d,%d",
|
||||
&fo_struct->vfo, &fo_struct->freq,
|
||||
&fo_struct->step, &fo_struct->shift,
|
||||
&fo_struct->reverse, &fo_struct->tone,
|
||||
&fo_struct->ct, &fo_struct->dcs,
|
||||
(unsigned int*)&fo_struct->vfo, &fo_struct->freq,
|
||||
(unsigned int*)&fo_struct->step, (unsigned int*)&fo_struct->shift,
|
||||
(unsigned int*)&fo_struct->reverse, (unsigned int*)&fo_struct->tone,
|
||||
(unsigned int*)&fo_struct->ct, (unsigned int*)&fo_struct->dcs,
|
||||
&fo_struct->tone_freq, &fo_struct->ct_freq,
|
||||
&fo_struct->dcs_val, &fo_struct->offset,
|
||||
&fo_struct->mode);
|
||||
|
@ -1061,12 +1061,12 @@ int tmd710_scan_mu(char *buf, tmd710_mu *mu_struct)
|
|||
&mu_struct->brightness_level,
|
||||
&mu_struct->auto_brightness,
|
||||
&mu_struct->backlight_color,
|
||||
&mu_struct->pf1_key,
|
||||
&mu_struct->pf2_key,
|
||||
&mu_struct->mic_pf1_key,
|
||||
&mu_struct->mic_pf2_key,
|
||||
&mu_struct->mic_pf3_key,
|
||||
&mu_struct->mic_pf4_key,
|
||||
(unsigned int*)&mu_struct->pf1_key,
|
||||
(unsigned int*)&mu_struct->pf2_key,
|
||||
(unsigned int*)&mu_struct->mic_pf1_key,
|
||||
(unsigned int*)&mu_struct->mic_pf2_key,
|
||||
(unsigned int*)&mu_struct->mic_pf3_key,
|
||||
(unsigned int*)&mu_struct->mic_pf4_key,
|
||||
&mu_struct->mic_key_lock,
|
||||
&mu_struct->scan_resume,
|
||||
&mu_struct->auto_power_off,
|
||||
|
@ -1260,7 +1260,7 @@ int tmd710_do_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
int tmd710_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called for vfo: %s(%d)\n", __func__,
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called for vfo: %s(%u)\n", __func__,
|
||||
rig_strvfo(vfo), vfo);
|
||||
|
||||
return tmd710_do_set_freq(rig, vfo, freq);
|
||||
|
@ -1319,7 +1319,7 @@ static int tmd710_find_ctcss_index(RIG *rig, tone_t tone, int *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;
|
||||
}
|
||||
|
||||
|
@ -1965,7 +1965,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 %u\n", __func__, vfo);
|
||||
return -RIG_EVFO;
|
||||
}
|
||||
|
||||
|
@ -2491,7 +2491,7 @@ int tmd710_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
return retval;
|
||||
}
|
||||
|
||||
retval = sscanf(ackbuf, "SQ %X", &l);
|
||||
retval = sscanf(ackbuf, "SQ %X", (unsigned int*)&l);
|
||||
|
||||
if (retval != 1 || l < TMD710_SQL_MIN || l > TMD710_SQL_MAX)
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue