diff --git a/.vscode/.server-controller-port.log b/.vscode/.server-controller-port.log index 4af0d03..2b25154 100644 --- a/.vscode/.server-controller-port.log +++ b/.vscode/.server-controller-port.log @@ -1,5 +1,5 @@ { "port": 13452, - "time": 1742842630343, + "time": 1742904021409, "version": "0.0.3" } \ No newline at end of file diff --git a/src/ascii_cmd.c b/src/ascii_cmd.c index c3008d9..b3363a2 100644 --- a/src/ascii_cmd.c +++ b/src/ascii_cmd.c @@ -18,25 +18,25 @@ typedef struct { static void handle_ptyn(char *arg, RDSModulator* mod, char* output) { arg[PTYN_LENGTH] = 0; - set_rds_ptyn(mod->enc, xlat(arg)); + set_rds_ptyn(mod->enc, convert_to_rds_charset(arg)); strcpy(output, "+\0"); } static void handle_tps(char *arg, RDSModulator* mod, char* output) { arg[PS_LENGTH * 2] = 0; - set_rds_tps(mod->enc, xlat(arg)); + set_rds_tps(mod->enc, convert_to_rds_charset(arg)); strcpy(output, "+\0"); } static void handle_rt1(char *arg, RDSModulator* mod, char* output) { arg[RT_LENGTH * 2] = 0; - set_rds_rt1(mod->enc, xlat(arg)); + set_rds_rt1(mod->enc, convert_to_rds_charset(arg)); strcpy(output, "+\0"); } static void handle_rt2(char *arg, RDSModulator* mod, char* output) { arg[RT_LENGTH * 2] = 0; - set_rds_rt2(mod->enc, xlat(arg)); + set_rds_rt2(mod->enc, convert_to_rds_charset(arg)); strcpy(output, "+\0"); } @@ -69,7 +69,7 @@ static void handle_lps(char *arg, RDSModulator* mod, char* output) { static void handle_ps(char *arg, RDSModulator* mod, char* output) { arg[PS_LENGTH * 2] = 0; - set_rds_ps(mod->enc, xlat(arg)); + set_rds_ps(mod->enc, convert_to_rds_charset(arg)); strcpy(output, "+\0"); } diff --git a/src/lib.c b/src/lib.c index f4a851c..84b2202 100644 --- a/src/lib.c +++ b/src/lib.c @@ -86,12 +86,11 @@ uint8_t add_rds_af(RDSAFs *af_list, float freq) { return 0; } -#define XLATSTRLEN 255 -char *xlat(char *str) { - static char new_str[XLATSTRLEN]; +char *convert_to_rds_charset(char *str) { + static char new_str[255]; uint8_t i = 0; - while (*str != 0 && i < XLATSTRLEN) { + while (*str != 0 && i < 255) { switch (*str) { case 0xc2: str++; diff --git a/src/lib.h b/src/lib.h index 4d74bd5..65f7159 100644 --- a/src/lib.h +++ b/src/lib.h @@ -4,4 +4,4 @@ extern int _strnlen(const char *s, int maxlen); extern void add_checkwords(uint16_t *blocks, uint8_t *bits, uint8_t stream); extern uint8_t add_rds_af(RDSAFs *af_list, float freq); -extern char *xlat(char *str); \ No newline at end of file +extern char *convert_to_rds_charset(char *str); \ No newline at end of file