Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8572
Modified Files: Tag: desiredata s_path.c Log Message: remove some MAXPDSTRING
Index: s_path.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_path.c,v retrieving revision 1.3.4.6.2.8.2.7 retrieving revision 1.3.4.6.2.8.2.8 diff -C2 -d -r1.3.4.6.2.8.2.7 -r1.3.4.6.2.8.2.8 *** s_path.c 16 Jan 2007 00:27:17 -0000 1.3.4.6.2.8.2.7 --- s_path.c 28 Jun 2007 04:29:16 -0000 1.3.4.6.2.8.2.8 *************** *** 62,68 **** /* if it was the last substring, return NULL */
! static const char* strtokcpy(char *to, const char *from, int delim) { int size = 0; while (from[size] != (char)delim && from[size] != '\0') size++; strncpy(to,from,size); to[size] = '\0'; --- 62,69 ---- /* if it was the last substring, return NULL */
! static const char *strtokcpy(char *&to, const char *from, int delim) { int size = 0; while (from[size] != (char)delim && from[size] != '\0') size++; + to = (char *)malloc(size+1); strncpy(to,from,size); to[size] = '\0'; *************** *** 74,79 **** may be added; othewise they're dropped. */ t_namelist *namelist_append(t_namelist *listwas, const char *s, int allowdup) { ! t_namelist *nl, *nl2; ! nl2 = (t_namelist *)(getbytes(sizeof(*nl))); nl2->nl_next = 0; nl2->nl_string = strdup(s); --- 75,79 ---- may be added; othewise they're dropped. */ t_namelist *namelist_append(t_namelist *listwas, const char *s, int allowdup) { ! t_namelist *nl, *nl2 = (t_namelist *)getbytes(sizeof(*nl)); nl2->nl_next = 0; nl2->nl_string = strdup(s); *************** *** 98,108 ****
t_namelist *namelist_append_files(t_namelist *listwas, const char *s) { - char temp[MAXPDSTRING]; const char *npos = s; t_namelist *nl = listwas; do { npos = strtokcpy(temp, npos, SEPARATOR); if (!*temp) continue; nl = namelist_append(nl, temp, 0); } while (npos); return nl; --- 98,109 ----
t_namelist *namelist_append_files(t_namelist *listwas, const char *s) { const char *npos = s; t_namelist *nl = listwas; do { + char *temp; npos = strtokcpy(temp, npos, SEPARATOR); if (!*temp) continue; nl = namelist_append(nl, temp, 0); + free(temp); } while (npos); return nl; *************** *** 195,204 **** #endif ) { - char dirbuf[MAXPDSTRING]; int dirlen = strrchr(name, '/') - name; if (dirlen > MAXPDSTRING-1) dirlen = MAXPDSTRING-1; strncpy(dirbuf, name, dirlen); dirbuf[dirlen] = 0; *fdp = sys_trytoopenone(dirbuf, name+(dirlen+1), ext, dirresult, nameresult, size, bin); return 1; } else return 0; --- 196,206 ---- #endif ) { int dirlen = strrchr(name, '/') - name; if (dirlen > MAXPDSTRING-1) dirlen = MAXPDSTRING-1; + char *dirbuf = new char[dirlen+1]; strncpy(dirbuf, name, dirlen); dirbuf[dirlen] = 0; *fdp = sys_trytoopenone(dirbuf, name+(dirlen+1), ext, dirresult, nameresult, size, bin); + delete[] dirbuf; return 1; } else return 0; *************** *** 240,247 **** /* open via path, using the global search path. */ extern "C" int open_via_path(const char *dir, const char *name, const char *ext, ! char *dirresult, char **nameresult, unsigned int size, int bin) ! { ! return do_open_via_path(dir, name, ext, dirresult, nameresult, ! size, bin, sys_searchpath); }
--- 242,247 ---- /* open via path, using the global search path. */ extern "C" int open_via_path(const char *dir, const char *name, const char *ext, ! char *dirresult, char **nameresult, unsigned int size, int bin) { ! return do_open_via_path(dir, name, ext, dirresult, nameresult, size, bin, sys_searchpath); }
*************** *** 251,255 **** extern "C" void open_via_helppath(const char *name, const char *dir) { char realname[MAXPDSTRING], dirbuf[MAXPDSTRING], *basename; ! /* make up a silly "dir" if none is supplied */ int fd; /* 1. "objectname-help.pd" */ --- 251,255 ---- extern "C" void open_via_helppath(const char *name, const char *dir) { char realname[MAXPDSTRING], dirbuf[MAXPDSTRING], *basename; ! /* make up a silly "dir" if none is supplied */ int fd; /* 1. "objectname-help.pd" */ *************** *** 258,272 **** if (strlen(realname) > 3 && !strcmp(realname+strlen(realname)-3, ".pd")) realname[strlen(realname)-3] = 0; strcat(realname, "-help.pd"); ! if ((fd = do_open_via_path(dir, realname, "", dirbuf, &basename, MAXPDSTRING, 0, sys_helppath)) >= 0) ! goto gotone; /* 2. "help-objectname.pd" */ ! strcpy(realname, "help-"); ! strncat(realname, name, MAXPDSTRING-10); realname[MAXPDSTRING-1] = 0; ! if ((fd = do_open_via_path(dir, realname, "", dirbuf, &basename, MAXPDSTRING, 0, sys_helppath)) >= 0) ! goto gotone; /* 3. "objectname.pd" */ ! if ((fd = do_open_via_path(dir, name, "", dirbuf, &basename, MAXPDSTRING, 0, sys_helppath)) >= 0) ! goto gotone; post("sorry, couldn't find help patch for "%s"", name); return; --- 258,268 ---- if (strlen(realname) > 3 && !strcmp(realname+strlen(realname)-3, ".pd")) realname[strlen(realname)-3] = 0; strcat(realname, "-help.pd"); ! if ((fd = do_open_via_path(dir,realname,"",dirbuf,&basename,MAXPDSTRING,0,sys_helppath))>=0) goto gotone; /* 2. "help-objectname.pd" */ ! snprintf(realname,MAXPDSTRING,"help-%s",name); realname[MAXPDSTRING-1] = 0; ! if ((fd = do_open_via_path(dir,realname,"",dirbuf,&basename,MAXPDSTRING,0,sys_helppath))>=0) goto gotone; /* 3. "objectname.pd" */ ! if ((fd = do_open_via_path(dir, name,"",dirbuf,&basename,MAXPDSTRING,0,sys_helppath))>=0) goto gotone; post("sorry, couldn't find help patch for "%s"", name); return; *************** *** 283,287 **** #define NUMARGS 1000
! extern "C" int sys_parsercfile(char*filename) { int i; int rcargc; --- 279,283 ---- #define NUMARGS 1000
! extern "C" int sys_parsercfile(char *filename) { int i; int rcargc; *************** *** 341,345 **** #ifndef MSW #define STARTUPNAME ".pdrc" ! extern "C" int sys_rcfile(void) { char fname[MAXPDSTRING], *home = getenv("HOME"); // parse a startup file */ --- 337,341 ---- #ifndef MSW #define STARTUPNAME ".pdrc" ! extern "C" int sys_rcfile () { char fname[MAXPDSTRING], *home = getenv("HOME"); // parse a startup file */ *************** *** 352,356 **** #endif /* MSW */
! void sys_doflags(void) { int beginstring = 0, state = 0, len = strlen(sys_flags->s_name); int rcargc = 0; --- 348,352 ---- #endif /* MSW */
! void sys_doflags() { int beginstring = 0, state = 0, len = strlen(sys_flags->s_name); int rcargc = 0; *************** *** 383,387 **** }
! extern "C" void glob_update_path (void) { t_namelist *nl; sys_vgui("global pd_path; set pd_path {"); --- 379,383 ---- }
! extern "C" void glob_update_path () { t_namelist *nl; sys_vgui("global pd_path; set pd_path {");