diff --git a/c++/rotclass.cc b/c++/rotclass.cc index daa47b711..ec18813f6 100644 --- a/c++/rotclass.cc +++ b/c++/rotclass.cc @@ -73,13 +73,21 @@ void Rotator::setConf(const char *name, const char *val) CHECK_ROT( rot_set_conf(theRot, tokenLookup(name), val) ); } -void Rotator::getConf(hamlib_token_t token, char *val) +HL_DEPRECATED void Rotator::getConf(hamlib_token_t token, char *val) { - CHECK_ROT( rot_get_conf(theRot, token, val) ); + CHECK_ROT( rot_get_conf2(theRot, token, val, 128) ); } -void Rotator::getConf(const char *name, char *val) +HL_DEPRECATED void Rotator::getConf(const char *name, char *val) { - CHECK_ROT( rot_get_conf(theRot, tokenLookup(name), val) ); + CHECK_ROT( rot_get_conf2(theRot, tokenLookup(name), val, 128) ); +} +void Rotator::getConf2(hamlib_token_t token, char *val, int val_len) +{ + CHECK_ROT( rot_get_conf2(theRot, token, val, val_len) ); +} +void Rotator::getConf2(const char *name, char *val, int val_len) +{ + CHECK_ROT( rot_get_conf2(theRot, tokenLookup(name), val, val_len) ); } hamlib_token_t Rotator::tokenLookup(const char *name) diff --git a/include/hamlib/rotator.h b/include/hamlib/rotator.h index a2f8283ee..88de79fd1 100644 --- a/include/hamlib/rotator.h +++ b/include/hamlib/rotator.h @@ -613,7 +613,7 @@ extern HAMLIB_EXPORT(int) rot_set_conf HAMLIB_PARAMS((ROT *rot, hamlib_token_t token, const char *val)); -extern HAMLIB_EXPORT(int) +HL_DEPRECATED extern HAMLIB_EXPORT(int) rot_get_conf HAMLIB_PARAMS((ROT *rot, hamlib_token_t token, char *val)); diff --git a/include/hamlib/rotclass.h b/include/hamlib/rotclass.h index 219e3a92f..5526f984c 100644 --- a/include/hamlib/rotclass.h +++ b/include/hamlib/rotclass.h @@ -55,6 +55,8 @@ public: void setConf(const char *name, const char *val); void getConf(hamlib_token_t token, char *val); void getConf(const char *name, char *val); + void getConf2(hamlib_token_t token, char *val, int len); + void getConf2(const char *name, char *val, int len); hamlib_token_t tokenLookup(const char *name); void setPosition(azimuth_t az, elevation_t el); diff --git a/rotators/grbltrk/grbltrk.c b/rotators/grbltrk/grbltrk.c index a1f024f78..b207f6a64 100644 --- a/rotators/grbltrk/grbltrk.c +++ b/rotators/grbltrk/grbltrk.c @@ -488,7 +488,7 @@ grbltrk_rot_open(ROT *rot) } else if (rot->caps->rot_model == ROT_MODEL_GRBLTRK_NET) { - rot_get_conf(rot, TOK_PATHNAME, host); + rot_get_conf2(rot, TOK_PATHNAME, host, sizeof(host)); rot_debug(RIG_DEBUG_ERR, "%s:%d ctrl via net, host [%s]\n", __func__, __LINE__, host); grbl_net_open(rot, 23); diff --git a/tests/rotctl_parse.c b/tests/rotctl_parse.c index ec4ed85b6..09b27c56f 100644 --- a/tests/rotctl_parse.c +++ b/tests/rotctl_parse.c @@ -1698,7 +1698,7 @@ declare_proto_rot(get_conf) else { char value[4096]; - ret = rot_get_conf(rot, rot_token_lookup(rot, arg1), value); + ret = rot_get_conf2(rot, rot_token_lookup(rot, arg1), value, sizeof(value)); if (ret != RIG_OK) { @@ -2917,7 +2917,7 @@ int print_conf_list2(const struct confparams *cfp, rig_ptr_t data, FILE *fout) ROT *rot = (ROT *) data; char buf[128] = ""; - rot_get_conf(rot, cfp->token, buf); + rot_get_conf2(rot, cfp->token, buf, sizeof(buf)); fprintf(fout, "%s: \"%s\"\n" "\t" "Default: %s, Value: %s\n", cfp->name, cfp->tooltip,