fixed execution order bug that was causing the first two frame numbers to output...
[puredata.git] / packages / patches / use_FILENAME_MAX_for_file_operations-0.41.4.patch
blobfe6c2f0b5f0d28b74794d18b31e431b9ca71b3e4
1 Index: m_pd.h
2 ===================================================================
3 --- m_pd.h (revision 9725)
4 +++ m_pd.h (working copy)
5 @@ -51,7 +51,7 @@
6 #include <stddef.h> /* just for size_t -- how lame! */
7 #endif
9 -#define MAXPDSTRING 1000 /* use this for anything you want */
10 +#define MAXPDSTRING 1000 /* must be >= FILENAME_MAX */
11 #define MAXPDARG 5 /* max number of args we can typecheck today */
13 /* signed and unsigned integer types the size of a pointer: */
14 Index: g_editor.c
15 ===================================================================
16 --- g_editor.c (revision 9725)
17 +++ g_editor.c (working copy)
18 @@ -979,7 +979,7 @@
19 "open," or "help." */
20 static void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, t_float ypos)
22 - char pathbuf[MAXPDSTRING], namebuf[MAXPDSTRING];
23 + char pathbuf[FILENAME_MAX], namebuf[FILENAME_MAX];
24 t_gobj *y;
25 for (y = x->gl_list; y; y = y->g_next)
27 @@ -1011,7 +1011,7 @@
28 t_atom *av = binbuf_getvec(ob->te_binbuf);
29 if (ac < 1)
30 return;
31 - atom_string(av, namebuf, MAXPDSTRING);
32 + atom_string(av, namebuf, FILENAME_MAX);
33 dir = canvas_getdir((t_canvas *)y)->s_name;
35 else
36 Index: s_file.c
37 ===================================================================
38 --- s_file.c (revision 9725)
39 +++ s_file.c (working copy)
40 @@ -43,23 +43,23 @@
42 static void sys_initloadpreferences( void)
44 - char filenamebuf[MAXPDSTRING], *homedir = getenv("HOME");
45 + char filenamebuf[FILENAME_MAX], *homedir = getenv("HOME");
46 int fd, length;
47 - char user_prefs_file[MAXPDSTRING]; /* user prefs file */
48 + char user_prefs_file[FILENAME_MAX]; /* user prefs file */
49 /* default prefs embedded in the package */
50 - char default_prefs_file[MAXPDSTRING];
51 + char default_prefs_file[FILENAME_MAX];
52 struct stat statbuf;
54 - snprintf(default_prefs_file, MAXPDSTRING, "%s/default.pdsettings",
55 + snprintf(default_prefs_file, FILENAME_MAX, "%s/default.pdsettings",
56 sys_libdir->s_name);
57 if (homedir)
58 - snprintf(user_prefs_file, MAXPDSTRING, "%s/.pdsettings", homedir);
59 + snprintf(user_prefs_file, FILENAME_MAX, "%s/.pdsettings", homedir);
60 if (stat(user_prefs_file, &statbuf) == 0)
61 - strncpy(filenamebuf, user_prefs_file, MAXPDSTRING);
62 + strncpy(filenamebuf, user_prefs_file, FILENAME_MAX);
63 else if (stat(default_prefs_file, &statbuf) == 0)
64 - strncpy(filenamebuf, default_prefs_file, MAXPDSTRING);
65 + strncpy(filenamebuf, default_prefs_file, FILENAME_MAX);
66 else return;
67 - filenamebuf[MAXPDSTRING-1] = 0;
68 + filenamebuf[FILENAME_MAX-1] = 0;
69 if ((fd = open(filenamebuf, 0)) < 0)
71 if (sys_verbose)
72 @@ -128,17 +128,17 @@
74 static void sys_initsavepreferences( void)
76 - char filenamebuf[MAXPDSTRING], errbuf[MAXPDSTRING],
77 + char filenamebuf[FILENAME_MAX], errbuf[FILENAME_MAX],
78 *homedir = getenv("HOME");
79 FILE *fp;
81 if (!homedir)
82 return;
83 - snprintf(filenamebuf, MAXPDSTRING, "%s/.pdsettings", homedir);
84 - filenamebuf[MAXPDSTRING-1] = 0;
85 + snprintf(filenamebuf, FILENAME_MAX, "%s/.pdsettings", homedir);
86 + filenamebuf[FILENAME_MAX-1] = 0;
87 if ((sys_prefsavefp = fopen(filenamebuf, "w")) == NULL)
89 - snprintf(errbuf, MAXPDSTRING, "%s: %s",filenamebuf, strerror(errno));
90 + snprintf(errbuf, FILENAME_MAX, "%s: %s",filenamebuf, strerror(errno));
91 pd_error(0, errbuf);
94 @@ -228,15 +228,15 @@
96 char cmdbuf[256];
97 int nread = 0, nleft = size;
98 - char embedded_prefs[MAXPDSTRING];
99 - char user_prefs[MAXPDSTRING];
100 + char embedded_prefs[FILENAME_MAX];
101 + char user_prefs[FILENAME_MAX];
102 char *homedir = getenv("HOME");
103 struct stat statbuf;
104 /* the 'defaults' command expects the filename without .plist at the
105 end */
106 - snprintf(embedded_prefs, MAXPDSTRING, "%s/../org.puredata.pd",
107 + snprintf(embedded_prefs, FILENAME_MAX, "%s/../org.puredata.pd",
108 sys_libdir->s_name);
109 - snprintf(user_prefs, MAXPDSTRING,
110 + snprintf(user_prefs, FILENAME_MAX,
111 "%s/Library/Preferences/org.puredata.pd.plist", homedir);
112 if (stat(user_prefs, &statbuf) == 0)
113 snprintf(cmdbuf, 256, "defaults read org.puredata.pd %s 2> /dev/null\n",
114 Index: configure.in
115 ===================================================================
116 --- configure.in (revision 9725)
117 +++ configure.in (working copy)
118 @@ -347,11 +347,11 @@
119 OSNUMBER=2
120 if test x$jack = "xyes";
121 then
122 - LDFLAGS=$LDFLAGS" -weak_framework Jack"
123 + LDFLAGS=$LDFLAGS" -weak_framework Jackmp"
125 if test x$jack = "xrun";
126 then
127 - LDFLAGS=$LDFLAGS" -weak_framework Jack"
128 + LDFLAGS=$LDFLAGS" -weak_framework Jackmp"
132 Index: s_main.c
133 ===================================================================
134 --- s_main.c (revision 9725)
135 +++ s_main.c (working copy)
136 @@ -177,9 +177,9 @@
138 static void openit(const char *dirname, const char *filename)
140 - char dirbuf[MAXPDSTRING], *nameptr;
141 + char dirbuf[FILENAME_MAX], *nameptr;
142 int fd = open_via_path(dirname, filename, "", dirbuf, &nameptr,
143 - MAXPDSTRING, 0);
144 + FILENAME_MAX, 0);
145 if (fd >= 0)
147 close (fd);
148 @@ -430,7 +430,7 @@
149 INSTALL_PREFIX. In MSW, we don't try to use INSTALL_PREFIX. */
150 void sys_findprogdir(char *progname)
152 - char sbuf[MAXPDSTRING], sbuf2[MAXPDSTRING], *sp;
153 + char sbuf[FILENAME_MAX], sbuf2[FILENAME_MAX], *sp;
154 char *lastslash;
155 #ifdef UNISTD
156 struct stat statbuf;
157 @@ -439,12 +439,12 @@
158 /* find out by what string Pd was invoked; put answer in "sbuf". */
159 #ifdef MSW
160 GetModuleFileName(NULL, sbuf2, sizeof(sbuf2));
161 - sbuf2[MAXPDSTRING-1] = 0;
162 + sbuf2[FILENAME_MAX-1] = 0;
163 sys_unbashfilename(sbuf2, sbuf);
164 #endif /* MSW */
165 #ifdef UNISTD
166 - strncpy(sbuf, progname, MAXPDSTRING);
167 - sbuf[MAXPDSTRING-1] = 0;
168 + strncpy(sbuf, progname, FILENAME_MAX);
169 + sbuf[FILENAME_MAX-1] = 0;
170 #endif
171 lastslash = strrchr(sbuf, '/');
172 if (lastslash)
173 @@ -491,16 +491,16 @@
174 sys_libdir = gensym(sbuf2);
175 sys_guidir = &s_; /* in MSW the guipath just depends on the libdir */
176 #else
177 - strncpy(sbuf, sbuf2, MAXPDSTRING-30);
178 - sbuf[MAXPDSTRING-30] = 0;
179 + strncpy(sbuf, sbuf2, FILENAME_MAX-30);
180 + sbuf[FILENAME_MAX-30] = 0;
181 strcat(sbuf, "/lib/pd");
182 if (stat(sbuf, &statbuf) >= 0)
184 /* complicated layout: lib dir is the one we just stat-ed above */
185 sys_libdir = gensym(sbuf);
186 /* gui lives in .../lib/pd/bin */
187 - strncpy(sbuf, sbuf2, MAXPDSTRING-30);
188 - sbuf[MAXPDSTRING-30] = 0;
189 + strncpy(sbuf, sbuf2, FILENAME_MAX-30);
190 + sbuf[FILENAME_MAX-30] = 0;
191 strcat(sbuf, "/lib/pd/bin");
192 sys_guidir = gensym(sbuf);
194 @@ -509,8 +509,8 @@
195 /* simple layout: lib dir is the parent */
196 sys_libdir = gensym(sbuf2);
197 /* gui lives in .../bin */
198 - strncpy(sbuf, sbuf2, MAXPDSTRING-30);
199 - sbuf[MAXPDSTRING-30] = 0;
200 + strncpy(sbuf, sbuf2, FILENAME_MAX-30);
201 + sbuf[FILENAME_MAX-30] = 0;
202 strcat(sbuf, "/bin");
203 sys_guidir = gensym(sbuf);
205 @@ -525,7 +525,6 @@
207 int sys_argparse(int argc, char **argv)
209 - char sbuf[MAXPDSTRING];
210 int i;
211 while ((argc > 0) && **argv == '-')
213 @@ -901,7 +900,7 @@
214 from command-line arguments */
215 static void sys_afterargparse(void)
217 - char sbuf[MAXPDSTRING];
218 + char sbuf[FILENAME_MAX];
219 int i;
220 int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV];
221 int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV];
222 @@ -909,13 +908,13 @@
223 int nmidiindev = 0, midiindev[MAXMIDIINDEV];
224 int nmidioutdev = 0, midioutdev[MAXMIDIOUTDEV];
225 /* add "extra" library to path */
226 - strncpy(sbuf, sys_libdir->s_name, MAXPDSTRING-30);
227 - sbuf[MAXPDSTRING-30] = 0;
228 + strncpy(sbuf, sys_libdir->s_name, FILENAME_MAX-30);
229 + sbuf[FILENAME_MAX-30] = 0;
230 strcat(sbuf, "/extra");
231 sys_setextrapath(sbuf);
232 /* add "doc/5.reference" library to helppath */
233 - strncpy(sbuf, sys_libdir->s_name, MAXPDSTRING-30);
234 - sbuf[MAXPDSTRING-30] = 0;
235 + strncpy(sbuf, sys_libdir->s_name, FILENAME_MAX-30);
236 + sbuf[FILENAME_MAX-30] = 0;
237 strcat(sbuf, "/doc/5.reference");
238 sys_helppath = namelist_append_files(sys_helppath, sbuf);
239 /* correct to make audio and MIDI device lists zero based. On
240 Index: s_path.c
241 ===================================================================
242 --- s_path.c (revision 9725)
243 +++ s_path.c (working copy)
244 @@ -256,10 +256,10 @@
245 #endif
248 - char dirbuf[MAXPDSTRING];
249 + char dirbuf[FILENAME_MAX];
250 int dirlen = (strrchr(name, '/') - name);
251 - if (dirlen > MAXPDSTRING-1)
252 - dirlen = MAXPDSTRING-1;
253 + if (dirlen > FILENAME_MAX-1)
254 + dirlen = FILENAME_MAX-1;
255 strncpy(dirbuf, name, dirlen);
256 dirbuf[dirlen] = 0;
257 *fdp = sys_trytoopenone(dirbuf, name+(dirlen+1), ext,
258 @@ -326,32 +326,32 @@
259 search attempts. */
260 void open_via_helppath(const char *name, const char *dir)
262 - char realname[MAXPDSTRING], dirbuf[MAXPDSTRING], *basename;
263 + char realname[FILENAME_MAX], dirbuf[FILENAME_MAX], *basename;
264 /* make up a silly "dir" if none is supplied */
265 const char *usedir = (*dir ? dir : "./");
266 int fd;
268 /* 1. "objectname-help.pd" */
269 - strncpy(realname, name, MAXPDSTRING-10);
270 - realname[MAXPDSTRING-10] = 0;
271 + strncpy(realname, name, FILENAME_MAX-10);
272 + realname[FILENAME_MAX-10] = 0;
273 if (strlen(realname) > 3 && !strcmp(realname+strlen(realname)-3, ".pd"))
274 realname[strlen(realname)-3] = 0;
275 strcat(realname, "-help.pd");
276 if ((fd = do_open_via_path(dir, realname, "", dirbuf, &basename,
277 - MAXPDSTRING, 0, sys_helppath)) >= 0)
278 + FILENAME_MAX, 0, sys_helppath)) >= 0)
279 goto gotone;
281 /* 2. "help-objectname.pd" */
282 strcpy(realname, "help-");
283 - strncat(realname, name, MAXPDSTRING-10);
284 - realname[MAXPDSTRING-1] = 0;
285 + strncat(realname, name, FILENAME_MAX-10);
286 + realname[FILENAME_MAX-1] = 0;
287 if ((fd = do_open_via_path(dir, realname, "", dirbuf, &basename,
288 - MAXPDSTRING, 0, sys_helppath)) >= 0)
289 + FILENAME_MAX, 0, sys_helppath)) >= 0)
290 goto gotone;
292 /* 3. "objectname.pd" */
293 if ((fd = do_open_via_path(dir, name, "", dirbuf, &basename,
294 - MAXPDSTRING, 0, sys_helppath)) >= 0)
295 + FILENAME_MAX, 0, sys_helppath)) >= 0)
296 goto gotone;
297 post("sorry, couldn't find help patch for \"%s\"", name);
298 return;
299 @@ -379,7 +379,7 @@
300 int rcargc;
301 char* rcargv[NUMARGS];
302 char* buffer;
303 - char fname[MAXPDSTRING], buf[1000], *home = getenv("HOME");
304 + char fname[FILENAME_MAX], buf[1000], *home = getenv("HOME");
305 int retval = 1; /* that's what we will return at the end; for now, let's think it'll be an error */
307 /* initialize rc-arg-array so we can safely clean up at the end */
308 @@ -391,7 +391,7 @@
310 *fname = '\0';
312 - strncat(fname, home? home : ".", MAXPDSTRING-10);
313 + strncat(fname, home? home : ".", FILENAME_MAX-10);
314 strcat(fname, "/");
316 strcat(fname, STARTUPNAME);
317 Index: g_canvas.c
318 ===================================================================
319 --- g_canvas.c (revision 9725)
320 +++ g_canvas.c (working copy)
321 @@ -1543,7 +1543,6 @@
323 t_namelist *nl, thislist;
324 int fd = -1;
325 - char listbuf[MAXPDSTRING];
326 t_canvas *y;
328 /* first check if "name" is absolute (and if so, try to open) */
329 @@ -1563,12 +1562,12 @@
330 dir = (x2 ? canvas_getdir(x2)->s_name : ".");
331 for (nl = y->gl_env->ce_path; nl; nl = nl->nl_next)
333 - char realname[MAXPDSTRING];
334 - strncpy(realname, dir, MAXPDSTRING);
335 - realname[MAXPDSTRING-3] = 0;
336 + char realname[FILENAME_MAX];
337 + strncpy(realname, dir, FILENAME_MAX);
338 + realname[FILENAME_MAX-3] = 0;
339 strcat(realname, "/");
340 - strncat(realname, nl->nl_string, MAXPDSTRING-strlen(realname));
341 - realname[MAXPDSTRING-1] = 0;
342 + strncat(realname, nl->nl_string, FILENAME_MAX-strlen(realname));
343 + realname[FILENAME_MAX-1] = 0;
344 if ((fd = sys_trytoopenone(realname, name, ext,
345 dirresult, nameresult, size, bin)) >= 0)
346 return (fd);
347 Index: s_loader.c
348 ===================================================================
349 --- s_loader.c (revision 9725)
350 +++ s_loader.c (working copy)
351 @@ -86,7 +86,7 @@
353 static int sys_do_load_lib(t_canvas *canvas, char *objectname)
355 - char symname[MAXPDSTRING], filename[MAXPDSTRING], dirbuf[MAXPDSTRING],
356 + char symname[MAXPDSTRING], filename[FILENAME_MAX], dirbuf[FILENAME_MAX],
357 *classname, *nameptr, altsymname[MAXPDSTRING];
358 void *dlobj;
359 t_xxx makeout = NULL;
360 @@ -137,23 +137,23 @@
361 #endif
362 /* try looking in the path for (objectname).(sys_dllextent) ... */
363 if ((fd = canvas_open(canvas, objectname, sys_dllextent,
364 - dirbuf, &nameptr, MAXPDSTRING, 1)) >= 0)
365 + dirbuf, &nameptr, FILENAME_MAX, 1)) >= 0)
366 goto gotone;
367 /* same, with the more generic sys_dllextent2 */
368 if ((fd = canvas_open(canvas, objectname, sys_dllextent2,
369 - dirbuf, &nameptr, MAXPDSTRING, 1)) >= 0)
370 + dirbuf, &nameptr, FILENAME_MAX, 1)) >= 0)
371 goto gotone;
372 /* next try (objectname)/(classname).(sys_dllextent) ... */
373 - strncpy(filename, objectname, MAXPDSTRING);
374 + strncpy(filename, objectname, FILENAME_MAX);
375 filename[MAXPDSTRING-2] = 0;
376 strcat(filename, "/");
377 - strncat(filename, classname, MAXPDSTRING-strlen(filename));
378 - filename[MAXPDSTRING-1] = 0;
379 + strncat(filename, classname, FILENAME_MAX-strlen(filename));
380 + filename[FILENAME_MAX-1] = 0;
381 if ((fd = canvas_open(canvas, filename, sys_dllextent,
382 - dirbuf, &nameptr, MAXPDSTRING, 1)) >= 0)
383 + dirbuf, &nameptr, FILENAME_MAX, 1)) >= 0)
384 goto gotone;
385 if ((fd = canvas_open(canvas, filename, sys_dllextent2,
386 - dirbuf, &nameptr, MAXPDSTRING, 1)) >= 0)
387 + dirbuf, &nameptr, FILENAME_MAX, 1)) >= 0)
388 goto gotone;
389 return (0);
390 gotone:
391 @@ -161,11 +161,11 @@
392 class_set_extern_dir(gensym(dirbuf));
394 /* rebuild the absolute pathname */
395 - strncpy(filename, dirbuf, MAXPDSTRING);
396 - filename[MAXPDSTRING-2] = 0;
397 + strncpy(filename, dirbuf, FILENAME_MAX);
398 + filename[FILENAME_MAX-2] = 0;
399 strcat(filename, "/");
400 - strncat(filename, nameptr, MAXPDSTRING-strlen(filename));
401 - filename[MAXPDSTRING-1] = 0;
402 + strncat(filename, nameptr, FILENAME_MAX-strlen(filename));
403 + filename[FILENAME_MAX-1] = 0;
405 #ifdef DL_OPEN
406 dlobj = dlopen(filename, RTLD_NOW | RTLD_GLOBAL);
407 Index: m_binbuf.c
408 ===================================================================
409 --- m_binbuf.c (revision 9725)
410 +++ m_binbuf.c (working copy)
411 @@ -740,7 +740,7 @@
413 static int binbuf_doopen(char *s, int mode)
415 - char namebuf[MAXPDSTRING];
416 + char namebuf[FILENAME_MAX];
417 #ifdef MSW
418 mode |= O_BINARY;
419 #endif
420 @@ -750,7 +750,7 @@
422 static FILE *binbuf_dofopen(char *s, char *mode)
424 - char namebuf[MAXPDSTRING];
425 + char namebuf[FILENAME_MAX];
426 sys_bashfilename(s, namebuf);
427 return (fopen(namebuf, mode));
429 @@ -761,7 +761,7 @@
430 int fd;
431 int readret;
432 char *buf;
433 - char namebuf[MAXPDSTRING];
434 + char namebuf[FILENAME_MAX];
436 namebuf[0] = 0;
437 if (*dirname)
438 @@ -814,9 +814,9 @@
439 int crflag)
441 int filedesc;
442 - char buf[MAXPDSTRING], *bufptr;
443 + char buf[FILENAME_MAX], *bufptr;
444 if ((filedesc = canvas_open(canvas, filename, "",
445 - buf, &bufptr, MAXPDSTRING, 0)) < 0)
446 + buf, &bufptr, FILENAME_MAX, 0)) < 0)
448 error("%s: can't open", filename);
449 return (1);
450 @@ -832,9 +832,9 @@
451 int crflag)
453 int filedesc;
454 - char buf[MAXPDSTRING], *bufptr;
455 + char buf[FILENAME_MAX], *bufptr;
456 if ((filedesc = open_via_path(
457 - dirname, filename, "", buf, &bufptr, MAXPDSTRING, 0)) < 0)
458 + dirname, filename, "", buf, &bufptr, FILENAME_MAX, 0)) < 0)
460 error("%s: can't open", filename);
461 return (1);
462 @@ -853,7 +853,7 @@
463 int binbuf_write(t_binbuf *x, char *filename, char *dir, int crflag)
465 FILE *f = 0;
466 - char sbuf[WBUFSIZE], fbuf[MAXPDSTRING], *bp = sbuf, *ep = sbuf + WBUFSIZE;
467 + char sbuf[WBUFSIZE], fbuf[FILENAME_MAX], *bp = sbuf, *ep = sbuf + WBUFSIZE;
468 t_atom *ap;
469 int indx, deleteit = 0;
470 int ncolumn = 0;
471 Index: d_soundfile.c
472 ===================================================================
473 --- d_soundfile.c (revision 9725)
474 +++ d_soundfile.c (working copy)
475 @@ -400,9 +400,9 @@
476 int *p_bytespersamp, int *p_bigendian, int *p_nchannels, long *p_bytelimit,
477 long skipframes)
479 - char buf[OBUFSIZE], *bufptr;
480 + char buf[FILENAME_MAX], *bufptr;
481 int fd;
482 - fd = open_via_path(dirname, filename, "", buf, &bufptr, MAXPDSTRING, 1);
483 + fd = open_via_path(dirname, filename, "", buf, &bufptr, FILENAME_MAX, 1);
484 if (fd < 0)
485 return (-1);
486 else return (open_soundfile_via_fd(fd, headersize, p_bytespersamp,
487 @@ -416,9 +416,9 @@
488 int *p_bytespersamp, int *p_bigendian, int *p_nchannels, long *p_bytelimit,
489 long skipframes)
491 - char buf[OBUFSIZE], *bufptr;
492 + char buf[FILENAME_MAX], *bufptr;
493 int fd;
494 - fd = canvas_open(canvas, filename, "", buf, &bufptr, MAXPDSTRING, 1);
495 + fd = canvas_open(canvas, filename, "", buf, &bufptr, FILENAME_MAX, 1);
496 if (fd < 0)
497 return (-1);
498 else return (open_soundfile_via_fd(fd, headersize, p_bytespersamp,
499 @@ -738,15 +738,15 @@
500 int filetype, int nframes, int bytespersamp,
501 int bigendian, int nchannels, int swap, t_float samplerate)
503 - char filenamebuf[MAXPDSTRING], buf2[MAXPDSTRING];
504 + char filenamebuf[FILENAME_MAX], buf2[FILENAME_MAX];
505 char headerbuf[WRITEHDRSIZE];
506 t_wave *wavehdr = (t_wave *)headerbuf;
507 t_nextstep *nexthdr = (t_nextstep *)headerbuf;
508 t_aiff *aiffhdr = (t_aiff *)headerbuf;
509 int fd, headersize = 0;
511 - strncpy(filenamebuf, filename, MAXPDSTRING-10);
512 - filenamebuf[MAXPDSTRING-10] = 0;
513 + strncpy(filenamebuf, filename, FILENAME_MAX-10);
514 + filenamebuf[FILENAME_MAX-10] = 0;
516 if (filetype == FORMAT_NEXT)
518 @@ -812,7 +812,7 @@
519 headersize = sizeof(t_wave);
522 - canvas_makefilename(canvas, filenamebuf, buf2, MAXPDSTRING);
523 + canvas_makefilename(canvas, filenamebuf, buf2, FILENAME_MAX);
524 sys_bashfilename(buf2, buf2);
525 if ((fd = open(buf2, BINCREATE, 0666)) < 0)
526 return (-1);
527 Index: m_class.c
528 ===================================================================
529 --- m_class.c (revision 9725)
530 +++ m_class.c (working copy)
531 @@ -498,7 +498,7 @@
533 static t_symbol *addfileextent(t_symbol *s)
535 - char namebuf[MAXPDSTRING], *str = s->s_name;
536 + char namebuf[FILENAME_MAX], *str = s->s_name;
537 int ln = strlen(str);
538 if (!strcmp(str + ln - 3, ".pd")) return (s);
539 strcpy(namebuf, str);
540 @@ -520,7 +520,7 @@
542 t_pd *current;
543 int fd;
544 - char dirbuf[MAXPDSTRING], *nameptr;
545 + char dirbuf[FILENAME_MAX], *nameptr;
546 if (tryingalready) return;
547 newest = 0;
548 class_loadsym = s;
549 @@ -534,9 +534,9 @@
550 class_loadsym = 0;
551 current = s__X.s_thing;
552 if ((fd = canvas_open(canvas_getcurrent(), s->s_name, ".pd",
553 - dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0 ||
554 + dirbuf, &nameptr, FILENAME_MAX, 0)) >= 0 ||
555 (fd = canvas_open(canvas_getcurrent(), s->s_name, ".pat",
556 - dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0)
557 + dirbuf, &nameptr, FILENAME_MAX, 0)) >= 0)
559 close (fd);
560 if (!pd_setloadingabstraction(s))
561 Index: g_array.c
562 ===================================================================
563 --- g_array.c (revision 9725)
564 +++ g_array.c (working copy)
565 @@ -1384,7 +1384,7 @@
567 int nelem, filedesc, i;
568 FILE *fd;
569 - char buf[MAXPDSTRING], *bufptr;
570 + char buf[FILENAME_MAX], *bufptr;
571 int yonset, elemsize;
572 t_array *array = garray_getarray_floatonly(x, &yonset, &elemsize);
573 if (!array)
574 @@ -1394,7 +1394,7 @@
576 nelem = array->a_n;
577 if ((filedesc = canvas_open(glist_getcanvas(x->x_glist),
578 - filename->s_name, "", buf, &bufptr, MAXPDSTRING, 0)) < 0
579 + filename->s_name, "", buf, &bufptr, FILENAME_MAX, 0)) < 0
580 || !(fd = fdopen(filedesc, "r")))
582 error("%s: can't open", filename->s_name);