kopia lustrzana https://github.com/Hamlib/Hamlib
Deprecate rig_get_conf()
Define macro to set attribute, if compiler is capable Add macro to rig_get_conf(), Rig::getConf() declarations Fix internal uses of rig_get_conf()pull/1818/head
rodzic
6c372f981f
commit
20eeb96787
|
@ -87,11 +87,19 @@ void Rig::setConf(const char *name, const char *val)
|
|||
|
||||
void Rig::getConf(hamlib_token_t token, char *val)
|
||||
{
|
||||
CHECK_RIG( rig_get_conf(theRig, token, val) );
|
||||
CHECK_RIG( rig_get_conf2(theRig, token, val, 128) );
|
||||
}
|
||||
void Rig::getConf(const char *name, char *val)
|
||||
{
|
||||
CHECK_RIG( rig_get_conf(theRig, tokenLookup(name), val) );
|
||||
CHECK_RIG( rig_get_conf2(theRig, tokenLookup(name), val, 128) );
|
||||
}
|
||||
void Rig::getConf2(hamlib_token_t token, char *val, int val_len)
|
||||
{
|
||||
CHECK_RIG( rig_get_conf2(theRig, token, val, val_len) );
|
||||
}
|
||||
void Rig::getConf2(const char *name, char *val, int val_len)
|
||||
{
|
||||
CHECK_RIG( rig_get_conf2(theRig, tokenLookup(name), val, val_len) );
|
||||
}
|
||||
|
||||
hamlib_token_t Rig::tokenLookup(const char *name)
|
||||
|
|
|
@ -86,10 +86,18 @@
|
|||
#if __has_c_attribute(fallthrough)
|
||||
#define HL_FALLTHROUGH [[fallthrough]];
|
||||
#else
|
||||
/* Fall back */
|
||||
/* Fall back to nothing */
|
||||
#define HL_FALLTHROUGH
|
||||
#endif
|
||||
|
||||
// Macro to mark function or variable as deprecated/obsolete
|
||||
#if __has_c_attribute(deprecated)
|
||||
#define HL_DEPRECATED [[deprecated]]
|
||||
#else
|
||||
// Make it vanish
|
||||
#define HL_DEPRECATED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup rig
|
||||
* @{
|
||||
|
@ -2959,7 +2967,7 @@ rig_set_conf HAMLIB_PARAMS((RIG *rig,
|
|||
hamlib_token_t token,
|
||||
const char *val));
|
||||
// deprecating rig_get_conf
|
||||
extern HAMLIB_EXPORT(int)
|
||||
HL_DEPRECATED extern HAMLIB_EXPORT(int)
|
||||
rig_get_conf HAMLIB_PARAMS((RIG *rig,
|
||||
hamlib_token_t token,
|
||||
char *val));
|
||||
|
|
|
@ -56,8 +56,10 @@ public:
|
|||
|
||||
void setConf(hamlib_token_t token, const char *val);
|
||||
void setConf(const char *name, const char *val);
|
||||
void getConf(hamlib_token_t token, char *val);
|
||||
void getConf(const char *name, char *val);
|
||||
HL_DEPRECATED void getConf(hamlib_token_t token, char *val);
|
||||
HL_DEPRECATED void getConf(const char *name, char *val);
|
||||
void getConf2(hamlib_token_t token, char *val, int val_len);
|
||||
void getConf2(const char *name, char *val, int val_len);
|
||||
hamlib_token_t tokenLookup(const char *name);
|
||||
|
||||
void setFreq(freq_t freq, vfo_t vfo = RIG_VFO_CURR);
|
||||
|
|
|
@ -462,7 +462,7 @@ static int dttsp_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_le
|
|||
/* if it's not for the dttsp backend, maybe it's for the tuner */
|
||||
if (priv->tuner)
|
||||
{
|
||||
return rig_get_conf(priv->tuner, token, val);
|
||||
return rig_get_conf2(priv->tuner, token, val, val_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2014,7 +2014,7 @@ int print_conf_list(const struct confparams *cfp, rig_ptr_t data)
|
|||
int i;
|
||||
char buf[128] = "";
|
||||
|
||||
rig_get_conf(rig, cfp->token, buf);
|
||||
rig_get_conf2(rig, cfp->token, buf, sizeof(buf));
|
||||
printf("%s: \"%s\"\n" "\t" "Default: %s, Value: %s\n",
|
||||
cfp->name,
|
||||
cfp->tooltip,
|
||||
|
@ -2078,7 +2078,7 @@ int print_conf_list2(const struct confparams *cfp, rig_ptr_t data)
|
|||
RIG *rig = (RIG *) data;
|
||||
char buf[128] = "";
|
||||
|
||||
rig_get_conf(rig, cfp->token, buf);
|
||||
rig_get_conf2(rig, cfp->token, buf, sizeof(buf));
|
||||
fprintf(stdout, "%s: \"%s\"\n" "\t" "Default: %s, Value: %s\n",
|
||||
cfp->name,
|
||||
cfp->tooltip,
|
||||
|
@ -6025,7 +6025,7 @@ declare_proto_rig(get_conf)
|
|||
else
|
||||
{
|
||||
char value[4096]; // no max value known -- should we limit it?
|
||||
ret = rig_get_conf(rig, mytoken, value);
|
||||
ret = rig_get_conf2(rig, mytoken, value, sizeof(value));
|
||||
|
||||
if (ret != RIG_OK)
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue