From a55a72cd2a37174ad0fd63901034acc15b645ca1 Mon Sep 17 00:00:00 2001 From: Michael Black Date: Thu, 14 Jan 2016 08:43:56 -0600 Subject: [PATCH] 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 --- kenwood/kenwood.c | 2 +- yaesu/newcat.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kenwood/kenwood.c b/kenwood/kenwood.c index 81753ce13..7f502cc03 100644 --- a/kenwood/kenwood.c +++ b/kenwood/kenwood.c @@ -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); diff --git a/yaesu/newcat.c b/yaesu/newcat.c index 303180f49..c9cff0346 100644 --- a/yaesu/newcat.c +++ b/yaesu/newcat.c @@ -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))) {