diff --git a/c++/rigclass.cc b/c++/rigclass.cc index 218058ea0..db473e2f1 100644 --- a/c++/rigclass.cc +++ b/c++/rigclass.cc @@ -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) diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 3441a162b..7c79443a7 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -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)); diff --git a/include/hamlib/rigclass.h b/include/hamlib/rigclass.h index 23b4738fd..6a0e428ff 100644 --- a/include/hamlib/rigclass.h +++ b/include/hamlib/rigclass.h @@ -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); diff --git a/rigs/flexradio/dttsp.c b/rigs/flexradio/dttsp.c index 2a24b70f1..24ca388fb 100644 --- a/rigs/flexradio/dttsp.c +++ b/rigs/flexradio/dttsp.c @@ -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 { diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index d650a2b9b..4db850e87 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -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) {