diff --git a/intern/clog/CLG_log.h b/intern/clog/CLG_log.h index 8fc887cb1ce..db49da4faeb 100644 --- a/intern/clog/CLG_log.h +++ b/intern/clog/CLG_log.h @@ -109,12 +109,12 @@ typedef struct CLG_LogRef { struct CLG_LogRef *next; } CLG_LogRef; -void CLG_log_str(CLG_LogType *lg, +void CLG_log_str(const CLG_LogType *lg, enum CLG_Severity severity, const char *file_line, const char *fn, const char *message) _CLOG_ATTR_NONNULL(1, 3, 4, 5); -void CLG_logf(CLG_LogType *lg, +void CLG_logf(const CLG_LogType *lg, enum CLG_Severity severity, const char *file_line, const char *fn, @@ -156,7 +156,7 @@ int CLG_color_support_get(CLG_LogRef *clg_ref); #define CLOG_AT_SEVERITY(clg_ref, severity, verbose_level, ...) \ { \ - CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \ + const CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \ if (((_lg_ty->flag & CLG_FLAG_USE) && (_lg_ty->level >= verbose_level)) || \ (severity >= CLG_SEVERITY_WARN)) \ { \ @@ -167,7 +167,7 @@ int CLG_color_support_get(CLG_LogRef *clg_ref); #define CLOG_STR_AT_SEVERITY(clg_ref, severity, verbose_level, str) \ { \ - CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \ + const CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \ if (((_lg_ty->flag & CLG_FLAG_USE) && (_lg_ty->level >= verbose_level)) || \ (severity >= CLG_SEVERITY_WARN)) \ { \ diff --git a/intern/clog/clog.c b/intern/clog/clog.c index 0b3887e5350..9202861a589 100644 --- a/intern/clog/clog.c +++ b/intern/clog/clog.c @@ -429,7 +429,7 @@ static void write_severity(CLogStringBuf *cstr, enum CLG_Severity severity, bool } } -static void write_type(CLogStringBuf *cstr, CLG_LogType *lg) +static void write_type(CLogStringBuf *cstr, const CLG_LogType *lg) { clg_str_append(cstr, " ("); clg_str_append(cstr, lg->identifier); @@ -460,7 +460,7 @@ static void write_file_line_fn(CLogStringBuf *cstr, clg_str_append(cstr, ": "); } -void CLG_log_str(CLG_LogType *lg, +void CLG_log_str(const CLG_LogType *lg, enum CLG_Severity severity, const char *file_line, const char *fn, @@ -498,7 +498,7 @@ void CLG_log_str(CLG_LogType *lg, } } -void CLG_logf(CLG_LogType *lg, +void CLG_logf(const CLG_LogType *lg, enum CLG_Severity severity, const char *file_line, const char *fn, diff --git a/source/blender/blenkernel/BKE_customdata_file.h b/source/blender/blenkernel/BKE_customdata_file.h index e364dca247c..4a527d8cd11 100644 --- a/source/blender/blenkernel/BKE_customdata_file.h +++ b/source/blender/blenkernel/BKE_customdata_file.h @@ -28,13 +28,13 @@ void cdf_free(CDataFile *cdf); /* File read/write/remove */ bool cdf_read_open(CDataFile *cdf, const char *filepath); -bool cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay); +bool cdf_read_layer(CDataFile *cdf, const CDataFileLayer *blay); bool cdf_read_data(CDataFile *cdf, unsigned int size, void *data); void cdf_read_close(CDataFile *cdf); bool cdf_write_open(CDataFile *cdf, const char *filepath); bool cdf_write_layer(CDataFile *cdf, CDataFileLayer *blay); -bool cdf_write_data(CDataFile *cdf, unsigned int size, void *data); +bool cdf_write_data(CDataFile *cdf, unsigned int size, const void *data); void cdf_write_close(CDataFile *cdf); void cdf_remove(const char *filepath); diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index 38c07aa4085..64b54341442 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -65,7 +65,7 @@ void txt_clean_text(struct Text *text); void txt_order_cursors(struct Text *text, bool reverse); int txt_find_string(struct Text *text, const char *findstr, int wrap, int match_case); bool txt_has_sel(const struct Text *text); -int txt_get_span(struct TextLine *from, struct TextLine *to); +int txt_get_span(struct TextLine *from, const struct TextLine *to); void txt_move_up(struct Text *text, bool sel); void txt_move_down(struct Text *text, bool sel); void txt_move_left(struct Text *text, bool sel); @@ -116,8 +116,8 @@ int txt_setcurr_tab_spaces(struct Text *text, int space); 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); +int txt_calc_tab_left(const struct TextLine *tl, int ch); +int txt_calc_tab_right(const struct TextLine *tl, int ch); /** * Utility functions, could be moved somewhere more generic but are python/text related. diff --git a/source/blender/blenkernel/BKE_vfont.hh b/source/blender/blenkernel/BKE_vfont.hh index 9135e0b14e3..bf26f162543 100644 --- a/source/blender/blenkernel/BKE_vfont.hh +++ b/source/blender/blenkernel/BKE_vfont.hh @@ -111,7 +111,7 @@ bool BKE_vfont_to_curve(Object *ob, eEditFontMode mode); void BKE_vfont_build_char(Curve *cu, ListBase *nubase, unsigned int character, - CharInfo *info, + const CharInfo *info, float ofsx, float ofsy, float rot, diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc index 586819971e5..6194ffdd53e 100644 --- a/source/blender/blenkernel/intern/customdata.cc +++ b/source/blender/blenkernel/intern/customdata.cc @@ -4799,7 +4799,7 @@ void CustomData_external_read(CustomData *data, ID *id, eCustomDataMask mask, co /* pass */ } else if ((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->read) { - CDataFileLayer *blay = cdf_layer_find(cdf, layer->type, layer->name); + const CDataFileLayer *blay = cdf_layer_find(cdf, layer->type, layer->name); if (blay) { if (cdf_read_layer(cdf, blay)) { diff --git a/source/blender/blenkernel/intern/customdata_file.cc b/source/blender/blenkernel/intern/customdata_file.cc index 38b4d38c4a9..79bdfbe719a 100644 --- a/source/blender/blenkernel/intern/customdata_file.cc +++ b/source/blender/blenkernel/intern/customdata_file.cc @@ -295,7 +295,7 @@ bool cdf_read_open(CDataFile *cdf, const char *filepath) return true; } -bool cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay) +bool cdf_read_layer(CDataFile *cdf, const CDataFileLayer *blay) { size_t offset; int a; @@ -387,7 +387,7 @@ bool cdf_write_layer(CDataFile * /*cdf*/, CDataFileLayer * /*blay*/) return true; } -bool cdf_write_data(CDataFile *cdf, uint size, void *data) +bool cdf_write_data(CDataFile *cdf, uint size, const void *data) { /* write data */ if (!fwrite(data, size, 1, cdf->writef)) { diff --git a/source/blender/blenkernel/intern/text.cc b/source/blender/blenkernel/intern/text.cc index 3e53bdcefda..5942499a13d 100644 --- a/source/blender/blenkernel/intern/text.cc +++ b/source/blender/blenkernel/intern/text.cc @@ -673,7 +673,7 @@ void txt_clean_text(Text *text) } } -int txt_get_span(TextLine *from, TextLine *to) +int txt_get_span(TextLine *from, const TextLine *to) { int ret = 0; TextLine *tmp = from; @@ -825,7 +825,7 @@ void txt_move_down(Text *text, const bool sel) } } -int txt_calc_tab_left(TextLine *tl, int ch) +int txt_calc_tab_left(const TextLine *tl, int ch) { /* do nice left only if there are only spaces */ @@ -845,7 +845,7 @@ int txt_calc_tab_left(TextLine *tl, int ch) return tabsize; } -int txt_calc_tab_right(TextLine *tl, int ch) +int txt_calc_tab_right(const TextLine *tl, int ch) { if (tl->line[ch] == ' ') { int i; diff --git a/source/blender/blenkernel/intern/vfont.cc b/source/blender/blenkernel/intern/vfont.cc index 06b920300a0..c2f596ed6bf 100644 --- a/source/blender/blenkernel/intern/vfont.cc +++ b/source/blender/blenkernel/intern/vfont.cc @@ -405,7 +405,7 @@ VFont *BKE_vfont_load_exists(Main *bmain, const char *filepath) return BKE_vfont_load_exists_ex(bmain, filepath, nullptr); } -static VFont *which_vfont(Curve *cu, CharInfo *info) +static VFont *which_vfont(Curve *cu, const CharInfo *info) { switch (info->flag & (CU_CHINFO_BOLD | CU_CHINFO_ITALIC)) { case CU_CHINFO_BOLD: @@ -435,7 +435,7 @@ VFont *BKE_vfont_builtin_get() return vfont; } -static VChar *find_vfont_char(VFontData *vfd, uint character) +static VChar *find_vfont_char(const VFontData *vfd, uint character) { return static_cast(BLI_ghash_lookup(vfd->characters, POINTER_FROM_UINT(character))); } @@ -507,7 +507,7 @@ static void build_underline(Curve *cu, void BKE_vfont_build_char(Curve *cu, ListBase *nubase, uint character, - CharInfo *info, + const CharInfo *info, float ofsx, float ofsy, float rot, @@ -679,7 +679,7 @@ void BKE_vfont_select_clamp(Object *ob) CLAMP_MAX(ef->selend, ef->len); } -static float char_width(Curve *cu, VChar *che, CharInfo *info) +static float char_width(Curve *cu, VChar *che, const CharInfo *info) { /* The character wasn't found, probably ascii = 0, then the width shall be 0 as well */ if (che == nullptr) { diff --git a/source/blender/blenlib/BLI_args.h b/source/blender/blenlib/BLI_args.h index 8ae2148ec09..50a4ed54468 100644 --- a/source/blender/blenlib/BLI_args.h +++ b/source/blender/blenlib/BLI_args.h @@ -69,7 +69,7 @@ void BLI_args_print_other_doc(struct bArgs *ba); bool BLI_args_has_other_doc(const struct bArgs *ba); -void BLI_args_print(struct bArgs *ba); +void BLI_args_print(const struct bArgs *ba); #ifdef __cplusplus } diff --git a/source/blender/blenlib/BLI_rand.h b/source/blender/blenlib/BLI_rand.h index 8aca93264bd..7c7743716a3 100644 --- a/source/blender/blenlib/BLI_rand.h +++ b/source/blender/blenlib/BLI_rand.h @@ -32,7 +32,7 @@ struct RNG *BLI_rng_new(unsigned int seed); * A version of #BLI_rng_new that hashes the seed. */ struct RNG *BLI_rng_new_srandom(unsigned int seed); -struct RNG *BLI_rng_copy(struct RNG *rng) ATTR_NONNULL(1); +struct RNG *BLI_rng_copy(const struct RNG *rng) ATTR_NONNULL(1); void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1); void BLI_rng_seed(struct RNG *rng, unsigned int seed) ATTR_NONNULL(1); diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index 50eb0945ec6..0050d8e5f2d 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -152,7 +152,7 @@ void BLI_args_pass_set(bArgs *ba, int current_pass) ba->current_pass = current_pass; } -void BLI_args_print(bArgs *ba) +void BLI_args_print(const bArgs *ba) { int i; for (i = 0; i < ba->argc; i++) { diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index be3a8aeee6a..f11e13cf1aa 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -258,7 +258,7 @@ static void bvh_insertionsort(BVHNode **a, int lo, int hi, int axis) } } -static int bvh_partition(BVHNode **a, int lo, int hi, BVHNode *x, int axis) +static int bvh_partition(BVHNode **a, int lo, int hi, const BVHNode *x, int axis) { int i = lo, j = hi; while (1) { diff --git a/source/blender/blenlib/intern/rand.cc b/source/blender/blenlib/intern/rand.cc index a1ec6550c9b..9a11e8157d8 100644 --- a/source/blender/blenlib/intern/rand.cc +++ b/source/blender/blenlib/intern/rand.cc @@ -50,7 +50,7 @@ RNG *BLI_rng_new_srandom(uint seed) return rng; } -RNG *BLI_rng_copy(RNG *rng) +RNG *BLI_rng_copy(const RNG *rng) { return new RNG(*rng); } diff --git a/source/blender/blenloader/intern/versioning_userdef.cc b/source/blender/blenloader/intern/versioning_userdef.cc index 5ac450fccf8..05565e8d677 100644 --- a/source/blender/blenloader/intern/versioning_userdef.cc +++ b/source/blender/blenloader/intern/versioning_userdef.cc @@ -155,7 +155,7 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme) /** #UserDef.flag */ #define USER_LMOUSESELECT (1 << 14) /* deprecated */ -static void do_version_select_mouse(UserDef *userdef, wmKeyMapItem *kmi) +static void do_version_select_mouse(const UserDef *userdef, wmKeyMapItem *kmi) { /* Remove select/action mouse from user defined keymaps. */ enum { diff --git a/source/blender/editors/animation/anim_markers.cc b/source/blender/editors/animation/anim_markers.cc index a7b6cd54f5c..f72827ffe75 100644 --- a/source/blender/editors/animation/anim_markers.cc +++ b/source/blender/editors/animation/anim_markers.cc @@ -509,7 +509,7 @@ static void draw_marker(const uiFontStyle *fstyle, draw_marker_name(text_color, fstyle, marker, xpos, xmax, name_y); } -static void draw_markers_background(rctf *rect) +static void draw_markers_background(const rctf *rect) { uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); diff --git a/source/blender/editors/gpencil_legacy/gpencil_select.cc b/source/blender/editors/gpencil_legacy/gpencil_select.cc index 773ca679427..2758b54ff73 100644 --- a/source/blender/editors/gpencil_legacy/gpencil_select.cc +++ b/source/blender/editors/gpencil_legacy/gpencil_select.cc @@ -1574,7 +1574,7 @@ static bool gpencil_do_curve_circle_sel(bContext *C, const int my, const int radius, const bool select, - rcti *rect, + const rcti *rect, const float diff_mat[4][4], const int selectmode) { diff --git a/source/blender/editors/include/ED_numinput.hh b/source/blender/editors/include/ED_numinput.hh index 7a7576a1097..5b281abbe3d 100644 --- a/source/blender/editors/include/ED_numinput.hh +++ b/source/blender/editors/include/ED_numinput.hh @@ -80,7 +80,7 @@ void initNumInput(NumInput *n); /** * \param str: Must be NUM_STR_REP_LEN * (idx_max + 1) length. */ -void outputNumInput(NumInput *n, char *str, UnitSettings *unit_settings); +void outputNumInput(NumInput *n, char *str, const UnitSettings *unit_settings); bool hasNumInput(const NumInput *n); /** * \warning \a vec must be set beforehand otherwise we risk uninitialized vars. diff --git a/source/blender/editors/include/ED_util.hh b/source/blender/editors/include/ED_util.hh index 224bcae5b65..6d9b1e06589 100644 --- a/source/blender/editors/include/ED_util.hh +++ b/source/blender/editors/include/ED_util.hh @@ -87,7 +87,7 @@ void ED_slider_status_string_get(const tSlider *slider, char *status_string, size_t size_of_status_string); -float ED_slider_factor_get(tSlider *slider); +float ED_slider_factor_get(const tSlider *slider); void ED_slider_factor_set(tSlider *slider, float factor); /** One bool value for each side of the slider. Allows to enable overshoot only on one side. */ @@ -98,11 +98,11 @@ void ED_slider_allow_overshoot_set(tSlider *slider, bool lower, bool upper); */ void ED_slider_factor_bounds_set(tSlider *slider, float lower_bound, float upper_bound); -bool ED_slider_allow_increments_get(tSlider *slider); +bool ED_slider_allow_increments_get(const tSlider *slider); void ED_slider_allow_increments_set(tSlider *slider, bool value); void ED_slider_mode_set(tSlider *slider, SliderMode mode); -SliderMode ED_slider_mode_get(tSlider *slider); +SliderMode ED_slider_mode_get(const tSlider *slider); void ED_slider_unit_set(tSlider *slider, const char *unit); /* ************** XXX OLD CRUFT WARNING ************* */ diff --git a/source/blender/editors/include/ED_view3d.hh b/source/blender/editors/include/ED_view3d.hh index b022b48a207..d4bfe26e4ac 100644 --- a/source/blender/editors/include/ED_view3d.hh +++ b/source/blender/editors/include/ED_view3d.hh @@ -148,7 +148,7 @@ void ED_view3d_from_m4(const float mat[4][4], float ofs[3], float quat[4], const * \param lens: The view lens angle set for cameras and lights, normally from View3D.lens. */ void ED_view3d_from_object( - const Object *ob, float ofs[3], float quat[4], float *dist, float *lens); + const Object *ob, float ofs[3], float quat[4], const float *dist, float *lens); /** * Set the object transformation from #RegionView3D members. * \param depsgraph: The depsgraph to get the evaluated object parent diff --git a/source/blender/editors/interface/interface_draw.cc b/source/blender/editors/interface/interface_draw.cc index 99bc6c5b1da..cd76cc91da5 100644 --- a/source/blender/editors/interface/interface_draw.cc +++ b/source/blender/editors/interface/interface_draw.cc @@ -589,7 +589,7 @@ void ui_draw_but_HISTOGRAM(ARegion * /*region*/, #undef HISTOGRAM_TOT_GRID_LINES -static void waveform_draw_one(float *waveform, int waveform_num, const float col[3]) +static void waveform_draw_one(const float *waveform, int waveform_num, const float col[3]) { GPUVertFormat format = {0}; const uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -609,7 +609,7 @@ static void waveform_draw_one(float *waveform, int waveform_num, const float col GPU_batch_discard(batch); } -static void waveform_draw_rgb(float *waveform, int waveform_num, float *col) +static void waveform_draw_rgb(const float *waveform, int waveform_num, const float *col) { GPUVertFormat format = {0}; const uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -629,7 +629,7 @@ static void waveform_draw_rgb(float *waveform, int waveform_num, float *col) GPU_batch_discard(batch); } -static void circle_draw_rgb(float *points, int tot_points, float *col, GPUPrimType prim) +static void circle_draw_rgb(float *points, int tot_points, const float *col, GPUPrimType prim) { GPUVertFormat format = {0}; const uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); diff --git a/source/blender/editors/interface/templates/interface_template_search_menu.cc b/source/blender/editors/interface/templates/interface_template_search_menu.cc index 778dd329f4e..183fed4fbdc 100644 --- a/source/blender/editors/interface/templates/interface_template_search_menu.cc +++ b/source/blender/editors/interface/templates/interface_template_search_menu.cc @@ -144,7 +144,7 @@ static const char *strdup_memarena(MemArena *memarena, const char *str) return str_dst; } -static const char *strdup_memarena_from_dynstr(MemArena *memarena, DynStr *dyn_str) +static const char *strdup_memarena_from_dynstr(MemArena *memarena, const DynStr *dyn_str) { const uint str_size = BLI_dynstr_get_len(dyn_str) + 1; char *str_dst = (char *)BLI_memarena_alloc(memarena, str_size); diff --git a/source/blender/editors/render/render_preview.cc b/source/blender/editors/render/render_preview.cc index ba5180ba6a0..e7720326ee2 100644 --- a/source/blender/editors/render/render_preview.cc +++ b/source/blender/editors/render/render_preview.cc @@ -643,7 +643,7 @@ static Scene *preview_prepare_scene( /* new UI convention: draw is in pixel space already. */ /* uses UI_BTYPE_ROUNDBOX button in block to get the rect */ static bool ed_preview_draw_rect( - Scene *scene, ScrArea *area, int split, int first, rcti *rect, rcti *newrect) + Scene *scene, ScrArea *area, int split, int first, const rcti *rect, rcti *newrect) { Render *re; RenderView *rv; diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.cc b/source/blender/editors/sculpt_paint/paint_image_2d.cc index f8f2735aa5f..4aac396719c 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.cc +++ b/source/blender/editors/sculpt_paint/paint_image_2d.cc @@ -191,7 +191,7 @@ static void brush_painter_cache_2d_free(BrushPainterCache *cache) } } -static void brush_imbuf_tex_co(rctf *mapping, int x, int y, float texco[3]) +static void brush_imbuf_tex_co(const rctf *mapping, int x, int y, float texco[3]) { texco[0] = mapping->xmin + x * mapping->xmax; texco[1] = mapping->ymin + y * mapping->ymax; diff --git a/source/blender/editors/space_graph/graph_slider_ops.cc b/source/blender/editors/space_graph/graph_slider_ops.cc index cd5c665fea7..0266658d96e 100644 --- a/source/blender/editors/space_graph/graph_slider_ops.cc +++ b/source/blender/editors/space_graph/graph_slider_ops.cc @@ -2025,8 +2025,8 @@ struct tBtwOperatorData { ListBase anim_data; /* bAnimListElem */ }; -static int btw_calculate_sample_count(BezTriple *right_bezt, - BezTriple *left_bezt, +static int btw_calculate_sample_count(const BezTriple *right_bezt, + const BezTriple *left_bezt, const int filter_order, const int samples_per_frame) { diff --git a/source/blender/editors/space_sequencer/sequencer_retiming_draw.cc b/source/blender/editors/space_sequencer/sequencer_retiming_draw.cc index 574ac69e732..7a17787f07d 100644 --- a/source/blender/editors/space_sequencer/sequencer_retiming_draw.cc +++ b/source/blender/editors/space_sequencer/sequencer_retiming_draw.cc @@ -509,7 +509,7 @@ static size_t label_str_get(const Sequence *seq, static bool label_rect_get(const bContext *C, const Sequence *seq, const SeqRetimingKey *key, - char *label_str, + const char *label_str, const size_t label_len, rctf *rect) { diff --git a/source/blender/editors/space_sequencer/sequencer_thumbnails.cc b/source/blender/editors/space_sequencer/sequencer_thumbnails.cc index 473fa07861e..9ee44ae9d7f 100644 --- a/source/blender/editors/space_sequencer/sequencer_thumbnails.cc +++ b/source/blender/editors/space_sequencer/sequencer_thumbnails.cc @@ -37,7 +37,7 @@ struct ThumbnailDrawJob { SeqRenderData context; GHash *sequences_ghash; Scene *scene; - rctf *view_area; + const rctf *view_area; float pixelx; float pixely; float thumb_height; @@ -59,7 +59,7 @@ static void thumbnail_freejob(void *data) { ThumbnailDrawJob *tj = static_cast(data); BLI_ghash_free(tj->sequences_ghash, nullptr, thumbnail_hash_data_free); - MEM_freeN(tj->view_area); + MEM_freeN((void *)tj->view_area); MEM_freeN(tj); } @@ -69,7 +69,7 @@ static void thumbnail_endjob(void *data) WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, tj->scene); } -static bool check_seq_need_thumbnails(const Scene *scene, Sequence *seq, rctf *view_area) +static bool check_seq_need_thumbnails(const Scene *scene, Sequence *seq, const rctf *view_area) { if (!ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE)) { return false; diff --git a/source/blender/editors/space_text/text_draw.cc b/source/blender/editors/space_text/text_draw.cc index 1f06d5ac28e..399e43ef93a 100644 --- a/source/blender/editors/space_text/text_draw.cc +++ b/source/blender/editors/space_text/text_draw.cc @@ -1013,7 +1013,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *region, rcti *scroll, rcti *b CLAMP(st->runtime->scroll_region_select.ymax, pix_bottom_margin, region->winy - pix_top_margin); } -static void draw_textscroll(const SpaceText *st, rcti *scroll, rcti *back) +static void draw_textscroll(const SpaceText *st, const rcti *scroll, const rcti *back) { bTheme *btheme = UI_GetTheme(); uiWidgetColors wcol = btheme->tui.wcol_scroll; diff --git a/source/blender/editors/space_view3d/view3d_utils.cc b/source/blender/editors/space_view3d/view3d_utils.cc index 309049d9956..70c55cb79fc 100644 --- a/source/blender/editors/space_view3d/view3d_utils.cc +++ b/source/blender/editors/space_view3d/view3d_utils.cc @@ -1572,7 +1572,8 @@ void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], c sub_v3_v3v3(mat[3], dvec, ofs); } -void ED_view3d_from_object(const Object *ob, float ofs[3], float quat[4], float *dist, float *lens) +void ED_view3d_from_object( + const Object *ob, float ofs[3], float quat[4], const float *dist, float *lens) { ED_view3d_from_m4(ob->object_to_world().ptr(), ofs, quat, dist); diff --git a/source/blender/editors/transform/transform_snap_animation.cc b/source/blender/editors/transform/transform_snap_animation.cc index abee64eb0d9..1e3a57e5097 100644 --- a/source/blender/editors/transform/transform_snap_animation.cc +++ b/source/blender/editors/transform/transform_snap_animation.cc @@ -117,7 +117,7 @@ static void invert_snap(eSnapMode &snap_mode) /* WORKAROUND: The source position is based on the transformed elements. * However, at this stage, the transformation has not yet been applied. * So apply the transformation here. */ -static float2 nla_transform_apply(TransInfo *t, float *vec, float2 &ival) +static float2 nla_transform_apply(TransInfo *t, const float *vec, float2 &ival) { float4x4 mat = float4x4::identity(); diff --git a/source/blender/editors/util/ed_draw.cc b/source/blender/editors/util/ed_draw.cc index 1e8474735f5..9e446b0e33a 100644 --- a/source/blender/editors/util/ed_draw.cc +++ b/source/blender/editors/util/ed_draw.cc @@ -531,7 +531,7 @@ void ED_slider_destroy(bContext *C, tSlider *slider) /* Setters & Getters */ -float ED_slider_factor_get(tSlider *slider) +float ED_slider_factor_get(const tSlider *slider) { return slider->factor; } @@ -551,7 +551,7 @@ void ED_slider_allow_overshoot_set(tSlider *slider, const bool lower, const bool slider->allow_overshoot_upper = upper; } -bool ED_slider_allow_increments_get(tSlider *slider) +bool ED_slider_allow_increments_get(const tSlider *slider) { return slider->allow_increments; } @@ -574,7 +574,7 @@ void ED_slider_mode_set(tSlider *slider, SliderMode mode) slider->slider_mode = mode; } -SliderMode ED_slider_mode_get(tSlider *slider) +SliderMode ED_slider_mode_get(const tSlider *slider) { return slider->slider_mode; } diff --git a/source/blender/editors/util/numinput.cc b/source/blender/editors/util/numinput.cc index 53d06bf1306..925d805e582 100644 --- a/source/blender/editors/util/numinput.cc +++ b/source/blender/editors/util/numinput.cc @@ -85,7 +85,7 @@ void initNumInput(NumInput *n) n->str_cur = 0; } -void outputNumInput(NumInput *n, char *str, UnitSettings *unit_settings) +void outputNumInput(NumInput *n, char *str, const UnitSettings *unit_settings) { short j; const int ln = NUM_STR_REP_LEN; diff --git a/source/blender/editors/uvedit/uvedit_clipboard_graph_iso.cc b/source/blender/editors/uvedit/uvedit_clipboard_graph_iso.cc index a2227a7c73d..5f40a9d39ab 100644 --- a/source/blender/editors/uvedit/uvedit_clipboard_graph_iso.cc +++ b/source/blender/editors/uvedit/uvedit_clipboard_graph_iso.cc @@ -249,8 +249,11 @@ static uint8_t find_min_value(const uint8_t *arr, uint8_t start_idx, uint8_t len return min_v; } -static void select_bidomain( - uint8_t domains[][BDS], int bd_pos, uint8_t *left, int current_matching_size, bool connected) +static void select_bidomain(uint8_t domains[][BDS], + int bd_pos, + const uint8_t *left, + int current_matching_size, + bool connected) { int i; int min_size = INT_MAX; diff --git a/source/blender/geometry/intern/uv_pack.cc b/source/blender/geometry/intern/uv_pack.cc index 15d3198840a..ce39beb94b0 100644 --- a/source/blender/geometry/intern/uv_pack.cc +++ b/source/blender/geometry/intern/uv_pack.cc @@ -2189,7 +2189,7 @@ class OverlapMerger { } /** Return a new root of the binary tree, with `a` and `b` as leaves. */ - static PackIsland *merge_islands(PackIsland *a, PackIsland *b) + static PackIsland *merge_islands(const PackIsland *a, const PackIsland *b) { PackIsland *result = new PackIsland(); result->aspect_y = sqrtf(a->aspect_y * b->aspect_y); diff --git a/source/blender/geometry/intern/uv_parametrizer.cc b/source/blender/geometry/intern/uv_parametrizer.cc index dd2af9f9e53..9f3c0eded08 100644 --- a/source/blender/geometry/intern/uv_parametrizer.cc +++ b/source/blender/geometry/intern/uv_parametrizer.cc @@ -1234,7 +1234,7 @@ static void p_chart_fill_boundary(ParamHandle *handle, PChart *chart, PEdge *be, BLI_heap_free(heap, nullptr); } -static void p_chart_fill_boundaries(ParamHandle *handle, PChart *chart, PEdge *outer) +static void p_chart_fill_boundaries(ParamHandle *handle, PChart *chart, const PEdge *outer) { PEdge *e, *be; /* *enext - as yet unused */ int nedges; diff --git a/source/blender/gpu/GPU_batch.hh b/source/blender/gpu/GPU_batch.hh index f727a0d9a0c..8d85c6f52f2 100644 --- a/source/blender/gpu/GPU_batch.hh +++ b/source/blender/gpu/GPU_batch.hh @@ -243,7 +243,7 @@ void GPU_batch_elembuf_set(blender::gpu::Batch *batch, * Returns true if the #GPUbatch has \a vertex_buf in its vertex buffer list. * \note The search is only conducted on the non-instance rate vertex buffer list. */ -bool GPU_batch_vertbuf_has(blender::gpu::Batch *batch, blender::gpu::VertBuf *vertex_buf); +bool GPU_batch_vertbuf_has(const blender::gpu::Batch *batch, blender::gpu::VertBuf *vertex_buf); /** * Set resource id buffer to bind as instance attribute to workaround the lack of gl_BaseInstance diff --git a/source/blender/gpu/intern/gpu_batch.cc b/source/blender/gpu/intern/gpu_batch.cc index b764af15cb7..a7cd8f82787 100644 --- a/source/blender/gpu/intern/gpu_batch.cc +++ b/source/blender/gpu/intern/gpu_batch.cc @@ -204,7 +204,7 @@ int GPU_batch_vertbuf_add(Batch *batch, VertBuf *vertex_buf, bool own_vbo) return -1; } -bool GPU_batch_vertbuf_has(Batch *batch, VertBuf *vertex_buf) +bool GPU_batch_vertbuf_has(const Batch *batch, VertBuf *vertex_buf) { for (uint v = 0; v < GPU_BATCH_VBO_MAX_LEN; v++) { if (batch->verts[v] == vertex_buf) { diff --git a/source/blender/imbuf/intern/colormanagement.cc b/source/blender/imbuf/intern/colormanagement.cc index b35301ea337..cc027218534 100644 --- a/source/blender/imbuf/intern/colormanagement.cc +++ b/source/blender/imbuf/intern/colormanagement.cc @@ -1060,7 +1060,9 @@ void IMB_colormanagement_init_default_view_settings( view_settings->curve_mapping = nullptr; } -static void curve_mapping_apply_pixel(CurveMapping *curve_mapping, float *pixel, int channels) +static void curve_mapping_apply_pixel(const CurveMapping *curve_mapping, + float *pixel, + int channels) { if (channels == 1) { pixel[0] = BKE_curvemap_evaluateF(curve_mapping, curve_mapping->cm, pixel[0]); diff --git a/source/blender/imbuf/intern/iris.cc b/source/blender/imbuf/intern/iris.cc index a5fef4e27a1..41e6fff9855 100644 --- a/source/blender/imbuf/intern/iris.cc +++ b/source/blender/imbuf/intern/iris.cc @@ -88,13 +88,13 @@ struct MFileOffset { /* Functions. */ static void readheader(MFileOffset *inf, IMAGE *image); -static int writeheader(FILE *outf, IMAGE *image); +static int writeheader(FILE *outf, const IMAGE *image); static ushort getshort(MFileOffset *inf); static uint getlong(MFileOffset *mofs); static void putshort(FILE *outf, ushort val); static int putlong(FILE *outf, uint val); -static int writetab(FILE *outf, uint *tab, int len); +static int writetab(FILE *outf, const uint *tab, int len); static void readtab(MFileOffset *inf, uint *tab, int len); static int expandrow( @@ -161,7 +161,7 @@ static void readheader(MFileOffset *inf, IMAGE *image) image->zsize = getshort(inf); } -static int writeheader(FILE *outf, IMAGE *image) +static int writeheader(FILE *outf, const IMAGE *image) { IMAGE t = {0}; @@ -179,7 +179,7 @@ static int writeheader(FILE *outf, IMAGE *image) return fwrite("no name", 8, 1, outf); } -static int writetab(FILE *outf, uint *tab, int len) +static int writetab(FILE *outf, const uint *tab, int len) { int r = 0; diff --git a/source/blender/render/intern/render_result.cc b/source/blender/render/intern/render_result.cc index bfb03cabd27..8a9b26b8f6f 100644 --- a/source/blender/render/intern/render_result.cc +++ b/source/blender/render/intern/render_result.cc @@ -1027,7 +1027,7 @@ void render_result_exr_file_cache_write(Render *re) { RenderResult *rr = re->result; char str[FILE_CACHE_MAX]; - char *root = U.render_cachedir; + const char *root = U.render_cachedir; render_result_passes_allocated_ensure(rr); @@ -1041,7 +1041,7 @@ bool render_result_exr_file_cache_read(Render *re) { /* File path to cache. */ char filepath[FILE_CACHE_MAX] = ""; - char *root = U.render_cachedir; + const char *root = U.render_cachedir; render_result_exr_file_cache_path(re->scene, root, filepath); printf("read exr cache file: %s\n", filepath); diff --git a/source/blender/sequencer/intern/disk_cache.cc b/source/blender/sequencer/intern/disk_cache.cc index 0c698c449a2..a5cf6fc98b8 100644 --- a/source/blender/sequencer/intern/disk_cache.cc +++ b/source/blender/sequencer/intern/disk_cache.cc @@ -97,7 +97,7 @@ struct DiskCacheFile { static ThreadMutex cache_create_lock = BLI_MUTEX_INITIALIZER; -static char *seq_disk_cache_base_dir() +static const char *seq_disk_cache_base_dir() { return U.sequencer_disk_cache_dir; } @@ -152,7 +152,7 @@ static DiskCacheFile *seq_disk_cache_add_file_to_list(SeqDiskCache *disk_cache, return cache_file; } -static void seq_disk_cache_get_files(SeqDiskCache *disk_cache, char *dirpath) +static void seq_disk_cache_get_files(SeqDiskCache *disk_cache, const char *dirpath) { direntry *filelist, *fl; uint i; @@ -329,7 +329,7 @@ static void seq_disk_cache_get_file_path(SeqDiskCache *disk_cache, BLI_path_append(filepath, filepath_maxncpy, cache_filename); } -static void seq_disk_cache_create_version_file(char *filepath) +static void seq_disk_cache_create_version_file(const char *filepath) { BLI_file_ensure_parent_dir_exists(filepath); @@ -475,7 +475,7 @@ static bool seq_disk_cache_read_header(FILE *file, DiskCacheHeader *header) return true; } -static size_t seq_disk_cache_write_header(FILE *file, DiskCacheHeader *header) +static size_t seq_disk_cache_write_header(FILE *file, const DiskCacheHeader *header) { BLI_fseek(file, 0LL, SEEK_SET); return fwrite(header, sizeof(*header), 1, file); @@ -531,7 +531,7 @@ static int seq_disk_cache_add_header_entry(SeqCacheKey *key, ImBuf *ibuf, DiskCa return i; } -static int seq_disk_cache_get_header_entry(SeqCacheKey *key, DiskCacheHeader *header) +static int seq_disk_cache_get_header_entry(SeqCacheKey *key, const DiskCacheHeader *header) { for (int i = 0; i < DCACHE_IMAGES_PER_FILE; i++) { if (header->entry[i].frameno == key->frame_index) { diff --git a/source/blender/sequencer/intern/effects.cc b/source/blender/sequencer/intern/effects.cc index 00146c174e1..06886bdefa7 100644 --- a/source/blender/sequencer/intern/effects.cc +++ b/source/blender/sequencer/intern/effects.cc @@ -888,7 +888,7 @@ static void apply_blend_function( } static void do_blend_effect_float( - float fac, int x, int y, float *rect1, float *rect2, int btype, float *out) + float fac, int x, int y, const float *rect1, float *rect2, int btype, float *out) { switch (btype) { case SEQ_TYPE_ADD: diff --git a/source/blender/sequencer/intern/utils.cc b/source/blender/sequencer/intern/utils.cc index 9ff6d8b2b45..3823b15ab28 100644 --- a/source/blender/sequencer/intern/utils.cc +++ b/source/blender/sequencer/intern/utils.cc @@ -257,7 +257,7 @@ static void index_dir_set(Editing *ed, Sequence *seq, StripAnim *sanim) seq_proxy_index_dir_set(sanim->anim, proxy_dirpath); } -static bool open_anim_file_multiview(Scene *scene, Sequence *seq, char *filepath) +static bool open_anim_file_multiview(Scene *scene, Sequence *seq, const char *filepath) { char prefix[FILE_MAX]; const char *ext = nullptr; diff --git a/source/blender/windowmanager/intern/wm_gesture.cc b/source/blender/windowmanager/intern/wm_gesture.cc index 251bf1352d2..29bdcee9cb9 100644 --- a/source/blender/windowmanager/intern/wm_gesture.cc +++ b/source/blender/windowmanager/intern/wm_gesture.cc @@ -116,7 +116,7 @@ bool WM_gesture_is_modal_first(const wmGesture *gesture) /* ******************* gesture draw ******************* */ -static void wm_gesture_draw_line_active_side(rcti *rect, const bool flip) +static void wm_gesture_draw_line_active_side(const rcti *rect, const bool flip) { GPUVertFormat *format = immVertexFormat(); uint shdr_pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -167,7 +167,7 @@ static void wm_gesture_draw_line_active_side(rcti *rect, const bool flip) static void wm_gesture_draw_line(wmGesture *gt) { - rcti *rect = (rcti *)gt->customdata; + const rcti *rect = (rcti *)gt->customdata; if (gt->draw_active_side) { wm_gesture_draw_line_active_side(rect, gt->use_flip);