Code cleanup: const args and arrays
authorCampbell Barton <ideasman42@gmail.com>
Sat, 26 Apr 2014 21:50:08 +0000 (07:50 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 26 Apr 2014 22:56:54 +0000 (08:56 +1000)
30 files changed:
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/implicit.c
source/blender/blenkernel/intern/tracking_solver.c
source/blender/blenlib/intern/math_geom.c
source/blender/bmesh/intern/bmesh_interp.c
source/blender/bmesh/intern/bmesh_walkers_impl.c
source/blender/editors/armature/armature_skinning.c
source/blender/editors/gpencil/drawgpencil.c
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_eyedropper.c
source/blender/editors/interface/view2d_ops.c
source/blender/editors/mesh/editmesh_loopcut.c
source/blender/editors/mesh/editmesh_utils.c
source/blender/editors/sculpt_paint/paint_image_proj.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_clip/clip_draw.c
source/blender/editors/space_clip/clip_graph_draw.c
source/blender/editors/space_clip/tracking_ops.c
source/blender/editors/space_node/node_draw.c
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_ruler.c
source/blender/editors/transform/transform_manipulator.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/gpu/intern/gpu_buffers.c
source/blender/imbuf/intern/scaling.c
source/blender/modifiers/intern/MOD_skin.c
source/blender/windowmanager/intern/wm_cursors.c

index e14282b9eacb2a0b9cada5fbdf9bfd0d51cf5864..682a429ca995db10b16b406c4c640b6a50462f21 100644 (file)
@@ -2235,11 +2235,13 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
 int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface)
 {
        /* Antialias jitter point relative coords       */
-       float jitter5sample[10] =  {0.0f, 0.0f,
-                                       -0.2f, -0.4f,
-                                       0.2f, 0.4f,
-                                       0.4f, -0.2f,
-                                       -0.4f, 0.3f};
+       const float jitter5sample[10] =  {
+                   0.0f, 0.0f,
+                   -0.2f, -0.4f,
+                   0.2f, 0.4f,
+                   0.4f, -0.2f,
+                   -0.4f, 0.3f,
+       };
        int ty;
        int w, h;
        int numOfFaces;
index cceb792519494e660d11f7c45fcd722f382667f7..bf70e0d6aa550e167fef09b4a670cda4df0d5b5d 100644 (file)
@@ -1400,7 +1400,7 @@ static void CalcFloat4( float *v1, float *v2, float *v3, float *v4, float *n)
        n[2] = n1[0]*n2[1]-n1[1]*n2[0];
 }
 
-static float calculateVertexWindForce(float wind[3], float vertexnormal[3])  
+static float calculateVertexWindForce(const float wind[3], const float vertexnormal[3])
 {
        return dot_v3v3(wind, vertexnormal);
 }
index 9ab1643aab1ac23204b1ae46c51a9d9786833a3f..056220e27d84ce093ba51ee48fb52ade117afd74 100644 (file)
@@ -535,7 +535,7 @@ bool BKE_tracking_reconstruction_finish(MovieReconstructContext *context, MovieT
 }
 
 static void tracking_scale_reconstruction(ListBase *tracksbase, MovieTrackingReconstruction *reconstruction,
-                                          float scale[3])
+                                          const float scale[3])
 {
        MovieTrackingTrack *track;
        int i;
index 5638d8e0360926c51107a87a3b0c68abc4892d2b..36b26f9166614f3366a96a99e6bc9370c3abd430 100644 (file)
@@ -2357,7 +2357,7 @@ void barycentric_weights_v2_quad(const float v1[2], const float v2[2], const flo
 #endif
 
                /* inline mean_value_half_tan four times here */
-               float t[4] = {
+               const float t[4] = {
                        MEAN_VALUE_HALF_TAN_V2(area, 0, 1),
                        MEAN_VALUE_HALF_TAN_V2(area, 1, 2),
                        MEAN_VALUE_HALF_TAN_V2(area, 2, 3),
index 1a1b3991aac5cf90705ed0db14c39bd5658e06f8..a4e9106d6fa144085a2ed9fce532e2c6bc02f793 100644 (file)
@@ -295,8 +295,9 @@ static float quad_coord(const float aa[3], const float bb[3], const float cc[3],
        return f1;
 }
 
-static int quad_co(float *x, float *y, float v1[3], float v2[3], float v3[3], float v4[3],
-                   float p[3], float n[3])
+static int quad_co(float *x, float *y,
+                   const float v1[3], const float v2[3], const float v3[3], const float v4[3],
+                   const float p[3], const float n[3])
 {
        float projverts[5][3], n2[3];
        float dprojverts[4][3], origin[3] = {0.0f, 0.0f, 0.0f};
@@ -384,8 +385,8 @@ static bool mdisp_in_mdispquad(BMLoop *l, BMLoop *tl, float p[3], float *x, floa
        return 1;
 }
 
-static float bm_loop_flip_equotion(float mat[2][2], float b[2], float target_axis_x[3], float target_axis_y[3],
-                                   float coord[3], int i, int j)
+static float bm_loop_flip_equotion(float mat[2][2], float b[2], const float target_axis_x[3], const float target_axis_y[3],
+                                   const float coord[3], int i, int j)
 {
        mat[0][0] = target_axis_x[i];
        mat[0][1] = target_axis_y[i];
index d530980f020e24f0e36a1d751a263e7ddf697626..70b90238f9611f86995aa3a99830ec118c66e196 100644 (file)
@@ -471,8 +471,10 @@ static void bmw_LoopWalker_begin(BMWalker *walker, void *data)
        BMwLoopWalker *lwalk = NULL, owalk, *owalk_pt;
        BMEdge *e = data;
        BMVert *v;
-       int vert_edge_count[2] = {BM_vert_edge_count_nonwire(e->v1),
-                                 BM_vert_edge_count_nonwire(e->v2)};
+       const int vert_edge_count[2] = {
+           BM_vert_edge_count_nonwire(e->v1),
+           BM_vert_edge_count_nonwire(e->v2),
+       };
 
        v = e->v1;
 
index 560af2dbd0b28af3d20a7316933c53bb056b52ae..e898e600e9b6ba7eefa335b909ddb4bbbd4e3205 100644 (file)
@@ -191,7 +191,7 @@ static void add_vgroups__mapFunc(void *userData, int index, const float co[3],
 
 static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], int numbones, Bone **bonelist,
                                     bDeformGroup **dgrouplist, bDeformGroup **dgroupflip,
-                                    float (*root)[3], float (*tip)[3], int *selected, float scale)
+                                    float (*root)[3], float (*tip)[3], const int *selected, float scale)
 {
        /* Create vertex group weights from envelopes */
 
index a4597b6bf6cfb8741cfbce82353599127eb76d5a..6e65cbb760c2965c43bcc9122484a6dc62856e71 100644 (file)
@@ -475,7 +475,7 @@ static void gp_draw_stroke(bGPDspoint *points, int totpoints, short thickness_s,
 
 /* draw a set of strokes */
 static void gp_draw_strokes(bGPDframe *gpf, int offsx, int offsy, int winx, int winy, int dflag,
-                            short debug, short lthick, float color[4])
+                            short debug, short lthick, const float color[4])
 {
        bGPDstroke *gps;
        
index 57e0892e8f50bf48d17ad636ec480af6a4104807..6f9189cef47a80a7b21ddd66cb6ea6838be7f2cf 100644 (file)
@@ -456,7 +456,7 @@ static void draw_scope_end(const rctf *rect, GLint *scissor)
 }
 
 static void histogram_draw_one(float r, float g, float b, float alpha,
-                               float x, float y, float w, float h, float *data, int res, const bool is_line)
+                               float x, float y, float w, float h, const float *data, int res, const bool is_line)
 {
        int i;
        
@@ -1612,14 +1612,14 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
        static const float size = 5.0f;
        
        /* 16 values of sin function */
-       static float si[16] = {
+       const float si[16] = {
            0.00000000f, 0.39435585f, 0.72479278f, 0.93775213f,
            0.99871650f, 0.89780453f, 0.65137248f, 0.29936312f,
            -0.10116832f, -0.48530196f, -0.79077573f, -0.96807711f,
            -0.98846832f, -0.84864425f, -0.57126821f, -0.20129852f
        };
        /* 16 values of cos function */
-       static float co[16] = {
+       const float co[16] = {
            1.00000000f, 0.91895781f, 0.68896691f, 0.34730525f,
            -0.05064916f, -0.44039415f, -0.75875812f, -0.95413925f,
            -0.99486932f, -0.87434661f, -0.61210598f, -0.25065253f,
index 0af902b74b780636e034be2c4ed255bc43c27913..5b7915e20c5fe5d5eda8e0bfa0d8d689b7dfcd60 100644 (file)
@@ -476,8 +476,9 @@ static void datadropper_id_sample_pt(bContext *C, DataDropper *ddr, int mx, int
                        if (sa->spacetype == SPACE_VIEW3D) {
                                ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
                                if (ar && BLI_rcti_isect_pt(&ar->winrct, mx, my)) {
-                                       int mval[2] = {mx - ar->winrct.xmin,
-                                                      my - ar->winrct.ymin};
+                                       const int mval[2] = {
+                                           mx - ar->winrct.xmin,
+                                           my - ar->winrct.ymin};
                                        Base *base;
 
                                        CTX_wm_area_set(C, sa);
index fe3190aa76e1d309c2de5eb50d9c88725bd8c667..af43a10a593091427a80e3a08ea9c2ab0492a4a9 100644 (file)
@@ -1348,14 +1348,14 @@ struct SmoothView2DStore {
  */
 static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b)
 {
-       float size_a[2] = {BLI_rctf_size_x(rect_a),
-                          BLI_rctf_size_y(rect_a)};
-       float size_b[2] = {BLI_rctf_size_x(rect_b),
-                          BLI_rctf_size_y(rect_b)};
-       float cent_a[2] = {BLI_rctf_cent_x(rect_a),
-                          BLI_rctf_cent_y(rect_a)};
-       float cent_b[2] = {BLI_rctf_cent_x(rect_b),
-                          BLI_rctf_cent_y(rect_b)};
+       const float size_a[2] = {BLI_rctf_size_x(rect_a),
+                                BLI_rctf_size_y(rect_a)};
+       const float size_b[2] = {BLI_rctf_size_x(rect_b),
+                                BLI_rctf_size_y(rect_b)};
+       const float cent_a[2] = {BLI_rctf_cent_x(rect_a),
+                                BLI_rctf_cent_y(rect_a)};
+       const float cent_b[2] = {BLI_rctf_cent_x(rect_b),
+                                BLI_rctf_cent_y(rect_b)};
 
        float fac_max = 0.0f;
        float tfac;
index 9a02a9761b0466705c52bd89499c779daa6d16b2..e52ec8d74f5c934c257d29388cf2a3c2e9712a36 100644 (file)
@@ -493,7 +493,7 @@ static int loopcut_init(bContext *C, wmOperator *op, const wmEvent *event)
        {
                Scene *scene = CTX_data_scene(C);
                ToolSettings *settings = scene->toolsettings;
-               int mesh_select_mode[3] = {
+               const int mesh_select_mode[3] = {
                    (settings->selectmode & SCE_SELECT_VERTEX) != 0,
                    (settings->selectmode & SCE_SELECT_EDGE)   != 0,
                    (settings->selectmode & SCE_SELECT_FACE)   != 0,
index 8b72e153852c834aaa51d13725a8e9a07bde5a32..d2648bf1c4e42813c8e86055c3a3a6eb6d86be71 100644 (file)
@@ -1261,9 +1261,11 @@ void EDBM_mesh_reveal(BMEditMesh *em)
                                    BM_EDGES_OF_MESH,
                                    BM_FACES_OF_MESH};
 
-       int sels[3] = {(em->selectmode & SCE_SELECT_VERTEX),
-                      (em->selectmode & SCE_SELECT_EDGE),
-                      (em->selectmode & SCE_SELECT_FACE), };
+       const bool sels[3] = {
+           (em->selectmode & SCE_SELECT_VERTEX) != 0,
+           (em->selectmode & SCE_SELECT_EDGE) != 0,
+           (em->selectmode & SCE_SELECT_FACE) != 0,
+       };
        int i;
 
        /* Use tag flag to remember what was hidden before all is revealed.
index aa1bcf542ff3879ec4091a492582d2b9f516f1e5..86a4de9d9852c26957e7912a5a0bbb1619750426 100644 (file)
@@ -1053,9 +1053,9 @@ static void project_face_seams_init(const ProjPaintState *ps, const int face_ind
  *
  * This is used for finding a pixels location in screenspace for painting */
 static void screen_px_from_ortho(
-        float uv[2],
-        float v1co[3], float v2co[3], float v3co[3],  /* Screenspace coords */
-        float uv1co[2], float uv2co[2], float uv3co[2],
+        const float uv[2],
+        const float v1co[3], const float v2co[3], const float v3co[3],  /* Screenspace coords */
+        const float uv1co[2], const float uv2co[2], const float uv3co[2],
         float pixelScreenCo[4],
         float w[3])
 {
@@ -1066,9 +1066,9 @@ static void screen_px_from_ortho(
 /* same as screen_px_from_ortho except we need to take into account
  * the perspective W coord for each vert */
 static void screen_px_from_persp(
-        float uv[2],
-        float v1co[4], float v2co[4], float v3co[4],  /* screenspace coords */
-        float uv1co[2], float uv2co[2], float uv3co[2],
+        const float uv[2],
+        const float v1co[4], const float v2co[4], const float v3co[4],  /* screenspace coords */
+        const float uv1co[2], const float uv2co[2], const float uv3co[2],
         float pixelScreenCo[4],
         float w[3])
 {
@@ -1101,9 +1101,9 @@ static void screen_px_from_persp(
 /* same as screen_px_from_persp except we return ortho weights back to the caller.
  * These weights will be used to determine correct interpolation of uvs in cloned uv layer */
 static void screen_px_from_persp_ortho_weights(
-        float uv[2],
-        float v1co[4], float v2co[4], float v3co[4],  /* screenspace coords */
-        float uv1co[2], float uv2co[2], float uv3co[2],
+        const float uv[2],
+        const float v1co[4], const float v2co[4], const float v3co[4],  /* screenspace coords */
+        const float uv1co[2], const float uv2co[2], const float uv3co[2],
         float pixelScreenCo[4],
         float w[3])
 {
@@ -1711,8 +1711,8 @@ static bool project_bucket_isect_circle(const float cent[2], const float radius_
 
 static void rect_to_uvspace_ortho(
         rctf *bucket_bounds,
-        float *v1coSS, float *v2coSS, float *v3coSS,
-        float *uv1co, float *uv2co, float *uv3co,
+        const float *v1coSS, const float *v2coSS, const float *v3coSS,
+        const float *uv1co, const float *uv2co, const float *uv3co,
         float bucket_bounds_uv[4][2],
         const int flip)
 {
@@ -1744,8 +1744,8 @@ static void rect_to_uvspace_ortho(
 /* same as above but use barycentric_weights_v2_persp */
 static void rect_to_uvspace_persp(
         rctf *bucket_bounds,
-        float *v1coSS, float *v2coSS, float *v3coSS,
-        float *uv1co, float *uv2co, float *uv3co,
+        const float *v1coSS, const float *v2coSS, const float *v3coSS,
+        const float *uv1co, const float *uv2co, const float *uv3co,
         float bucket_bounds_uv[4][2],
         const int flip
         )
@@ -1821,7 +1821,7 @@ static void project_bucket_clip_face(
         const bool is_ortho,
         rctf *bucket_bounds,
         float *v1coSS, float *v2coSS, float *v3coSS,
-        float *uv1co, float *uv2co, float *uv3co,
+        const float *uv1co, const float *uv2co, const float *uv3co,
         float bucket_bounds_uv[8][2],
         int *tot)
 {
index 108f5a7ee3745eeb9a660d521c59001b3856a4f8..e18ad1d1ba87b4ddc3f20c5fb72de5a6a48f9343 100644 (file)
@@ -1185,8 +1185,10 @@ static EnumPropertyItem *weight_paint_sample_enum_itemf(bContext *C, PointerRNA
                                bool found = false;
                                unsigned int index;
 
-                               int mval[2] = {win->eventstate->x - vc.ar->winrct.xmin,
-                                              win->eventstate->y - vc.ar->winrct.ymin};
+                               const int mval[2] = {
+                                   win->eventstate->x - vc.ar->winrct.xmin,
+                                   win->eventstate->y - vc.ar->winrct.ymin,
+                               };
 
                                view3d_operator_needs_opengl(C);
                                ED_view3d_init_mats_rv3d(vc.obact, vc.rv3d);
index c8c644a546aa8ef94bb520e5769d1730131bd8fe..25f02cda2cb8b922bbc541f288c25b82ead46f96 100644 (file)
@@ -4012,7 +4012,7 @@ static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru
 {
        SculptSession *ss = ob->sculpt;
        StrokeCache *cache = ss->cache;
-       float mouse[2] = {
+       const float mouse[2] = {
                cache->mouse[0],
                cache->mouse[1]
        };
index 7425d0cf5ffd00e0c8f5deaefc05e3bc87ad807e..85404309e0bc3b2f9d17680e8416c97d8f0d630f 100644 (file)
@@ -468,7 +468,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
 }
 
 static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker,
-                                float marker_pos[2], int width, int height)
+                                const float marker_pos[2], int width, int height)
 {
        int tiny = sc->flag & SC_SHOW_TINY_MARKER;
        bool show_search = false;
@@ -571,7 +571,7 @@ static void track_colors(MovieTrackingTrack *track, int act, float col[3], float
 }
 
 static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker,
-                              float marker_pos[2], int width, int height, int act, int sel)
+                              const float marker_pos[2], int width, int height, int act, int sel)
 {
        int tiny = sc->flag & SC_SHOW_TINY_MARKER;
        bool show_search = false;
@@ -785,7 +785,7 @@ static void draw_marker_slide_triangle(float x, float y, float dx, float dy, int
 }
 
 static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker,
-                                    float marker_pos[2], int outline, int sel, int act, int width, int height)
+                                    const float marker_pos[2], int outline, int sel, int act, int width, int height)
 {
        float dx, dy, patdx, patdy, searchdx, searchdy;
        int tiny = sc->flag & SC_SHOW_TINY_MARKER;
@@ -898,7 +898,7 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
 }
 
 static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker,
-                              float marker_pos[2], int act, int width, int height, float zoomx, float zoomy)
+                              const float marker_pos[2], int act, int width, int height, float zoomx, float zoomy)
 {
        char str[128] = {0}, state[64] = {0};
        float dx = 0.0f, dy = 0.0f, fontsize, pos[3];
index 11447c99605b25b38f1a61d98edb3ad2431cc927..4f4949def1948d76e8f2a668f9d5f57e3bc8005c 100644 (file)
@@ -96,8 +96,10 @@ static void tracking_segment_point_cb(void *UNUSED(userdata), MovieTrackingTrack
 
 static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track, int coord)
 {
-       static float colors[2][3] = {{1.0f, 0.0f, 0.0f},
-                                    {0.0f, 1.0f, 0.0f}};
+       const float colors[2][3] = {
+           {1.0f, 0.0f, 0.0f},
+           {0.0f, 1.0f, 0.0f},
+       };
        float col[4];
 
        copy_v3_v3(col, colors[coord]);
index 09ad8e7793ba2b9415f62f4f43719bfd62ae9172..1cc416c2c29b6bc87c5f28b2a879ca84c55f88a8 100644 (file)
@@ -473,7 +473,7 @@ static SlideMarkerData *create_slide_marker_data(SpaceClip *sc, MovieTrackingTra
 }
 
 static int mouse_on_slide_zone(SpaceClip *sc, MovieTrackingMarker *marker,
-                               int area, float co[2], float slide_zone[2],
+                               int area, const float co[2], const float slide_zone[2],
                                float padding, int width, int height)
 {
        const float size = 12.0f;
@@ -504,7 +504,7 @@ static int mouse_on_slide_zone(SpaceClip *sc, MovieTrackingMarker *marker,
 }
 
 static int mouse_on_corner(SpaceClip *sc, MovieTrackingMarker *marker,
-                           int area, float co[2], int corner, float padding,
+                           int area, const float co[2], int corner, float padding,
                            int width, int height)
 {
        float min[2], max[2], crn[2];
@@ -573,7 +573,7 @@ static int get_mouse_pattern_corner(SpaceClip *sc, MovieTrackingMarker *marker,
 }
 
 static int mouse_on_offset(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker,
-                           float co[2], int width, int height)
+                           const float co[2], int width, int height)
 {
        float pos[2], dx, dy;
        float pat_min[2], pat_max[2];
index e8dd65e7c648ec3b7ac5c9df2a4306a4e26a7219..b37e2ff445bb9650509f5eb0f9a687270e1d60d1 100644 (file)
@@ -587,14 +587,14 @@ static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node)
 static void node_circle_draw(float x, float y, float size, const float col[4], int highlight)
 {
        /* 16 values of sin function */
-       static float si[16] = {
+       static const float si[16] = {
                0.00000000f, 0.39435585f, 0.72479278f, 0.93775213f,
                0.99871650f, 0.89780453f, 0.65137248f, 0.29936312f,
                -0.10116832f, -0.48530196f, -0.79077573f, -0.96807711f,
                -0.98846832f, -0.84864425f, -0.57126821f, -0.20129852f
        };
        /* 16 values of cos function */
-       static float co[16] = {
+       static const float co[16] = {
                1.00000000f, 0.91895781f, 0.68896691f, 0.34730525f,
                -0.05064916f, -0.44039415f, -0.75875812f, -0.95413925f,
                -0.99486932f, -0.87434661f, -0.61210598f, -0.25065253f,
index 6c0bdc377977f9ec1594087e477e86f3548ecce9..245cdadc7a2c0314cd79ecbb69dfa37ccf211fe2 100644 (file)
@@ -1467,7 +1467,7 @@ static void bgl_sphere_project(float ax, float az)
 
 static void draw_dof_ellipse(float ax, float az)
 {
-       static float staticSine[16] = {
+       const float staticSine[16] = {
                0.0f, 0.104528463268f, 0.207911690818f, 0.309016994375f,
                0.406736643076f, 0.5f, 0.587785252292f, 0.669130606359f,
                0.743144825477f, 0.809016994375f, 0.866025403784f,
index 429d9cc0a143f1c2ab7a7bcc53619de9b9276f61..ff7d251d45a53f20b6c6d4b25fa1321e7f6aeba9 100644 (file)
@@ -150,7 +150,7 @@ static void view3d_draw_clipping(RegionView3D *rv3d)
        BoundBox *bb = rv3d->clipbb;
 
        if (bb) {
-               static unsigned int clipping_index[6][4] = {
+               const unsigned int clipping_index[6][4] = {
                        {0, 1, 2, 3},
                        {0, 4, 5, 1},
                        {4, 7, 6, 5},
index 213ea0f465a29f7d0b7f481d6a7aa2cce2e0e946..38088f9f1b4e786600a7ae62e7b3ebe11a1630a6 100644 (file)
@@ -621,7 +621,7 @@ static void viewops_data_create_ex(bContext *C, wmOperator *op, const wmEvent *e
                                negate_v3_v3(rv3d->ofs, dvec);
                        }
                        else {
-                               float mval_ar_mid[2] = {
+                               const float mval_ar_mid[2] = {
                                    (float)vod->ar->winx / 2.0f,
                                    (float)vod->ar->winy / 2.0f};
 
index c7f8abd7fb47e8d54c025477f0b7849ee5ab8a86..9d0a70ea9d03e744a7aed95e11f9778896f8ad22 100644 (file)
@@ -282,9 +282,11 @@ static bool view3d_ruler_pick(RulerInfo *ruler_info, const float mval[2],
                                ruler_item_best = ruler_item;
 
                                {
-                                       float dist_points[3] = {len_squared_v2v2(co_ss[0], mval),
-                                                               len_squared_v2v2(co_ss[1], mval),
-                                                               len_squared_v2v2(co_ss[2], mval)};
+                                       const float dist_points[3] = {
+                                           len_squared_v2v2(co_ss[0], mval),
+                                           len_squared_v2v2(co_ss[1], mval),
+                                           len_squared_v2v2(co_ss[2], mval),
+                                       };
                                        if (min_fff(UNPACK3(dist_points)) < RULER_PICK_DIST_SQ) {
                                                co_index_best = min_axis_v3(dist_points);
                                        }
@@ -301,8 +303,10 @@ static bool view3d_ruler_pick(RulerInfo *ruler_info, const float mval[2],
                                ruler_item_best = ruler_item;
 
                                {
-                                       float dist_points[2] = {len_squared_v2v2(co_ss[0], mval),
-                                                               len_squared_v2v2(co_ss[2], mval)};
+                                       const float dist_points[2] = {
+                                           len_squared_v2v2(co_ss[0], mval),
+                                           len_squared_v2v2(co_ss[2], mval),
+                                       };
                                        if (min_ff(UNPACK2(dist_points)) < RULER_PICK_DIST_SQ) {
                                                co_index_best = (dist_points[0] < dist_points[1]) ? 0 : 2;
                                        }
index 2b8776a2816213a6240b09dba64ab6d47c848fea..a2b53da831bce4f7b4399bb7d5da8d844478be76 100644 (file)
@@ -1189,7 +1189,7 @@ static void draw_manipulator_rotate(
 
 static void drawsolidcube(float size)
 {
-       static float cube[8][3] = {
+       const float cube[8][3] = {
                {-1.0, -1.0, -1.0},
                {-1.0, -1.0,  1.0},
                {-1.0,  1.0,  1.0},
index 82537dca9734a4bca38caa1e1b2fc82cc858bfe7..dfff8632da3a1c9fa09d985c3da221e94a6ff8c8 100644 (file)
@@ -991,7 +991,7 @@ static bool uv_select_edgeloop_edge_tag_faces(BMEditMesh *em, UvMapVert *first1,
 }
 
 static int uv_select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit *hit,
-                              float limit[2], const bool extend)
+                              const float limit[2], const bool extend)
 {
        BMFace *efa;
        BMIter iter, liter;
index a30918a175d02c4c4d8b197d304103ebe671b4a8..80f0cdac86ce62f5c1d631ef9b10347108c8fe96 100644 (file)
@@ -1481,7 +1481,7 @@ static void gpu_color_from_mask_quad_copy(const CCGKey *key,
 static void gpu_color_from_mask_quad_set(const CCGKey *key,
                                          CCGElem *a, CCGElem *b,
                                          CCGElem *c, CCGElem *d,
-                                         float diffuse_color[4])
+                                         const float diffuse_color[4])
 {
        float color = gpu_color_from_mask_quad(key, a, b, c, d);
        glColor3f(diffuse_color[0] * color, diffuse_color[1] * color, diffuse_color[2] * color);
index 34253cd227c606dca99041db66af1a6b1ee1c904..c98b39c826be303fcbd9a647bffaa9f435dadba8 100644 (file)
@@ -674,7 +674,7 @@ struct scale_outpix_float {
 };
 
 static void shrink_picture_float(
-        float *src, float *dst, int src_width,
+        const float *src, float *dst, int src_width,
         int src_height, int dst_width, int dst_height)
 {
        double ratiox = (double) (dst_width) / (double) (src_width);
index 6dc3f9cf24074cd8eb42cd23ad5ab64f793ea723..70e7e79abaa632431a21169636b333349c702f3b 100644 (file)
@@ -752,7 +752,7 @@ static EMat *build_edge_mats(const MVertSkin *vs,
  * having any special cases for dealing with sharing a frame between
  * two hulls.) */
 static int calc_edge_subdivisions(const MVert *mvert, const MVertSkin *nodes,
-                                  const MEdge *e, int *degree)
+                                  const MEdge *e, const int *degree)
 {
        /* prevent memory errors [#38003] */
 #define NUM_SUBDIVISIONS_MAX 128
index 9a9e113ba90882c9a2cf1db73eb85e96e34c78bd..6fd3b426142f013e0ae88800b3e7d4c7016d0f37 100644 (file)
@@ -277,7 +277,7 @@ int wm_cursor_arrow_move(wmWindow *win, wmEvent *event)
 void WM_cursor_time(wmWindow *win, int nr)
 {
        /* 10 8x8 digits */
-       static char number_bitmaps[10][8] = {
+       const char number_bitmaps[10][8] = {
                {0,  56,  68,  68,  68,  68,  68,  56},
                {0,  24,  16,  16,  16,  16,  16,  56},
                {0,  60,  66,  32,  16,   8,   4, 126},