From 84694bf635cb1d7c2c975c2d62dd1cf62424f785 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 23 May 2025 03:58:32 +0000 Subject: [PATCH] Cleanup: add inline array size comments and minor corrections --- source/blender/animrig/ANIM_keyingsets.hh | 4 ++-- source/blender/editors/space_file/filelist.cc | 2 +- source/blender/editors/space_file/filelist.hh | 2 +- source/blender/editors/transform/transform.hh | 4 ++-- source/blender/gpu/GPU_material.hh | 12 ++++++------ .../imbuf/movie/intern/movie_proxy_indexer.cc | 2 +- source/blender/io/usd/usd.hh | 2 +- source/blender/makesdna/DNA_fluid_types.h | 5 ++--- source/blender/makesdna/DNA_image_types.h | 6 +++--- source/blender/makesdna/DNA_key_types.h | 2 +- source/blender/makesdna/DNA_modifier_types.h | 16 ++++++++-------- source/blender/makesdna/DNA_node_types.h | 14 +++++++------- source/blender/makesdna/DNA_space_types.h | 4 ++-- source/blender/makesdna/DNA_userdef_types.h | 2 +- .../blender/makesdna/DNA_windowmanager_types.h | 2 +- .../modifiers/intern/MOD_laplaciandeform.cc | 2 +- 16 files changed, 40 insertions(+), 41 deletions(-) diff --git a/source/blender/animrig/ANIM_keyingsets.hh b/source/blender/animrig/ANIM_keyingsets.hh index 5b4c92931eb..7edbb53cd8b 100644 --- a/source/blender/animrig/ANIM_keyingsets.hh +++ b/source/blender/animrig/ANIM_keyingsets.hh @@ -49,9 +49,9 @@ struct KeyingSetInfo { /* info */ /** Identifier used for class name, which KeyingSet instances reference as "Type-info Name". */ - char idname[/* MAX_NAME */ 64]; + char idname[/*MAX_NAME*/ 64]; /** identifier so that user can hook this up to a KeyingSet (used as label). */ - char name[/* MAX_NAME */ 64]; + char name[/*MAX_NAME*/ 64]; /** Short help/description. */ char description[1024]; /* #RNA_DYN_DESCR_MAX */ /** Keying settings. */ diff --git a/source/blender/editors/space_file/filelist.cc b/source/blender/editors/space_file/filelist.cc index 47e80351579..7419c3fc306 100644 --- a/source/blender/editors/space_file/filelist.cc +++ b/source/blender/editors/space_file/filelist.cc @@ -1143,7 +1143,7 @@ void filelist_free_icons() void filelist_file_get_full_path(const FileList *filelist, const FileDirEntry *file, - char r_filepath[/*FILE_MAX_LIBEXTRA*/]) + char r_filepath[FILE_MAX_LIBEXTRA]) { if (file->asset) { const std::string asset_path = file->asset->full_path(); diff --git a/source/blender/editors/space_file/filelist.hh b/source/blender/editors/space_file/filelist.hh index a0d0758a1f6..dee67f4f826 100644 --- a/source/blender/editors/space_file/filelist.hh +++ b/source/blender/editors/space_file/filelist.hh @@ -81,7 +81,7 @@ void filelist_init_icons(); void filelist_free_icons(); void filelist_file_get_full_path(const FileList *filelist, const FileDirEntry *file, - char r_filepath[/*FILE_MAX_LIBEXTRA*/]); + char r_filepath[/*FILE_MAX_LIBEXTRA*/ 1090]); bool filelist_file_is_preview_pending(const FileList *filelist, const FileDirEntry *file); /** * \return True if a new preview request was pushed, false otherwise (e.g. because the preview is diff --git a/source/blender/editors/transform/transform.hh b/source/blender/editors/transform/transform.hh index e7642b25b21..1a23036d13c 100644 --- a/source/blender/editors/transform/transform.hh +++ b/source/blender/editors/transform/transform.hh @@ -809,8 +809,8 @@ struct TransInfo { /** Orientation matrix of the current space. */ float spacemtx[3][3]; float spacemtx_inv[3][3]; - /** Name of the current space, MAX_NAME. */ - char spacename[64]; + /** Name of the current space. */ + char spacename[/*MAX_NAME*/ 64]; /*************** NEW STUFF *********************/ /** Event type used to launch transform. */ diff --git a/source/blender/gpu/GPU_material.hh b/source/blender/gpu/GPU_material.hh index 84f0a65b6fb..3b1e7253b93 100644 --- a/source/blender/gpu/GPU_material.hh +++ b/source/blender/gpu/GPU_material.hh @@ -165,7 +165,7 @@ struct GPULayerAttr { /* Meaningful part of the attribute set key. */ char name[256]; /* Multiple MAX_CUSTOMDATA_LAYER_NAME */ - /** Hash of name[68]. */ + /** Hash of `name[68]`. */ uint32_t hash_code; /* Helper fields used by code generation. */ @@ -208,9 +208,9 @@ enum eGPUDefaultValue { struct GPUMaterialAttribute { GPUMaterialAttribute *next, *prev; - int type; /* eCustomDataType */ - char name[68]; /* MAX_CUSTOMDATA_LAYER_NAME */ - char input_name[12 + 1]; /* GPU_MAX_SAFE_ATTR_NAME + 1 */ + int type; /* eCustomDataType */ + char name[/*MAX_CUSTOMDATA_LAYER_NAME*/ 68]; + char input_name[/*GPU_MAX_SAFE_ATTR_NAME + 1*/ 12 + 1]; eGPUType gputype; eGPUDefaultValue default_value; /* Only for volumes attributes. */ int id; @@ -247,8 +247,8 @@ struct GPUUniformAttr { GPUUniformAttr *next, *prev; /* Meaningful part of the attribute set key. */ - char name[68]; /* MAX_CUSTOMDATA_LAYER_NAME */ - /** Hash of name[68] + use_dupli. */ + char name[/*MAX_CUSTOMDATA_LAYER_NAME*/ 68]; + /** Hash of `name[MAX_CUSTOMDATA_LAYER_NAME] + use_dupli`. */ uint32_t hash_code; bool use_dupli; diff --git a/source/blender/imbuf/movie/intern/movie_proxy_indexer.cc b/source/blender/imbuf/movie/intern/movie_proxy_indexer.cc index c4f633b7d18..8a5b7e1ebd6 100644 --- a/source/blender/imbuf/movie/intern/movie_proxy_indexer.cc +++ b/source/blender/imbuf/movie/intern/movie_proxy_indexer.cc @@ -297,7 +297,7 @@ static bool get_proxy_filepath(const MovieReader *anim, BLI_assert(i >= 0); - char proxy_name[256]; + char proxy_name[FILE_MAXFILE]; char stream_suffix[20]; const char *name = (temp) ? "proxy_%d%s_part.avi" : "proxy_%d%s.avi"; diff --git a/source/blender/io/usd/usd.hh b/source/blender/io/usd/usd.hh index 528bfc46e35..4e19c8bf9b4 100644 --- a/source/blender/io/usd/usd.hh +++ b/source/blender/io/usd/usd.hh @@ -234,7 +234,7 @@ struct USDImportParams { eUSDMtlNameCollisionMode mtl_name_collision_mode; eUSDTexImportMode import_textures_mode; - char import_textures_dir[768]; /* FILE_MAXDIR */ + char import_textures_dir[/*FILE_MAXDIR*/ 768]; eUSDTexNameCollisionMode tex_name_collision_mode; eUSDAttrImportMode attr_import_mode; diff --git a/source/blender/makesdna/DNA_fluid_types.h b/source/blender/makesdna/DNA_fluid_types.h index ffc96d025a3..f0cab244b3e 100644 --- a/source/blender/makesdna/DNA_fluid_types.h +++ b/source/blender/makesdna/DNA_fluid_types.h @@ -629,7 +629,7 @@ typedef struct FluidDomainSettings { char cache_data_format; char cache_particle_format; char cache_noise_format; - char cache_directory[1024]; + char cache_directory[/*FILE_MAX*/ 1024]; char error[64]; /* Bake error description. */ short cache_type; char cache_id[4]; /* Run-time only */ @@ -783,8 +783,7 @@ typedef struct FluidFlowSettings { float texture_size; float texture_offset; char _pad2[4]; - /* MAX_CUSTOMDATA_LAYER_NAME. */ - char uvlayer_name[68]; + char uvlayer_name[/*MAX_CUSTOMDATA_LAYER_NAME*/ 68]; char _pad3[4]; short vgroup_density; diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h index 024f8f5dc0b..2657d6f6524 100644 --- a/source/blender/makesdna/DNA_image_types.h +++ b/source/blender/makesdna/DNA_image_types.h @@ -120,9 +120,9 @@ enum { /* Used to get the correct gpu texture from an Image datablock. */ typedef enum eGPUTextureTarget { TEXTARGET_2D = 0, - TEXTARGET_2D_ARRAY, - TEXTARGET_TILE_MAPPING, - TEXTARGET_COUNT, + TEXTARGET_2D_ARRAY = 1, + TEXTARGET_TILE_MAPPING = 2, + TEXTARGET_COUNT = 3, } eGPUTextureTarget; typedef struct Image { diff --git a/source/blender/makesdna/DNA_key_types.h b/source/blender/makesdna/DNA_key_types.h index 6ef0d03967b..599678b6b31 100644 --- a/source/blender/makesdna/DNA_key_types.h +++ b/source/blender/makesdna/DNA_key_types.h @@ -52,7 +52,7 @@ typedef struct KeyBlock { * E.g. meshes use float3. */ void *data; /** Unique name, user assigned. */ - char name[64]; + char name[/*MAX_NAME*/ 64]; /** Optional vertex group, array gets allocated into 'weights' when set. */ char vgroup[/*MAX_VGROUP_NAME*/ 64]; diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 00fb45f954c..9b93bbf6fed 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -213,7 +213,7 @@ typedef struct MappingInfoModifierData { struct Tex *texture; struct Object *map_object; - char map_bone[64]; + char map_bone[/*MAXBONENAME*/ 64]; char uvlayer_name[/*MAX_CUSTOMDATA_LAYER_NAME*/ 68]; char _pad1[4]; int uvlayer_tmp; @@ -631,7 +631,7 @@ typedef struct DisplaceModifierData { struct Tex *texture; struct Object *map_object; - char map_bone[64]; + char map_bone[/*MAXBONENAME*/ 64]; char uvlayer_name[/*MAX_CUSTOMDATA_LAYER_NAME*/ 68]; char _pad1[4]; int uvlayer_tmp; @@ -785,7 +785,7 @@ typedef struct WaveModifierData { struct Tex *texture; struct Object *map_object; - char map_bone[64]; + char map_bone[/*MAXBONENAME*/ 64]; char uvlayer_name[/*MAX_CUSTOMDATA_LAYER_NAME*/ 68]; char _pad1[4]; int uvlayer_tmp; @@ -1460,7 +1460,7 @@ typedef struct WarpModifierData { struct Tex *texture; struct Object *map_object; - char map_bone[64]; + char map_bone[/*MAXBONENAME*/ 64]; char uvlayer_name[/*MAX_CUSTOMDATA_LAYER_NAME*/ 68]; char _pad1[4]; int uvlayer_tmp; @@ -1539,7 +1539,7 @@ typedef struct WeightVGEditModifierData { /** Name of the map object. */ struct Object *mask_tex_map_obj; /** Name of the map bone. */ - char mask_tex_map_bone[64]; + char mask_tex_map_bone[/*MAXBONENAME*/ 64]; /** How to map the texture (using MOD_DISP_MAP_* enums). */ int mask_tex_mapping; /** Name of the UV map. */ @@ -1592,11 +1592,11 @@ typedef struct WeightVGMixModifierData { /** Name of the map object. */ struct Object *mask_tex_map_obj; /** Name of the map bone. */ - char mask_tex_map_bone[64]; + char mask_tex_map_bone[/*MAXBONENAME*/ 64]; /** How to map the texture. */ int mask_tex_mapping; /** Name of the UV map. */ - char mask_tex_uvlayer_name[68]; + char mask_tex_uvlayer_name[/*MAX_CUSTOMDATA_LAYER_NAME*/ 68]; char _pad1[4]; char flag; @@ -1681,7 +1681,7 @@ typedef struct WeightVGProximityModifierData { /** Name of the map object. */ struct Object *mask_tex_map_obj; /** Name of the map bone. */ - char mask_tex_map_bone[64]; + char mask_tex_map_bone[/*MAXBONENAME*/ 64]; /** How to map the texture. */ int mask_tex_mapping; /** Name of the UV Map. */ diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index edfe1f8f045..1081d9638c6 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -1520,7 +1520,7 @@ typedef struct TexNodeOutput { } TexNodeOutput; typedef struct NodeKeyingScreenData { - char tracking_object[64]; + char tracking_object[/*MAX_NAME*/ 64]; float smoothness DNA_DEPRECATED; } NodeKeyingScreenData; @@ -1540,7 +1540,7 @@ typedef struct NodeKeyingData { } NodeKeyingData; typedef struct NodeTrackPosData { - char tracking_object[64]; + char tracking_object[/*MAX_NAME*/ 64]; char track_name[64]; } NodeTrackPosData; @@ -1576,20 +1576,20 @@ typedef struct NodeShaderScript { typedef struct NodeShaderTangent { int direction_type; int axis; - char uv_map[64]; + char uv_map[/*MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX*/ 64]; } NodeShaderTangent; typedef struct NodeShaderNormalMap { int space; - char uv_map[64]; + char uv_map[/*MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX*/ 64]; } NodeShaderNormalMap; typedef struct NodeShaderUVMap { - char uv_map[64]; + char uv_map[/*MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX*/ 64]; } NodeShaderUVMap; typedef struct NodeShaderVertexColor { - char layer_name[64]; + char layer_name[/*MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX*/ 64]; } NodeShaderVertexColor; typedef struct NodeShaderTexIES { @@ -1599,7 +1599,7 @@ typedef struct NodeShaderTexIES { } NodeShaderTexIES; typedef struct NodeShaderOutputAOV { - char name[64]; + char name[/*MAX_NAME*/ 64]; } NodeShaderOutputAOV; typedef struct NodeSunBeams { diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 7ac963d979e..389da8994d6 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -400,9 +400,9 @@ typedef struct FileSelectParams { * needs to be linked in, where `foo.blend/Armature` need adding. */ char dir[/*FILE_MAX_LIBEXTRA*/ 1090]; - char file[256]; + char file[/*FILE_MAXFILE*/ 256]; - char renamefile[256]; + char renamefile[/*FILE_MAXFILE*/ 256]; short rename_flag; char _pad[4]; /** An ID that was just renamed. Used to identify a renamed asset file over re-reads, similar to diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index da84b867191..532239f11eb 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -104,7 +104,7 @@ typedef struct bUserExtensionRepo { * Use a shorter name than #NAME_MAX to leave room for a base module prefix. * e.g. `bl_ext.{submodule}.{add_on}` to allow this string to fit into #bAddon::module. */ - char module[/*NAME_MAX-16*/ 48]; + char module[/*MAX_NAME - 16*/ 48]; /** * Secret access token for remote repositories (allocated). diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index c49b608e736..cd16cf87f14 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -286,7 +286,7 @@ typedef struct wmWindow { /** Temporary when switching. */ struct Scene *new_scene; /** Active view layer displayed in this window. */ - char view_layer_name[64]; + char view_layer_name[/*MAX_NAME*/ 64]; /** The workspace may temporarily override the window's scene with scene pinning. This is the * "overridden" or "default" scene to restore when entering a workspace with no scene pinned. */ struct Scene *unpinned_scene; diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.cc b/source/blender/modifiers/intern/MOD_laplaciandeform.cc index a4541dc7be0..6e734d163d5 100644 --- a/source/blender/modifiers/intern/MOD_laplaciandeform.cc +++ b/source/blender/modifiers/intern/MOD_laplaciandeform.cc @@ -60,7 +60,7 @@ struct LaplacianSystem { int anchors_num; int repeat; /** Vertex Group name */ - char anchor_grp_name[64]; + char anchor_grp_name[/*MAX_VGROUP_NAME*/ 64]; /** Original vertex coordinates. */ float (*co)[3]; /** Original vertex normal. */