[Bf-committers] Long plugin path problem
Ton Roosendaal
bf-committers@blender.org
Mon, 22 Sep 2003 13:51:50 +0200
Hi,
Although not all blender code has been adapted for it, our standard is:
../blenlib/intern/util.c:#define FILE_MAXDIR 160
../blenlib/intern/util.c:#define FILE_MAXFILE 80
The total filename+path therefore is 240 max. The define is a bit
confusing here... 'file' is the actual file name, not its entire path.
Since the DNA code in Blender doesn't read #defines, you'll have to
hardcode the string array lengths in it; in this case 240 chars minium,
for paranoia safety reasons it is set at 256 in many cases.
The two .h files related to plugins have now:
DNA_texture_types.h: 160 chars
DNA_sequence_types.h 80 chars
Bad bad! :)
Although I 99.99% sure know that goes well, I hesitate to change this
in the code without a test. No time for me to do it now. Another reason
for it you'll read in a next mail I'll send.
What I just did was increasing the texture plugin path button max size
to 160.
-Ton-
On Monday, Sep 22, 2003, at 00:16 Europe/Amsterdam, Robert Wenzlaff
wrote:
> On Sunday 21 September 2003 05:48 pm, Stephane SOPPERA wrote:
>>> Hi!
>>>
>>> I noticed today that the path of sequence plugins is limited to 80
>>> caracters (name member of the PluginSeq struct) and that strcpy is
>>> used to copy the path in this variable. So the memory is corrupted
>>> when the path for a plugin is longer than 80 characters (that's the
>>> case of many plugins on my system) and the plugin don't work ;-)
>>>
>>> An easy fix would be to set a bigger limit (bigger than FILE_MAXDIR
>>> which is quite small and lesser than PATH_MAX on my system). A better
>>> fix should be to use a C++ class for strings ;-)
>
> Well since most of the code is in straight C, the second option is a
> bit
> tedious...
>
> _POSIX_PATH_MAX is 256, so there's no reason to make it longer than
> that. And
> it even pads the DNA nicely. And in the big picture, really isn't
> that much
> wasted memory.
>
> --
> ********************************************
> I prefer Rush to G. Gordon Liddy.
> After all, the Watergate Tapes
> can't hold a candle to either
> "2112" or "Moving Pictures".
> ********************************************
> Robert Wenzlaff rwenzlaff@soylent-green.com
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers@blender.org
> http://www.blender.org/mailman/listinfo/bf-committers
>
>
------------------------------------------------------------------------
--
Ton Roosendaal Blender Foundation ton@blender.org
http://www.blender.org