diff options
Diffstat (limited to 'source/blender/editors')
20 files changed, 58 insertions, 58 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 9f992e1063a..d76eba93640 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -3909,7 +3909,7 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann } /* Draw UI widgets the given channel */ -void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale, uiBlock *block, float yminc, float ymaxc, size_t channel_index) +void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListElem *ale, uiBlock *block, float yminc, float ymaxc, size_t channel_index) { bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); View2D *v2d = &ac->ar->v2d; diff --git a/source/blender/editors/armature/pose_group.c b/source/blender/editors/armature/pose_group.c index 9c27fe5218a..413a74d24b5 100644 --- a/source/blender/editors/armature/pose_group.c +++ b/source/blender/editors/armature/pose_group.c @@ -365,8 +365,8 @@ typedef struct tSortActionGroup { /* compare bone groups by name */ static int compare_agroup(const void *sgrp_a_ptr, const void *sgrp_b_ptr) { - tSortActionGroup *sgrp_a = (tSortActionGroup *)sgrp_a_ptr; - tSortActionGroup *sgrp_b = (tSortActionGroup *)sgrp_b_ptr; + const tSortActionGroup *sgrp_a = sgrp_a_ptr; + const tSortActionGroup *sgrp_b = sgrp_b_ptr; return strcmp(sgrp_a->agrp->name, sgrp_b->agrp->name); } diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 108166109b8..1a4b0c0d6a2 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1884,8 +1884,8 @@ static void undoFont_to_editFont(void *strv, void *ecu, void *UNUSED(obdata)) EditFont *ef = cu->editfont; const char *str = strv; - ef->pos = *((short *)str); - ef->len = *((short *)(str + 2)); + ef->pos = *((const short *)str); + ef->len = *((const short *)(str + 2)); memcpy(ef->textbuf, str + 4, (ef->len + 1) * sizeof(wchar_t)); memcpy(ef->textbufinfo, str + 4 + (ef->len + 1) * sizeof(wchar_t), ef->len * sizeof(CharInfo)); diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index cd0cfeb7e7f..50581429700 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -458,7 +458,7 @@ void ANIM_channel_debug_print_info(bAnimListElem *ale, short indent_level); /* Draw the given channel */ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc); /* Draw the widgets for the given channel */ -void ANIM_channel_draw_widgets(struct bContext *C, bAnimContext *ac, bAnimListElem *ale, struct uiBlock *block, float yminc, float ymaxc, size_t channel_index); +void ANIM_channel_draw_widgets(const struct bContext *C, bAnimContext *ac, bAnimListElem *ale, struct uiBlock *block, float yminc, float ymaxc, size_t channel_index); /* ------------------------ Editing API -------------------------- */ diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 517b8b61ac1..a54ced53e5e 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -931,7 +931,7 @@ static void icon_create_rect(struct PreviewImage *prv_img, enum eIconSizes size) /* only called when icon has changed */ /* only call with valid pointer from UI_icon_draw */ -static void icon_set_image(bContext *C, ID *id, PreviewImage *prv_img, enum eIconSizes size) +static void icon_set_image(const bContext *C, ID *id, PreviewImage *prv_img, enum eIconSizes size) { if (!prv_img) { if (G.debug & G_DEBUG) @@ -1149,7 +1149,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al } } -static void ui_id_preview_image_render_size(bContext *C, ID *id, PreviewImage *pi, int size) +static void ui_id_preview_image_render_size(const bContext *C, ID *id, PreviewImage *pi, int size) { if ((pi->changed[size] || !pi->rect[size])) { /* changed only ever set by dynamic icons */ /* create the rect if necessary */ @@ -1159,7 +1159,7 @@ static void ui_id_preview_image_render_size(bContext *C, ID *id, PreviewImage *p } } -static void ui_id_icon_render(bContext *C, ID *id, const bool big) +static void ui_id_icon_render(const bContext *C, ID *id, const bool big) { PreviewImage *pi = BKE_previewimg_get(id); @@ -1171,7 +1171,7 @@ static void ui_id_icon_render(bContext *C, ID *id, const bool big) } } -static void ui_id_brush_render(bContext *C, ID *id) +static void ui_id_brush_render(const bContext *C, ID *id) { PreviewImage *pi = BKE_previewimg_get(id); enum eIconSizes i; @@ -1190,7 +1190,7 @@ static void ui_id_brush_render(bContext *C, ID *id) } -static int ui_id_brush_get_icon(bContext *C, ID *id) +static int ui_id_brush_get_icon(const bContext *C, ID *id) { Brush *br = (Brush *)id; @@ -1243,7 +1243,7 @@ static int ui_id_brush_get_icon(bContext *C, ID *id) return id->icon_id; } -int ui_id_icon_get(bContext *C, ID *id, const bool big) +int ui_id_icon_get(const bContext *C, ID *id, const bool big) { int iconid = 0; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 2c3a239b2a2..7a217e5ff10 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -659,7 +659,7 @@ void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, const char *na void uiStyleInit(void); /* interface_icons.c */ -int ui_id_icon_get(struct bContext *C, struct ID *id, const bool big); +int ui_id_icon_get(const struct bContext *C, struct ID *id, const bool big); /* resources.c */ void init_userdef_do_versions(void); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 7a8d2afb68e..d316360a1ab 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1450,8 +1450,8 @@ typedef struct CollItemSearch { static int sort_search_items_list(const void *a, const void *b) { - CollItemSearch *cis1 = (CollItemSearch *)a; - CollItemSearch *cis2 = (CollItemSearch *)b; + const CollItemSearch *cis1 = (CollItemSearch *)a; + const CollItemSearch *cis2 = (CollItemSearch *)b; if (BLI_strcasecmp(cis1->name, cis2->name) > 0) return 1; @@ -1492,7 +1492,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s BLI_strncpy(name_ui, id->name + 2, sizeof(name_ui)); #endif name = BLI_strdup(name_ui); - iconid = ui_id_icon_get((bContext *)C, id, false); + iconid = ui_id_icon_get(C, id, false); } else { name = RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL); /* could use the string length here */ diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 9d96513095e..214fcfa2389 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -154,7 +154,7 @@ static void id_search_cb(const bContext *C, void *arg_template, const char *str, char name_ui[MAX_ID_NAME + 1]; name_uiprefix_id(name_ui, id); - iconid = ui_id_icon_get((bContext *)C, id, template->preview); + iconid = ui_id_icon_get(C, id, template->preview); if (false == UI_search_item_add(items, name_ui, id, iconid)) break; diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index a0af914e0bc..c7915d450e8 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -664,7 +664,7 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo } } - return (unsigned char *)cp; + return (const unsigned char *)cp; } /* use this call to init new bone color sets in Theme */ diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index f42e35945d7..de46d47e5a3 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -2305,7 +2305,7 @@ void UI_view2d_text_cache_add(View2D *v2d, float x, float y, BLI_LINKS_PREPEND(g_v2d_strings, v2s); - v2s->col.pack = *((int *)col); + v2s->col.pack = *((const int *)col); memset(&v2s->rect, 0, sizeof(v2s->rect)); @@ -2336,7 +2336,7 @@ void UI_view2d_text_cache_add_rectf(View2D *v2d, const rctf *rect_view, BLI_LINKS_PREPEND(g_v2d_strings, v2s); - v2s->col.pack = *((int *)col); + v2s->col.pack = *((const int *)col); v2s->rect = rect; diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 9cb0fc6e8ae..7f20970cfb9 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -2025,8 +2025,8 @@ static int knife_update_active(KnifeTool_OpData *kcd) static int sort_verts_by_dist_cb(void *co_p, const void *cur_a_p, const void *cur_b_p) { - KnifeVert *cur_a = ((Ref *)cur_a_p)->ref; - KnifeVert *cur_b = ((Ref *)cur_b_p)->ref; + const KnifeVert *cur_a = ((const Ref *)cur_a_p)->ref; + const KnifeVert *cur_b = ((const Ref *)cur_b_p)->ref; const float *co = co_p; const float a_sq = len_squared_v3v3(co, cur_a->co); const float b_sq = len_squared_v3v3(co, cur_b->co); diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index bd17631b7cd..d3073d519f6 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -3362,8 +3362,8 @@ static int loop_find_region(BMLoop *l, int flag, static int verg_radial(const void *va, const void *vb) { - BMEdge *e_a = *((BMEdge **)va); - BMEdge *e_b = *((BMEdge **)vb); + const BMEdge *e_a = *((const BMEdge **)va); + const BMEdge *e_b = *((const BMEdge **)vb); int a, b; a = BM_edge_face_count(e_a); diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 92a9112b6e5..23bc4a483d3 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -557,15 +557,15 @@ static int uv_element_offset_from_face_get(UvElementMap *map, BMFace *efa, BMLoo static unsigned int uv_edge_hash(const void *key) { - UvEdge *edge = (UvEdge *)key; + const UvEdge *edge = key; return (BLI_ghashutil_uinthash(edge->uv2) + BLI_ghashutil_uinthash(edge->uv1)); } static bool uv_edge_compare(const void *a, const void *b) { - UvEdge *edge1 = (UvEdge *)a; - UvEdge *edge2 = (UvEdge *)b; + const UvEdge *edge1 = a; + const UvEdge *edge2 = b; if ((edge1->uv1 == edge2->uv1) && (edge1->uv2 == edge2->uv2)) { return 0; diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index c5105fd9724..ef3c3504a85 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -618,7 +618,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar) /* *********************************************** */ /* Channel List */ -void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar) +void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *ar) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h index 766ae28da6f..bd96b5a4de5 100644 --- a/source/blender/editors/space_nla/nla_intern.h +++ b/source/blender/editors/space_nla/nla_intern.h @@ -50,7 +50,7 @@ void NLA_OT_properties(wmOperatorType *ot); /* nla_draw.c */ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar); -void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar); +void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *ar); /* **************************************** */ /* nla_select.c */ diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index cc1d6002134..ec584525aeb 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -236,7 +236,7 @@ static void nla_channel_area_draw(const bContext *C, ARegion *ar) /* data */ if (ANIM_animdata_get_context(C, &ac)) { - draw_nla_channel_list((bContext *)C, &ac, ar); + draw_nla_channel_list(C, &ac, ar); } /* reset view matrix */ diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index 83015228b78..f046670f387 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -453,8 +453,8 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) PointerRNA ptr, idptr; PropertyRNA *prop; const char *idname; - char _treename[MAX_ID_NAME - 2]; - char *treename = _treename; + char treename_buf[MAX_ID_NAME - 2]; + const char *treename; if (RNA_struct_property_is_set(op->ptr, "type")) { prop = RNA_struct_find_property(op->ptr, "type"); @@ -466,10 +466,11 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; if (RNA_struct_property_is_set(op->ptr, "name")) { - RNA_string_get(op->ptr, "name", treename); + RNA_string_get(op->ptr, "name", treename_buf); + treename = treename_buf; } else { - treename = (char *)DATA_("NodeTree"); + treename = DATA_("NodeTree"); } if (!ntreeTypeFind(idname)) { diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c index 9b3b9f23036..24b3776da6d 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.c +++ b/source/blender/editors/space_sequencer/sequencer_scopes.c @@ -55,7 +55,7 @@ static void rgb_to_yuv_normalized(const float rgb[3], float yuv[3]) static void scope_put_pixel(unsigned char *table, unsigned char *pos) { - char newval = table[*pos]; + unsigned char newval = table[*pos]; pos[0] = pos[1] = pos[2] = newval; pos[3] = 255; } @@ -148,8 +148,8 @@ static ImBuf *make_waveform_view_from_ibuf_byte(ImBuf *ibuf) { ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); int x, y; - unsigned char *src = (unsigned char *) ibuf->rect; - unsigned char *tgt = (unsigned char *) rval->rect; + const unsigned char *src = (unsigned char *)ibuf->rect; + unsigned char *tgt = (unsigned char *)rval->rect; int w = ibuf->x + 3; int h = 515; float waveform_gamma = 0.2; @@ -166,7 +166,7 @@ static ImBuf *make_waveform_view_from_ibuf_byte(ImBuf *ibuf) unsigned char *last_p = NULL; for (x = 0; x < ibuf->x; x++) { - unsigned char *rgb = src + 4 * (ibuf->x * y + x); + const unsigned char *rgb = src + 4 * (ibuf->x * y + x); float v = (float)rgb_to_luma_byte(rgb) / 255.0f; unsigned char *p = tgt; p += 4 * (w * ((int) (v * (h - 3)) + 1) + x + 1); @@ -189,7 +189,7 @@ static ImBuf *make_waveform_view_from_ibuf_float(ImBuf *ibuf) { ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); int x, y; - float *src = ibuf->rect_float; + const float *src = ibuf->rect_float; unsigned char *tgt = (unsigned char *) rval->rect; int w = ibuf->x + 3; int h = 515; @@ -245,8 +245,8 @@ static ImBuf *make_sep_waveform_view_from_ibuf_byte(ImBuf *ibuf) { ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); int x, y; - unsigned char *src = (unsigned char *) ibuf->rect; - unsigned char *tgt = (unsigned char *) rval->rect; + const unsigned char *src = (const unsigned char *)ibuf->rect; + unsigned char *tgt = (unsigned char *)rval->rect; int w = ibuf->x + 3; int sw = ibuf->x / 3; int h = 515; @@ -264,7 +264,7 @@ static ImBuf *make_sep_waveform_view_from_ibuf_byte(ImBuf *ibuf) for (x = 0; x < ibuf->x; x++) { int c; - unsigned char *rgb = src + 4 * (ibuf->x * y + x); + const unsigned char *rgb = src + 4 * (ibuf->x * y + x); for (c = 0; c < 3; c++) { unsigned char *p = tgt; p += 4 * (w * ((rgb[c] * (h - 3)) / 255 + 1) + c * sw + x / 3 + 1); @@ -290,8 +290,8 @@ static ImBuf *make_sep_waveform_view_from_ibuf_float(ImBuf *ibuf) { ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); int x, y; - float *src = ibuf->rect_float; - unsigned char *tgt = (unsigned char *) rval->rect; + const float *src = ibuf->rect_float; + unsigned char *tgt = (unsigned char *)rval->rect; int w = ibuf->x + 3; int sw = ibuf->x / 3; int h = 515; @@ -455,7 +455,7 @@ static ImBuf *make_histogram_view_from_ibuf_byte(ImBuf *ibuf) ImBuf *rval = IMB_allocImBuf(515, 128, 32, IB_rect); int x, y; unsigned int nr, ng, nb; - unsigned char *src = (unsigned char *) ibuf->rect; + const unsigned char *src = (unsigned char *)ibuf->rect; unsigned int bins[3][HIS_STEPS]; @@ -468,7 +468,7 @@ static ImBuf *make_histogram_view_from_ibuf_byte(ImBuf *ibuf) memset(cur_bins, 0, sizeof(cur_bins)); for (x = 0; x < ibuf->x; x++) { - unsigned char *pixel = src + (y * ibuf->x + x) * 4; + const unsigned char *pixel = src + (y * ibuf->x + x) * 4; cur_bins[0][pixel[0]]++; cur_bins[1][pixel[1]]++; @@ -532,7 +532,7 @@ static ImBuf *make_histogram_view_from_ibuf_float(ImBuf *ibuf) { ImBuf *rval = IMB_allocImBuf(515, 128, 32, IB_rect); int nr, ng, nb, x, y; - float *src = ibuf->rect_float; + const float *src = ibuf->rect_float; unsigned int bins[3][HIS_STEPS]; @@ -635,7 +635,7 @@ static ImBuf *make_vectorscope_view_from_ibuf_byte(ImBuf *ibuf) { ImBuf *rval = IMB_allocImBuf(515, 515, 32, IB_rect); int x, y; - char *src = (char *) ibuf->rect; + const char *src = (const char *) ibuf->rect; char *tgt = (char *) rval->rect; float rgb[3], yuv[3]; int w = 515; @@ -659,7 +659,7 @@ static ImBuf *make_vectorscope_view_from_ibuf_byte(ImBuf *ibuf) for (y = 0; y < ibuf->y; y++) { for (x = 0; x < ibuf->x; x++) { const char *src1 = src + 4 * (ibuf->x * y + x); - const char *p; + char *p; rgb[0] = (float)src1[0] / 255.0f; rgb[1] = (float)src1[1] / 255.0f; @@ -681,7 +681,7 @@ static ImBuf *make_vectorscope_view_from_ibuf_float(ImBuf *ibuf) { ImBuf *rval = IMB_allocImBuf(515, 515, 32, IB_rect); int x, y; - float *src = ibuf->rect_float; + const float *src = ibuf->rect_float; char *tgt = (char *) rval->rect; float rgb[3], yuv[3]; int w = 515; diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index d054ccc1a85..c51a192b109 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -3402,8 +3402,8 @@ static void p_chart_stretch_minimize(PChart *chart, RNG *rng) static int p_compare_geometric_uv(const void *a, const void *b) { - PVert *v1 = *(PVert **)a; - PVert *v2 = *(PVert **)b; + const PVert *v1 = *(const PVert **)a; + const PVert *v2 = *(const PVert **)b; if (v1->uv[0] < v2->uv[0]) return -1; diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index eab3d5965f6..c5931cf2943 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -1354,16 +1354,15 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final) /* Stitch hash initialization functions */ static unsigned int uv_edge_hash(const void *key) { - UvEdge *edge = (UvEdge *)key; - return - BLI_ghashutil_uinthash(edge->uv2) + - BLI_ghashutil_uinthash(edge->uv1); + const UvEdge *edge = key; + return (BLI_ghashutil_uinthash(edge->uv2) + + BLI_ghashutil_uinthash(edge->uv1)); } static bool uv_edge_compare(const void *a, const void *b) { - UvEdge *edge1 = (UvEdge *)a; - UvEdge *edge2 = (UvEdge *)b; + const UvEdge *edge1 = a; + const UvEdge *edge2 = b; if ((edge1->uv1 == edge2->uv1) && (edge1->uv2 == edge2->uv2)) { return 0; |