From b55306a87afdb659d05bf2b89ab18fd3a815ca76 Mon Sep 17 00:00:00 2001 From: Jonathan Wilkes <jon.w.wilkes@gmail.com> Date: Sat, 1 Aug 2020 00:20:10 -0400 Subject: [PATCH] quick bugfix to remove unnecessary complexity that caused memory error --- pd/src/g_all_guis.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/pd/src/g_all_guis.c b/pd/src/g_all_guis.c index d3c483905..7830086e6 100644 --- a/pd/src/g_all_guis.c +++ b/pd/src/g_all_guis.c @@ -190,15 +190,6 @@ void iemgui_all_col2save(t_iemgui *x, t_symbol **bflcol) bflcol[2] = color2symbol(x->x_lcol); } -static void expand_shorthex(char *source, char *doubled) -{ - while(*source) - { - *doubled++ = *source; - *doubled++ = *source++; - } -} - static int iemgui_getcolorarg(t_iemgui *x, int index, int argc, t_atom *argv) { char *classname; @@ -215,11 +206,14 @@ static int iemgui_getcolorarg(t_iemgui *x, int index, int argc, t_atom *argv) if ('#' == s->s_name[0]) { char *start = s->s_name + 1, *end; - char expanded[6]; + char expanded[7]; int len = strlen(start); if (len == 3) { - expand_shorthex(start, expanded); + sprintf(expanded, "%c%c%c%c%c%c", + start[0], start[0], + start[1], start[1], + start[2], start[2]); start = expanded; len = 6; } -- GitLab