From c67bd49e5607cc3db7446d4b12e1346fc9b2c83a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 27 Apr 2014 00:22:49 +1000 Subject: Code cleanup: use 'const' for arrays (editors) --- source/blender/editors/animation/anim_channels_defines.c | 6 +++--- source/blender/editors/animation/keyframes_draw.c | 4 ++-- source/blender/editors/animation/keyframes_edit.c | 2 +- source/blender/editors/animation/keyingsets.c | 2 +- source/blender/editors/armature/pose_slide.c | 2 +- source/blender/editors/curve/editcurve.c | 4 ++-- source/blender/editors/curve/editfont.c | 4 ++-- source/blender/editors/interface/interface.c | 4 ++-- source/blender/editors/interface/interface_handlers.c | 2 +- source/blender/editors/interface/interface_icons.c | 2 +- source/blender/editors/interface/interface_ops.c | 2 +- source/blender/editors/interface/interface_panel.c | 6 +++--- source/blender/editors/interface/interface_regions.c | 6 +++--- source/blender/editors/interface/interface_widgets.c | 12 ++++++------ source/blender/editors/interface/resources.c | 2 +- source/blender/editors/mask/mask_draw.c | 2 +- source/blender/editors/mask/mask_relationships.c | 2 +- source/blender/editors/mesh/editface.c | 4 ++-- source/blender/editors/mesh/editmesh_knife.c | 2 +- source/blender/editors/mesh/editmesh_tools.c | 6 +++--- source/blender/editors/mesh/editmesh_utils.c | 2 +- source/blender/editors/object/object_relations.c | 2 +- source/blender/editors/physics/particle_edit.c | 4 ++-- source/blender/editors/render/render_internal.c | 2 +- source/blender/editors/screen/glutil.c | 8 ++++---- source/blender/editors/screen/screendump.c | 4 ++-- source/blender/editors/sculpt_paint/paint_hide.c | 2 +- source/blender/editors/sculpt_paint/paint_image_2d.c | 10 +++++----- source/blender/editors/sculpt_paint/paint_image_proj.c | 16 ++++++++-------- source/blender/editors/sculpt_paint/paint_utils.c | 2 +- source/blender/editors/sculpt_paint/paint_vertex.c | 2 +- source/blender/editors/sculpt_paint/sculpt.c | 10 +++++----- source/blender/editors/space_clip/clip_editor.c | 2 +- source/blender/editors/space_clip/clip_ops.c | 2 +- source/blender/editors/space_clip/tracking_ops.c | 2 +- source/blender/editors/space_clip/tracking_select.c | 8 ++++---- source/blender/editors/space_file/file_panels.c | 2 +- source/blender/editors/space_file/filelist.c | 6 +++--- source/blender/editors/space_file/filesel.c | 4 ++-- source/blender/editors/space_graph/graph_draw.c | 2 +- source/blender/editors/space_graph/graph_edit.c | 2 +- source/blender/editors/space_image/image_ops.c | 8 ++++---- source/blender/editors/space_info/textview.c | 2 +- source/blender/editors/space_logic/logic_window.c | 2 +- source/blender/editors/space_node/node_edit.c | 2 +- source/blender/editors/space_node/node_view.c | 4 ++-- .../blender/editors/space_sequencer/sequencer_scopes.c | 16 ++++++++-------- .../blender/editors/space_sequencer/sequencer_select.c | 2 +- source/blender/editors/space_sequencer/sequencer_view.c | 4 ++-- source/blender/editors/space_text/text_autocomplete.c | 2 +- source/blender/editors/space_text/text_ops.c | 4 ++-- source/blender/editors/space_view3d/drawarmature.c | 2 +- source/blender/editors/space_view3d/drawobject.c | 16 ++++++++-------- source/blender/editors/space_view3d/view3d_draw.c | 2 +- source/blender/editors/space_view3d/view3d_iterators.c | 2 +- source/blender/editors/space_view3d/view3d_select.c | 2 +- source/blender/editors/transform/transform.c | 8 ++++---- source/blender/editors/transform/transform_conversions.c | 4 ++-- source/blender/editors/transform/transform_generics.c | 2 +- source/blender/editors/transform/transform_input.c | 2 +- source/blender/editors/transform/transform_ops.c | 2 +- source/blender/editors/transform/transform_snap.c | 10 +++++----- source/blender/editors/uvedit/uvedit_ops.c | 6 +++--- source/blender/editors/uvedit/uvedit_smart_stitch.c | 2 +- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 2 +- 65 files changed, 139 insertions(+), 139 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 44ac78ed358..8fb1765668c 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -3043,7 +3043,7 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting switch (ptrsize) { case sizeof(int): /* integer pointer for setting */ { - int *val = (int *)ptr; + const int *val = (int *)ptr; if (negflag) return ((*val) & flag) == 0; @@ -3052,7 +3052,7 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting } case sizeof(short): /* short pointer for setting */ { - short *val = (short *)ptr; + const short *val = (short *)ptr; if (negflag) return ((*val) & flag) == 0; @@ -3061,7 +3061,7 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting } case sizeof(char): /* char pointer for setting */ { - char *val = (char *)ptr; + const char *val = (char *)ptr; if (negflag) return ((*val) & flag) == 0; diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 92ffdfe4947..d4cf98be4fb 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -85,7 +85,7 @@ short compare_ak_cfraPtr(void *node, void *data) { ActKeyColumn *ak = (ActKeyColumn *)node; - float *cframe = data; + const float *cframe = data; float val = *cframe; if (IS_EQT(val, ak->cfra, BEZT_BINARYSEARCH_THRESH)) @@ -270,7 +270,7 @@ static void add_masklay_to_keycolumns_list(DLRBT_Tree *keys, MaskLayerShape *mas short compare_ab_cfraPtr(void *node, void *data) { ActKeyBlock *ab = (ActKeyBlock *)node; - float *cframe = data; + const float *cframe = data; float val = *cframe; if (val < ab->start) diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 4a160353670..808ed758659 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -1292,7 +1292,7 @@ KeyframeEditFunc ANIM_editkeyframes_buildselmap(short mode) /* flush selection map values to the given beztriple */ short bezt_selmap_flush(KeyframeEditData *ked, BezTriple *bezt) { - char *map = ked->data; + const char *map = ked->data; short on = map[ked->curIndex]; /* select or deselect based on whether the map allows it or not */ diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 53ebd658ca2..dd8433f7770 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -916,7 +916,7 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe ReportList *reports = CTX_wm_reports(C); KS_Path *ksp; int kflag = 0, success = 0; - char *groupname = NULL; + const char *groupname = NULL; /* sanity checks */ if (ks == NULL) diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c index 56cc5c5b1ee..375cbb0fe2b 100644 --- a/source/blender/editors/armature/pose_slide.c +++ b/source/blender/editors/armature/pose_slide.c @@ -300,7 +300,7 @@ static void pose_slide_apply_props(tPoseSlideOp *pso, tPChanFCurveLink *pfl) */ for (ld = pfl->fcurves.first; ld; ld = ld->next) { FCurve *fcu = (FCurve *)ld->data; - char *bPtr, *pPtr; + const char *bPtr, *pPtr; if (fcu->rna_path == NULL) continue; diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 50152b02993..61a9a586531 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -897,7 +897,7 @@ static void calc_shapeKeys(Object *obedit) } else { int index; - float *curofp; + const float *curofp; if (oldkey) { if (nu->bezt) { @@ -1111,7 +1111,7 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves) next = fcu->next; if (!strncmp(fcu->rna_path, "splines", 7)) { - char *ch = strchr(fcu->rna_path, '.'); + const char *ch = strchr(fcu->rna_path, '.'); if (ch && (!strncmp(ch, ".bezier_points", 14) || !strncmp(ch, ".points", 7))) fcurve_remove(adt, orig_curves, fcu); diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index de067d68573..1bcdbadde7a 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1790,7 +1790,7 @@ static int font_open_exec(bContext *C, wmOperator *op) static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { VFont *vfont = NULL; - char *path; + const char *path; PointerRNA idptr; PropertyPointerRNA *pprop; @@ -1879,7 +1879,7 @@ static void undoFont_to_editFont(void *strv, void *ecu, void *UNUSED(obdata)) { Curve *cu = (Curve *)ecu; EditFont *ef = cu->editfont; - char *str = strv; + const char *str = strv; ef->pos = *((short *)str); ef->len = *((short *)(str + 2)); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 6e1398549a6..1b9dfd8b1f9 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1534,14 +1534,14 @@ void ui_get_but_vectorf(uiBut *but, float vec[3]) } } else if (but->pointype == UI_BUT_POIN_CHAR) { - char *cp = (char *)but->poin; + const char *cp = (char *)but->poin; vec[0] = ((float)cp[0]) / 255.0f; vec[1] = ((float)cp[1]) / 255.0f; vec[2] = ((float)cp[2]) / 255.0f; } else if (but->pointype == UI_BUT_POIN_FLOAT) { - float *fp = (float *)but->poin; + const float *fp = (float *)but->poin; copy_v3_v3(vec, fp); } else { diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 380f94883be..10951c62a51 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -7293,7 +7293,7 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar) if (dyn_data->items_filter_neworder || dyn_data->items_filter_flags) { /* If we have a display order different from collection order, we have some work! */ int *org_order = MEM_mallocN(dyn_data->items_shown * sizeof(int), __func__); - int *new_order = dyn_data->items_filter_neworder; + const int *new_order = dyn_data->items_filter_neworder; int i, org_idx = -1, len = dyn_data->items_len; int current_idx = -1; int filter_exclude = ui_list->filter_flag & UILST_FLT_EXCLUDE; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 0f988008b2c..f580bd6b5f2 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -719,7 +719,7 @@ static void init_iconfile_list(struct ListBase *list) for (i = 0; i < totfile; i++) { if ((dir[i].type & S_IFREG)) { - char *filename = dir[i].relname; + const char *filename = dir[i].relname; if (BLI_testextensie(filename, ".png")) { /* loading all icons on file start is overkill & slows startup diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index cef7128cd5e..316a4d34881 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -659,7 +659,7 @@ static void edittranslation_find_po_file(const char *root, const char *uilng, ch /* Now try without the second iso code part (_ES in es_ES). */ { - char *tc = NULL; + const char *tc = NULL; size_t szt = 0; tstr[0] = '\0'; diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index e9a4119ac7e..46cf822b08d 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -227,9 +227,9 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, Pan { Panel *patab, *palast, *panext; const char *drawname = CTX_IFACE_(pt->translation_context, pt->label); - char *idname = pt->idname; - char *tabname = pt->idname; - char *hookname = NULL; + const char *idname = pt->idname; + const char *tabname = pt->idname; + const char *hookname = NULL; const bool newpanel = (pa == NULL); int align = panel_aligned(sa, ar); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 3b180078e5f..3299b7b1312 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1643,7 +1643,7 @@ static void ui_warp_pointer(int x, int y) void ui_set_but_hsv(uiBut *but) { float col[3]; - float *hsv = ui_block_hsv_get(but->block); + const float *hsv = ui_block_hsv_get(but->block); ui_color_picker_to_rgb_v(hsv, col); @@ -1755,7 +1755,7 @@ static void do_color_wheel_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(a uiBut *but = (uiBut *)bt1; uiPopupBlockHandle *popup = but->block->handle; float rgb[3]; - float *hsv = ui_block_hsv_get(but->block); + const float *hsv = ui_block_hsv_get(but->block); bool use_display_colorspace = ui_color_picker_use_display_colorspace(but); ui_color_picker_to_rgb_v(hsv, rgb); @@ -2088,7 +2088,7 @@ static unsigned int ui_popup_string_hash(const char *str) { /* sometimes button contains hotkey, sometimes not, strip for proper compare */ int hash; - char *delimit = strchr(str, UI_SEP_CHAR); + const char *delimit = strchr(str, UI_SEP_CHAR); if (delimit) { hash = BLI_ghashutil_strhash_n(str, delimit - str); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 4b18898b17f..4d2bd186f56 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -921,7 +921,7 @@ static void widget_draw_icon(const uiBut *but, BIFIconID icon, float alpha, cons static void ui_text_clip_give_prev_off(uiBut *but) { - char *prev_utf8 = BLI_str_find_prev_char_utf8(but->drawstr, but->drawstr + but->ofs); + const char *prev_utf8 = BLI_str_find_prev_char_utf8(but->drawstr, but->drawstr + but->ofs); int bytes = but->drawstr + but->ofs - prev_utf8; but->ofs -= bytes; @@ -929,7 +929,7 @@ static void ui_text_clip_give_prev_off(uiBut *but) static void ui_text_clip_give_next_off(uiBut *but) { - char *next_utf8 = BLI_str_find_next_char_utf8(but->drawstr + but->ofs, NULL); + const char *next_utf8 = BLI_str_find_next_char_utf8(but->drawstr + but->ofs, NULL); int bytes = next_utf8 - (but->drawstr + but->ofs); but->ofs += bytes; @@ -1138,7 +1138,7 @@ static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti const int okwidth = max_ii(BLI_rcti_size_x(rect) - border, 0); char *cpoin = NULL; int drawstr_len = strlen(but->drawstr); - char *cpend = but->drawstr + drawstr_len; + const char *cpend = but->drawstr + drawstr_len; /* need to set this first */ uiStyleFontSet(fstyle); @@ -1164,7 +1164,7 @@ static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti /* chop off the leading text, starting from the right */ while (but->strwidth > okwidth && cp2 > but->drawstr) { - char *prev_utf8 = BLI_str_find_prev_char_utf8(but->drawstr, cp2); + const char *prev_utf8 = BLI_str_find_prev_char_utf8(but->drawstr, cp2); int bytes = cp2 - prev_utf8; /* shift the text after and including cp2 back by 1 char, +1 to include null terminator */ @@ -1325,7 +1325,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b if (but->menu_key != '\0') { char fixedbuf[128]; - char *str; + const char *str; BLI_strncpy(fixedbuf, drawstr + but->ofs, min_ii(sizeof(fixedbuf), drawstr_left_len)); @@ -2322,7 +2322,7 @@ static void ui_draw_but_HSVCUBE(uiBut *but, const rcti *rect) { float rgb[3]; float x = 0.0f, y = 0.0f; - float *hsv = ui_block_hsv_get(but->block); + const float *hsv = ui_block_hsv_get(but->block); float hsv_n[3]; bool use_display_colorspace = ui_color_picker_use_display_colorspace(but); diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 339dd64875f..16550327a5e 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1735,7 +1735,7 @@ void init_userdef_do_versions(void) /* adjust themes */ for (btheme = U.themes.first; btheme; btheme = btheme->next) { - char *col; + const char *col; /* IPO Editor: Handles/Vertices */ col = btheme->tipo.vertex; diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index eb220551be3..92d55cc1abb 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -531,7 +531,7 @@ static void draw_spline_curve(const bContext *C, MaskLayer *masklay, MaskSpline if (!is_fill) { - float *fp = &diff_points[0][0]; + const float *fp = &diff_points[0][0]; float *fp_feather = &feather_points[0][0]; float tvec[2]; int i; diff --git a/source/blender/editors/mask/mask_relationships.c b/source/blender/editors/mask/mask_relationships.c index ec32190fb95..bebbc00ca1f 100644 --- a/source/blender/editors/mask/mask_relationships.c +++ b/source/blender/editors/mask/mask_relationships.c @@ -112,7 +112,7 @@ static int mask_parent_set_exec(bContext *C, wmOperator *UNUSED(op)) int framenr, parent_type; float parmask_pos[2], orig_corners[4][2]; - char *sub_parent_name; + const char *sub_parent_name; if (ELEM(NULL, sc, clip)) { return OPERATOR_CANCELLED; diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 9e1785e27d1..1c5036ccf80 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -66,7 +66,7 @@ void paintface_flush_flags(Object *ob) DerivedMesh *dm = ob->derivedFinal; MPoly *polys, *mp_orig; MFace *faces; - int *index_array = NULL; + const int *index_array = NULL; int totface, totpoly; int i; @@ -499,7 +499,7 @@ void paintvert_flush_flags(Object *ob) Mesh *me = BKE_mesh_from_object(ob); DerivedMesh *dm = ob->derivedFinal; MVert *dm_mvert, *dm_mv; - int *index_array = NULL; + const int *index_array = NULL; int totvert; int i; diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index d973523437d..cf2528366e6 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -2934,7 +2934,7 @@ static void edvm_mesh_knife_face_point(BMFace *f, float r_cent[3]) unsigned int (*index)[3] = BLI_array_alloca(index, tottri); int j; - float const *best_co[3] = {NULL}; + const float const *best_co[3] = {NULL}; float best_area = -1.0f; bool ok = false; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 90e1c916029..45099166bf4 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2071,7 +2071,7 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op) if (use_add) { /* in add mode, we add relative shape key offset */ if (kb) { - float *rco = CustomData_bmesh_get_n(&em->bm->vdata, eve->head.data, CD_SHAPEKEY, kb->relative); + const float *rco = CustomData_bmesh_get_n(&em->bm->vdata, eve->head.data, CD_SHAPEKEY, kb->relative); sub_v3_v3v3(co, co, rco); } @@ -2652,7 +2652,7 @@ static void mesh_separate_material_assign_mat_nr(Object *ob, const short mat_nr) ID *obdata = ob->data; Material ***matarar; - short *totcolp; + const short *totcolp; totcolp = give_totcolp_id(obdata); matarar = give_matarar_id(obdata); @@ -4263,7 +4263,7 @@ static void sort_bmelem_flag(Scene *scene, Object *ob, pb = pblock[j]; sb = sblock[j]; if (pb && sb && !map[j]) { - char *p_blk; + const char *p_blk; BMElemSort *s_blk; int tot = totelem[j]; int aff = affected[j]; diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index b84a0cc6600..8b72e153852 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -1135,7 +1135,7 @@ void EDBM_verts_mirror_cache_begin(BMEditMesh *em, const int axis, BMVert *EDBM_verts_mirror_get(BMEditMesh *em, BMVert *v) { - int *mirr = CustomData_bmesh_get_layer_n(&em->bm->vdata, v->head.data, em->mirror_cdlayer); + const int *mirr = CustomData_bmesh_get_layer_n(&em->bm->vdata, v->head.data, em->mirror_cdlayer); BLI_assert(em->mirror_cdlayer != -1); /* invalid use */ diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 44d6bc00250..6a54c209218 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -819,7 +819,7 @@ static int parent_set_exec(bContext *C, wmOperator *op) int tree_tot; struct KDTree *tree = NULL; int vert_par[3] = {0, 0, 0}; - int *vert_par_p = is_vert_par ? vert_par : NULL; + const int *vert_par_p = is_vert_par ? vert_par : NULL; if (is_vert_par) { diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index f835d08032b..cadfa296a26 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3356,8 +3356,8 @@ static int brush_add(PEData *data, short number) short size2= size*size; DerivedMesh *dm=0; RNG *rng; - int *index_mf_to_mpoly; - int *index_mp_to_orig; + const int *index_mf_to_mpoly; + const int *index_mp_to_orig; bool release_dm = false; invert_m4_m4(imat, ob->obmat); diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 3078b16ceeb..58498156243 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -124,7 +124,7 @@ typedef struct RenderJob { static void image_buffer_rect_update(RenderJob *rj, RenderResult *rr, ImBuf *ibuf, ImageUser *iuser, volatile rcti *renrect) { Scene *scene = rj->scene; - float *rectf = NULL; + const float *rectf = NULL; int ymin, ymax, xmin, xmax; int rymin, rxmin; int linear_stride, linear_offset_x, linear_offset_y; diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 6b5f5a1a9ae..3feabef2c5f 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -502,7 +502,7 @@ static int get_cached_work_texture(int *r_w, int *r_h) void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float scaleX, float scaleY) { unsigned char *uc_rect = (unsigned char *) rect; - float *f_rect = (float *)rect; + const float *f_rect = (float *)rect; float xzoom = glaGetOneFloat(GL_ZOOM_X), yzoom = glaGetOneFloat(GL_ZOOM_Y); int ltexid = glaGetOneInteger(GL_TEXTURE_2D); int lrowlength = glaGetOneInteger(GL_UNPACK_ROW_LENGTH); @@ -692,17 +692,17 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo glPixelStorei(GL_UNPACK_ROW_LENGTH, row_w); if (format == GL_LUMINANCE || format == GL_RED) { if (type == GL_FLOAT) { - float *f_rect = (float *)rect; + const float *f_rect = (float *)rect; glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y * row_w + off_x)); } else if (type == GL_INT || type == GL_UNSIGNED_INT) { - int *i_rect = (int *)rect; + const int *i_rect = (int *)rect; glDrawPixels(draw_w, draw_h, format, type, i_rect + (off_y * row_w + off_x)); } } else { /* RGBA */ if (type == GL_FLOAT) { - float *f_rect = (float *)rect; + const float *f_rect = (float *)rect; glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y * row_w + off_x) * 4); } else if (type == GL_UNSIGNED_BYTE) { diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index c5ca5ab921f..be5fd48b41a 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -301,8 +301,8 @@ typedef struct ScreenshotJob { wmWindowManager *wm; unsigned int *dumprect; int x, y, dumpsx, dumpsy; - short *stop; - short *do_update; + const short *stop; + const short *do_update; ReportList reports; } ScreenshotJob; diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index fb3fd10a5f1..484bafb4d83 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -98,7 +98,7 @@ static void partialvis_update_mesh(Object *ob, { Mesh *me = ob->data; MVert *mvert; - float *paint_mask; + const float *paint_mask; int *vert_indices; int totvert, i; bool any_changed = false, any_visible = false; diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index cf2655bae7f..7007d9b119c 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -126,8 +126,8 @@ typedef struct ImagePaintState { Image *image; ImBuf *canvas; ImBuf *clonecanvas; - char *warnpackedfile; - char *warnmultifile; + const char *warnpackedfile; + const char *warnmultifile; bool do_masking; @@ -399,7 +399,7 @@ static void brush_painter_imbuf_update(BrushPainter *painter, ImBuf *oldtexibuf, /* read from old texture buffer */ if (use_texture_old) { - float *otf = oldtexibuf->rect_float + ((y - origy + yt) * oldtexibuf->x + (x - origx + xt)) * 4; + const float *otf = oldtexibuf->rect_float + ((y - origy + yt) * oldtexibuf->x + (x - origx + xt)) * 4; copy_v4_v4(rgba, otf); } @@ -671,7 +671,7 @@ static void paint_2d_ibuf_rgb_get(ImBuf *ibuf, int x, int y, const bool is_torus } if (ibuf->rect_float) { - float *rrgbf = ibuf->rect_float + (ibuf->x * y + x) * 4; + const float *rrgbf = ibuf->rect_float + (ibuf->x * y + x) * 4; copy_v4_v4(r_rgb, rrgbf); } else { @@ -867,7 +867,7 @@ static int paint_2d_op(void *state, ImBuf *ibufb, unsigned short *maskb, const f ImagePaintRegion region[4]; short torus = s->brush->flag & BRUSH_TORUS; short blend = s->blend; - float *offset = s->brush->clone.offset; + const float *offset = s->brush->clone.offset; float liftpos[2]; float brush_alpha = BKE_brush_alpha_get(s->scene, s->brush); unsigned short mask_max = (unsigned short)(brush_alpha * 65535.0f); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index af88ff11dac..aa1bcf542ff 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -423,7 +423,7 @@ static int project_paint_PickFace(const ProjPaintState *ps, const float pt[2], f { LinkNode *node; float w_tmp[3]; - float *v1, *v2, *v3, *v4; + const float *v1, *v2, *v3, *v4; int bucket_index; int face_index; int best_side = -1; @@ -560,7 +560,7 @@ static bool project_paint_PickColor(const ProjPaintState *ps, const float pt[2], if (rgba) { if (ibuf->rect_float) { - float *rgba_tmp_fp = ibuf->rect_float + (xi + yi * ibuf->x * 4); + const float *rgba_tmp_fp = ibuf->rect_float + (xi + yi * ibuf->x * 4); premul_float_to_straight_uchar(rgba, rgba_tmp_fp); } else { @@ -1138,7 +1138,7 @@ static void screen_px_from_persp_ortho_weights( static void project_face_pixel(const MTFace *tf_other, ImBuf *ibuf_other, const float w[3], int side, unsigned char rgba_ub[4], float rgba_f[4]) { - float *uvCo1, *uvCo2, *uvCo3; + const float *uvCo1, *uvCo2, *uvCo3; float uv_other[2], x, y; uvCo1 = (float *)tf_other->uv[0]; @@ -1218,7 +1218,7 @@ static float project_paint_uvpixel_mask( MFace *mf = &ps->dm_mface[face_index]; float no[3], angle; if (mf->flag & ME_SMOOTH) { - short *no1, *no2, *no3; + const short *no1, *no2, *no3; no1 = ps->dm_mvert[mf->v1].no; if (side == 1) { no2 = ps->dm_mvert[mf->v3].no; @@ -1262,7 +1262,7 @@ static float project_paint_uvpixel_mask( else { /* Annoying but for the perspective view we need to get the pixels location in 3D space :/ */ float viewDirPersp[3]; - float *co1, *co2, *co3; + const float *co1, *co2, *co3; co1 = ps->dm_mvert[mf->v1].co; if (side == 1) { co2 = ps->dm_mvert[mf->v3].co; @@ -2652,7 +2652,7 @@ static bool project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int buck /* TODO - replace this with a tricker method that uses sideofline for all screenCoords's edges against the closest bucket corner */ rctf bucket_bounds; float p1[2], p2[2], p3[2], p4[2]; - float *v, *v1, *v2, *v3, *v4 = NULL; + const float *v, *v1, *v2, *v3, *v4 = NULL; int fidx; project_bucket_bounds(ps, bucket_x, bucket_y, &bucket_bounds); @@ -2940,7 +2940,7 @@ static void project_paint_begin(ProjPaintState *ps) IDProperty *idgroup = IDP_GetProperties(&ps->reproject_image->id, 0); IDProperty *view_data = IDP_GetPropertyFromGroup(idgroup, PROJ_VIEW_DATA_ID); - float *array = (float *)IDP_Array(view_data); + const float *array = (float *)IDP_Array(view_data); /* use image array, written when creating image */ memcpy(winmat, array, sizeof(winmat)); array += sizeof(winmat) / sizeof(float); @@ -3166,7 +3166,7 @@ static void project_paint_begin(ProjPaintState *ps) } if (is_face_sel && (tpage = project_paint_face_image(ps, ps->dm_mtface, face_index))) { - float *v1coSS, *v2coSS, *v3coSS, *v4coSS = NULL; + const float *v1coSS, *v2coSS, *v3coSS, *v4coSS = NULL; v1coSS = ps->screenCoords[mf->v1]; v2coSS = ps->screenCoords[mf->v2]; diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 7316c58755c..642c1dd9529 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -227,7 +227,7 @@ void paint_sample_color(const bContext *C, ARegion *ar, int x, int y) /* fron { Brush *br = BKE_paint_brush(BKE_paint_get_active_from_context(C)); unsigned int col; - char *cp; + const char *cp; CLAMP(x, 0, ar->winx); CLAMP(y, 0, ar->winy); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 1d127cd5f4e..108f5a7ee37 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -217,7 +217,7 @@ static void do_shared_vertex_tesscol(Mesh *me, bool *mfacetag) int a; short *scolmain, *scol; char *mcol; - bool *mftag; + const bool *mftag; if (me->mcol == NULL || me->totvert == 0 || me->totface == 0) return; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index fcb2e6ad588..c8c644a546a 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -317,7 +317,7 @@ typedef struct { SculptUndoNode *unode; float (*coords)[3]; short (*normals)[3]; - float *vmasks; + const float *vmasks; /* Original coordinate, normal, and mask */ const float *co; @@ -1613,7 +1613,7 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no for (y = 0; y < gridsize; ++y) { for (x = 0; x < gridsize; ++x) { float *co; - float *fno; + const float *fno; float *mask; int index; @@ -4247,14 +4247,14 @@ static void sculpt_stroke_modifiers_check(const bContext *C, Object *ob) typedef struct { SculptSession *ss; - float *ray_start, *ray_normal; + const float *ray_start, *ray_normal; int hit; float dist; int original; } SculptRaycastData; typedef struct { - float *ray_start, *ray_normal; + const float *ray_start, *ray_normal; int hit; float dist; float detail; @@ -5083,7 +5083,7 @@ static void sculpt_init_session(Scene *scene, Object *ob) int ED_sculpt_mask_layers_ensure(Object *ob, MultiresModifierData *mmd) { - float *paint_mask; + const float *paint_mask; Mesh *me = ob->data; int ret = 0; diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index c67e84671fb..ae75b9e3088 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -281,7 +281,7 @@ bool ED_space_clip_color_sample(Scene *scene, SpaceClip *sc, ARegion *ar, int mv fy = co[1]; if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) { - float *fp; + const float *fp; unsigned char *cp; int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y); diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index b8fe9fe4a17..6ef4b12eadf 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -1056,7 +1056,7 @@ typedef struct ProxyQueue { int efra; SpinLock spin; - short *stop; + const short *stop; short *do_update; float *progress; } ProxyQueue; diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 43251ac930f..09ad8e7793b 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -4060,7 +4060,7 @@ static int slide_plane_marker_modal(bContext *C, wmOperator *op, const wmEvent * SlidePlaneMarkerData *data = (SlidePlaneMarkerData *) op->customdata; float dx, dy, mdelta[2]; int next_corner_index, prev_corner_index, diag_corner_index; - float *next_corner, *prev_corner, *diag_corner; + const float *next_corner, *prev_corner, *diag_corner; float next_edge[2], prev_edge[2], next_diag_edge[2], prev_diag_edge[2]; switch (event->type) { diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c index ec3b10a008c..9909268bb53 100644 --- a/source/blender/editors/space_clip/tracking_select.c +++ b/source/blender/editors/space_clip/tracking_select.c @@ -174,8 +174,8 @@ static float dist_to_crns(float co[2], float pos[2], float crns[4][2]) { float d1, d2, d3, d4; float p[2] = {co[0] - pos[0], co[1] - pos[1]}; - float *v1 = crns[0], *v2 = crns[1]; - float *v3 = crns[2], *v4 = crns[3]; + const float *v1 = crns[0], *v2 = crns[1]; + const float *v3 = crns[2], *v4 = crns[3]; d1 = dist_squared_to_line_segment_v2(p, v1, v2); d2 = dist_squared_to_line_segment_v2(p, v2, v3); @@ -189,8 +189,8 @@ static float dist_to_crns(float co[2], float pos[2], float crns[4][2]) static float dist_to_crns_abs(float co[2], float corners[4][2]) { float d1, d2, d3, d4; - float *v1 = corners[0], *v2 = corners[1]; - float *v3 = corners[2], *v4 = corners[3]; + const float *v1 = corners[0], *v2 = corners[1]; + const float *v3 = corners[2], *v4 = corners[3]; d1 = dist_squared_to_line_segment_v2(co, v1, v2); d2 = dist_squared_to_line_segment_v2(co, v2, v3); diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index cb07db75a91..69789569912 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -58,7 +58,7 @@ static void file_panel_cb(bContext *C, void *arg_entry, void *UNUSED(arg_v)) { PointerRNA ptr; - char *entry = (char *)arg_entry; + const char *entry = (char *)arg_entry; WM_operator_properties_create(&ptr, "FILE_OT_select_bookmark"); RNA_string_set(&ptr, "dir", entry); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 15d177011c4..8ef9308e2fd 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -94,8 +94,8 @@ typedef struct FileImage { typedef struct ThumbnailJob { ListBase loadimages; - short *stop; - short *do_update; + const short *stop; + const short *do_update; struct FileList *filelist; ReportList reports; } ThumbnailJob; @@ -1097,7 +1097,7 @@ void filelist_from_library(struct FileList *filelist) filelist->filelist[0].type |= S_IFDIR; for (i = 0, l = names; i < nnames; i++, l = l->next) { - char *blockname = l->link; + const char *blockname = l->link; filelist->filelist[i + 1].relname = BLI_strdup(blockname); if (idcode) { diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 19947a9ffc9..69888105713 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -396,7 +396,7 @@ float file_shorten_string(char *string, float w, int front) sw = file_string_width(string); if (front == 1) { - char *s = string; + const char *s = string; BLI_strncpy(temp, "...", 4); pad = file_string_width(temp); while ((*s) && (sw + pad > w)) { @@ -412,7 +412,7 @@ float file_shorten_string(char *string, float w, int front) } } else { - char *s = string; + const char *s = string; while (sw > w) { int slen = strlen(string); string[slen - 1] = '\0'; diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 6d55430944d..cb8aa6689c3 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -345,7 +345,7 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu) for (sel = 0; sel < 2; sel++) { BezTriple *bezt = fcu->bezt, *prevbezt = NULL; int basecol = (sel) ? TH_HANDLE_SEL_FREE : TH_HANDLE_FREE; - float *fp; + const float *fp; unsigned char col[4]; for (b = 0; b < fcu->totvert; b++, prevbezt = bezt, bezt++) { diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 14148802aae..c6743e74777 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1661,7 +1661,7 @@ typedef struct tEulerFilter { ID *id; /* ID-block which owns the channels */ FCurve *(fcurves[3]); /* 3 Pointers to F-Curves */ - char *rna_path; /* Pointer to one of the RNA Path's used by one of the F-Curves */ + const char *rna_path; /* Pointer to one of the RNA Path's used by one of the F-Curves */ } tEulerFilter; static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 74ccf2885a7..0fd15237966 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1125,7 +1125,7 @@ static int image_open_exec(bContext *C, wmOperator *op) static int image_open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { SpaceImage *sima = CTX_wm_space_image(C); /* XXX other space types can call */ - char *path = U.textudir; + const char *path = U.textudir; Image *ima = NULL; if (sima) { @@ -2300,7 +2300,7 @@ typedef struct ImageSampleInfo { float zf; unsigned char *colp; - float *colfp; + const float *colfp; int *zp; float *zfp; @@ -2338,7 +2338,7 @@ bool ED_space_image_color_sample(Scene *scene, SpaceImage *sima, ARegion *ar, in UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &fx, &fy); if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) { - float *fp; + const float *fp; unsigned char *cp; int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y); @@ -2386,7 +2386,7 @@ static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fx, &fy); if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) { - float *fp; + const float *fp; unsigned char *cp; int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y); Image *image = ED_space_image(sima); diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index 879c99c35d5..3c2024b026b 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -64,7 +64,7 @@ typedef struct ConsoleDrawContext { int *xy; // [2] int *sel; // [2] int *pos_pick; // bottom of view == 0, top of file == combine chars, end of line is lower then start. - int *mval; // [2] + const int *mval; // [2] int draw; } ConsoleDrawContext; diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 70837002979..77aff78baa4 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -121,7 +121,7 @@ void make_unique_prop_names(bContext *C, char *str) bActuator *act; ID **idar; short a, obcount, propcount=0, nr; - char **names; + const char **names; /* this function is called by a Button, and gives the current * stringpointer as an argument, this is the one that can change diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 9e89a192543..677b5c24023 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -99,7 +99,7 @@ typedef struct CompoJob { Scene *scene; bNodeTree *ntree; bNodeTree *localtree; - short *stop; + const short *stop; short *do_update; float *progress; short need_sync; diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c index 59b942e5eb4..3491ecc86af 100644 --- a/source/blender/editors/space_node/node_view.c +++ b/source/blender/editors/space_node/node_view.c @@ -450,7 +450,7 @@ bool ED_space_node_color_sample(Scene *scene, SpaceNode *snode, ARegion *ar, int fy = (bufy > 0.0f ? ((float)mval[1] - 0.5f * ar->winy - snode->yof) / bufy + 0.5f : 0.0f); if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) { - float *fp; + const float *fp; unsigned char *cp; int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y); @@ -508,7 +508,7 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event) fy = (bufy > 0.0f ? ((float)event->mval[1] - 0.5f * ar->winy - snode->yof) / bufy + 0.5f : 0.0f); if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) { - float *fp; + const float *fp; unsigned char *cp; int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y); diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c index 9199c6de343..9b3b9f23036 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.c +++ b/source/blender/editors/space_sequencer/sequencer_scopes.c @@ -206,7 +206,7 @@ static ImBuf *make_waveform_view_from_ibuf_float(ImBuf *ibuf) unsigned char *last_p = NULL; for (x = 0; x < ibuf->x; x++) { - float *rgb = src + 4 * (ibuf->x * y + x); + const float *rgb = src + 4 * (ibuf->x * y + x); float v = rgb_to_luma(rgb); unsigned char *p = tgt; @@ -309,7 +309,7 @@ static ImBuf *make_sep_waveform_view_from_ibuf_float(ImBuf *ibuf) for (x = 0; x < ibuf->x; x++) { int c; - float *rgb = src + 4 * (ibuf->x * y + x); + const float *rgb = src + 4 * (ibuf->x * y + x); for (c = 0; c < 3; c++) { unsigned char *p = tgt; float v = rgb[c]; @@ -379,7 +379,7 @@ static void draw_zebra_byte(ImBuf *src, ImBuf *ibuf, float perc) static void draw_zebra_float(ImBuf *src, ImBuf *ibuf, float perc) { float limit = perc / 100.0f; - float *p = src->rect_float; + const float *p = src->rect_float; unsigned char *o = (unsigned char *) ibuf->rect; int x; int y; @@ -545,7 +545,7 @@ static ImBuf *make_histogram_view_from_ibuf_float(ImBuf *ibuf) memset(cur_bins, 0, sizeof(cur_bins)); for (x = 0; x < ibuf->x; x++) { - float *pixel = src + (y * ibuf->x + x) * 4; + const float *pixel = src + (y * ibuf->x + x) * 4; cur_bins[0][get_bin_float(pixel[0])]++; cur_bins[1][get_bin_float(pixel[1])]++; @@ -658,8 +658,8 @@ static ImBuf *make_vectorscope_view_from_ibuf_byte(ImBuf *ibuf) for (y = 0; y < ibuf->y; y++) { for (x = 0; x < ibuf->x; x++) { - char *src1 = src + 4 * (ibuf->x * y + x); - char *p; + const char *src1 = src + 4 * (ibuf->x * y + x); + const char *p; rgb[0] = (float)src1[0] / 255.0f; rgb[1] = (float)src1[1] / 255.0f; @@ -704,8 +704,8 @@ static ImBuf *make_vectorscope_view_from_ibuf_float(ImBuf *ibuf) for (y = 0; y < ibuf->y; y++) { for (x = 0; x < ibuf->x; x++) { - float *src1 = src + 4 * (ibuf->x * y + x); - char *p; + const float *src1 = src + 4 * (ibuf->x * y + x); + const char *p; memcpy(rgb, src1, 3 * sizeof(float)); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index cfae0056a35..a5d7944ac3a 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -980,7 +980,7 @@ static bool select_grouped_data(Editing *ed, Sequence *actseq) { Sequence *seq; bool changed = false; - char *dir = actseq->strip ? actseq->strip->dir : NULL; + const char *dir = actseq->strip ? actseq->strip->dir : NULL; if (!SEQ_USE_DATA(actseq)) return changed; diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c index cad25663609..7fdbc9cc7de 100644 --- a/source/blender/editors/space_sequencer/sequencer_view.c +++ b/source/blender/editors/space_sequencer/sequencer_view.c @@ -70,7 +70,7 @@ typedef struct ImageSampleInfo { float linearcol[4]; unsigned char *colp; - float *colfp; + const float *colfp; int draw; int color_manage; @@ -110,7 +110,7 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event) fy += (float) ibuf->y / 2.0f; if (fx >= 0.0f && fy >= 0.0f && fx < ibuf->x && fy < ibuf->y) { - float *fp; + const float *fp; unsigned char *cp; int x = (int) fx, y = (int) fy; diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c index d3b494631bb..e2948fc239a 100644 --- a/source/blender/editors/space_text/text_autocomplete.c +++ b/source/blender/editors/space_text/text_autocomplete.c @@ -232,7 +232,7 @@ static GHash *text_autocomplete_build(Text *text) static void get_suggest_prefix(Text *text, int offset) { int i, len; - char *line; + const char *line; if (!text) return; if (!texttool_text_is_active(text)) return; diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 4d2eea87904..4835ef711e9 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -272,7 +272,7 @@ static int text_open_exec(bContext *C, wmOperator *op) static int text_open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { Text *text = CTX_data_edit_text(C); - char *path = (text && text->name) ? text->name : G.main->name; + const char *path = (text && text->name) ? text->name : G.main->name; if (RNA_struct_property_is_set(op->ptr, "filepath")) return text_open_exec(C, op); @@ -545,7 +545,7 @@ static int text_save_as_exec(bContext *C, wmOperator *op) static int text_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { Text *text = CTX_data_edit_text(C); - char *str; + const char *str; if (RNA_struct_property_is_set(op->ptr, "filepath")) return text_save_as_exec(C, op); diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 5863416f451..6c0bdc37797 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -271,7 +271,7 @@ static bool set_pchan_glColor(short colCode, int boneflag, short constflag) } else { if (bcolor) { - char *cp = bcolor->solid; + const char *cp = bcolor->solid; glColor4ub(cp[0], cp[1], cp[2], 204); } else diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 5acccb68bfb..6e8e1ffe114 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -157,8 +157,8 @@ typedef struct drawDMFacesSel_userData { BMesh *bm; BMFace *efa_act; - int *orig_index_mf_to_mpoly; - int *orig_index_mp_to_orig; + const int *orig_index_mf_to_mpoly; + const int *orig_index_mp_to_orig; } drawDMFacesSel_userData; typedef struct drawDMNormal_userData { @@ -1883,7 +1883,7 @@ static void drawspeaker(Scene *UNUSED(scene), View3D *UNUSED(v3d), RegionView3D static void lattice_draw_verts(Lattice *lt, DispList *dl, BPoint *actbp, short sel) { BPoint *bp = lt->def; - float *co = dl ? dl->verts : NULL; + const float *co = dl ? dl->verts : NULL; int u, v, w; const int color = sel ? TH_VERTEX_SELECT : TH_VERTEX; @@ -3863,7 +3863,7 @@ static bool drawDispListwire(ListBase *dlbase) { DispList *dl; int parts, nr; - float *data; + const float *data; if (dlbase == NULL) return 1; @@ -3957,8 +3957,8 @@ static void drawDispListsolid(ListBase *lb, Object *ob, const short dflag, { DispList *dl; GPUVertexAttribs gattribs; - float *data; - float *ndata; + const float *data; + const float *ndata; if (lb == NULL) return; @@ -5428,7 +5428,7 @@ static void ob_draw_RE_motion(float com[3], float rotscale[3][3], float itw, flo static void drawhandlesN(Nurb *nu, const char sel, const bool hide_handles) { BezTriple *bezt; - float *fp; + const float *fp; int a; if (nu->hide || hide_handles) return; @@ -5488,7 +5488,7 @@ static void drawhandlesN(Nurb *nu, const char sel, const bool hide_handles) static void drawhandlesN_active(Nurb *nu) { BezTriple *bezt; - float *fp; + const float *fp; int a; if (nu->hide) return; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 1a010bf77ff..429d9cc0a14 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -836,7 +836,7 @@ static void draw_selected_name(Scene *scene, Object *ob, rcti *rect) const char *msg_sep = " : "; char info[300]; - char *markern; + const char *markern; char *s = info; short offset = 1.5f * UI_UNIT_X + rect->xmin; diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c index 4df8010be9d..98d61c108a7 100644 --- a/source/blender/editors/space_view3d/view3d_iterators.c +++ b/source/blender/editors/space_view3d/view3d_iterators.c @@ -370,7 +370,7 @@ void lattice_foreachScreenVert( Lattice *lt = obedit->data; BPoint *bp = lt->editlatt->latt->def; DispList *dl = obedit->curve_cache ? BKE_displist_find(&obedit->curve_cache->disp, DL_VERTS) : NULL; - float *co = dl ? dl->verts : NULL; + const float *co = dl ? dl->verts : NULL; int i, N = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw; ED_view3d_check_mats_rv3d(vc->rv3d); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 90a88567996..46a3a17747f 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1141,7 +1141,7 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int for (node = linklist, i = 0; node; node = node->next, i++) { Base *base = node->link; Object *ob = base->object; - char *name = ob->id.name + 2; + const char *name = ob->id.name + 2; BLI_strncpy(object_mouse_select_menu_data[i].idname, name, MAX_ID_NAME - 2); object_mouse_select_menu_data[i].icon = uiIconFromID(&ob->id); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 1f5286fc577..b52fba36cac 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1884,7 +1884,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) } if ((prop = RNA_struct_find_property(op->ptr, "value"))) { - float *values = (t->flag & T_AUTOVALUES) ? t->auto_values : t->values; + const float *values = (t->flag & T_AUTOVALUES) ? t->auto_values : t->values; if (RNA_property_array_check(prop)) { RNA_property_float_set_array(op->ptr, prop, values); } @@ -4202,7 +4202,7 @@ static void applyTranslationValue(TransInfo *t, float vec[3]) /* handle snapping rotation before doing the translation */ if (usingSnappingNormal(t)) { if (validSnappingNormal(t)) { - float *original_normal; + const float *original_normal; float axis[3]; float quat[4]; float mat[3][3]; @@ -6249,8 +6249,8 @@ static void calcVertSlideCustomPoints(struct TransInfo *t) { VertSlideData *sld = t->customData; TransDataVertSlideVert *sv = &sld->sv[sld->curr_sv_index]; - float *co_orig = sv->co_orig_2d; - float *co_curr = sv->co_link_orig_2d[sv->co_link_curr]; + const float *co_orig = sv->co_orig_2d; + const float *co_curr = sv->co_link_orig_2d[sv->co_link_curr]; const int mval_start[2] = {co_orig[0], co_orig[1]}; const int mval_end[2] = {co_curr[0], co_curr[1]}; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 0ad77504c64..aef0434fd4c 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -3577,7 +3577,7 @@ static void bezt_to_transdata(TransData *td, TransData2D *td2d, AnimData *adt, B float mtx[3][3], float smtx[3][3]) { float *loc = bezt->vec[bi]; - float *cent = bezt->vec[1]; + const float *cent = bezt->vec[1]; /* New location from td gets dumped onto the old-location of td2d, which then * gets copied to the actual data at td2d->loc2d (bezt->vec[n]) @@ -6057,7 +6057,7 @@ typedef struct TransDataTracking { /* tracks transformation from main window */ int area; - float *relative, *loc; + const float *relative, *loc; float soffset[2], srelative[2]; float offset[2]; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index ee8a8518135..4bd767c240b 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1545,7 +1545,7 @@ void calculateCenterCursor(TransInfo *t) void calculateCenterCursor2D(TransInfo *t) { float aspx = 1.0, aspy = 1.0; - float *cursor = NULL; + const float *cursor = NULL; if (t->spacetype == SPACE_IMAGE) { SpaceImage *sima = (SpaceImage *)t->sa->spacedata.first; diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index 225f3218ccb..70b565859f3 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -183,7 +183,7 @@ static void InputCustomRatioFlip(TransInfo *UNUSED(t), MouseInput *mi, const int double length; double distance; double dx, dy; - int *data = mi->data; + const int *data = mi->data; if (data) { dx = data[2] - data[0]; diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index d8c5339c14f..4823f44914d 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -55,7 +55,7 @@ #include "transform.h" typedef struct TransformModeItem { - char *idname; + const char *idname; int mode; void (*opfunc)(wmOperatorType *); } TransformModeItem; diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index a14f0c22b37..0ede3e668dd 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -904,7 +904,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) if (t->tsnap.mode == SCE_SNAP_MODE_VOLUME) { ListBase depth_peels; DepthPeel *p1, *p2; - float *last_p = NULL; + const float *last_p = NULL; float max_dist = FLT_MAX; float p[3] = {0.0f, 0.0f, 0.0f}; @@ -1411,8 +1411,8 @@ static bool snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *ar bone = pchan->bone; /* skip hidden bones */ if (bone && !(bone->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG))) { - float *head_vec = pchan->pose_head; - float *tail_vec = pchan->pose_tail; + const float *head_vec = pchan->pose_head; + const float *tail_vec = pchan->pose_tail; switch (snap_mode) { case SCE_SNAP_MODE_VERTEX: @@ -1596,7 +1596,7 @@ static bool snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMes case SCE_SNAP_MODE_VERTEX: { MVert *verts = dm->getVertArray(dm); - int *index_array = NULL; + const int *index_array = NULL; int index = 0; int i; @@ -1645,7 +1645,7 @@ static bool snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMes MVert *verts = dm->getVertArray(dm); MEdge *edges = dm->getEdgeArray(dm); int totedge = dm->getNumEdges(dm); - int *index_array = NULL; + const int *index_array = NULL; int index = 0; int i; diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 557b01557d0..82537dca973 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -1582,8 +1582,8 @@ static void uv_weld_align(bContext *C, int tool) if (BLI_array_count(eve_line) > 2) { /* we know the returns from these must be valid */ - float *uv_start = uv_sel_co_from_eve(scene, ima, em, eve_line[0]); - float *uv_end = uv_sel_co_from_eve(scene, ima, em, eve_line[BLI_array_count(eve_line) - 1]); + const float *uv_start = uv_sel_co_from_eve(scene, ima, em, eve_line[0]); + const float *uv_end = uv_sel_co_from_eve(scene, ima, em, eve_line[BLI_array_count(eve_line) - 1]); /* For t & u modes */ float a = 0.0f; @@ -1695,7 +1695,7 @@ static int uv_remove_doubles_exec(bContext *C, wmOperator *op) int uv_a_index; int uv_b_index; float *uv_a; - float *uv_b; + const float *uv_b; BMIter iter, liter; BMFace *efa; diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 86aece5d882..1a96ff242f8 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -634,7 +634,7 @@ static void state_delete(StitchState *state) static void stitch_uv_edge_generate_linked_edges(GHash *edge_hash, StitchState *state) { UvEdge *edges = state->edges; - int *map = state->map; + const int *map = state->map; UvElementMap *element_map = state->element_map; UvElement *first_element = element_map->buf; int i; diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 7f43ca01f4a..662e0276eb9 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -361,7 +361,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, B /* Used to hold subsurfed Mesh */ DerivedMesh *derivedMesh, *initialDerived; /* holds original indices for subsurfed mesh */ - int *origVertIndices, *origEdgeIndices, *origFaceIndices, *origPolyIndices; + const int *origVertIndices, *origEdgeIndices, *origFaceIndices, *origPolyIndices; /* Holds vertices of subsurfed mesh */ MVert *subsurfedVerts; MEdge *subsurfedEdges; -- cgit v1.2.3