Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13399
Modified Files: Tag: desiredata kernel.c Log Message: removed alternative_classname and shortened a_w.w_index to a_index
Index: kernel.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/kernel.c,v retrieving revision 1.1.2.56 retrieving revision 1.1.2.57 diff -C2 -d -r1.1.2.56 -r1.1.2.57 *** kernel.c 17 Jul 2007 23:54:55 -0000 1.1.2.56 --- kernel.c 18 Jul 2007 03:57:00 -0000 1.1.2.57 *************** *** 32,35 **** --- 32,36 ---- #define a_symbol a_w.w_symbol #define a_gpointer a_w.w_gpointer + #define a_index a_w.w_index
/* T.Grill - bit alignment for signal vectors (must be a multiple of 8!) */ *************** *** 287,291 **** } } break; ! case A_DOLLAR: sprintf(buf, "$%ld", a->a_w.w_index); break; case A_DOLLSYM: strncpy(buf, a->a_symbol->name, bufsize); buf[bufsize-1] = 0; break; default: bug("atom_string"); --- 288,292 ---- } } break; ! case A_DOLLAR: sprintf(buf, "$%ld", a->a_index); break; case A_DOLLSYM: strncpy(buf, a->a_symbol->name, bufsize); buf[bufsize-1] = 0; break; default: bug("atom_string"); *************** *** 1311,1340 **** int pd_setloadingabstraction(t_symbol *sym);
- /* replace everything but [a-zA-Z0-9_] by "0x%x" */ - /* BUG: buffer overflow */ - static char *alternative_classname(char *classname) { - char *altname=(char*)malloc(sizeof(char)*MAXPDSTRING); - int count=0; - int i=0; - for(i=0; i<MAXPDSTRING; i++) altname[i]=0; - i=0; - while(*classname) { - char c=*classname; - if((c>=48 && c<=57) || (c>=65 && c<=90) || (c>=97 && c<=122) || c==95) { - altname[i]=c; - i++; - } else { - sprintf(altname+i, "0x%02x", c); - i+=4; - count++; - } - classname++; - } - if(count>0) return altname; - free(altname); - return 0; - } - - /* this routine is called when a new "object" is requested whose class Pd doesn't know. Pd tries to load it as an extern, then as an abstraction. */ --- 1312,1315 ---- *************** *** 1843,1847 **** case A_SEMI: SETSYMBOL(ap, gensym(";")); break; case A_COMMA: SETSYMBOL(ap, gensym(",")); break; ! case A_DOLLAR: sprintf(tbuf, "$%ld", ap->a_w.w_index); SETSYMBOL(ap, gensym(tbuf)); break; case A_DOLLSYM: atom_string(ap, tbuf, MAXPDSTRING); SETSYMBOL(ap, gensym(tbuf)); break; case A_SYMBOL: --- 1818,1822 ---- 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: atom_string(ap, tbuf, MAXPDSTRING); SETSYMBOL(ap, gensym(tbuf)); break; case A_SYMBOL: *************** *** 2011,2021 **** if (!ac) break; if (at->a_type == A_DOLLAR) { ! if (at->a_w.w_index <= 0 || at->a_w.w_index > argc) { ! error("$%d: not enough arguments supplied", at->a_w.w_index); goto cleanup; ! } else if (argv[at->a_w.w_index-1].a_type != A_SYMBOL) { ! error("$%d: symbol needed as message destination", at->a_w.w_index); goto cleanup; ! } else s = argv[at->a_w.w_index-1].a_symbol; } else if (at->a_type == A_DOLLSYM) { s = binbuf_realizedollsym(at->a_symbol, argc, argv, 0); --- 1986,1996 ---- if (!ac) break; if (at->a_type == A_DOLLAR) { ! if (at->a_index <= 0 || at->a_index > argc) { ! error("$%d: not enough arguments supplied", at->a_index); goto cleanup; ! } else if (argv[at->a_index-1].a_type != A_SYMBOL) { ! error("$%d: symbol needed as message destination", at->a_index); goto cleanup; ! } else s = argv[at->a_index-1].a_symbol; } else if (at->a_type == A_DOLLSYM) { s = binbuf_realizedollsym(at->a_symbol, argc, argv, 0); *************** *** 2069,2080 **** break; case A_DOLLAR: ! if (at->a_w.w_index > 0 && at->a_w.w_index <= argc) ! *msp = argv[at->a_w.w_index-1]; ! else if (at->a_w.w_index == 0) SETFLOAT(msp, canvas_getdollarzero()); else { if (target == &pd_objectmaker) SETFLOAT(msp, 0); else { ! error("$%d: argument number out of range", at->a_w.w_index); SETFLOAT(msp, 0); } --- 2044,2055 ---- break; case A_DOLLAR: ! if (at->a_index > 0 && at->a_index <= argc) ! *msp = argv[at->a_index-1]; ! else if (at->a_index == 0) SETFLOAT(msp, canvas_getdollarzero()); else { if (target == &pd_objectmaker) SETFLOAT(msp, 0); else { ! error("$%d: argument number out of range", at->a_index); SETFLOAT(msp, 0); } *************** *** 2279,2283 **** if (nextmess[i].a_type == A_DOLLAR) { char buf[100]; ! sprintf(buf, "$%ld", nextmess[i].a_w.w_index); SETSYMBOL(nextmess+i, gensym(buf)); } else if (nextmess[i].a_type == A_DOLLSYM) { --- 2254,2258 ---- if (nextmess[i].a_type == A_DOLLAR) { char buf[100]; ! sprintf(buf, "$%ld", nextmess[i].a_index); SETSYMBOL(nextmess+i, gensym(buf)); } else if (nextmess[i].a_type == A_DOLLSYM) { *************** *** 2437,2441 **** a1->a_type == A_SYMBOL && a1->a_symbol != a2->a_symbol || a1->a_type == A_FLOAT && a1->a_float != a2->a_float || ! a1->a_type == A_DOLLAR && a1->a_w.w_index != a2->a_w.w_index || a1->a_type == A_DOLLSYM && a1->a_symbol != a2->a_symbol) goto nomatch; } --- 2412,2416 ---- a1->a_type == A_SYMBOL && a1->a_symbol != a2->a_symbol || a1->a_type == A_FLOAT && a1->a_float != a2->a_float || ! a1->a_type == A_DOLLAR && a1->a_index != a2->a_index || a1->a_type == A_DOLLSYM && a1->a_symbol != a2->a_symbol) goto nomatch; }