diff options
Diffstat (limited to 'pd/src/g_all_guis.c')
-rw-r--r-- | pd/src/g_all_guis.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/pd/src/g_all_guis.c b/pd/src/g_all_guis.c index 4f82bec0..2d18f480 100644 --- a/pd/src/g_all_guis.c +++ b/pd/src/g_all_guis.c @@ -147,30 +147,34 @@ int iemgui_modulo_color(int col) return(col); } -t_symbol *iemgui_raute2dollar(t_symbol *s) +t_symbol *iemgui_dollar2raute(t_symbol *s) { - if (s->s_name[0] == '#') + char buf[MAXPDSTRING+1], *s1, *s2; + if (strlen(s->s_name) >= MAXPDSTRING) + return (s); + for (s1 = s->s_name, s2 = buf; ; s1++, s2++) { - char buf[MAXPDSTRING]; - strncpy(buf, s->s_name, MAXPDSTRING); - buf[MAXPDSTRING-1] = 0; - buf[0] = '$'; - return (gensym(buf)); + if (*s1 == '$') + *s2 = '#'; + else if (!(*s2 = *s1)) + break; } - else return (s); + return(gensym(buf)); } -t_symbol *iemgui_dollar2raute(t_symbol *s) +t_symbol *iemgui_raute2dollar(t_symbol *s) { - if (s->s_name[0] == '$') + char buf[MAXPDSTRING+1], *s1, *s2; + if (strlen(s->s_name) >= MAXPDSTRING) + return (s); + for (s1 = s->s_name, s2 = buf; ; s1++, s2++) { - char buf[MAXPDSTRING]; - strncpy(buf, s->s_name, MAXPDSTRING); - buf[MAXPDSTRING-1] = 0; - buf[0] = '#'; - return (gensym(buf)); + if (*s1 == '#') + *s2 = '$'; + else if (!(*s2 = *s1)) + break; } - else return (s); + return(gensym(buf)); } void iemgui_verify_snd_ne_rcv(t_iemgui *iemgui) |