diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-06-30 09:37:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-06-30 09:42:19 +0300 |
commit | 501d2443d03cce18985fab3ffad5d23238748f3e (patch) | |
tree | 1d127d4e4c6d82fc85feedc9826dd5619174e346 /source/blender | |
parent | df9597cfba78deb40009553ab9dcf09c21edd434 (diff) |
Cleanup: use const arguments for accessor functions
Diffstat (limited to 'source/blender')
70 files changed, 249 insertions, 233 deletions
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index 07b7aa2ec50..86aa18e5739 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -151,7 +151,7 @@ typedef struct PoseTree { struct bArmature *BKE_armature_add(struct Main *bmain, const char *name); struct bArmature *BKE_armature_from_object(struct Object *ob); -int BKE_armature_bonelist_count(struct ListBase *lb); +int BKE_armature_bonelist_count(const struct ListBase *lb); void BKE_armature_bonelist_free(struct ListBase *lb, const bool do_id_user); void BKE_armature_editbonelist_free(struct ListBase *lb, const bool do_id_user); diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h index 7963d54126e..f47cdf32ca0 100644 --- a/source/blender/blenkernel/BKE_collection.h +++ b/source/blender/blenkernel/BKE_collection.h @@ -164,7 +164,8 @@ bool BKE_collection_move(struct Main *bmain, bool BKE_collection_cycle_find(struct Collection *new_ancestor, struct Collection *collection); bool BKE_collection_cycles_fix(struct Main *bmain, struct Collection *collection); -bool BKE_collection_has_collection(struct Collection *parent, struct Collection *collection); +bool BKE_collection_has_collection(const struct Collection *parent, + const struct Collection *collection); void BKE_collection_parent_relations_rebuild(struct Collection *collection); void BKE_main_collections_parent_relations_rebuild(struct Main *bmain); diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index ed2d9d4507f..f494c2e30cc 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -227,9 +227,9 @@ struct FCurve *BKE_fcurve_find_by_rna_context_ui(struct bContext *C, /* Binary search algorithm for finding where to 'insert' BezTriple with given frame number. * Returns the index to insert at (data already at that index will be offset if replace is 0) */ -int BKE_fcurve_bezt_binarysearch_index(struct BezTriple array[], - float frame, - int arraylen, +int BKE_fcurve_bezt_binarysearch_index(const struct BezTriple array[], + const float frame, + const int arraylen, bool *r_replace); /* fcurve_cache.c */ diff --git a/source/blender/blenkernel/BKE_gpencil_geom.h b/source/blender/blenkernel/BKE_gpencil_geom.h index 8fc3ce133a0..c1ccae7a437 100644 --- a/source/blender/blenkernel/BKE_gpencil_geom.h +++ b/source/blender/blenkernel/BKE_gpencil_geom.h @@ -90,7 +90,7 @@ typedef struct GPencilPointCoordinates { float pressure; } GPencilPointCoordinates; -int BKE_gpencil_stroke_point_count(struct bGPdata *gpd); +int BKE_gpencil_stroke_point_count(const struct bGPdata *gpd); void BKE_gpencil_point_coords_get(struct bGPdata *gpd, GPencilPointCoordinates *elem_data); void BKE_gpencil_point_coords_apply(struct bGPdata *gpd, const GPencilPointCoordinates *elem_data); void BKE_gpencil_point_coords_apply_with_mat4(struct bGPdata *gpd, diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h index c969ce07d74..58b8d19abaa 100644 --- a/source/blender/blenkernel/BKE_key.h +++ b/source/blender/blenkernel/BKE_key.h @@ -76,7 +76,7 @@ void BKE_keyblock_update_from_lattice(struct Lattice *lt, struct KeyBlock *kb); void BKE_keyblock_convert_from_lattice(struct Lattice *lt, struct KeyBlock *kb); void BKE_keyblock_convert_to_lattice(struct KeyBlock *kb, struct Lattice *lt); -int BKE_keyblock_curve_element_count(struct ListBase *nurb); +int BKE_keyblock_curve_element_count(const struct ListBase *nurb); void BKE_keyblock_curve_data_transform(const struct ListBase *nurb, const float mat[4][4], const void *src, diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h index 240d6cb18ec..404f344919c 100644 --- a/source/blender/blenkernel/BKE_layer.h +++ b/source/blender/blenkernel/BKE_layer.h @@ -92,7 +92,7 @@ bool BKE_layer_collection_activate(struct ViewLayer *view_layer, struct LayerCol struct LayerCollection *BKE_layer_collection_activate_parent(struct ViewLayer *view_layer, struct LayerCollection *lc); -int BKE_layer_collection_count(struct ViewLayer *view_layer); +int BKE_layer_collection_count(const struct ViewLayer *view_layer); struct LayerCollection *BKE_layer_collection_from_index(struct ViewLayer *view_layer, const int index); @@ -107,8 +107,8 @@ void BKE_layer_collection_local_sync_all(const struct Main *bmain); void BKE_main_collection_sync_remap(const struct Main *bmain); struct LayerCollection *BKE_layer_collection_first_from_scene_collection( - struct ViewLayer *view_layer, const struct Collection *collection); -bool BKE_view_layer_has_collection(struct ViewLayer *view_layer, + const struct ViewLayer *view_layer, const struct Collection *collection); +bool BKE_view_layer_has_collection(const struct ViewLayer *view_layer, const struct Collection *collection); bool BKE_scene_has_object(struct Scene *scene, struct Object *ob); @@ -367,7 +367,7 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter); struct ObjectsInViewLayerParams { uint no_dup_data : 1; - bool (*filter_fn)(struct Object *ob, void *user_data); + bool (*filter_fn)(const struct Object *ob, void *user_data); void *filter_userdata; }; @@ -388,7 +388,7 @@ struct ObjectsInModeParams { int object_mode; uint no_dup_data : 1; - bool (*filter_fn)(struct Object *ob, void *user_data); + bool (*filter_fn)(const struct Object *ob, void *user_data); void *filter_userdata; }; @@ -412,8 +412,8 @@ struct Object **BKE_view_layer_array_from_objects_in_mode_params( BKE_view_layer_array_from_bases_in_mode_params( \ view_layer, v3d, r_len, &(const struct ObjectsInModeParams)__VA_ARGS__) -bool BKE_view_layer_filter_edit_mesh_has_uvs(struct Object *ob, void *user_data); -bool BKE_view_layer_filter_edit_mesh_has_edges(struct Object *ob, void *user_data); +bool BKE_view_layer_filter_edit_mesh_has_uvs(const struct Object *ob, void *user_data); +bool BKE_view_layer_filter_edit_mesh_has_edges(const struct Object *ob, void *user_data); /* Utility macros that wrap common args (add more as needed). */ diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index 0fa44067b16..97e5698d6f9 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -474,7 +474,7 @@ bool BKE_pbvh_node_vert_update_check_any(PBVH *pbvh, PBVHNode *node); // void BKE_pbvh_node_BB_reset(PBVHNode *node); // void BKE_pbvh_node_BB_expand(PBVHNode *node, float co[3]); -bool pbvh_has_mask(PBVH *pbvh); +bool pbvh_has_mask(const PBVH *pbvh); void pbvh_show_mask_set(PBVH *pbvh, bool show_mask); bool pbvh_has_face_sets(PBVH *pbvh); diff --git a/source/blender/blenkernel/BKE_shader_fx.h b/source/blender/blenkernel/BKE_shader_fx.h index 7e3783a3ee9..8d1fe709355 100644 --- a/source/blender/blenkernel/BKE_shader_fx.h +++ b/source/blender/blenkernel/BKE_shader_fx.h @@ -172,7 +172,7 @@ void BKE_shaderfx_copydata_ex(struct ShaderFxData *fx, void BKE_shaderfx_copy(struct ListBase *dst, const struct ListBase *src); void BKE_shaderfx_foreach_ID_link(struct Object *ob, ShaderFxIDWalkFunc walk, void *userData); -bool BKE_shaderfx_has_gpencil(struct Object *ob); +bool BKE_shaderfx_has_gpencil(const struct Object *ob); void BKE_shaderfx_blend_write(struct BlendWriter *writer, struct ListBase *fxbase); void BKE_shaderfx_blend_read_data(struct BlendDataReader *reader, struct ListBase *lb); diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index 26351ee65c2..c7120c60020 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -48,7 +48,7 @@ char *txt_to_buf(struct Text *text, int *r_buf_strlen); void txt_clean_text(struct Text *text); void txt_order_cursors(struct Text *text, const bool reverse); int txt_find_string(struct Text *text, const char *findstr, int wrap, int match_case); -bool txt_has_sel(struct Text *text); +bool txt_has_sel(const struct Text *text); int txt_get_span(struct TextLine *from, struct TextLine *to); void txt_move_up(struct Text *text, const bool sel); void txt_move_down(struct Text *text, const bool sel); @@ -85,8 +85,8 @@ bool txt_uncomment(struct Text *text); void txt_move_lines(struct Text *text, const int direction); void txt_duplicate_line(struct Text *text); int txt_setcurr_tab_spaces(struct Text *text, int space); -bool txt_cursor_is_line_start(struct Text *text); -bool txt_cursor_is_line_end(struct Text *text); +bool txt_cursor_is_line_start(const struct Text *text); +bool txt_cursor_is_line_end(const struct Text *text); int txt_calc_tab_left(struct TextLine *tl, int ch); int txt_calc_tab_right(struct TextLine *tl, int ch); diff --git a/source/blender/blenkernel/BKE_undo_system.h b/source/blender/blenkernel/BKE_undo_system.h index 620496864f5..efac5d9097f 100644 --- a/source/blender/blenkernel/BKE_undo_system.h +++ b/source/blender/blenkernel/BKE_undo_system.h @@ -178,7 +178,7 @@ UndoStack *BKE_undosys_stack_create(void); void BKE_undosys_stack_destroy(UndoStack *ustack); void BKE_undosys_stack_clear(UndoStack *ustack); void BKE_undosys_stack_clear_active(UndoStack *ustack); -bool BKE_undosys_stack_has_undo(UndoStack *ustack, const char *name); +bool BKE_undosys_stack_has_undo(const UndoStack *ustack, const char *name); void BKE_undosys_stack_init_from_main(UndoStack *ustack, struct Main *bmain); void BKE_undosys_stack_init_from_context(UndoStack *ustack, struct bContext *C); UndoStep *BKE_undosys_stack_active_with_type(UndoStack *ustack, const UndoType *ut); diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 5799f82bf94..d0604f4bfda 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -358,7 +358,7 @@ bArmature *BKE_armature_from_object(Object *ob) return NULL; } -int BKE_armature_bonelist_count(ListBase *lb) +int BKE_armature_bonelist_count(const ListBase *lb) { int i = 0; LISTBASE_FOREACH (Bone *, bone, lb) { diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index fdffe7dca57..24266dc6bea 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -79,7 +79,8 @@ static bool collection_object_remove(Main *bmain, static CollectionChild *collection_find_child(Collection *parent, Collection *collection); static CollectionParent *collection_find_parent(Collection *child, Collection *collection); -static bool collection_find_child_recursive(Collection *parent, Collection *collection); +static bool collection_find_child_recursive(const Collection *parent, + const Collection *collection); /** \} */ @@ -1521,9 +1522,9 @@ static CollectionChild *collection_find_child(Collection *parent, Collection *co return BLI_findptr(&parent->children, collection, offsetof(CollectionChild, collection)); } -static bool collection_find_child_recursive(Collection *parent, Collection *collection) +static bool collection_find_child_recursive(const Collection *parent, const Collection *collection) { - LISTBASE_FOREACH (CollectionChild *, child, &parent->children) { + LISTBASE_FOREACH (const CollectionChild *, child, &parent->children) { if (child->collection == collection) { return true; } @@ -1536,7 +1537,7 @@ static bool collection_find_child_recursive(Collection *parent, Collection *coll return false; } -bool BKE_collection_has_collection(Collection *parent, Collection *collection) +bool BKE_collection_has_collection(const Collection *parent, const Collection *collection) { return collection_find_child_recursive(parent, collection); } diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 18dac2fb679..7fe7b38e120 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -510,8 +510,11 @@ FCurve *BKE_fcurve_find_by_rna_context_ui(bContext *C, * with optional argument for precision required. * Returns the index to insert at (data already at that index will be offset if replace is 0) */ -static int BKE_fcurve_bezt_binarysearch_index_ex( - BezTriple array[], float frame, int arraylen, float threshold, bool *r_replace) +static int BKE_fcurve_bezt_binarysearch_index_ex(const BezTriple array[], + const float frame, + const int arraylen, + const float threshold, + bool *r_replace) { int start = 0, end = arraylen; int loopbreaker = 0, maxloop = arraylen * 2; @@ -597,9 +600,9 @@ static int BKE_fcurve_bezt_binarysearch_index_ex( /* Binary search algorithm for finding where to insert BezTriple. (for use by insert_bezt_fcurve) * Returns the index to insert at (data already at that index will be offset if replace is 0) */ -int BKE_fcurve_bezt_binarysearch_index(BezTriple array[], - float frame, - int arraylen, +int BKE_fcurve_bezt_binarysearch_index(const BezTriple array[], + const float frame, + const int arraylen, bool *r_replace) { /* This is just a wrapper which uses the default threshold. */ diff --git a/source/blender/blenkernel/intern/gpencil_geom.c b/source/blender/blenkernel/intern/gpencil_geom.c index 2b16bbb10b2..53939da08e2 100644 --- a/source/blender/blenkernel/intern/gpencil_geom.c +++ b/source/blender/blenkernel/intern/gpencil_geom.c @@ -2616,7 +2616,7 @@ void BKE_gpencil_transform(bGPdata *gpd, const float mat[4][4]) } /* Used for "move only origins" in object_data_transform.c */ -int BKE_gpencil_stroke_point_count(bGPdata *gpd) +int BKE_gpencil_stroke_point_count(const bGPdata *gpd) { int total_points = 0; @@ -2624,7 +2624,7 @@ int BKE_gpencil_stroke_point_count(bGPdata *gpd) return 0; } - LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { + LISTBASE_FOREACH (const bGPDlayer *, gpl, &gpd->layers) { /* FIXME: For now, we just skip parented layers. * Otherwise, we have to update each frame to find * the current parent position/effects. @@ -2633,7 +2633,7 @@ int BKE_gpencil_stroke_point_count(bGPdata *gpd) continue; } - LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) { + LISTBASE_FOREACH (const bGPDframe *, gpf, &gpl->frames) { LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { total_points += gps->totpoints; } diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 073276b7011..1a988e687db 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -2048,9 +2048,9 @@ void BKE_keyblock_convert_to_lattice(KeyBlock *kb, Lattice *lt) /************************* Curve ************************/ -int BKE_keyblock_curve_element_count(ListBase *nurb) +int BKE_keyblock_curve_element_count(const ListBase *nurb) { - Nurb *nu; + const Nurb *nu; int tot = 0; nu = nurb->first; diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 1edf83b6685..d49eb0d4da8 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -676,10 +676,10 @@ LayerCollection *BKE_layer_collection_activate_parent(ViewLayer *view_layer, Lay /** * Recursively get the count of collections */ -static int collection_count(ListBase *lb) +static int collection_count(const ListBase *lb) { int i = 0; - LISTBASE_FOREACH (LayerCollection *, lc, lb) { + LISTBASE_FOREACH (const LayerCollection *, lc, lb) { i += collection_count(&lc->layer_collections) + 1; } return i; @@ -689,7 +689,7 @@ static int collection_count(ListBase *lb) * Get the total number of collections * (including all the nested collections) */ -int BKE_layer_collection_count(ViewLayer *view_layer) +int BKE_layer_collection_count(const ViewLayer *view_layer) { return collection_count(&view_layer->layer_collections); } @@ -1504,7 +1504,7 @@ static LayerCollection *find_layer_collection_by_scene_collection(LayerCollectio /** * Return the first matching LayerCollection in the ViewLayer for the Collection. */ -LayerCollection *BKE_layer_collection_first_from_scene_collection(ViewLayer *view_layer, +LayerCollection *BKE_layer_collection_first_from_scene_collection(const ViewLayer *view_layer, const Collection *collection) { LISTBASE_FOREACH (LayerCollection *, layer_collection, &view_layer->layer_collections) { @@ -1520,7 +1520,7 @@ LayerCollection *BKE_layer_collection_first_from_scene_collection(ViewLayer *vie /** * See if view layer has the scene collection linked directly, or indirectly (nested) */ -bool BKE_view_layer_has_collection(ViewLayer *view_layer, const Collection *collection) +bool BKE_view_layer_has_collection(const ViewLayer *view_layer, const Collection *collection) { return BKE_layer_collection_first_from_scene_collection(view_layer, collection) != NULL; } diff --git a/source/blender/blenkernel/intern/layer_utils.c b/source/blender/blenkernel/intern/layer_utils.c index 974a5a24e8a..10ab0a06dd0 100644 --- a/source/blender/blenkernel/intern/layer_utils.c +++ b/source/blender/blenkernel/intern/layer_utils.c @@ -164,11 +164,11 @@ Object **BKE_view_layer_array_from_objects_in_mode_params(ViewLayer *view_layer, /** \name Filter Functions * \{ */ -bool BKE_view_layer_filter_edit_mesh_has_uvs(Object *ob, void *UNUSED(user_data)) +bool BKE_view_layer_filter_edit_mesh_has_uvs(const Object *ob, void *UNUSED(user_data)) { if (ob->type == OB_MESH) { - Mesh *me = ob->data; - BMEditMesh *em = me->edit_mesh; + const Mesh *me = ob->data; + const BMEditMesh *em = me->edit_mesh; if (em != NULL) { if (CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV) != -1) { return true; @@ -178,11 +178,11 @@ bool BKE_view_layer_filter_edit_mesh_has_uvs(Object *ob, void *UNUSED(user_data) return false; } -bool BKE_view_layer_filter_edit_mesh_has_edges(Object *ob, void *UNUSED(user_data)) +bool BKE_view_layer_filter_edit_mesh_has_edges(const Object *ob, void *UNUSED(user_data)) { if (ob->type == OB_MESH) { - Mesh *me = ob->data; - BMEditMesh *em = me->edit_mesh; + const Mesh *me = ob->data; + const BMEditMesh *em = me->edit_mesh; if (em != NULL) { if (em->bm->totedge != 0) { return true; diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 9f316ec60c0..0d84022da77 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -2985,7 +2985,7 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m } } -bool pbvh_has_mask(PBVH *pbvh) +bool pbvh_has_mask(const PBVH *pbvh) { switch (pbvh->type) { case PBVH_GRIDS: diff --git a/source/blender/blenkernel/intern/shader_fx.c b/source/blender/blenkernel/intern/shader_fx.c index 60f0b744e59..b537bdc5479 100644 --- a/source/blender/blenkernel/intern/shader_fx.c +++ b/source/blender/blenkernel/intern/shader_fx.c @@ -58,9 +58,9 @@ static ShaderFxTypeInfo *shader_fx_types[NUM_SHADER_FX_TYPES] = {NULL}; /* Methods - Evaluation Loops, etc. */ /* check if exist grease pencil effects */ -bool BKE_shaderfx_has_gpencil(Object *ob) +bool BKE_shaderfx_has_gpencil(const Object *ob) { - ShaderFxData *fx; + const ShaderFxData *fx; for (fx = ob->shader_fx.first; fx; fx = fx->next) { const ShaderFxTypeInfo *fxi = BKE_shaderfx_get_info(fx->type); if (fxi->type == eShaderFxType_GpencilType) { diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 123843c88db..9d871777c61 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -3205,7 +3205,7 @@ void sbObjectToSoftbody(Object *ob) free_softbody_intern(ob->soft); } -static bool object_has_edges(Object *ob) +static bool object_has_edges(const Object *ob) { if (ob->type == OB_MESH) { return ((Mesh *)ob->data)->totedge; diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 27f5593c2ca..74845e3f1b9 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -781,12 +781,12 @@ static void txt_curs_sel(Text *text, TextLine ***linep, int **charp) *charp = &text->selc; } -bool txt_cursor_is_line_start(Text *text) +bool txt_cursor_is_line_start(const Text *text) { return (text->selc == 0); } -bool txt_cursor_is_line_end(Text *text) +bool txt_cursor_is_line_end(const Text *text) { return (text->selc == text->sell->len); } @@ -1239,7 +1239,7 @@ void txt_order_cursors(Text *text, const bool reverse) } } -bool txt_has_sel(Text *text) +bool txt_has_sel(const Text *text) { return ((text->curl != text->sell) || (text->curc != text->selc)); } diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c index 377802f1af7..14dd286a315 100644 --- a/source/blender/blenkernel/intern/undo_system.c +++ b/source/blender/blenkernel/intern/undo_system.c @@ -368,10 +368,10 @@ void BKE_undosys_stack_init_from_context(UndoStack *ustack, bContext *C) } /* name optional */ -bool BKE_undosys_stack_has_undo(UndoStack *ustack, const char *name) +bool BKE_undosys_stack_has_undo(const UndoStack *ustack, const char *name) { if (name) { - UndoStep *us = BLI_rfindstring(&ustack->steps, name, offsetof(UndoStep, name)); + const UndoStep *us = BLI_rfindstring(&ustack->steps, name, offsetof(UndoStep, name)); return us && us->prev; } diff --git a/source/blender/blenlib/BLI_dynstr.h b/source/blender/blenlib/BLI_dynstr.h index 4733812746d..4df773c7cc6 100644 --- a/source/blender/blenlib/BLI_dynstr.h +++ b/source/blender/blenlib/BLI_dynstr.h @@ -53,9 +53,9 @@ void BLI_dynstr_appendf(DynStr *__restrict ds, const char *__restrict format, .. void BLI_dynstr_vappendf(DynStr *__restrict ds, const char *__restrict format, va_list args) ATTR_PRINTF_FORMAT(2, 0) ATTR_NONNULL(1, 2); -int BLI_dynstr_get_len(DynStr *ds) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -char *BLI_dynstr_get_cstring(DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -void BLI_dynstr_get_cstring_ex(DynStr *__restrict ds, char *__restrict rets) ATTR_NONNULL(); +int BLI_dynstr_get_len(const DynStr *ds) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +char *BLI_dynstr_get_cstring(const DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +void BLI_dynstr_get_cstring_ex(const DynStr *__restrict ds, char *__restrict rets) ATTR_NONNULL(); void BLI_dynstr_clear(DynStr *ds) ATTR_NONNULL(); void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL(); diff --git a/source/blender/blenlib/BLI_edgehash.h b/source/blender/blenlib/BLI_edgehash.h index 184e3bb57e7..41f0d41d1e0 100644 --- a/source/blender/blenlib/BLI_edgehash.h +++ b/source/blender/blenlib/BLI_edgehash.h @@ -57,8 +57,10 @@ void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP free_value); void BLI_edgehash_print(EdgeHash *eh); void BLI_edgehash_insert(EdgeHash *eh, unsigned int v0, unsigned int v1, void *val); bool BLI_edgehash_reinsert(EdgeHash *eh, unsigned int v0, unsigned int v1, void *val); -void *BLI_edgehash_lookup(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT; -void *BLI_edgehash_lookup_default(EdgeHash *eh, +void *BLI_edgehash_lookup(const EdgeHash *eh, + unsigned int v0, + unsigned int v1) ATTR_WARN_UNUSED_RESULT; +void *BLI_edgehash_lookup_default(const EdgeHash *eh, unsigned int v0, unsigned int v1, void *default_value) ATTR_WARN_UNUSED_RESULT; @@ -73,8 +75,10 @@ bool BLI_edgehash_remove(EdgeHash *eh, EdgeHashFreeFP free_value); void *BLI_edgehash_popkey(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT; -bool BLI_edgehash_haskey(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT; -int BLI_edgehash_len(EdgeHash *eh) ATTR_WARN_UNUSED_RESULT; +bool BLI_edgehash_haskey(const EdgeHash *eh, + unsigned int v0, + unsigned int v1) ATTR_WARN_UNUSED_RESULT; +int BLI_edgehash_len(const EdgeHash *eh) ATTR_WARN_UNUSED_RESULT; void BLI_edgehash_clear_ex(EdgeHash *eh, EdgeHashFreeFP free_value, const uint reserve); void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP free_value); @@ -86,7 +90,7 @@ BLI_INLINE void BLI_edgehashIterator_step(EdgeHashIterator *ehi) { ehi->index++; } -BLI_INLINE bool BLI_edgehashIterator_isDone(EdgeHashIterator *ehi) +BLI_INLINE bool BLI_edgehashIterator_isDone(const EdgeHashIterator *ehi) { return ehi->index >= ehi->length; } @@ -128,10 +132,12 @@ typedef struct EdgeSetIterator { EdgeSet *BLI_edgeset_new_ex(const char *info, const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; EdgeSet *BLI_edgeset_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; -int BLI_edgeset_len(EdgeSet *es) ATTR_WARN_UNUSED_RESULT; +int BLI_edgeset_len(const EdgeSet *es) ATTR_WARN_UNUSED_RESULT; bool BLI_edgeset_add(EdgeSet *es, unsigned int v0, unsigned int v1); void BLI_edgeset_insert(EdgeSet *es, unsigned int v0, unsigned int v1); -bool BLI_edgeset_haskey(EdgeSet *es, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT; +bool BLI_edgeset_haskey(const EdgeSet *es, + unsigned int v0, + unsigned int v1) ATTR_WARN_UNUSED_RESULT; void BLI_edgeset_free(EdgeSet *es); /* rely on inline api for now */ @@ -150,7 +156,7 @@ BLI_INLINE void BLI_edgesetIterator_step(EdgeSetIterator *esi) { esi->index++; } -BLI_INLINE bool BLI_edgesetIterator_isDone(EdgeSetIterator *esi) +BLI_INLINE bool BLI_edgesetIterator_isDone(const EdgeSetIterator *esi) { return esi->index >= esi->length; } diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index b53b8a433d2..e708b327bd4 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -87,7 +87,7 @@ GHash *BLI_ghash_new_ex(GHashHashFP hashfp, GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; -GHash *BLI_ghash_copy(GHash *gh, +GHash *BLI_ghash_copy(const GHash *gh, GHashKeyCopyFP keycopyfp, GHashValCopyFP valcopyfp) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp); @@ -96,8 +96,8 @@ void BLI_ghash_insert(GHash *gh, void *key, void *val); bool BLI_ghash_reinsert( GHash *gh, void *key, void *val, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp); void *BLI_ghash_replace_key(GHash *gh, void *key); -void *BLI_ghash_lookup(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT; -void *BLI_ghash_lookup_default(GHash *gh, +void *BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT; +void *BLI_ghash_lookup_default(const GHash *gh, const void *key, void *val_default) ATTR_WARN_UNUSED_RESULT; void **BLI_ghash_lookup_p(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT; @@ -116,10 +116,10 @@ void BLI_ghash_clear_ex(GHash *gh, void *BLI_ghash_popkey(GHash *gh, const void *key, GHashKeyFreeFP keyfreefp) ATTR_WARN_UNUSED_RESULT; -bool BLI_ghash_haskey(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT; +bool BLI_ghash_haskey(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT; bool BLI_ghash_pop(GHash *gh, GHashIterState *state, void **r_key, void **r_val) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -unsigned int BLI_ghash_len(GHash *gh) ATTR_WARN_UNUSED_RESULT; +unsigned int BLI_ghash_len(const GHash *gh) ATTR_WARN_UNUSED_RESULT; void BLI_ghash_flag_set(GHash *gh, unsigned int flag); void BLI_ghash_flag_clear(GHash *gh, unsigned int flag); @@ -138,7 +138,7 @@ void BLI_ghashIterator_step(GHashIterator *ghi); BLI_INLINE void *BLI_ghashIterator_getKey(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT; BLI_INLINE void *BLI_ghashIterator_getValue(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT; BLI_INLINE void **BLI_ghashIterator_getValue_p(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT; -BLI_INLINE bool BLI_ghashIterator_done(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT; +BLI_INLINE bool BLI_ghashIterator_done(const GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT; struct _gh_Entry { void *next, *key, *val; @@ -155,7 +155,7 @@ BLI_INLINE void **BLI_ghashIterator_getValue_p(GHashIterator *ghi) { return &((struct _gh_Entry *)ghi->curEntry)->val; } -BLI_INLINE bool BLI_ghashIterator_done(GHashIterator *ghi) +BLI_INLINE bool BLI_ghashIterator_done(const GHashIterator *ghi) { return !ghi->curEntry; } @@ -202,8 +202,8 @@ GSet *BLI_gset_new_ex(GSetHashFP hashfp, GSet *BLI_gset_new(GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; -GSet *BLI_gset_copy(GSet *gs, GSetKeyCopyFP keycopyfp) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; -unsigned int BLI_gset_len(GSet *gs) ATTR_WARN_UNUSED_RESULT; +GSet *BLI_gset_copy(const GSet *gs, GSetKeyCopyFP keycopyfp) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; +unsigned int BLI_gset_len(const GSet *gs) ATTR_WARN_UNUSED_RESULT; void BLI_gset_flag_set(GSet *gs, unsigned int flag); void BLI_gset_flag_clear(GSet *gs, unsigned int flag); void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp); @@ -212,7 +212,7 @@ bool BLI_gset_add(GSet *gs, void *key); bool BLI_gset_ensure_p_ex(GSet *gs, const void *key, void ***r_key); bool BLI_gset_reinsert(GSet *gh, void *key, GSetKeyFreeFP keyfreefp); void *BLI_gset_replace_key(GSet *gs, void *key); -bool BLI_gset_haskey(GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT; +bool BLI_gset_haskey(const GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT; bool BLI_gset_pop(GSet *gs, GSetIterState *state, void **r_key) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); bool BLI_gset_remove(GSet *gs, const void *key, GSetKeyFreeFP keyfreefp); @@ -220,7 +220,7 @@ void BLI_gset_clear_ex(GSet *gs, GSetKeyFreeFP keyfreefp, const unsigned int nen void BLI_gset_clear(GSet *gs, GSetKeyFreeFP keyfreefp); /* When set's are used for key & value. */ -void *BLI_gset_lookup(GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT; +void *BLI_gset_lookup(const GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT; void *BLI_gset_pop_key(GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT; /** \} */ @@ -260,9 +260,9 @@ BLI_INLINE void BLI_gsetIterator_step(GSetIterator *gsi) { BLI_ghashIterator_step((GHashIterator *)gsi); } -BLI_INLINE bool BLI_gsetIterator_done(GSetIterator *gsi) +BLI_INLINE bool BLI_gsetIterator_done(const GSetIterator *gsi) { - return BLI_ghashIterator_done((GHashIterator *)gsi); + return BLI_ghashIterator_done((const GHashIterator *)gsi); } #define GSET_ITER(gs_iter_, gset_) \ @@ -282,8 +282,8 @@ BLI_INLINE bool BLI_gsetIterator_done(GSetIterator *gsi) /* For testing, debugging only */ #ifdef GHASH_INTERNAL_API -int BLI_ghash_buckets_len(GHash *gh); -int BLI_gset_buckets_len(GSet *gs); +int BLI_ghash_buckets_len(const GHash *gh); +int BLI_gset_buckets_len(const GSet *gs); double BLI_ghash_calc_quality_ex(GHash *gh, double *r_load, diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h index 4d9381093c7..e5e0df02033 100644 --- a/source/blender/blenlib/BLI_mempool.h +++ b/source/blender/blenlib/BLI_mempool.h @@ -48,7 +48,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr) ATTR_NONNULL(1, 2); void BLI_mempool_clear_ex(BLI_mempool *pool, const int totelem_reserve) ATTR_NONNULL(1); void BLI_mempool_clear(BLI_mempool *pool) ATTR_NONNULL(1); void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1); -int BLI_mempool_len(BLI_mempool *pool) ATTR_NONNULL(1); +int BLI_mempool_len(const BLI_mempool *pool) ATTR_NONNULL(1); void *BLI_mempool_findelem(BLI_mempool *pool, unsigned int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); diff --git a/source/blender/blenlib/intern/BLI_dynstr.c b/source/blender/blenlib/intern/BLI_dynstr.c index 5255e8b9902..86784557b25 100644 --- a/source/blender/blenlib/intern/BLI_dynstr.c +++ b/source/blender/blenlib/intern/BLI_dynstr.c @@ -283,7 +283,7 @@ void BLI_dynstr_appendf(DynStr *__restrict ds, const char *__restrict format, .. * \param ds: The DynStr of interest. * \return The length of \a ds. */ -int BLI_dynstr_get_len(DynStr *ds) +int BLI_dynstr_get_len(const DynStr *ds) { return ds->curlen; } @@ -296,10 +296,10 @@ int BLI_dynstr_get_len(DynStr *ds) * \param ds: The DynStr of interest. * \param rets: The string to fill. */ -void BLI_dynstr_get_cstring_ex(DynStr *__restrict ds, char *__restrict rets) +void BLI_dynstr_get_cstring_ex(const DynStr *__restrict ds, char *__restrict rets) { char *s; - DynStrElem *dse; + const DynStrElem *dse; for (s = rets, dse = ds->elems; dse; dse = dse->next) { int slen = strlen(dse->str); @@ -320,7 +320,7 @@ void BLI_dynstr_get_cstring_ex(DynStr *__restrict ds, char *__restrict rets) * \param ds: The DynStr of interest. * \return The contents of \a ds as a c-string. */ -char *BLI_dynstr_get_cstring(DynStr *ds) +char *BLI_dynstr_get_cstring(const DynStr *ds) { char *rets = MEM_mallocN(ds->curlen + 1, "dynstr_cstring"); BLI_dynstr_get_cstring_ex(ds, rets); diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 82eac7e0b33..8463c0ec511 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -122,8 +122,8 @@ struct GHash { BLI_INLINE void ghash_entry_copy(GHash *gh_dst, Entry *dst, - GHash *gh_src, - Entry *src, + const GHash *gh_src, + const Entry *src, GHashKeyCopyFP keycopyfp, GHashValCopyFP valcopyfp) { @@ -143,7 +143,7 @@ BLI_INLINE void ghash_entry_copy(GHash *gh_dst, /** * Get the full hash for a key. */ -BLI_INLINE uint ghash_keyhash(GHash *gh, const void *key) +BLI_INLINE uint ghash_keyhash(const GHash *gh, const void *key) { return gh->hashfp(key); } @@ -151,7 +151,7 @@ BLI_INLINE uint ghash_keyhash(GHash *gh, const void *key) /** * Get the full hash for an entry. */ -BLI_INLINE uint ghash_entryhash(GHash *gh, const Entry *e) +BLI_INLINE uint ghash_entryhash(const GHash *gh, const Entry *e) { return gh->hashfp(e->key); } @@ -159,7 +159,7 @@ BLI_INLINE uint ghash_entryhash(GHash *gh, const Entry *e) /** * Get the bucket-index for an already-computed full hash. */ -BLI_INLINE uint ghash_bucket_index(GHash *gh, const uint hash) +BLI_INLINE uint ghash_bucket_index(const GHash *gh, const uint hash) { #ifdef GHASH_USE_MODULO_BUCKETS return hash % gh->nbuckets; @@ -171,7 +171,7 @@ BLI_INLINE uint ghash_bucket_index(GHash *gh, const uint hash) /** * Find the index of next used bucket, starting from \a curr_bucket (\a gh is assumed non-empty). */ -BLI_INLINE uint ghash_find_next_bucket_index(GHash *gh, uint curr_bucket) +BLI_INLINE uint ghash_find_next_bucket_index(const GHash *gh, uint curr_bucket) { if (curr_bucket >= gh->nbuckets) { curr_bucket = 0; @@ -381,7 +381,7 @@ BLI_INLINE void ghash_buckets_reset(GHash *gh, const uint nentries) * Takes hash and bucket_index arguments to avoid calling #ghash_keyhash and #ghash_bucket_index * multiple times. */ -BLI_INLINE Entry *ghash_lookup_entry_ex(GHash *gh, const void *key, const uint bucket_index) +BLI_INLINE Entry *ghash_lookup_entry_ex(const GHash *gh, const void *key, const uint bucket_index) { Entry *e; /* If we do not store GHash, not worth computing it for each entry here! @@ -422,7 +422,7 @@ BLI_INLINE Entry *ghash_lookup_entry_prev_ex(GHash *gh, /** * Internal lookup function. Only wraps #ghash_lookup_entry_ex */ -BLI_INLINE Entry *ghash_lookup_entry(GHash *gh, const void *key) +BLI_INLINE Entry *ghash_lookup_entry(const GHash *gh, const void *key) { const uint hash = ghash_keyhash(gh, key); const uint bucket_index = ghash_bucket_index(gh, hash); @@ -652,7 +652,7 @@ static void ghash_free_cb(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP va /** * Copy the GHash. */ -static GHash *ghash_copy(GHash *gh, GHashKeyCopyFP keycopyfp, GHashValCopyFP valcopyfp) +static GHash *ghash_copy(const GHash *gh, GHashKeyCopyFP keycopyfp, GHashValCopyFP valcopyfp) { GHash *gh_new; uint i; @@ -724,7 +724,7 @@ GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) * Copy given GHash. Keys and values are also copied if relevant callback is provided, * else pointers remain the same. */ -GHash *BLI_ghash_copy(GHash *gh, GHashKeyCopyFP keycopyfp, GHashValCopyFP valcopyfp) +GHash *BLI_ghash_copy(const GHash *gh, GHashKeyCopyFP keycopyfp, GHashValCopyFP valcopyfp) { return ghash_copy(gh, keycopyfp, valcopyfp); } @@ -741,7 +741,7 @@ void BLI_ghash_reserve(GHash *gh, const uint nentries_reserve) /** * \return size of the GHash. */ -uint BLI_ghash_len(GHash *gh) +uint BLI_ghash_len(const GHash *gh) { return gh->nentries; } @@ -800,7 +800,7 @@ void *BLI_ghash_replace_key(GHash *gh, void *key) * \note When NULL is a valid value, use #BLI_ghash_lookup_p to differentiate a missing key * from a key with a NULL value. (Avoids calling #BLI_ghash_haskey before #BLI_ghash_lookup) */ -void *BLI_ghash_lookup(GHash *gh, const void *key) +void *BLI_ghash_lookup(const GHash *gh, const void *key) { GHashEntry *e = (GHashEntry *)ghash_lookup_entry(gh, key); BLI_assert(!(gh->flag & GHASH_FLAG_IS_GSET)); @@ -810,7 +810,7 @@ void *BLI_ghash_lookup(GHash *gh, const void *key) /** * A version of #BLI_ghash_lookup which accepts a fallback argument. */ -void *BLI_ghash_lookup_default(GHash *gh, const void *key, void *val_default) +void *BLI_ghash_lookup_default(const GHash *gh, const void *key, void *val_default) { GHashEntry *e = (GHashEntry *)ghash_lookup_entry(gh, key); BLI_assert(!(gh->flag & GHASH_FLAG_IS_GSET)); @@ -938,7 +938,7 @@ void *BLI_ghash_popkey(GHash *gh, const void *key, GHashKeyFreeFP keyfreefp) /** * \return true if the \a key is in \a gh. */ -bool BLI_ghash_haskey(GHash *gh, const void *key) +bool BLI_ghash_haskey(const GHash *gh, const void *key) { return (ghash_lookup_entry(gh, key) != NULL); } @@ -1130,12 +1130,12 @@ GSet *BLI_gset_new(GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info) /** * Copy given GSet. Keys are also copied if callback is provided, else pointers remain the same. */ -GSet *BLI_gset_copy(GSet *gs, GHashKeyCopyFP keycopyfp) +GSet *BLI_gset_copy(const GSet *gs, GHashKeyCopyFP keycopyfp) { - return (GSet *)ghash_copy((GHash *)gs, keycopyfp, NULL); + return (GSet *)ghash_copy((const GHash *)gs, keycopyfp, NULL); } -uint BLI_gset_len(GSet *gs) +uint BLI_gset_len(const GSet *gs) { return ((GHash *)gs)->nentries; } @@ -1172,7 +1172,7 @@ bool BLI_gset_ensure_p_ex(GSet *gs, const void *key, void ***r_key) { const uint hash = ghash_keyhash((GHash *)gs, key); const uint bucket_index = ghash_bucket_index((GHash *)gs, hash); - GSetEntry *e = (GSetEntry *)ghash_lookup_entry_ex((GHash *)gs, key, bucket_index); + GSetEntry *e = (GSetEntry *)ghash_lookup_entry_ex((const GHash *)gs, key, bucket_index); const bool haskey = (e != NULL); if (!haskey) { @@ -1213,9 +1213,9 @@ bool BLI_gset_remove(GSet *gs, const void *key, GSetKeyFreeFP keyfreefp) return BLI_ghash_remove((GHash *)gs, key, keyfreefp, NULL); } -bool BLI_gset_haskey(GSet *gs, const void *key) +bool BLI_gset_haskey(const GSet *gs, const void *key) { - return (ghash_lookup_entry((GHash *)gs, key) != NULL); + return (ghash_lookup_entry((const GHash *)gs, key) != NULL); } /** @@ -1277,9 +1277,9 @@ void BLI_gset_flag_clear(GSet *gs, uint flag) /** * Returns the pointer to the key if it's found. */ -void *BLI_gset_lookup(GSet *gs, const void *key) +void *BLI_gset_lookup(const GSet *gs, const void *key) { - Entry *e = ghash_lookup_entry((GHash *)gs, key); + Entry *e = ghash_lookup_entry((const GHash *)gs, key); return e ? e->key : NULL; } @@ -1311,13 +1311,13 @@ void *BLI_gset_pop_key(GSet *gs, const void *key) /** * \return number of buckets in the GHash. */ -int BLI_ghash_buckets_len(GHash *gh) +int BLI_ghash_buckets_len(const GHash *gh) { return (int)gh->nbuckets; } -int BLI_gset_buckets_len(GSet *gs) +int BLI_gset_buckets_len(const GSet *gs) { - return BLI_ghash_buckets_len((GHash *)gs); + return BLI_ghash_buckets_len((const GHash *)gs); } /** diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index d3000ef38e8..8196438eb25 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -452,7 +452,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr) } } -int BLI_mempool_len(BLI_mempool *pool) +int BLI_mempool_len(const BLI_mempool *pool) { return (int)pool->totused; } diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c index b8bf535a3b4..f95619803bf 100644 --- a/source/blender/blenlib/intern/edgehash.c +++ b/source/blender/blenlib/intern/edgehash.c @@ -193,7 +193,7 @@ BLI_INLINE EdgeHashEntry *edgehash_insert(EdgeHash *eh, Edge edge, void *value) } } -BLI_INLINE EdgeHashEntry *edgehash_lookup_entry(EdgeHash *eh, uint v0, uint v1) +BLI_INLINE EdgeHashEntry *edgehash_lookup_entry(const EdgeHash *eh, uint v0, uint v1) { Edge edge = init_edge(v0, v1); @@ -310,7 +310,7 @@ bool BLI_edgehash_reinsert(EdgeHash *eh, uint v0, uint v1, void *value) /** * A version of #BLI_edgehash_lookup which accepts a fallback argument. */ -void *BLI_edgehash_lookup_default(EdgeHash *eh, uint v0, uint v1, void *default_value) +void *BLI_edgehash_lookup_default(const EdgeHash *eh, uint v0, uint v1, void *default_value) { EdgeHashEntry *entry = edgehash_lookup_entry(eh, v0, v1); return entry ? entry->value : default_value; @@ -322,7 +322,7 @@ void *BLI_edgehash_lookup_default(EdgeHash *eh, uint v0, uint v1, void *default_ * to differentiate between key-value being NULL and * lack of key then see #BLI_edgehash_lookup_p(). */ -void *BLI_edgehash_lookup(EdgeHash *eh, uint v0, uint v1) +void *BLI_edgehash_lookup(const EdgeHash *eh, uint v0, uint v1) { EdgeHashEntry *entry = edgehash_lookup_entry(eh, v0, v1); return entry ? entry->value : NULL; @@ -423,7 +423,7 @@ void *BLI_edgehash_popkey(EdgeHash *eh, uint v0, uint v1) /** * Return boolean true/false if edge (v0,v1) in hash. */ -bool BLI_edgehash_haskey(EdgeHash *eh, uint v0, uint v1) +bool BLI_edgehash_haskey(const EdgeHash *eh, uint v0, uint v1) { return edgehash_lookup_entry(eh, v0, v1) != NULL; } @@ -431,7 +431,7 @@ bool BLI_edgehash_haskey(EdgeHash *eh, uint v0, uint v1) /** * Return number of keys in hash. */ -int BLI_edgehash_len(EdgeHash *eh) +int BLI_edgehash_len(const EdgeHash *eh) { return (int)eh->length; } @@ -533,7 +533,7 @@ void BLI_edgeset_free(EdgeSet *es) MEM_freeN(es); } -int BLI_edgeset_len(EdgeSet *es) +int BLI_edgeset_len(const EdgeSet *es) { return (int)es->length; } @@ -608,7 +608,7 @@ void BLI_edgeset_insert(EdgeSet *es, uint v0, uint v1) } } -bool BLI_edgeset_haskey(EdgeSet *es, uint v0, uint v1) +bool BLI_edgeset_haskey(const EdgeSet *es, uint v0, uint v1) { Edge edge = init_edge(v0, v1); diff --git a/source/blender/blenloader/intern/versioning_cycles.c b/source/blender/blenloader/intern/versioning_cycles.c index 816b90491aa..94ee89c5120 100644 --- a/source/blender/blenloader/intern/versioning_cycles.c +++ b/source/blender/blenloader/intern/versioning_cycles.c @@ -182,7 +182,7 @@ static void displacement_principled_nodes(bNode *node) } } -static bool node_has_roughness(bNode *node) +static bool node_has_roughness(const bNode *node) { return ELEM(node->type, SH_NODE_BSDF_ANISOTROPIC, diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 1cdd879a8f9..f04fa556dad 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -1217,7 +1217,7 @@ static bool skip_fcurve_with_name( * * \return true if F-Curve has errors/is disabled */ -static bool fcurve_has_errors(FCurve *fcu) +static bool fcurve_has_errors(const FCurve *fcu) { /* F-Curve disabled - path eval error */ if (fcu->flag & FCURVE_DISABLED) { @@ -1226,7 +1226,7 @@ static bool fcurve_has_errors(FCurve *fcu) /* driver? */ if (fcu->driver) { - ChannelDriver *driver = fcu->driver; + const ChannelDriver *driver = fcu->driver; DriverVar *dvar; /* error flag on driver usually means that there is an error diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 506b126d01e..9364be41543 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -2810,7 +2810,7 @@ bool autokeyframe_cfra_can_key(const Scene *scene, ID *id) /* --------------- API/Per-Datablock Handling ------------------- */ /* Checks if some F-Curve has a keyframe for a given frame */ -bool fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter) +bool fcurve_frame_has_keyframe(const FCurve *fcu, float frame, short filter) { /* quick sanity check */ if (ELEM(NULL, fcu, fcu->bezt)) { diff --git a/source/blender/editors/curve/editcurve_select.c b/source/blender/editors/curve/editcurve_select.c index a265a794f56..721aa7afecc 100644 --- a/source/blender/editors/curve/editcurve_select.c +++ b/source/blender/editors/curve/editcurve_select.c @@ -111,10 +111,10 @@ static bool swap_selection_bpoint(BPoint *bp) return select_bpoint(bp, SELECT, SELECT, VISIBLE); } -bool ED_curve_nurb_select_check(View3D *v3d, Nurb *nu) +bool ED_curve_nurb_select_check(const View3D *v3d, const Nurb *nu) { if (nu->type == CU_BEZIER) { - BezTriple *bezt; + const BezTriple *bezt; int i; for (i = nu->pntsu, bezt = nu->bezt; i--; bezt++) { @@ -124,7 +124,7 @@ bool ED_curve_nurb_select_check(View3D *v3d, Nurb *nu) } } else { - BPoint *bp; + const BPoint *bp; int i; for (i = nu->pntsu * nu->pntsv, bp = nu->bp; i--; bp++) { @@ -136,12 +136,12 @@ bool ED_curve_nurb_select_check(View3D *v3d, Nurb *nu) return false; } -int ED_curve_nurb_select_count(View3D *v3d, Nurb *nu) +int ED_curve_nurb_select_count(const View3D *v3d, const Nurb *nu) { int sel = 0; if (nu->type == CU_BEZIER) { - BezTriple *bezt; + const BezTriple *bezt; int i; for (i = nu->pntsu, bezt = nu->bezt; i--; bezt++) { @@ -151,7 +151,7 @@ int ED_curve_nurb_select_count(View3D *v3d, Nurb *nu) } } else { - BPoint *bp; + const BPoint *bp; int i; for (i = nu->pntsu * nu->pntsv, bp = nu->bp; i--; bp++) { @@ -227,7 +227,7 @@ bool ED_curve_nurb_deselect_all(const Nurb *nu) return changed; } -int ED_curve_select_count(View3D *v3d, struct EditNurb *editnurb) +int ED_curve_select_count(const View3D *v3d, const EditNurb *editnurb) { int sel = 0; Nurb *nu; @@ -239,9 +239,9 @@ int ED_curve_select_count(View3D *v3d, struct EditNurb *editnurb) return sel; } -bool ED_curve_select_check(View3D *v3d, struct EditNurb *editnurb) +bool ED_curve_select_check(const View3D *v3d, const EditNurb *editnurb) { - LISTBASE_FOREACH (Nurb *, nu, &editnurb->nurbs) { + LISTBASE_FOREACH (const Nurb *, nu, &editnurb->nurbs) { if (ED_curve_nurb_select_check(v3d, nu)) { return true; } diff --git a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c index b2d3a2e1576..31ab5eca974 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c @@ -319,9 +319,9 @@ bool ED_gizmotypes_snap_3d_invert_snap_get(struct wmGizmo *gz) #endif } -bool ED_gizmotypes_snap_3d_is_enabled(wmGizmo *gz) +bool ED_gizmotypes_snap_3d_is_enabled(const wmGizmo *gz) { - SnapGizmo3D *snap_gizmo = (SnapGizmo3D *)gz; + const SnapGizmo3D *snap_gizmo = (const SnapGizmo3D *)gz; return snap_gizmo->is_enabled; } diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index 92f1629f7f7..6e6d94a2909 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -107,7 +107,7 @@ void ED_gpencil_layer_make_cfra_list(bGPDlayer *gpl, ListBase *elems, bool onlys /* Selection Tools */ /* check if one of the frames in this layer is selected */ -bool ED_gpencil_layer_frame_select_check(bGPDlayer *gpl) +bool ED_gpencil_layer_frame_select_check(const bGPDlayer *gpl) { /* error checking */ if (gpl == NULL) { @@ -115,7 +115,7 @@ bool ED_gpencil_layer_frame_select_check(bGPDlayer *gpl) } /* stop at the first one found */ - LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) { + LISTBASE_FOREACH (const bGPDframe *, gpf, &gpl->frames) { if (gpf->flag & GP_FRAME_SELECT) { return true; } diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index e11ed927cbf..e272f46d13d 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -871,20 +871,20 @@ void GPENCIL_OT_frame_clean_loose(wmOperatorType *ot) } /* ********************* Clean Duplicated Frames ************************** */ -static bool gpencil_frame_is_equal(bGPDframe *gpf_a, bGPDframe *gpf_b) +static bool gpencil_frame_is_equal(const bGPDframe *gpf_a, const bGPDframe *gpf_b) { if ((gpf_a == NULL) || (gpf_b == NULL)) { return false; } /* If the number of strokes is different, cannot be equal. */ - int totstrokes_a = BLI_listbase_count(&gpf_a->strokes); - int totstrokes_b = BLI_listbase_count(&gpf_b->strokes); + const int totstrokes_a = BLI_listbase_count(&gpf_a->strokes); + const int totstrokes_b = BLI_listbase_count(&gpf_b->strokes); if ((totstrokes_a == 0) || (totstrokes_b == 0) || (totstrokes_a != totstrokes_b)) { return false; } /* Loop all strokes and check. */ - bGPDstroke *gps_a = gpf_a->strokes.first; - bGPDstroke *gps_b = gpf_b->strokes.first; + const bGPDstroke *gps_a = gpf_a->strokes.first; + const bGPDstroke *gps_b = gpf_b->strokes.first; for (int i = 0; i < totstrokes_a; i++) { /* If the number of points is different, cannot be equal. */ if (gps_a->totpoints != gps_b->totpoints) { @@ -924,8 +924,8 @@ static bool gpencil_frame_is_equal(bGPDframe *gpf_a, bGPDframe *gpf_b) /* Loop points and check if equals or not. */ for (int p = 0; p < gps_a->totpoints; p++) { - bGPDspoint *pt_a = &gps_a->points[p]; - bGPDspoint *pt_b = &gps_b->points[p]; + const bGPDspoint *pt_a = &gps_a->points[p]; + const bGPDspoint *pt_b = &gps_b->points[p]; if (!equals_v3v3(&pt_a->x, &pt_b->x)) { return false; } diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c index 864231e6aab..0226558b4a0 100644 --- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c +++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c @@ -1381,7 +1381,7 @@ static float gpencil_sculpt_rotation_eval_get(tGP_BrushEditData *gso, return 0.0f; } - GP_SpaceConversion *gsc = &gso->gsc; + const GP_SpaceConversion *gsc = &gso->gsc; bGPDstroke *gps_orig = (gps_eval->runtime.gps_orig) ? gps_eval->runtime.gps_orig : gps_eval; bGPDspoint *pt_orig = &gps_orig->points[pt_eval->runtime.idx_orig]; bGPDspoint *pt_prev_eval = NULL; diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 15ada6e0891..54672743439 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -3106,8 +3106,8 @@ void ED_gpencil_sbuffer_vertex_color_set(Depsgraph *depsgraph, } /* Get the bigger 2D bound box points. */ -void ED_gpencil_projected_2d_bound_box(GP_SpaceConversion *gsc, - bGPDstroke *gps, +void ED_gpencil_projected_2d_bound_box(const GP_SpaceConversion *gsc, + const bGPDstroke *gps, const float diff_mat[4][4], float r_min[2], float r_max[2]) @@ -3140,7 +3140,7 @@ void ED_gpencil_projected_2d_bound_box(GP_SpaceConversion *gsc, } /* Check if the stroke collides with brush. */ -bool ED_gpencil_stroke_check_collision(GP_SpaceConversion *gsc, +bool ED_gpencil_stroke_check_collision(const GP_SpaceConversion *gsc, bGPDstroke *gps, const float mouse[2], const int radius, @@ -3175,9 +3175,9 @@ bool ED_gpencil_stroke_check_collision(GP_SpaceConversion *gsc, * \param diff_mat: View matrix. * \return True if the point is inside. */ -bool ED_gpencil_stroke_point_is_inside(bGPDstroke *gps, - GP_SpaceConversion *gsc, - int mouse[2], +bool ED_gpencil_stroke_point_is_inside(const bGPDstroke *gps, + const GP_SpaceConversion *gsc, + const int mouse[2], const float diff_mat[4][4]) { bool hit = false; @@ -3190,7 +3190,7 @@ bool ED_gpencil_stroke_point_is_inside(bGPDstroke *gps, mcoords = MEM_mallocN(sizeof(int[2]) * len, __func__); /* Convert stroke to 2D array of points. */ - bGPDspoint *pt; + const bGPDspoint *pt; int i; for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { bGPDspoint pt2; @@ -3214,7 +3214,7 @@ bool ED_gpencil_stroke_point_is_inside(bGPDstroke *gps, } bGPDstroke *ED_gpencil_stroke_nearest_to_ends(bContext *C, - GP_SpaceConversion *gsc, + const GP_SpaceConversion *gsc, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps, diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h index 8015a665970..44c5897d3a3 100644 --- a/source/blender/editors/include/ED_curve.h +++ b/source/blender/editors/include/ED_curve.h @@ -60,21 +60,21 @@ bool ED_curve_editnurb_select_pick( struct Nurb *ED_curve_add_nurbs_primitive( struct bContext *C, struct Object *obedit, float mat[4][4], int type, int newob); -bool ED_curve_nurb_select_check(struct View3D *v3d, struct Nurb *nu); -int ED_curve_nurb_select_count(struct View3D *v3d, struct Nurb *nu); +bool ED_curve_nurb_select_check(const struct View3D *v3d, const struct Nurb *nu); +int ED_curve_nurb_select_count(const struct View3D *v3d, const struct Nurb *nu); bool ED_curve_nurb_select_all(const struct Nurb *nu); bool ED_curve_nurb_deselect_all(const struct Nurb *nu); int ED_curve_join_objects_exec(struct bContext *C, struct wmOperator *op); /* editcurve_select.c */ -bool ED_curve_select_check(struct View3D *v3d, struct EditNurb *editnurb); +bool ED_curve_select_check(const struct View3D *v3d, const struct EditNurb *editnurb); bool ED_curve_deselect_all(struct EditNurb *editnurb); bool ED_curve_deselect_all_multi_ex(struct Base **bases, int bases_len); bool ED_curve_deselect_all_multi(struct bContext *C); bool ED_curve_select_all(struct EditNurb *editnurb); bool ED_curve_select_swap(struct EditNurb *editnurb, bool hide_handles); -int ED_curve_select_count(struct View3D *v3d, struct EditNurb *editnurb); +int ED_curve_select_count(const struct View3D *v3d, const struct EditNurb *editnurb); /* editcurve_undo.c */ void ED_curve_undosys_type(struct UndoType *ut); diff --git a/source/blender/editors/include/ED_gizmo_library.h b/source/blender/editors/include/ED_gizmo_library.h index 571519e52f7..357d5e10fa7 100644 --- a/source/blender/editors/include/ED_gizmo_library.h +++ b/source/blender/editors/include/ED_gizmo_library.h @@ -275,7 +275,7 @@ void ED_gizmotypes_snap_3d_flag_clear(struct wmGizmo *gz, eSnapGizmo flag); bool ED_gizmotypes_snap_3d_flag_test(struct wmGizmo *gz, eSnapGizmo flag); bool ED_gizmotypes_snap_3d_invert_snap_get(struct wmGizmo *gz); -bool ED_gizmotypes_snap_3d_is_enabled(struct wmGizmo *gz); +bool ED_gizmotypes_snap_3d_is_enabled(const struct wmGizmo *gz); short ED_gizmotypes_snap_3d_update(struct wmGizmo *gz, struct Depsgraph *depsgraph, diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index bad080e1609..59b5a1abaa6 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -189,7 +189,7 @@ bool ED_gpencil_layer_frames_looper(struct bGPDlayer *gpl, bool (*gpf_cb)(struct bGPDframe *, struct Scene *)); void ED_gpencil_layer_make_cfra_list(struct bGPDlayer *gpl, ListBase *elems, bool onlysel); -bool ED_gpencil_layer_frame_select_check(struct bGPDlayer *gpl); +bool ED_gpencil_layer_frame_select_check(const struct bGPDlayer *gpl); void ED_gpencil_layer_frame_select_set(struct bGPDlayer *gpl, short mode); void ED_gpencil_layer_frames_select_box(struct bGPDlayer *gpl, float min, @@ -364,23 +364,23 @@ void ED_gpencil_init_random_settings(struct Brush *brush, const int mval[2], struct GpRandomSettings *random_settings); -bool ED_gpencil_stroke_check_collision(struct GP_SpaceConversion *gsc, +bool ED_gpencil_stroke_check_collision(const struct GP_SpaceConversion *gsc, struct bGPDstroke *gps, const float mouse[2], const int radius, const float diff_mat[4][4]); -bool ED_gpencil_stroke_point_is_inside(struct bGPDstroke *gps, - struct GP_SpaceConversion *gsc, - int mouse[2], +bool ED_gpencil_stroke_point_is_inside(const struct bGPDstroke *gps, + const struct GP_SpaceConversion *gsc, + const int mouse[2], const float diff_mat[4][4]); -void ED_gpencil_projected_2d_bound_box(struct GP_SpaceConversion *gsc, - struct bGPDstroke *gps, +void ED_gpencil_projected_2d_bound_box(const struct GP_SpaceConversion *gsc, + const struct bGPDstroke *gps, const float diff_mat[4][4], float r_min[2], float r_max[2]); struct bGPDstroke *ED_gpencil_stroke_nearest_to_ends(struct bContext *C, - struct GP_SpaceConversion *gsc, + const struct GP_SpaceConversion *gsc, struct bGPDlayer *gpl, struct bGPDframe *gpf, struct bGPDstroke *gps, diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index 08d19318d4c..0493832c06f 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -452,7 +452,7 @@ bool autokeyframe_cfra_can_key(const struct Scene *scene, struct ID *id); /* Lesser Keyframe Checking API call: * - Used for the buttons to check for keyframes... */ -bool fcurve_frame_has_keyframe(struct FCurve *fcu, float frame, short filter); +bool fcurve_frame_has_keyframe(const struct FCurve *fcu, float frame, short filter); /* Lesser Keyframe Checking API call: * - Returns whether the current value of a given property differs from the interpolated value. diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h index 247911bdc55..c2fdbc160de 100644 --- a/source/blender/editors/include/ED_mask.h +++ b/source/blender/editors/include/ED_mask.h @@ -100,7 +100,7 @@ bool ED_masklayer_frames_looper(struct MaskLayer *mask_layer, struct Scene *)); void ED_masklayer_make_cfra_list(struct MaskLayer *mask_layer, ListBase *elems, bool onlysel); -bool ED_masklayer_frame_select_check(struct MaskLayer *mask_layer); +bool ED_masklayer_frame_select_check(const struct MaskLayer *mask_layer); void ED_masklayer_frame_select_set(struct MaskLayer *mask_layer, short mode); void ED_masklayer_frames_select_box(struct MaskLayer *mask_layer, float min, diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index ba65840dc99..73a1548362c 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -110,7 +110,7 @@ bool ED_node_is_geometry(struct SpaceNode *snode); void ED_node_shader_default(const struct bContext *C, struct ID *id); void ED_node_composit_default(const struct bContext *C, struct Scene *scene); void ED_node_texture_default(const struct bContext *C, struct Tex *tex); -bool ED_node_select_check(ListBase *lb); +bool ED_node_select_check(const ListBase *lb); void ED_node_select_all(ListBase *lb, int action); void ED_node_post_apply_transform(struct bContext *C, struct bNodeTree *ntree); void ED_node_set_active(struct Main *bmain, diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 1738c383328..888dcd9d428 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -62,7 +62,8 @@ struct Object *ED_object_active_context(const struct bContext *C); void ED_collection_hide_menu_draw(const struct bContext *C, struct uiLayout *layout); Object **ED_object_array_in_mode_or_selected(struct bContext *C, - bool (*filter_fn)(struct Object *ob, void *user_data), + bool (*filter_fn)(const struct Object *ob, + void *user_data), void *filter_user_data, uint *r_objects_len); @@ -387,7 +388,7 @@ void ED_object_mode_generic_exit(struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); -bool ED_object_mode_generic_has_data(struct Depsgraph *depsgraph, struct Object *ob); +bool ED_object_mode_generic_has_data(struct Depsgraph *depsgraph, const struct Object *ob); void ED_object_posemode_set_for_weight_paint(struct bContext *C, struct Main *bmain, diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 91a4c430023..92dd41932f2 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -3489,7 +3489,7 @@ static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), /** * Draw menu buttons still with triangles when field is not embossed */ -static void widget_menubut_embossn(uiBut *UNUSED(but), +static void widget_menubut_embossn(const uiBut *UNUSED(but), uiWidgetColors *wcol, rcti *rect, int UNUSED(state), @@ -3512,7 +3512,7 @@ static void widget_menubut_embossn(uiBut *UNUSED(but), * Draw number buttons still with triangles when field is not embossed */ static void widget_numbut_embossn( - uiBut *UNUSED(but), uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) + const uiBut *UNUSED(but), uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) { widget_numbut_draw(wcol, rect, state, roundboxalign, true); } diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c index 03f3f438829..d9efbef4b42 100644 --- a/source/blender/editors/mask/mask_editaction.c +++ b/source/blender/editors/mask/mask_editaction.c @@ -109,7 +109,7 @@ void ED_masklayer_make_cfra_list(MaskLayer *mask_layer, ListBase *elems, bool on /* Selection Tools */ /* check if one of the frames in this layer is selected */ -bool ED_masklayer_frame_select_check(MaskLayer *mask_layer) +bool ED_masklayer_frame_select_check(const MaskLayer *mask_layer) { MaskLayerShape *mask_layer_shape; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 36c51bcda7c..1ca967d9112 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -157,7 +157,7 @@ Object *ED_object_active_context(const bContext *C) * (assuming they need to be modified). */ Object **ED_object_array_in_mode_or_selected(bContext *C, - bool (*filter_fn)(Object *ob, void *user_data), + bool (*filter_fn)(const Object *ob, void *user_data), void *filter_user_data, uint *r_objects_len) { diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c index ed06cd2a217..36a4f002978 100644 --- a/source/blender/editors/object/object_modes.c +++ b/source/blender/editors/object/object_modes.c @@ -401,9 +401,9 @@ void ED_object_mode_generic_exit(struct Main *bmain, ed_object_mode_generic_exit_ex(bmain, depsgraph, scene, ob, false); } -bool ED_object_mode_generic_has_data(struct Depsgraph *depsgraph, struct Object *ob) +bool ED_object_mode_generic_has_data(struct Depsgraph *depsgraph, const struct Object *ob) { - return ed_object_mode_generic_exit_ex(NULL, depsgraph, NULL, ob, true); + return ed_object_mode_generic_exit_ex(NULL, depsgraph, NULL, (Object *)ob, true); } /** \} */ diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 51a9a3676e7..e6cde60e9aa 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -83,7 +83,7 @@ static bool vertex_group_supported_poll_ex(bContext *C, const Object *ob); /** \name Local Utility Functions * \{ */ -static bool object_array_for_wpaint_filter(Object *ob, void *user_data) +static bool object_array_for_wpaint_filter(const Object *ob, void *user_data) { bContext *C = user_data; if (vertex_group_supported_poll_ex(C, ob)) { diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 36492359d5c..ae9f80f746a 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -103,7 +103,7 @@ static bool object_materials_supported_poll_ex(bContext *C, const Object *ob); /** \name Local Utilities * \{ */ -static bool object_array_for_shading_edit_mode_enabled_filter(Object *ob, void *user_data) +static bool object_array_for_shading_edit_mode_enabled_filter(const Object *ob, void *user_data) { bContext *C = user_data; if (object_materials_supported_poll_ex(C, ob)) { @@ -120,7 +120,7 @@ static Object **object_array_for_shading_edit_mode_enabled(bContext *C, uint *r_ C, object_array_for_shading_edit_mode_enabled_filter, C, r_objects_len); } -static bool object_array_for_shading_edit_mode_disabled_filter(Object *ob, void *user_data) +static bool object_array_for_shading_edit_mode_disabled_filter(const Object *ob, void *user_data) { bContext *C = user_data; if (object_materials_supported_poll_ex(C, ob)) { diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc index 4bacf319f7c..0cf47ed35fa 100644 --- a/source/blender/editors/space_node/node_edit.cc +++ b/source/blender/editors/space_node/node_edit.cc @@ -1357,9 +1357,9 @@ void NODE_OT_duplicate(wmOperatorType *ot) ot->srna, "keep_inputs", false, "Keep Inputs", "Keep the input links to duplicated nodes"); } -bool ED_node_select_check(ListBase *lb) +bool ED_node_select_check(const ListBase *lb) { - LISTBASE_FOREACH (bNode *, node, lb) { + LISTBASE_FOREACH (const bNode *, node, lb) { if (node->flag & NODE_SELECT) { return true; } diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 78fc6575e6e..7135395ee2d 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -1150,7 +1150,7 @@ int constraintModeToIndex(const TransInfo *t) } } -bool isLockConstraint(TransInfo *t) +bool isLockConstraint(const TransInfo *t) { int mode = t->con.mode; diff --git a/source/blender/editors/transform/transform_constraints.h b/source/blender/editors/transform/transform_constraints.h index cbf6c7bb576..3632b352476 100644 --- a/source/blender/editors/transform/transform_constraints.h +++ b/source/blender/editors/transform/transform_constraints.h @@ -46,5 +46,5 @@ void postSelectConstraint(TransInfo *t); void setNearestAxis(TransInfo *t); int constraintModeToIndex(const TransInfo *t); char constraintModeToChar(const TransInfo *t); -bool isLockConstraint(TransInfo *t); +bool isLockConstraint(const TransInfo *t); int getConstraintSpaceDimension(const TransInfo *t); diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index c691eb3b534..876229411e0 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -1358,9 +1358,9 @@ int RNA_parameter_flag(PropertyRNA *prop); ParameterList *RNA_parameter_list_create(ParameterList *parms, PointerRNA *ptr, FunctionRNA *func); void RNA_parameter_list_free(ParameterList *parms); -int RNA_parameter_list_size(ParameterList *parms); -int RNA_parameter_list_arg_count(ParameterList *parms); -int RNA_parameter_list_ret_count(ParameterList *parms); +int RNA_parameter_list_size(const ParameterList *parms); +int RNA_parameter_list_arg_count(const ParameterList *parms); +int RNA_parameter_list_ret_count(const ParameterList *parms); void RNA_parameter_list_begin(ParameterList *parms, ParameterIterator *iter); void RNA_parameter_list_next(ParameterIterator *iter); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 6f1f75bd46e..840da76403a 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -7357,17 +7357,17 @@ void RNA_parameter_list_free(ParameterList *parms) parms->func = NULL; } -int RNA_parameter_list_size(ParameterList *parms) +int RNA_parameter_list_size(const ParameterList *parms) { return parms->alloc_size; } -int RNA_parameter_list_arg_count(ParameterList *parms) +int RNA_parameter_list_arg_count(const ParameterList *parms) { return parms->arg_count; } -int RNA_parameter_list_ret_count(ParameterList *parms) +int RNA_parameter_list_ret_count(const ParameterList *parms) { return parms->ret_count; } diff --git a/source/blender/modifiers/intern/MOD_ui_common.c b/source/blender/modifiers/intern/MOD_ui_common.c index 09fa7e9c8ac..9245afdb096 100644 --- a/source/blender/modifiers/intern/MOD_ui_common.c +++ b/source/blender/modifiers/intern/MOD_ui_common.c @@ -163,7 +163,7 @@ void modifier_vgroup_ui(uiLayout *layout, * Check whether Modifier is a simulation or not. Used for switching to the * physics/particles context tab. */ -static int modifier_is_simulation(ModifierData *md) +static int modifier_is_simulation(const ModifierData *md) { /* Physic Tab */ if (ELEM(md->type, diff --git a/source/blender/render/RE_bake.h b/source/blender/render/RE_bake.h index bb30b524b61..47a15199701 100644 --- a/source/blender/render/RE_bake.h +++ b/source/blender/render/RE_bake.h @@ -76,7 +76,7 @@ typedef struct BakeHighPolyData { } BakeHighPolyData; /* external_engine.c */ -bool RE_bake_has_engine(struct Render *re); +bool RE_bake_has_engine(const struct Render *re); bool RE_bake_engine(struct Render *re, struct Depsgraph *depsgraph, diff --git a/source/blender/render/intern/engine.c b/source/blender/render/intern/engine.c index 7316afc448e..db2458a636b 100644 --- a/source/blender/render/intern/engine.c +++ b/source/blender/render/intern/engine.c @@ -735,9 +735,9 @@ void RE_bake_engine_set_engine_parameters(Render *re, Main *bmain, Scene *scene) render_copy_renderdata(&re->r, &scene->r); } -bool RE_bake_has_engine(Render *re) +bool RE_bake_has_engine(const Render *re) { - RenderEngineType *type = RE_engines_find(re->r.engine); + const RenderEngineType *type = RE_engines_find(re->r.engine); return (type->bake != NULL); } diff --git a/source/blender/render/intern/render_result.c b/source/blender/render/intern/render_result.c index 83ed302ea46..70bd4f92512 100644 --- a/source/blender/render/intern/render_result.c +++ b/source/blender/render/intern/render_result.c @@ -804,9 +804,9 @@ void render_result_views_new(RenderResult *rr, const RenderData *rd) } } -bool render_result_has_views(RenderResult *rr) +bool render_result_has_views(const RenderResult *rr) { - RenderView *rv = rr->views.first; + const RenderView *rv = rr->views.first; return (rv && (rv->next || rv->name[0])); } diff --git a/source/blender/render/intern/render_result.h b/source/blender/render/intern/render_result.h index 67edd075e24..7732c113700 100644 --- a/source/blender/render/intern/render_result.h +++ b/source/blender/render/intern/render_result.h @@ -127,7 +127,7 @@ void render_result_rect_get_pixels(struct RenderResult *rr, void render_result_views_shallowcopy(struct RenderResult *dst, struct RenderResult *src); void render_result_views_shallowdelete(struct RenderResult *rr); -bool render_result_has_views(struct RenderResult *rr); +bool render_result_has_views(const struct RenderResult *rr); #define FOREACH_VIEW_LAYER_TO_RENDER_BEGIN(re_, iter_) \ { \ diff --git a/source/blender/sequencer/SEQ_iterator.h b/source/blender/sequencer/SEQ_iterator.h index bdc5a093fbe..eab2277bbe3 100644 --- a/source/blender/sequencer/SEQ_iterator.h +++ b/source/blender/sequencer/SEQ_iterator.h @@ -71,7 +71,7 @@ bool SEQ_iterator_ensure(SeqCollection *collection, struct Sequence *SEQ_iterator_yield(SeqIterator *iterator); SeqCollection *SEQ_collection_create(void); -uint SEQ_collection_len(SeqCollection *collection); +uint SEQ_collection_len(const SeqCollection *collection); bool SEQ_collection_append_strip(struct Sequence *seq, SeqCollection *data); bool SEQ_collection_remove_strip(struct Sequence *seq, SeqCollection *data); void SEQ_collection_free(SeqCollection *collection); diff --git a/source/blender/sequencer/SEQ_utils.h b/source/blender/sequencer/SEQ_utils.h index 432e8fdd0c0..99603dc8a3e 100644 --- a/source/blender/sequencer/SEQ_utils.h +++ b/source/blender/sequencer/SEQ_utils.h @@ -49,7 +49,7 @@ struct Sequence *SEQ_get_sequence_by_name(struct ListBase *seqbase, bool recursive); struct Mask *SEQ_active_mask_get(struct Scene *scene); void SEQ_alpha_mode_from_file_extension(struct Sequence *seq); -bool SEQ_sequence_has_source(struct Sequence *seq); +bool SEQ_sequence_has_source(const struct Sequence *seq); void SEQ_set_scale_to_fit(const struct Sequence *seq, const int image_width, const int image_height, diff --git a/source/blender/sequencer/intern/iterator.c b/source/blender/sequencer/intern/iterator.c index dd343776200..0754d9b38ed 100644 --- a/source/blender/sequencer/intern/iterator.c +++ b/source/blender/sequencer/intern/iterator.c @@ -117,7 +117,7 @@ SeqCollection *SEQ_collection_create(void) /** * Return number of items in collection. */ -uint SEQ_collection_len(SeqCollection *collection) +uint SEQ_collection_len(const SeqCollection *collection) { return BLI_gset_len(collection->set); } diff --git a/source/blender/sequencer/intern/prefetch.c b/source/blender/sequencer/intern/prefetch.c index b7dabda4a34..15609a76f5c 100644 --- a/source/blender/sequencer/intern/prefetch.c +++ b/source/blender/sequencer/intern/prefetch.c @@ -91,7 +91,7 @@ typedef struct PrefetchJob { bool stop; } PrefetchJob; -static bool seq_prefetch_is_playing(Main *bmain) +static bool seq_prefetch_is_playing(const Main *bmain) { for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { if (screen->animtimer) { @@ -101,7 +101,7 @@ static bool seq_prefetch_is_playing(Main *bmain) return false; } -static bool seq_prefetch_is_scrubbing(Main *bmain) +static bool seq_prefetch_is_scrubbing(const Main *bmain) { for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { diff --git a/source/blender/sequencer/intern/sequence_lookup.c b/source/blender/sequencer/intern/sequence_lookup.c index 72567dc394e..25b42957d99 100644 --- a/source/blender/sequencer/intern/sequence_lookup.c +++ b/source/blender/sequencer/intern/sequence_lookup.c @@ -87,7 +87,7 @@ static void seq_sequence_lookup_rebuild(const struct Scene *scene, struct Sequen seq_sequence_lookup_build(scene, *lookup); } -static bool seq_sequence_lookup_is_valid(struct SequenceLookup *lookup) +static bool seq_sequence_lookup_is_valid(const struct SequenceLookup *lookup) { return (lookup->tag & SEQ_LOOKUP_TAG_INVALID) == 0; } diff --git a/source/blender/sequencer/intern/utils.c b/source/blender/sequencer/intern/utils.c index a287466dfb2..98640ea8a5c 100644 --- a/source/blender/sequencer/intern/utils.c +++ b/source/blender/sequencer/intern/utils.c @@ -530,7 +530,7 @@ void SEQ_alpha_mode_from_file_extension(Sequence *seq) /* called on draw, needs to be fast, * we could cache and use a flag if we want to make checks for file paths resolving for eg. */ -bool SEQ_sequence_has_source(Sequence *seq) +bool SEQ_sequence_has_source(const Sequence *seq) { switch (seq->type) { case SEQ_TYPE_MASK: diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index f3c4cb93e7d..319683c8d8e 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -775,20 +775,20 @@ enum { struct wmJob *WM_jobs_get(struct wmWindowManager *wm, struct wmWindow *win, - void *owner, + const void *owner, const char *name, int flag, int job_type); -bool WM_jobs_test(struct wmWindowManager *wm, void *owner, int job_type); -float WM_jobs_progress(struct wmWindowManager *wm, void *owner); -char *WM_jobs_name(struct wmWindowManager *wm, void *owner); -double WM_jobs_starttime(struct wmWindowManager *wm, void *owner); -void *WM_jobs_customdata(struct wmWindowManager *wm, void *owner); +bool WM_jobs_test(const struct wmWindowManager *wm, const void *owner, int job_type); +float WM_jobs_progress(const struct wmWindowManager *wm, const void *owner); +const char *WM_jobs_name(const struct wmWindowManager *wm, const void *owner); +double WM_jobs_starttime(const struct wmWindowManager *wm, const void *owner); +void *WM_jobs_customdata(struct wmWindowManager *wm, const void *owner); void *WM_jobs_customdata_from_type(struct wmWindowManager *wm, int job_type); -bool WM_jobs_is_running(struct wmJob *); -bool WM_jobs_is_stopped(wmWindowManager *wm, void *owner); +bool WM_jobs_is_running(const struct wmJob *wm_job); +bool WM_jobs_is_stopped(const wmWindowManager *wm, const void *owner); void *WM_jobs_customdata_get(struct wmJob *); void WM_jobs_customdata_set(struct wmJob *, void *customdata, void (*free)(void *)); void WM_jobs_timer(struct wmJob *, double timestep, unsigned int note, unsigned int endnote); @@ -805,15 +805,15 @@ void WM_jobs_callbacks(struct wmJob *, void (*endjob)(void *)); void WM_jobs_start(struct wmWindowManager *wm, struct wmJob *); -void WM_jobs_stop(struct wmWindowManager *wm, void *owner, void *startjob); +void WM_jobs_stop(struct wmWindowManager *wm, const void *owner, void *startjob); void WM_jobs_kill(struct wmWindowManager *wm, void *owner, void (*)(void *, short int *, short int *, float *)); void WM_jobs_kill_all(struct wmWindowManager *wm); -void WM_jobs_kill_all_except(struct wmWindowManager *wm, void *owner); -void WM_jobs_kill_type(struct wmWindowManager *wm, void *owner, int job_type); +void WM_jobs_kill_all_except(struct wmWindowManager *wm, const void *owner); +void WM_jobs_kill_type(struct wmWindowManager *wm, const void *owner, int job_type); -bool WM_jobs_has_running(struct wmWindowManager *wm); +bool WM_jobs_has_running(const struct wmWindowManager *wm); void WM_job_main_thread_lock_acquire(struct wmJob *job); void WM_job_main_thread_lock_release(struct wmJob *job); diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c index 1cddc019ff8..6494c337c10 100644 --- a/source/blender/windowmanager/intern/wm_jobs.c +++ b/source/blender/windowmanager/intern/wm_jobs.c @@ -113,7 +113,7 @@ struct wmJob { unsigned int note, endnote; /* internal */ - void *owner; + const void *owner; int flag; short suspended, running, ready, do_update, stop, job_type; float progress; @@ -158,7 +158,7 @@ static void wm_job_main_thread_yield(wmJob *wm_job) /** * Finds if type or owner, compare for it, otherwise any matching job. */ -static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const int job_type) +static wmJob *wm_job_find(const wmWindowManager *wm, const void *owner, const int job_type) { if (owner && job_type) { LISTBASE_FOREACH (wmJob *, wm_job, &wm->jobs) { @@ -193,8 +193,12 @@ static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const int job_type) * \note every owner only gets a single job, * adding a new one will stop running job and when stopped it starts the new one. */ -wmJob *WM_jobs_get( - wmWindowManager *wm, wmWindow *win, void *owner, const char *name, int flag, int job_type) +wmJob *WM_jobs_get(wmWindowManager *wm, + wmWindow *win, + const void *owner, + const char *name, + int flag, + int job_type) { wmJob *wm_job = wm_job_find(wm, owner, job_type); @@ -220,7 +224,7 @@ wmJob *WM_jobs_get( } /* returns true if job runs, for UI (progress) indicators */ -bool WM_jobs_test(wmWindowManager *wm, void *owner, int job_type) +bool WM_jobs_test(const wmWindowManager *wm, const void *owner, int job_type) { /* job can be running or about to run (suspended) */ LISTBASE_FOREACH (wmJob *, wm_job, &wm->jobs) { @@ -236,9 +240,9 @@ bool WM_jobs_test(wmWindowManager *wm, void *owner, int job_type) return false; } -float WM_jobs_progress(wmWindowManager *wm, void *owner) +float WM_jobs_progress(const wmWindowManager *wm, const void *owner) { - wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY); + const wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY); if (wm_job && wm_job->flag & WM_JOB_PROGRESS) { return wm_job->progress; @@ -278,9 +282,9 @@ static void wm_jobs_update_progress_bars(wmWindowManager *wm) } /* time that job started */ -double WM_jobs_starttime(wmWindowManager *wm, void *owner) +double WM_jobs_starttime(const wmWindowManager *wm, const void *owner) { - wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY); + const wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY); if (wm_job && wm_job->flag & WM_JOB_PROGRESS) { return wm_job->start_time; @@ -289,7 +293,7 @@ double WM_jobs_starttime(wmWindowManager *wm, void *owner) return 0; } -char *WM_jobs_name(wmWindowManager *wm, void *owner) +const char *WM_jobs_name(const wmWindowManager *wm, const void *owner) { wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY); @@ -300,7 +304,7 @@ char *WM_jobs_name(wmWindowManager *wm, void *owner) return NULL; } -void *WM_jobs_customdata(wmWindowManager *wm, void *owner) +void *WM_jobs_customdata(wmWindowManager *wm, const void *owner) { wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY); @@ -322,12 +326,12 @@ void *WM_jobs_customdata_from_type(wmWindowManager *wm, int job_type) return NULL; } -bool WM_jobs_is_running(wmJob *wm_job) +bool WM_jobs_is_running(const wmJob *wm_job) { return wm_job->running; } -bool WM_jobs_is_stopped(wmWindowManager *wm, void *owner) +bool WM_jobs_is_stopped(const wmWindowManager *wm, const void *owner) { wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY); return wm_job ? wm_job->stop : true; /* XXX to be redesigned properly. */ @@ -560,7 +564,7 @@ void WM_jobs_kill_all(wmWindowManager *wm) } /* wait until every job ended, except for one owner (used in undo to keep screen job alive) */ -void WM_jobs_kill_all_except(wmWindowManager *wm, void *owner) +void WM_jobs_kill_all_except(wmWindowManager *wm, const void *owner) { LISTBASE_FOREACH_MUTABLE (wmJob *, wm_job, &wm->jobs) { if (wm_job->owner != owner) { @@ -569,7 +573,7 @@ void WM_jobs_kill_all_except(wmWindowManager *wm, void *owner) } } -void WM_jobs_kill_type(struct wmWindowManager *wm, void *owner, int job_type) +void WM_jobs_kill_type(struct wmWindowManager *wm, const void *owner, int job_type) { LISTBASE_FOREACH_MUTABLE (wmJob *, wm_job, &wm->jobs) { if (!owner || wm_job->owner == owner) { @@ -581,7 +585,7 @@ void WM_jobs_kill_type(struct wmWindowManager *wm, void *owner, int job_type) } /* signal job(s) from this owner or callback to stop, timer is required to get handled */ -void WM_jobs_stop(wmWindowManager *wm, void *owner, void *startjob) +void WM_jobs_stop(wmWindowManager *wm, const void *owner, void *startjob) { LISTBASE_FOREACH (wmJob *, wm_job, &wm->jobs) { if (wm_job->owner == owner || wm_job->startjob == startjob) { @@ -702,9 +706,9 @@ void wm_jobs_timer(wmWindowManager *wm, wmTimer *wt) wm_jobs_update_progress_bars(wm); } -bool WM_jobs_has_running(wmWindowManager *wm) +bool WM_jobs_has_running(const wmWindowManager *wm) { - LISTBASE_FOREACH (wmJob *, wm_job, &wm->jobs) { + LISTBASE_FOREACH (const wmJob *, wm_job, &wm->jobs) { if (wm_job->running) { return true; } |