use FILE_MAX instead of 240 or comment where define cant be used.

This commit is contained in:
Campbell Barton 2012-01-16 05:52:33 +00:00
parent fb4ad50cee
commit ea467d3228
16 changed files with 26 additions and 22 deletions

@ -50,7 +50,7 @@ struct Library;
typedef struct Main { typedef struct Main {
struct Main *next, *prev; struct Main *next, *prev;
char name[240]; char name[240]; /* 240 = FILE_MAX */
short versionfile, subversionfile; short versionfile, subversionfile;
short minversionfile, minsubversionfile; short minversionfile, minsubversionfile;
int revision; /* svn revision of binary that saved file */ int revision; /* svn revision of binary that saved file */

@ -14437,7 +14437,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
/* allow typing in a new lib path */ /* allow typing in a new lib path */
if(G.rt==-666) { if(G.rt==-666) {
while(fd==NULL) { while(fd==NULL) {
char newlib_path[240] = { 0 }; char newlib_path[FILE_MAX] = { 0 };
printf("Missing library...'\n"); printf("Missing library...'\n");
printf(" current file: %s\n", G.main->name); printf(" current file: %s\n", G.main->name);
printf(" absolute lib: %s\n", mainptr->curlib->filepath); printf(" absolute lib: %s\n", mainptr->curlib->filepath);

@ -494,7 +494,7 @@ struct uiEditSourceStore {
} uiEditSourceStore; } uiEditSourceStore;
struct uiEditSourceButStore { struct uiEditSourceButStore {
char py_dbg_fn[240]; char py_dbg_fn[FILE_MAX];
int py_dbg_ln; int py_dbg_ln;
} uiEditSourceButStore; } uiEditSourceButStore;
@ -584,7 +584,7 @@ void UI_editsource_active_but_test(uiBut *but)
/* editsource operator component */ /* editsource operator component */
static int editsource_text_edit(bContext *C, wmOperator *op, static int editsource_text_edit(bContext *C, wmOperator *op,
char filepath[240], int line) char filepath[FILE_MAX], int line)
{ {
struct Main *bmain= CTX_data_main(C); struct Main *bmain= CTX_data_main(C);
Text *text; Text *text;

@ -858,7 +858,9 @@ static int image_replace_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
RNA_string_get(op->ptr, "filepath", str); RNA_string_get(op->ptr, "filepath", str);
BLI_strncpy(sima->image->name, str, sizeof(sima->image->name)); /* we cant do much if the str is longer then 240 :/ */
/* we cant do much if the str is longer then FILE_MAX :/ */
BLI_strncpy(sima->image->name, str, sizeof(sima->image->name));
/* XXX unpackImage frees image buffers */ /* XXX unpackImage frees image buffers */
ED_preview_kill_jobs(C); ED_preview_kill_jobs(C);

@ -59,7 +59,7 @@ typedef struct Brush {
struct ImBuf *icon_imbuf; struct ImBuf *icon_imbuf;
PreviewImage *preview; PreviewImage *preview;
char icon_filepath[240]; char icon_filepath[240]; /* 240 = FILE_MAX */
float normal_weight; float normal_weight;

@ -125,7 +125,7 @@ typedef struct DynamicPaintSurface {
int pad_; int pad_;
char uvlayer_name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */ char uvlayer_name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
char image_output_path[240]; char image_output_path[240]; /* 240 = FILE_MAX */
char output_name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */ char output_name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
char output_name2[64]; /* MAX_CUSTOMDATA_LAYER_NAME */ /* some surfaces have 2 outputs */ char output_name2[64]; /* MAX_CUSTOMDATA_LAYER_NAME */ /* some surfaces have 2 outputs */

@ -69,7 +69,7 @@ typedef struct ImageUser {
typedef struct Image { typedef struct Image {
ID id; ID id;
char name[240]; /* file path */ char name[240]; /* file path, 240 = FILE_MAX */
ListBase ibufs; /* not written in file */ ListBase ibufs; /* not written in file */
struct GPUTexture *gputexture; /* not written in file */ struct GPUTexture *gputexture; /* not written in file */

@ -64,7 +64,7 @@ typedef struct MovieClipProxy {
typedef struct MovieClip { typedef struct MovieClip {
ID id; ID id;
char name[240]; /* file path */ char name[240]; /* file path, 240 = FILE_MAX */
int source; /* sequence or movie */ int source; /* sequence or movie */
int lastframe; /* last accessed frame number */ int lastframe; /* last accessed frame number */

@ -195,7 +195,7 @@ typedef struct PointCache {
char name[64]; char name[64];
char prev_name[64]; char prev_name[64];
char info[64]; char info[64];
char path[240]; /* file path */ char path[240]; /* file path, 240 = FILE_MAX */
char *cached_frames; /* array of length endframe-startframe+1 with flags to indicate cached frames */ char *cached_frames; /* array of length endframe-startframe+1 with flags to indicate cached frames */
/* can be later used for other per frame flags too if needed */ /* can be later used for other per frame flags too if needed */
struct ListBase mem_cache; struct ListBase mem_cache;

@ -471,7 +471,7 @@ typedef struct RenderData {
float bake_maxdist, bake_biasdist, bake_pad; float bake_maxdist, bake_biasdist, bake_pad;
/* path to render output */ /* path to render output */
char pic[240]; char pic[240]; /* 240 = FILE_MAX */
/* stamps flags. */ /* stamps flags. */
int stamp; int stamp;

@ -49,7 +49,7 @@ typedef struct bSound {
/** /**
* The path to the sound file. * The path to the sound file.
*/ */
char name[240]; char name[240]; /* 240 = FILE_MAX */
/** /**
* The packed file. * The packed file.

@ -200,7 +200,7 @@ typedef struct VoxelData {
struct Object *object; /* for rendering smoke sims */ struct Object *object; /* for rendering smoke sims */
float int_multiplier; float int_multiplier;
int still_frame; int still_frame;
char source_path[240]; char source_path[240]; /* 240 = FILE_MAX */
/* temporary data */ /* temporary data */
float *dataset; float *dataset;

@ -318,16 +318,16 @@ typedef struct SolidLight {
typedef struct UserDef { typedef struct UserDef {
int flag, dupflag; int flag, dupflag;
int savetime; int savetime;
char tempdir[160]; // FILE_MAXDIR length char tempdir[160]; /* FILE_MAXDIR length */
char fontdir[160]; char fontdir[160];
char renderdir[240]; // FILE_MAX length char renderdir[240]; /* FILE_MAX length */
char textudir[160]; char textudir[160];
char plugtexdir[160]; char plugtexdir[160];
char plugseqdir[160]; char plugseqdir[160];
char pythondir[160]; char pythondir[160];
char sounddir[160]; char sounddir[160];
char image_editor[240]; // FILE_MAX length char image_editor[240]; /* 240 = FILE_MAX */
char anim_player[240]; // FILE_MAX length char anim_player[240]; /* 240 = FILE_MAX */
int anim_player_preset; int anim_player_preset;
short v2d_min_gridsize; /* minimum spacing between gridlines in View2D grids */ short v2d_min_gridsize; /* minimum spacing between gridlines in View2D grids */

@ -304,7 +304,7 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_fluid_find_enframe"); RNA_def_property_update(prop, 0, "rna_fluid_find_enframe");
prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_maxlength(prop, 240); RNA_def_property_string_maxlength(prop, FILE_MAX);
RNA_def_property_string_sdna(prop, NULL, "surfdataPath"); RNA_def_property_string_sdna(prop, NULL, "surfdataPath");
RNA_def_property_ui_text(prop, "Path", "Directory (and/or filename prefix) to store baked fluid simulation files in"); RNA_def_property_ui_text(prop, "Path", "Directory (and/or filename prefix) to store baked fluid simulation files in");
RNA_def_property_update(prop, 0, "rna_fluid_update"); RNA_def_property_update(prop, 0, "rna_fluid_update");
@ -381,7 +381,7 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "surfaceSubdivs"); RNA_def_property_int_sdna(prop, NULL, "surfaceSubdivs");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, 0, 5); RNA_def_property_range(prop, 0, 5);
RNA_def_property_ui_text(prop, "Surface Subdivisions", "Number of isosurface subdivisions (this is necessary for the inclusion of particles into the surface generation - WARNING: can lead to longer computation times !)"); RNA_def_property_ui_text(prop, "Surface Subdivisions", "Number of isosurface subdivisions (this is necessary for the inclusion of particles into the surface generation - WARNING: can lead to longer computation times !)");
prop= RNA_def_property(srna, "use_speed_vectors", PROP_BOOLEAN, PROP_NONE); prop= RNA_def_property(srna, "use_speed_vectors", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "domainNovecgen", 0); RNA_def_property_boolean_negative_sdna(prop, NULL, "domainNovecgen", 0);
@ -554,7 +554,7 @@ static void rna_def_fluidsim_particle(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Alpha Influence", "Amount of particle alpha change, inverse of size influence: 0=off (all same alpha), 1=full (large particles get lower alphas, smaller ones higher values)"); RNA_def_property_ui_text(prop, "Alpha Influence", "Amount of particle alpha change, inverse of size influence: 0=off (all same alpha), 1=full (large particles get lower alphas, smaller ones higher values)");
prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_maxlength(prop, 240); RNA_def_property_string_maxlength(prop, FILE_MAX);
RNA_def_property_string_sdna(prop, NULL, "surfdataPath"); RNA_def_property_string_sdna(prop, NULL, "surfdataPath");
RNA_def_property_ui_text(prop, "Path", "Directory (and/or filename prefix) to store and load particles from"); RNA_def_property_ui_text(prop, "Path", "Directory (and/or filename prefix) to store and load particles from");
RNA_def_property_update(prop, 0, "rna_fluid_update"); RNA_def_property_update(prop, 0, "rna_fluid_update");

@ -32,6 +32,8 @@
#include "rna_internal.h" #include "rna_internal.h"
#include "BKE_utildefines.h"
#ifdef RNA_RUNTIME #ifdef RNA_RUNTIME
#include "BKE_main.h" #include "BKE_main.h"
@ -323,7 +325,7 @@ void RNA_def_main(BlenderRNA *brna)
RNA_def_struct_ui_icon(srna, ICON_BLENDER); RNA_def_struct_ui_icon(srna, ICON_BLENDER);
prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_maxlength(prop, 240); RNA_def_property_string_maxlength(prop, FILE_MAX);
RNA_def_property_string_funcs(prop, "rna_Main_filepath_get", "rna_Main_filepath_length", "rna_Main_filepath_set"); RNA_def_property_string_funcs(prop, "rna_Main_filepath_get", "rna_Main_filepath_length", "rna_Main_filepath_set");
RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Filename", "Path to the .blend file"); RNA_def_property_ui_text(prop, "Filename", "Path to the .blend file");

@ -248,7 +248,7 @@ void wm_drags_check_ops(bContext *C, wmEvent *event)
/* ************** draw ***************** */ /* ************** draw ***************** */
static void wm_drop_operator_draw(char *name, int x, int y) static void wm_drop_operator_draw(const char *name, int x, int y)
{ {
int width= UI_GetStringWidth(name); int width= UI_GetStringWidth(name);