Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3466
Modified Files:
Tag: desiredata
kernel.c
Log Message:
removed some MAXPDSTRING
Index: kernel.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/kernel.c,v
retrieving revision 1.1.2.66
retrieving revision 1.1.2.67
diff -C2 -d -r1.1.2.66 -r1.1.2.67
*** kernel.c 19 Jul 2007 17:54:50 -0000 1.1.2.66
--- kernel.c 19 Jul 2007 23:22:17 -0000 1.1.2.67
***************
*** 1800,1809 ****
t_atom *ap = z->v;
for (size_t i=0; i < z->n; i++, ap++) {
- char tbuf[MAXPDSTRING];
switch (ap->a_type) {
case A_FLOAT: break;
case A_SEMI: SETSYMBOL(ap, gensym(";")); break;
case A_COMMA: SETSYMBOL(ap, gensym(",")); break;
! case A_DOLLAR: sprintf(tbuf, "$%ld", ap->a_index); SETSYMBOL(ap, gensym(tbuf)); break;
case A_DOLLSYM: {
ostringstream b;
--- 1800,1808 ----
t_atom *ap = z->v;
for (size_t i=0; i < z->n; i++, ap++) {
switch (ap->a_type) {
case A_FLOAT: break;
case A_SEMI: SETSYMBOL(ap, gensym(";")); break;
case A_COMMA: SETSYMBOL(ap, gensym(",")); break;
! case A_DOLLAR: SETSYMBOL(ap, symprintf("$%ld", ap->a_index)); break;
case A_DOLLSYM: {
ostringstream b;
***************
*** 1927,1931 ****
ostringstream buf2;
char *str=s->name;
- int next=0;
t_atom dollarnull;
SETFLOAT(&dollarnull, canvas_getdollarzero());
--- 1926,1929 ----
***************
*** 1934,1943 ****
* and make everything a A_DOLLSYM that contains(!) a $ whenever this happened, enable this code */
char *substr=strchr(str, '$');
! if(!substr || substr-str >= MAXPDSTRING) return s;
oprintf(buf2,"%.*s",substr-str,str);
str=substr+1;
for (;;) {
std::ostringstream buf;
! next=binbuf_expanddollsym(str, buf, dollarnull, ac, av, tonew);
if (next<0) break;
/* JMZ: i am not sure what this means, so i might have broken it. it seems like that if "tonew" is
--- 1932,1941 ----
* and make everything a A_DOLLSYM that contains(!) a $ whenever this happened, enable this code */
char *substr=strchr(str, '$');
! if(!substr) return s;
oprintf(buf2,"%.*s",substr-str,str);
str=substr+1;
for (;;) {
std::ostringstream buf;
! int next = binbuf_expanddollsym(str, buf, dollarnull, ac, av, tonew);
if (next<0) break;
/* JMZ: i am not sure what this means, so i might have broken it. it seems like that if "tonew" is
***************
*** 2098,2109 ****
long length;
char *buf;
! char namebuf[MAXPDSTRING];
! if (*dirname) sprintf(namebuf,"%s/%s",dirname,filename);
! else sprintf(namebuf, "%s", filename);
int fd = binbuf_doopen(namebuf, 0);
if (fd < 0) {error("open: %s: %s",namebuf,strerror(errno)); return 1;}
if ((length = lseek(fd, 0, SEEK_END)) < 0 || lseek(fd, 0, SEEK_SET) < 0 || !(buf = (char *)malloc(length))) {
error("lseek: %s: %s",namebuf,strerror(errno));
! close(fd);
return 1;
}
--- 2096,2107 ----
long length;
char *buf;
! char *namebuf=0;
! if (*dirname) asprintf(&namebuf,"%s/%s",dirname,filename);
! else asprintf(&namebuf, "%s", filename);
int fd = binbuf_doopen(namebuf, 0);
if (fd < 0) {error("open: %s: %s",namebuf,strerror(errno)); return 1;}
if ((length = lseek(fd, 0, SEEK_END)) < 0 || lseek(fd, 0, SEEK_SET) < 0 || !(buf = (char *)malloc(length))) {
error("lseek: %s: %s",namebuf,strerror(errno));
! close(fd); free(namebuf);
return 1;
}
***************
*** 2111,2122 ****
if (readret < length) {
error("read (%d %ld) -> %d; %s: %s\n", fd, length, readret, namebuf, strerror(errno));
! close(fd);
! free(buf);
return 1;
}
if (flags&1) for (int i=0; i<length; i++) if (buf[i]=='\n') buf[i] = ';';
if (flags&2) pd_eval_text(buf,length); else binbuf_text(b, buf, length);
! free(buf);
! close(fd);
return 0;
}
--- 2109,2118 ----
if (readret < length) {
error("read (%d %ld) -> %d; %s: %s\n", fd, length, readret, namebuf, strerror(errno));
! close(fd); free(namebuf); free(buf);
return 1;
}
if (flags&1) for (int i=0; i<length; i++) if (buf[i]=='\n') buf[i] = ';';
if (flags&2) pd_eval_text(buf,length); else binbuf_text(b, buf, length);
! close(fd); free(namebuf); free(buf);
return 0;
}
***************
*** 2125,2132 ****
int binbuf_read_via_canvas(t_binbuf *b, char *filename, t_canvas *canvas, int flags) {
char *buf, *bufptr;
! int filedesc = canvas_open2(canvas, filename, "", &buf, &bufptr, 0);
! if (filedesc<0) {error("%s: can't open", filename); return 1;}
! close(filedesc);
! free(buf);
return !!binbuf_read(b, bufptr, buf, flags);
}
--- 2121,2127 ----
int binbuf_read_via_canvas(t_binbuf *b, char *filename, t_canvas *canvas, int flags) {
char *buf, *bufptr;
! int fd = canvas_open2(canvas, filename, "", &buf, &bufptr, 0);
! if (fd<0) {error("%s: can't open", filename); return 1;}
! close(fd); free(buf);
return !!binbuf_read(b, bufptr, buf, flags);
}
***************
*** 2135,2141 ****
int binbuf_read_via_path(t_binbuf *b, char *filename, char *dirname, int flags) {
char buf[MAXPDSTRING], *bufptr;
! int filedesc = open_via_path(dirname, filename, "", buf, &bufptr, MAXPDSTRING, 0);
! if (filedesc<0) {error("%s: can't open", filename); return 1;}
! close(filedesc);
return !!binbuf_read(b, bufptr, buf, flags);
}
--- 2130,2136 ----
int binbuf_read_via_path(t_binbuf *b, char *filename, char *dirname, int flags) {
char buf[MAXPDSTRING], *bufptr;
! int fd = open_via_path(dirname, filename, "", buf, &bufptr, MAXPDSTRING, 0);
! if (fd<0) {error("%s: can't open", filename); return 1;}
! close(fd);
return !!binbuf_read(b, bufptr, buf, flags);
}