From 17c345d5cc8afcd85361e46c784fec1ef9ed1bd2 Mon Sep 17 00:00:00 2001 From: Ivica Ico Bukvic <ico@vt.edu> Date: Tue, 2 Sep 2014 17:43:50 -0400 Subject: [PATCH] *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. --- pd/src/m_binbuf.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pd/src/m_binbuf.c b/pd/src/m_binbuf.c index d0e2c82c9..66d7612a5 100644 --- a/pd/src/m_binbuf.c +++ b/pd/src/m_binbuf.c @@ -247,20 +247,27 @@ void binbuf_gettext(t_binbuf *x, char **bufp, int *lengthp) char string[MAXPDSTRING]; t_atom *ap; int indx; + int newlength; 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) && - length && buf[length-1] == ' ') length--; + length && buf[length-1] == ' ') + { + //fprintf(stderr, "subtracting length\n"); + length--; + } atom_string(ap, string, MAXPDSTRING); newlength = length + strlen(string) + 1; if (!(newbuf = resizebytes(buf, length, newlength))) break; buf = newbuf; + //fprintf(stderr,"string=<%s> buf=<%s> length=%d\n", string, buf, length); strcpy(buf + length, string); length = newlength; if (ap->a_type == A_SEMI) buf[length-1] = '\n'; else buf[length-1] = ' '; + //if (ap->a_type == A_COMMA) length--; } if (length && buf[length-1] == ' ') { -- GitLab