[Bf-committers] FILE_MAX defines

Ton Roosendaal bf-committers@blender.org
Wed, 21 May 2003 12:37:45 +0200


Hi,

In the past we introduced the two defines to be used in Blender  
everywhere, and since some strings only need to contain a directory  
name or file name, we introduced FILE_MAXDIR and FILE_MAXFILE.

The values for it (160, 80) are hardcoded in the structures that are in  
the Blender DNA system, because it cannot read #defines. I would  
recommend to keep using these values and defines, also to communicate  
Blender doesn't (cannot) use OS specific defines for it. We also don't  
use OS specific widgets, so no reason to be compatible with it.

Please lets stick with it. :)

-Ton-


On Tuesday, May 20, 2003, at 22:32 Europe/Amsterdam, Kent Mein wrote:

> In reply to Holger Haase (holgrhaase@web.de):
> I'd say its a good idea.
> I would suggest it be put in:
>     blender/src/blender/source/blender/include/blendef.h
>
> Just taking a quick look at that file since were on the topic :)
> There is a /******************* MAX ***********************/
> section that has a couple of other MAX values...
> MAXFLOAT is not there though its at the top just before
> including float.h  Anyone see a problem with moving the MAX section
> up on the code so its up there with MAXFLOAT?
>
> Kent
>
>> Hello all,
>>
>> I played around with the sequencer, until blender crashed.
>> I searched the sources and found out, that the cause was something,  
>> that
>> might lead to crashes in other areas too.
>> The problem is, that StripElem.name[40] can only keep 39 characters,  
>> but is
>> supposed to store a filename.
>> There are three constants concerning lengths of file related stuff:
>>   FILE_MAXDIR  defined in util.c, BKE_utildefines.h, DNA_space_types.h
>>   FILE_MAXFILE defined in   "           "                  "
>>   MAXPATHLEN   defined via MAX_PATH from windows.h in the windows  
>> world
>>                  and   via sys/param.h in the other worlds.
>>
>> Do we really need three constants? As directorynames and filenames  
>> can be
>> combined randomly, wouldn't it be enough to define MAXPATHLEN in a  
>> global
>> header file and use this constant everywhere where directory- and/or
>> filenames can be stored?
>>
>> This global header file would be the ideal place to serve other
>> system-dependent constants as well, like the SEPARATOR for directory-  
>> and
>> filenames as a char and a string. I've already seen two places in the  
>> source
>> where entire blocks were duplified instead of using a constant... OK,  
>> one is
>> slightly different, but has the same function.
>>
>> Perhaps anyone familiar with the naming scheme for the sources can  
>> put such
>> a file into the cvs? Otherwise I'll feed blender with a directoryname  
>> of 254
>> chars and a filename of 1 char, after that with a directoryname of 3  
>> chars
>> and a filename of 252 chars and report every crash in the bug-tracker  
>> :-))
>>
>> -
>>   holger
>>
>> _______________________________________________
>> Bf-committers mailing list
>> Bf-committers@blender.org
>> http://www.blender.org/mailman/listinfo/bf-committers
>
> --  
> mein@cs.umn.edu
> http://www.cs.umn.edu/~mein
> _______________________________________________
> Bf-committers mailing list
> Bf-committers@blender.org
> http://www.blender.org/mailman/listinfo/bf-committers
>
>
------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton@blender.org