Fix possible frequency overflow on Kenwood and Yaesu

This patch fixes a frequency overflow problem on kenwood and yaesu that
can occur with frequencies that over a 32-bit signed int.  This has been
shown to fix the problem on kenwood.

73
Mike W9MDB
Hamlib-3.1
Michael Black 2016-01-14 08:43:56 -06:00 zatwierdzone przez Nate Bargmann
rodzic efb7860e4d
commit a55a72cd2a
2 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -1075,7 +1075,7 @@ int kenwood_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__, vfo);
return -RIG_EINVAL;
}
sprintf(freqbuf, "F%c%011ld", vfo_letter, (long)freq);
sprintf(freqbuf, "F%c%011lld", vfo_letter, (long long)freq);
int err = kenwood_transaction(rig, freqbuf, NULL, 0);

Wyświetl plik

@ -441,7 +441,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq) {
int width_frequency = priv->width_frequency;
if (width_frequency == 0) width_frequency = 8; // default to 8
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "F%c%0*d%c", c, width_frequency, (int)freq, cat_term);
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "F%c%0*lld%c", c, width_frequency, (long long)freq, cat_term);
rig_debug(RIG_DEBUG_TRACE, "%s:%d cmd_str = %s\n", __func__, __LINE__, priv->cmd_str);
if (RIG_OK != (err = newcat_set_cmd(rig)))
{