kopia lustrzana https://github.com/Hamlib/Hamlib
Change sprintf to snprint in icmarine.c and icm710.c
Add new rig_get_conf2 function to eventually replace rig_get_conf in 5.0 https://github.com/Hamlib/Hamlib/issues/857 https://github.com/Hamlib/Hamlib/issues/924pull/928/head
rodzic
926eba4d1c
commit
fdae4f6aa5
3
NEWS
3
NEWS
|
@ -8,6 +8,7 @@ Please send Hamlib bug reports to hamlib-developer@lists.sourceforge.net
|
||||||
|
|
||||||
|
|
||||||
Version 5.x
|
Version 5.x
|
||||||
|
* rig_get_conf deprecated and replaced by rig_get_conf2
|
||||||
* rot_get_conf deprecated and replaced by rot_get_conf2
|
* rot_get_conf deprecated and replaced by rot_get_conf2
|
||||||
* Asynchronous rig data output handling to support transceive and spectrum data. Mikael, OH3BHX
|
* Asynchronous rig data output handling to support transceive and spectrum data. Mikael, OH3BHX
|
||||||
* Multicast UDP packet output for asynchronous data. Mikael, OH3BHX
|
* Multicast UDP packet output for asynchronous data. Mikael, OH3BHX
|
||||||
|
@ -15,6 +16,8 @@ Version 5.x
|
||||||
|
|
||||||
Version 4.5
|
Version 4.5
|
||||||
* 202?-??-??
|
* 202?-??-??
|
||||||
|
* New rig_get_conf2 to replace rig_get_conf buffer overflow potential
|
||||||
|
* New rot_get_conf2 to reaplce rot_get_conf buffer overflow potential
|
||||||
* Added Barrett 4050 -- not functional yet
|
* Added Barrett 4050 -- not functional yet
|
||||||
* Added TCI 1.X -- not functional yet
|
* Added TCI 1.X -- not functional yet
|
||||||
* Added TM-V71(A)
|
* Added TM-V71(A)
|
||||||
|
|
|
@ -2007,6 +2007,7 @@ struct rig_caps {
|
||||||
const unsigned char *frame);
|
const unsigned char *frame);
|
||||||
// this will be used to check rigcaps structure is compatible with client
|
// this will be used to check rigcaps structure is compatible with client
|
||||||
const char *hamlib_check_rig_caps; // a constant value we can check for hamlib integrity
|
const char *hamlib_check_rig_caps; // a constant value we can check for hamlib integrity
|
||||||
|
int (*get_conf2)(RIG *rig, token_t token, char *val, int val_len);
|
||||||
};
|
};
|
||||||
//! @endcond
|
//! @endcond
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,7 @@ const struct rig_caps icm710_caps =
|
||||||
.cfgparams = icm710_cfg_params,
|
.cfgparams = icm710_cfg_params,
|
||||||
.set_conf = icm710_set_conf,
|
.set_conf = icm710_set_conf,
|
||||||
.get_conf = icm710_get_conf,
|
.get_conf = icm710_get_conf,
|
||||||
|
.get_conf2 = icm710_get_conf2,
|
||||||
|
|
||||||
.priv = (void *)& icm710_priv_caps,
|
.priv = (void *)& icm710_priv_caps,
|
||||||
.rig_init = icm710_init,
|
.rig_init = icm710_init,
|
||||||
|
@ -356,7 +357,7 @@ int icm710_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int icm710_get_conf(RIG *rig, token_t token, char *val)
|
int icm710_get_conf2(RIG *rig, token_t token, char *val, int val_len)
|
||||||
{
|
{
|
||||||
struct icm710_priv_data *priv;
|
struct icm710_priv_data *priv;
|
||||||
|
|
||||||
|
@ -365,7 +366,7 @@ int icm710_get_conf(RIG *rig, token_t token, char *val)
|
||||||
switch (token)
|
switch (token)
|
||||||
{
|
{
|
||||||
case TOK_REMOTEID:
|
case TOK_REMOTEID:
|
||||||
sprintf(val, "%u", priv->remote_id);
|
snprintf(val, val_len, "%u", priv->remote_id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -375,6 +376,11 @@ int icm710_get_conf(RIG *rig, token_t token, char *val)
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int icm710_get_conf(RIG *rig, token_t token, char *val)
|
||||||
|
{
|
||||||
|
return icm710_get_conf2(rig, token, val, 128);
|
||||||
|
}
|
||||||
|
|
||||||
int icm710_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
int icm710_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||||
{
|
{
|
||||||
char freqbuf[BUFSZ];
|
char freqbuf[BUFSZ];
|
||||||
|
|
|
@ -77,6 +77,7 @@ int icm710_set_parm(RIG *rig, setting_t parm, value_t val);
|
||||||
int icm710_get_parm(RIG *rig, setting_t parm, value_t *val);
|
int icm710_get_parm(RIG *rig, setting_t parm, value_t *val);
|
||||||
int icm710_set_conf(RIG *rig, token_t token, const char *val);
|
int icm710_set_conf(RIG *rig, token_t token, const char *val);
|
||||||
int icm710_get_conf(RIG *rig, token_t token, char *val);
|
int icm710_get_conf(RIG *rig, token_t token, char *val);
|
||||||
|
int icm710_get_conf2(RIG *rig, token_t token, char *val, int val_len);
|
||||||
|
|
||||||
extern const struct rig_caps icm700pro_caps;
|
extern const struct rig_caps icm700pro_caps;
|
||||||
extern const struct rig_caps icm710_caps;
|
extern const struct rig_caps icm710_caps;
|
||||||
|
|
|
@ -209,7 +209,7 @@ int icmarine_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int icmarine_get_conf(RIG *rig, token_t token, char *val)
|
int icmarine_get_conf2(RIG *rig, token_t token, char *val, int val_len)
|
||||||
{
|
{
|
||||||
struct icmarine_priv_data *priv;
|
struct icmarine_priv_data *priv;
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ int icmarine_get_conf(RIG *rig, token_t token, char *val)
|
||||||
switch (token)
|
switch (token)
|
||||||
{
|
{
|
||||||
case TOK_REMOTEID:
|
case TOK_REMOTEID:
|
||||||
sprintf(val, "%u", priv->remote_id);
|
snprintf(val, val_len, "%u", priv->remote_id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -228,6 +228,11 @@ int icmarine_get_conf(RIG *rig, token_t token, char *val)
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int icmarine_get_conf(RIG *rig, token_t token, char *val)
|
||||||
|
{
|
||||||
|
return icmarine_get_conf2(rig, token, val, 128);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* icmarine_transaction
|
* icmarine_transaction
|
||||||
|
@ -363,7 +368,7 @@ int icmarine_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||||
|
|
||||||
priv = (struct icmarine_priv_data *)rig->state.priv;
|
priv = (struct icmarine_priv_data *)rig->state.priv;
|
||||||
|
|
||||||
sprintf(freqbuf, "%.6f", freq / MHz(1));
|
snprintf(freqbuf, sizeof(freqbuf), "%.6f", freq / MHz(1));
|
||||||
|
|
||||||
/* no error reporting upon TXFREQ failure */
|
/* no error reporting upon TXFREQ failure */
|
||||||
if (RIG_SPLIT_OFF == priv->split)
|
if (RIG_SPLIT_OFF == priv->split)
|
||||||
|
@ -417,7 +422,7 @@ int icmarine_set_tx_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s:\n", __func__);
|
rig_debug(RIG_DEBUG_TRACE, "%s:\n", __func__);
|
||||||
|
|
||||||
sprintf(freqbuf, "%.6f", freq / MHz(1));
|
snprintf(freqbuf, sizeof(freqbuf), "%.6f", freq / MHz(1));
|
||||||
|
|
||||||
return icmarine_transaction(rig, CMD_TXFREQ, freqbuf, NULL);
|
return icmarine_transaction(rig, CMD_TXFREQ, freqbuf, NULL);
|
||||||
}
|
}
|
||||||
|
@ -718,17 +723,17 @@ int icmarine_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
||||||
switch (level)
|
switch (level)
|
||||||
{
|
{
|
||||||
case RIG_LEVEL_AF:
|
case RIG_LEVEL_AF:
|
||||||
sprintf(lvlbuf, "%u", (unsigned)(val.f * 255));
|
snprintf(lvlbuf, sizeof(lvlbuf), "%u", (unsigned)(val.f * 255));
|
||||||
retval = icmarine_transaction(rig, CMD_AFGAIN, lvlbuf, NULL);
|
retval = icmarine_transaction(rig, CMD_AFGAIN, lvlbuf, NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RIG_LEVEL_RF:
|
case RIG_LEVEL_RF:
|
||||||
sprintf(lvlbuf, "%u", (unsigned)(val.f * 9));
|
snprintf(lvlbuf, sizeof(lvlbuf), "%u", (unsigned)(val.f * 9));
|
||||||
retval = icmarine_transaction(rig, CMD_RFGAIN, lvlbuf, NULL);
|
retval = icmarine_transaction(rig, CMD_RFGAIN, lvlbuf, NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RIG_LEVEL_RFPOWER:
|
case RIG_LEVEL_RFPOWER:
|
||||||
sprintf(lvlbuf, "%u", 1 + (unsigned)(val.f * 2));
|
snprintf(lvlbuf, sizeof(lvlbuf), "%u", 1 + (unsigned)(val.f * 2));
|
||||||
retval = icmarine_transaction(rig, CMD_RFPWR, lvlbuf, NULL);
|
retval = icmarine_transaction(rig, CMD_RFPWR, lvlbuf, NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,7 @@ int icmarine_set_parm(RIG *rig, setting_t parm, value_t val);
|
||||||
int icmarine_get_parm(RIG *rig, setting_t parm, value_t *val);
|
int icmarine_get_parm(RIG *rig, setting_t parm, value_t *val);
|
||||||
int icmarine_set_conf(RIG *rig, token_t token, const char *val);
|
int icmarine_set_conf(RIG *rig, token_t token, const char *val);
|
||||||
int icmarine_get_conf(RIG *rig, token_t token, char *val);
|
int icmarine_get_conf(RIG *rig, token_t token, char *val);
|
||||||
|
int icmarine_get_conf2(RIG *rig, token_t token, char *val, int val_len);
|
||||||
|
|
||||||
extern const struct rig_caps icm700pro_caps;
|
extern const struct rig_caps icm700pro_caps;
|
||||||
extern const struct rig_caps icm710_caps;
|
extern const struct rig_caps icm710_caps;
|
||||||
|
|
Ładowanie…
Reference in New Issue