[PD-dev] sys_expandpath() implementation notes

Hans-Christoph Steiner hans at at.or.at
Wed Jul 21 23:39:07 CEST 2010


Hey Miller,

I just saw that you accepted and changed the sys_expandpath() stuff,
thanks for that.  There are two little related issues that I thought I'd
bring up:

- in commit c78d6b22941725368af014fd0863b00e96f0dde7 "bug fix to
sys_expandpath", you added some curly braces around the code at the end
in "#ifdef _WIN32 section.  They don't seem to do anything and could
make the code confusing, i.e. the ExpandEnvironmentStrings stuff at the
end is not part of the "if ((strlen(from) == 1 &&..." code block.

- second, MAXPDSTRING (1000) is bigger than FILENAME_MAX on Win32 (255).
 That is a source of crashes if anyone makes a string/symbol longer than
255 on Windows.  I think we should be using the POSIX macro FILENAME_MAX
rather than MAXPDSTRING anytime we are dealing with paths and filenames
for that reason.  Plus I think FILENAME_MAX is part of the C89 spec, so
it should be very widely implemented.
http://www.mofeel.net/957-microsoft-public-vc-language/11149.aspx

.hc



More information about the Pd-dev mailing list