diff --git a/pd/src/s_inter.c b/pd/src/s_inter.c index 6074974e22436a3065370cbe99439c0a21bb0bc3..a2e2efc13cbc55ff743d1eccd0e47191579ca73d 100644 --- a/pd/src/s_inter.c +++ b/pd/src/s_inter.c @@ -760,11 +760,14 @@ void sys_gui(const char *s) static void escape_double_quotes(const char *src) { int dq = 0, len = 0; const char *s = src; - while(*s++) + while(*s) { len++; if (*s == '\"') + { dq++; + } + s++; } if (!dq) sys_vgui("\"%s\"", src); @@ -773,7 +776,7 @@ static void escape_double_quotes(const char *src) { char *dest = (char *)t_getbytes((len+dq+1)*sizeof(*dest)); char *tmp = dest; s = src; - while(*s++) + while(*s) { if (*s == '\"') { @@ -781,7 +784,10 @@ static void escape_double_quotes(const char *src) { *tmp++ = '\"'; } else + { *tmp++ = *s; + } + s++; } *tmp = '\0'; /* null terminate */ sys_vgui("\"%s\"", dest);