Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29512
Modified Files: Tag: desiredata desire.c Log Message: removed a few MAXPDSTRING again
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.217.2.158 retrieving revision 1.1.2.217.2.159 diff -C2 -d -r1.1.2.217.2.158 -r1.1.2.217.2.159 *** desire.c 14 Jul 2007 12:58:16 -0000 1.1.2.217.2.158 --- desire.c 17 Jul 2007 22:57:13 -0000 1.1.2.217.2.159 *************** *** 14,18 **** */
- #define PD_PLUSPLUS_FACE #include "m_pd.h" --- 14,17 ---- *************** *** 688,693 **** static void canvas_menu_open(t_canvas *x) { if (canvas_isvisible(x) && !canvas_istoplevel(x)) { ! t_canvas *gl2 = x->owner; ! if (!gl2) pd_error(x,"can't open a non-subcanvas"); else SET(havewindow,1); } --- 687,691 ---- static void canvas_menu_open(t_canvas *x) { if (canvas_isvisible(x) && !canvas_istoplevel(x)) { ! if (!x->owner) pd_error(x,"can't open a non-subcanvas"); else SET(havewindow,1); } *************** *** 1285,1294 **** starting with '$' (because the Pd message interpreter would change them!) */ static t_symbol *sharptodollar(t_symbol *s) { - char buf[MAXPDSTRING]; if (*s->name != '#') return s; ! strncpy(buf, s->name, MAXPDSTRING); ! buf[MAXPDSTRING-1] = 0; ! buf[0] = '$'; ! return gensym(buf); }
--- 1283,1288 ---- starting with '$' (because the Pd message interpreter would change them!) */ static t_symbol *sharptodollar(t_symbol *s) { if (*s->name != '#') return s; ! return symsprintf("$%s",s->name+1); }
*************** *** 4049,4053 ****
static void slot_setfloat_var(t_slot *fd, t_symbol *s) { ! char *s1, *s2, *s3, strbuf[MAXPDSTRING]; fd->type = A_FLOAT; fd->var = 1; --- 4043,4047 ----
static void slot_setfloat_var(t_slot *fd, t_symbol *s) { ! char *s1, *s2, *s3; fd->type = A_FLOAT; fd->var = 1; *************** *** 4056,4064 **** fd->min = fd->max = fd->scrmin = fd->scrmax = fd->quantum = 0; } else { ! long cpy = (int)min((long)(s1-s->name),(long)(MAXPDSTRING-5)), got; ! strncpy(strbuf, s->name, cpy); ! strbuf[cpy] = 0; ! fd->varsym = gensym(strbuf); ! got = sscanf(s1, "(%f:%f)(%f:%f)(%f)", &fd->min, &fd->max, &fd->scrmin, &fd->scrmax, &fd->quantum); if (got < 2) goto fail; if (got == 3 || (got < 4 && strchr(s2, '('))) goto fail; --- 4050,4055 ---- fd->min = fd->max = fd->scrmin = fd->scrmax = fd->quantum = 0; } else { ! fd->varsym = symsprintf("%.*s",s1-s->name,s->name); ! t_int got = sscanf(s1, "(%f:%f)(%f:%f)(%f)", &fd->min, &fd->max, &fd->scrmin, &fd->scrmax, &fd->quantum); if (got < 2) goto fail; if (got == 3 || (got < 4 && strchr(s2, '('))) goto fail; *************** *** 6942,6946 **** #endif for (int i=0; i<argc; i++) { ! char strbuf[MAXPDSTRING]; char *flag = atom_getsymbolarg(i, argc, argv)->name; if ((argc > i+1) && !strcmp(flag, "-path")) { --- 6933,6937 ---- #endif for (int i=0; i<argc; i++) { ! char *buf; char *flag = atom_getsymbolarg(i, argc, argv)->name; if ((argc > i+1) && !strcmp(flag, "-path")) { *************** *** 6948,6966 **** i++; } else if (argc>i+1 && !strcmp(flag, "-stdpath")) { ! sprintf(strbuf, "%*s/", MAXPDSTRING-3, sys_libdir->name); ! strncpy(strbuf, atom_getsymbolarg(i+1, argc, argv)->name, MAXPDSTRING-strlen(strbuf)); ! strbuf[MAXPDSTRING-1] = 0; ! e->path = namelist_append(e->path, strbuf, 0); i++; } else if (argc>i+1 && !strcmp(flag, "-lib")) { - /* pd_error(x, "not implemented for now, ask matju"); */ sys_load_lib(x, atom_getsymbolarg(i+1, argc, argv)->name); i++; } else if (argc>i+1 && !strcmp(flag, "-stdlib")) { ! sprintf(strbuf, "%*s/", MAXPDSTRING-3, sys_libdir->name); ! strncpy(strbuf, atom_getsymbolarg(i+1, argc, argv)->name, MAXPDSTRING-strlen(strbuf)); ! strbuf[MAXPDSTRING-1] = 0; ! /* pd_error(x, "not implemented for now, ask matju"); */ ! sys_load_lib(0, strbuf); i++; } else post("declare: %s: unknown declaration", flag); --- 6939,6951 ---- i++; } else if (argc>i+1 && !strcmp(flag, "-stdpath")) { ! asprintf(&buf, "%s/%s", sys_libdir->name, atom_getsymbolarg(i+1, argc, argv)->name); ! e->path = namelist_append(e->path,buf,0); i++; } else if (argc>i+1 && !strcmp(flag, "-lib")) { sys_load_lib(x, atom_getsymbolarg(i+1, argc, argv)->name); i++; } else if (argc>i+1 && !strcmp(flag, "-stdlib")) { ! asprintf(&buf, "%s/%s", sys_libdir->name, atom_getsymbolarg(i+1, argc, argv)->name); ! sys_load_lib(0,buf); i++; } else post("declare: %s: unknown declaration", flag); *************** *** 6987,6994 **** const char *dir = x2 ? canvas_getdir(x2)->name : "."; for (t_namelist *nl = y->env->path; nl; nl = nl->nl_next) { ! char realname[MAXPDSTRING]; ! sprintf(realname, "%*s/", MAXPDSTRING-3, dir); ! strncat(realname, nl->nl_string, MAXPDSTRING-strlen(realname)); ! realname[MAXPDSTRING-1] = 0; if ((fd = sys_trytoopenone(realname, name, ext, dirresult, nameresult, size, bin)) >= 0) return fd; } --- 6972,6977 ---- const char *dir = x2 ? canvas_getdir(x2)->name : "."; for (t_namelist *nl = y->env->path; nl; nl = nl->nl_next) { ! char *realname; ! asprintf(&realname, "%s/%s", dir, nl->nl_string); if ((fd = sys_trytoopenone(realname, name, ext, dirresult, nameresult, size, bin)) >= 0) return fd; } *************** *** 7536,7547 ****
void error(const char *fmt, ...) { ! char buf[MAXPDSTRING]; va_list ap; dopost("error: "); ! va_start(ap, fmt); ! vsnprintf(buf, MAXPDSTRING-1, fmt, ap); va_end(ap); strcat(buf, "\n"); dopost(buf); }
--- 7519,7531 ----
void error(const char *fmt, ...) { ! char *buf; va_list ap; dopost("error: "); ! va_start(ap,fmt); ! vasprintf(&buf,fmt,ap); va_end(ap); strcat(buf, "\n"); dopost(buf); + free(buf); }