From 0f29f2c3e630a9f092bf02fd4669d27aef4b5921 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 1 Jun 2022 15:06:21 +1000 Subject: [PATCH] Cleanup: remove redundant const qualifiers for scalar & enum types --- source/blender/blenkernel/BKE_attribute.h | 8 ++++---- .../blenkernel/BKE_attribute_access.hh | 8 +++----- source/blender/blenkernel/BKE_customdata.h | 2 +- .../blender/blenkernel/BKE_geometry_fields.hh | 2 +- source/blender/blenkernel/BKE_geometry_set.hh | 12 +++++------ source/blender/blenkernel/BKE_lib_remap.h | 8 ++++---- source/blender/editors/include/BIF_glutil.h | 20 +++++++++---------- .../intern/MOD_gpencil_util.h | 2 +- source/blender/imbuf/IMB_colormanagement.h | 8 ++++---- source/blender/imbuf/intern/IMB_filetype.h | 8 ++++---- .../imbuf/intern/openexr/openexr_api.h | 4 ++-- source/blender/nodes/NOD_geometry_exec.hh | 4 ++-- source/blender/render/RE_pipeline.h | 6 +++--- source/blender/render/RE_texture_margin.h | 9 +++------ source/blender/sequencer/SEQ_channels.h | 4 ++-- 15 files changed, 50 insertions(+), 55 deletions(-) diff --git a/source/blender/blenkernel/BKE_attribute.h b/source/blender/blenkernel/BKE_attribute.h index 2985e7cd0b2..78edb6b95ed 100644 --- a/source/blender/blenkernel/BKE_attribute.h +++ b/source/blender/blenkernel/BKE_attribute.h @@ -64,13 +64,13 @@ bool BKE_id_attribute_remove(struct ID *id, struct CustomDataLayer *BKE_id_attribute_find(const struct ID *id, const char *name, - const int type, - const eAttrDomain domain); + int type, + eAttrDomain domain); struct CustomDataLayer *BKE_id_attribute_search(const struct ID *id, const char *name, - const eCustomDataMask type, - const eAttrDomainMask domain_mask); + eCustomDataMask type, + eAttrDomainMask domain_mask); eAttrDomain BKE_id_attribute_domain(const struct ID *id, const struct CustomDataLayer *layer); int BKE_id_attribute_data_length(struct ID *id, struct CustomDataLayer *layer); diff --git a/source/blender/blenkernel/BKE_attribute_access.hh b/source/blender/blenkernel/BKE_attribute_access.hh index d7826a0e17a..fef91d6f75d 100644 --- a/source/blender/blenkernel/BKE_attribute_access.hh +++ b/source/blender/blenkernel/BKE_attribute_access.hh @@ -376,7 +376,7 @@ class CustomDataAttributes { * value for the type will be used. */ blender::GVArray get_for_read(const AttributeIDRef &attribute_id, - const eCustomDataType data_type, + eCustomDataType data_type, const void *default_value) const; template @@ -389,10 +389,8 @@ class CustomDataAttributes { } std::optional get_for_write(const AttributeIDRef &attribute_id); - bool create(const AttributeIDRef &attribute_id, const eCustomDataType data_type); - bool create_by_move(const AttributeIDRef &attribute_id, - const eCustomDataType data_type, - void *buffer); + bool create(const AttributeIDRef &attribute_id, eCustomDataType data_type); + bool create_by_move(const AttributeIDRef &attribute_id, eCustomDataType data_type, void *buffer); bool remove(const AttributeIDRef &attribute_id); /** diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index 0e3e427d7ab..993ab476830 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -749,7 +749,7 @@ void CustomData_debug_info_from_layers(const struct CustomData *data, # include "BLI_cpp_type.hh" namespace blender::bke { -const CPPType *custom_data_type_to_cpp_type(const eCustomDataType type); +const CPPType *custom_data_type_to_cpp_type(eCustomDataType type); eCustomDataType cpp_type_to_custom_data_type(const CPPType &type); } // namespace blender::bke #endif diff --git a/source/blender/blenkernel/BKE_geometry_fields.hh b/source/blender/blenkernel/BKE_geometry_fields.hh index 8478a9d7464..7c504826044 100644 --- a/source/blender/blenkernel/BKE_geometry_fields.hh +++ b/source/blender/blenkernel/BKE_geometry_fields.hh @@ -104,7 +104,7 @@ VArray curve_normals_varray(const CurveComponent &component, const eAttr VArray mesh_normals_varray(const MeshComponent &mesh_component, const Mesh &mesh, const IndexMask mask, - const eAttrDomain domain); + eAttrDomain domain); class NormalFieldInput : public GeometryFieldInput { public: diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh index 04e467b2ff1..8d658c9be15 100644 --- a/source/blender/blenkernel/BKE_geometry_set.hh +++ b/source/blender/blenkernel/BKE_geometry_set.hh @@ -157,7 +157,7 @@ class GeometryComponent { /** Returns true when the attribute has been created. */ bool attribute_try_create(const blender::bke::AttributeIDRef &attribute_id, eAttrDomain domain, - const eCustomDataType data_type, + eCustomDataType data_type, const AttributeInit &initializer); /** @@ -183,7 +183,7 @@ class GeometryComponent { */ blender::GVArray attribute_try_get_for_read(const blender::bke::AttributeIDRef &attribute_id, eAttrDomain domain, - const eCustomDataType data_type) const; + eCustomDataType data_type) const; /** * Get a virtual array that refers to the data of an attribute, interpolated to the given domain. @@ -199,7 +199,7 @@ class GeometryComponent { * cannot be converted. */ blender::bke::ReadAttributeLookup attribute_try_get_for_read( - const blender::bke::AttributeIDRef &attribute_id, const eCustomDataType data_type) const; + const blender::bke::AttributeIDRef &attribute_id, eCustomDataType data_type) const; /** * Get a virtual array that refers to the data of an attribute, interpolated to the given domain @@ -208,7 +208,7 @@ class GeometryComponent { */ blender::GVArray attribute_get_for_read(const blender::bke::AttributeIDRef &attribute_id, eAttrDomain domain, - const eCustomDataType data_type, + eCustomDataType data_type, const void *default_value = nullptr) const; /* Use instead of the method above when the type is known at compile time for type safety. */ template @@ -235,7 +235,7 @@ class GeometryComponent { blender::bke::OutputAttribute attribute_try_get_for_output( const blender::bke::AttributeIDRef &attribute_id, eAttrDomain domain, - const eCustomDataType data_type, + eCustomDataType data_type, const void *default_value = nullptr); /* Use instead of the method above when the type is known at compile time for type safety. */ template @@ -258,7 +258,7 @@ class GeometryComponent { blender::bke::OutputAttribute attribute_try_get_for_output_only( const blender::bke::AttributeIDRef &attribute_id, eAttrDomain domain, - const eCustomDataType data_type); + eCustomDataType data_type); /* Use instead of the method above when the type is known at compile time for type safety. */ template blender::bke::OutputAttribute_Typed attribute_try_get_for_output_only( diff --git a/source/blender/blenkernel/BKE_lib_remap.h b/source/blender/blenkernel/BKE_lib_remap.h index f62225179bd..37b626fb4da 100644 --- a/source/blender/blenkernel/BKE_lib_remap.h +++ b/source/blender/blenkernel/BKE_lib_remap.h @@ -95,11 +95,11 @@ typedef enum eIDRemapType { */ void BKE_libblock_remap_multiple_locked(struct Main *bmain, struct IDRemapper *mappings, - const short remap_flags); + short remap_flags); void BKE_libblock_remap_multiple(struct Main *bmain, struct IDRemapper *mappings, - const short remap_flags); + short remap_flags); /** * Replace all references in given Main to \a old_id by \a new_id @@ -142,9 +142,9 @@ void BKE_libblock_relink_ex(struct Main *bmain, */ void BKE_libblock_relink_multiple(struct Main *bmain, struct LinkNode *ids, - const eIDRemapType remap_type, + eIDRemapType remap_type, struct IDRemapper *id_remapper, - const short remap_flags); + short remap_flags); /** * Remaps ID usages of given ID to their `id->newid` pointer if not None, and proceeds recursively diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index 3f1b8d6ecda..84512653a24 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -55,17 +55,17 @@ IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin); * finished. */ void immDrawPixelsTexScaledFullSize(const IMMDrawPixelsTexState *state, - const float x, - const float y, - const int img_w, - const int img_h, - const eGPUTextureFormat gpu_format, - const bool use_filter, + float x, + float y, + int img_w, + int img_h, + eGPUTextureFormat gpu_format, + bool use_filter, const void *rect, - const float scaleX, - const float scaleY, - const float xzoom, - const float yzoom, + float scaleX, + float scaleY, + float xzoom, + float yzoom, const float color[4]); /** diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h index e7301b4d910..73423d9a8ee 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h @@ -49,5 +49,5 @@ typedef void (*gpBakeCb)(struct GpencilModifierData *md_, void generic_bake_deform_stroke(struct Depsgraph *depsgraph, struct GpencilModifierData *md, struct Object *ob, - const bool retime, + bool retime, gpBakeCb bake_cb); diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h index 512dc674fc7..75159e186e9 100644 --- a/source/blender/imbuf/IMB_colormanagement.h +++ b/source/blender/imbuf/IMB_colormanagement.h @@ -519,10 +519,10 @@ enum { * \{ */ void IMB_colormanagement_blackbody_temperature_to_rgb_table(float *r_table, - const int width, - const float min, - const float max); -void IMB_colormanagement_wavelength_to_rgb_table(float *r_table, const int width); + int width, + float min, + float max); +void IMB_colormanagement_wavelength_to_rgb_table(float *r_table, int width); /** \} */ diff --git a/source/blender/imbuf/intern/IMB_filetype.h b/source/blender/imbuf/intern/IMB_filetype.h index 67d1aefeacb..6e505746643 100644 --- a/source/blender/imbuf/intern/IMB_filetype.h +++ b/source/blender/imbuf/intern/IMB_filetype.h @@ -42,8 +42,8 @@ typedef struct ImFileType { * dimensions of the full-size image in r_width & r_height. */ struct ImBuf *(*load_filepath_thumbnail)(const char *filepath, - const int flags, - const size_t max_thumb_size, + int flags, + size_t max_thumb_size, char colorspace[IM_MAX_SPACE], size_t *r_width, size_t *r_height); @@ -155,8 +155,8 @@ struct ImBuf *imb_load_jpeg(const unsigned char *buffer, int flags, char colorspace[IM_MAX_SPACE]); struct ImBuf *imb_thumbnail_jpeg(const char *filepath, - const int flags, - const size_t max_thumb_size, + int flags, + size_t max_thumb_size, char colorspace[IM_MAX_SPACE], size_t *r_width, size_t *r_height); diff --git a/source/blender/imbuf/intern/openexr/openexr_api.h b/source/blender/imbuf/intern/openexr/openexr_api.h index a62c87428b6..40a724c9f42 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.h +++ b/source/blender/imbuf/intern/openexr/openexr_api.h @@ -27,8 +27,8 @@ bool imb_save_openexr(struct ImBuf *ibuf, const char *name, int flags); struct ImBuf *imb_load_openexr(const unsigned char *mem, size_t size, int flags, char *colorspace); struct ImBuf *imb_load_filepath_thumbnail_openexr(const char *filepath, - const int flags, - const size_t max_thumb_size, + int flags, + size_t max_thumb_size, char colorspace[], size_t *r_width, size_t *r_height); diff --git a/source/blender/nodes/NOD_geometry_exec.hh b/source/blender/nodes/NOD_geometry_exec.hh index 176a240791e..8ffa9d978a8 100644 --- a/source/blender/nodes/NOD_geometry_exec.hh +++ b/source/blender/nodes/NOD_geometry_exec.hh @@ -308,7 +308,7 @@ class GeoNodeExecParams { GVArray get_input_attribute(const StringRef name, const GeometryComponent &component, eAttrDomain domain, - const eCustomDataType type, + eCustomDataType type, const void *default_value) const; template @@ -328,7 +328,7 @@ class GeoNodeExecParams { */ eCustomDataType get_input_attribute_data_type(const StringRef name, const GeometryComponent &component, - const eCustomDataType default_type) const; + eCustomDataType default_type) const; /** * If any of the corresponding input sockets are attributes instead of single values, diff --git a/source/blender/render/RE_pipeline.h b/source/blender/render/RE_pipeline.h index 0a8668221ad..39820603c98 100644 --- a/source/blender/render/RE_pipeline.h +++ b/source/blender/render/RE_pipeline.h @@ -247,15 +247,15 @@ void RE_render_result_full_channel_name(char *fullname, const char *passname, const char *viewname, const char *chan_id, - const int channel); + int channel); struct ImBuf *RE_render_result_rect_to_ibuf(struct RenderResult *rr, const struct ImageFormatData *imf, const float dither, - const int view_id); + int view_id); void RE_render_result_rect_from_ibuf(struct RenderResult *rr, const struct ImBuf *ibuf, - const int view_id); + int view_id); struct RenderLayer *RE_GetRenderLayer(struct RenderResult *rr, const char *name); float *RE_RenderLayerGetPass(struct RenderLayer *rl, const char *name, const char *viewname); diff --git a/source/blender/render/RE_texture_margin.h b/source/blender/render/RE_texture_margin.h index 0c91abeaddd..023615cea87 100644 --- a/source/blender/render/RE_texture_margin.h +++ b/source/blender/render/RE_texture_margin.h @@ -27,16 +27,13 @@ struct Mesh; */ void RE_generate_texturemargin_adjacentfaces(struct ImBuf *ibuf, char *mask, - const int margin, + int margin, struct Mesh const *me, char const *uv_layer, const float uv_offset[2]); -void RE_generate_texturemargin_adjacentfaces_dm(struct ImBuf *ibuf, - char *mask, - const int margin, - struct DerivedMesh *dm, - const float uv_offset[2]); +void RE_generate_texturemargin_adjacentfaces_dm( + struct ImBuf *ibuf, char *mask, int margin, struct DerivedMesh *dm, const float uv_offset[2]); #ifdef __cplusplus } diff --git a/source/blender/sequencer/SEQ_channels.h b/source/blender/sequencer/SEQ_channels.h index dcfdb933940..197ad5e55de 100644 --- a/source/blender/sequencer/SEQ_channels.h +++ b/source/blender/sequencer/SEQ_channels.h @@ -24,8 +24,8 @@ void SEQ_channels_duplicate(struct ListBase *channels_dst, struct ListBase *chan void SEQ_channels_free(struct ListBase *channels); struct SeqTimelineChannel *SEQ_channel_get_by_index(const struct ListBase *channels, - const int channel_index); -char *SEQ_channel_name_get(struct ListBase *channels, const int channel_index); + int channel_index); +char *SEQ_channel_name_get(struct ListBase *channels, int channel_index); bool SEQ_channel_is_locked(const struct SeqTimelineChannel *channel); bool SEQ_channel_is_muted(const struct SeqTimelineChannel *channel); int SEQ_channel_index_get(const struct SeqTimelineChannel *channel);