Skip to content
Snippets Groups Projects
Commit 681e32e4 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

fix regression where Pd would eat the first character of a symbol if the...

fix regression where Pd would eat the first character of a symbol if the symbol contained a double quote.
parent dc9cb0ba
No related branches found
No related tags found
No related merge requests found
...@@ -760,11 +760,14 @@ void sys_gui(const char *s) ...@@ -760,11 +760,14 @@ void sys_gui(const char *s)
static void escape_double_quotes(const char *src) { static void escape_double_quotes(const char *src) {
int dq = 0, len = 0; int dq = 0, len = 0;
const char *s = src; const char *s = src;
while(*s++) while(*s)
{ {
len++; len++;
if (*s == '\"') if (*s == '\"')
{
dq++; dq++;
}
s++;
} }
if (!dq) if (!dq)
sys_vgui("\"%s\"", src); sys_vgui("\"%s\"", src);
...@@ -773,7 +776,7 @@ static void escape_double_quotes(const char *src) { ...@@ -773,7 +776,7 @@ static void escape_double_quotes(const char *src) {
char *dest = (char *)t_getbytes((len+dq+1)*sizeof(*dest)); char *dest = (char *)t_getbytes((len+dq+1)*sizeof(*dest));
char *tmp = dest; char *tmp = dest;
s = src; s = src;
while(*s++) while(*s)
{ {
if (*s == '\"') if (*s == '\"')
{ {
...@@ -781,7 +784,10 @@ static void escape_double_quotes(const char *src) { ...@@ -781,7 +784,10 @@ static void escape_double_quotes(const char *src) {
*tmp++ = '\"'; *tmp++ = '\"';
} }
else else
{
*tmp++ = *s; *tmp++ = *s;
}
s++;
} }
*tmp = '\0'; /* null terminate */ *tmp = '\0'; /* null terminate */
sys_vgui("\"%s\"", dest); sys_vgui("\"%s\"", dest);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment