Skip to content
Snippets Groups Projects
Commit 17c345d5 authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

*started cleaning up addbinbuf--it seems like comment object will need to be...

*started cleaning up addbinbuf--it seems like comment object will need to be treated differently from others as commas, semis, and other reserved characters have unexpected behaviors.
parent b0a1f0bb
No related branches found
No related tags found
No related merge requests found
...@@ -247,20 +247,27 @@ void binbuf_gettext(t_binbuf *x, char **bufp, int *lengthp) ...@@ -247,20 +247,27 @@ void binbuf_gettext(t_binbuf *x, char **bufp, int *lengthp)
char string[MAXPDSTRING]; char string[MAXPDSTRING];
t_atom *ap; t_atom *ap;
int indx; int indx;
int newlength;
for (ap = x->b_vec, indx = x->b_n; indx--; ap++) for (ap = x->b_vec, indx = x->b_n; indx--; ap++)
{ {
int newlength; //fprintf(stderr,"=====\n");
if ((ap->a_type == A_SEMI || ap->a_type == A_COMMA) && if ((ap->a_type == A_SEMI || ap->a_type == A_COMMA) &&
length && buf[length-1] == ' ') length--; length && buf[length-1] == ' ')
{
//fprintf(stderr, "subtracting length\n");
length--;
}
atom_string(ap, string, MAXPDSTRING); atom_string(ap, string, MAXPDSTRING);
newlength = length + strlen(string) + 1; newlength = length + strlen(string) + 1;
if (!(newbuf = resizebytes(buf, length, newlength))) break; if (!(newbuf = resizebytes(buf, length, newlength))) break;
buf = newbuf; buf = newbuf;
//fprintf(stderr,"string=<%s> buf=<%s> length=%d\n", string, buf, length);
strcpy(buf + length, string); strcpy(buf + length, string);
length = newlength; length = newlength;
if (ap->a_type == A_SEMI) buf[length-1] = '\n'; if (ap->a_type == A_SEMI) buf[length-1] = '\n';
else buf[length-1] = ' '; else buf[length-1] = ' ';
//if (ap->a_type == A_COMMA) length--;
} }
if (length && buf[length-1] == ' ') if (length && buf[length-1] == ' ')
{ {
......
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