Code cleanup: use 'const' for arrays (blenkernel)
authorCampbell Barton <ideasman42@gmail.com>
Sat, 26 Apr 2014 14:20:13 +0000 (00:20 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 26 Apr 2014 14:25:15 +0000 (00:25 +1000)
31 files changed:
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/bvhutils.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/colortools.c
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/editderivedmesh.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/key.c
source/blender/blenkernel/intern/lattice.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/mask.c
source/blender/blenkernel/intern/mask_evaluate.c
source/blender/blenkernel/intern/mask_rasterize.c
source/blender/blenkernel/intern/material.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/mesh_evaluate.c
source/blender/blenkernel/intern/mesh_mapping.c
source/blender/blenkernel/intern/mesh_validate.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/object_dupli.c
source/blender/blenkernel/intern/seqmodifier.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenkernel/intern/sound.c
source/blender/blenkernel/intern/text.c
source/blender/blenkernel/intern/unit.c

index 68d108fad112a7a8c27683e77e02b7100168bccd..1f5ad4f0253728d5515c889eae8c078037c8fc3c 100644 (file)
@@ -2791,9 +2791,9 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
                                                int t;
                                                for (t = 0; t < nr_tris_to_pile; t++) {
                                                        float f2x_area_uv;
-                                                       float *p0 = verts[indices[t * 3 + 0]];
-                                                       float *p1 = verts[indices[t * 3 + 1]];
-                                                       float *p2 = verts[indices[t * 3 + 2]];
+                                                       const float *p0 = verts[indices[t * 3 + 0]];
+                                                       const float *p1 = verts[indices[t * 3 + 1]];
+                                                       const float *p2 = verts[indices[t * 3 + 2]];
 
                                                        float edge_t0[2], edge_t1[2];
                                                        sub_v2_v2v2(edge_t0, tex_coords[indices[t * 3 + 1]], tex_coords[indices[t * 3 + 0]]);
index e0bbe697c27fe2e2a485a64f6fd37f8031aa4c62..d02961430c455d11cfc8193c46ede0704f2035e5 100644 (file)
@@ -1127,7 +1127,7 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan,
         *      - we cannot use the groups, since they may not be grouped in that way...
         */
        for (fcu = act->curves.first; fcu; fcu = fcu->next) {
-               char *bPtr = NULL, *pPtr = NULL;
+               const char *bPtr = NULL, *pPtr = NULL;
                
                /* if enough flags have been found, we can stop checking unless we're also getting the curves */
                if ((flags == ACT_TRANS_ALL) && (curves == NULL))
index 8542bd65933b831e0597620b95e04f9a3f36b2f1..ae4580bfdfe4b26a43d92f808fae2643abfc21ed 100644 (file)
@@ -581,7 +581,7 @@ static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *o
                /* if we haven't aren't able to resolve the path now, try again after fixing it */
                if (!verify_paths || check_rna_path_is_valid(owner_id, oldpath) == 0) {
                        DynStr *ds = BLI_dynstr_new();
-                       char *postfixPtr = oldNamePtr + oldNameLen;
+                       const char *postfixPtr = oldNamePtr + oldNameLen;
                        char *newPath = NULL;
                        char oldChar;
                        
@@ -633,7 +633,7 @@ static void fcurves_path_rename_fix(ID *owner_id, const char *prefix, const char
        /* we need to check every curve... */
        for (fcu = curves->first; fcu; fcu = fcu->next) {
                if (fcu->rna_path) {
-                       char *old_path = fcu->rna_path;
+                       const char *old_path = fcu->rna_path;
                        
                        /* firstly, handle the F-Curve's own path */
                        fcu->rna_path = rna_path_rename_fix(owner_id, prefix, oldKey, newKey, fcu->rna_path, verify_paths);
index 7ba6079429b1644bd4aaeeacf9cb65c43e3a06a9..0ceee78874f78bf188ee9837a652614e3a1a207f 100644 (file)
@@ -371,7 +371,7 @@ static void mesh_faces_nearest_point(void *userdata, int index, const float co[3
        MVert *vert = data->vert;
        MFace *face = data->face + index;
 
-       float *t0, *t1, *t2, *t3;
+       const float *t0, *t1, *t2, *t3;
        t0 = vert[face->v1].co;
        t1 = vert[face->v2].co;
        t2 = vert[face->v3].co;
@@ -406,7 +406,7 @@ static void editmesh_faces_nearest_point(void *userdata, int index, const float
        BMEditMesh *em = data->em_evil;
        const BMLoop **ltri = (const BMLoop **)em->looptris[index];
 
-       float *t0, *t1, *t2;
+       const float *t0, *t1, *t2;
        t0 = ltri[0]->v->co;
        t1 = ltri[1]->v->co;
        t2 = ltri[2]->v->co;
@@ -433,7 +433,7 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r
        MVert *vert = data->vert;
        MFace *face = data->face + index;
 
-       float *t0, *t1, *t2, *t3;
+       const float *t0, *t1, *t2, *t3;
        t0 = vert[face->v1].co;
        t1 = vert[face->v2].co;
        t2 = vert[face->v3].co;
@@ -471,7 +471,7 @@ static void editmesh_faces_spherecast(void *userdata, int index, const BVHTreeRa
        BMEditMesh *em = data->em_evil;
        const BMLoop **ltri = (const BMLoop **)em->looptris[index];
 
-       float *t0, *t1, *t2;
+       const float *t0, *t1, *t2;
        t0 = ltri[0]->v->co;
        t1 = ltri[1]->v->co;
        t2 = ltri[2]->v->co;
@@ -503,7 +503,7 @@ static void mesh_edges_nearest_point(void *userdata, int index, const float co[3
        MEdge *edge = data->edge + index;
        float nearest_tmp[3], dist_sq;
 
-       float *t0, *t1;
+       const float *t0, *t1;
        t0 = vert[edge->v1].co;
        t1 = vert[edge->v2].co;
 
index 0c38baca40813b95067c0a4533840bcc30ddd0d0..5272332777f5053672374f8f4e1bedc6a1126c3e 100644 (file)
@@ -537,7 +537,7 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
        CDDerivedMesh *cddm = (CDDerivedMesh *) dm;
        MVert *mvert = cddm->mvert;
        MFace *mface = cddm->mface;
-       float *nors = dm->getTessFaceDataArray(dm, CD_NORMAL);
+       const float *nors = dm->getTessFaceDataArray(dm, CD_NORMAL);
        short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL);
        int a, glmode = -1, shademodel = -1, matnr = -1, drawCurrentMat = 1;
 
@@ -653,7 +653,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
        CDDerivedMesh *cddm = (CDDerivedMesh *) dm;
        MVert *mv = cddm->mvert;
        MFace *mf = DM_get_tessface_data_layer(dm, CD_MFACE);
-       float *nors = dm->getTessFaceDataArray(dm, CD_NORMAL);
+       const float *nors = dm->getTessFaceDataArray(dm, CD_NORMAL);
        short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL);
        MTFace *tf = DM_get_tessface_data_layer(dm, CD_MTFACE);
        MCol *mcol;
@@ -887,7 +887,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
        MVert *mv = cddm->mvert;
        MFace *mf = cddm->mface;
        MCol *mcol;
-       float *nors = DM_get_tessface_data_layer(dm, CD_NORMAL);
+       const float *nors = DM_get_tessface_data_layer(dm, CD_NORMAL);
        short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL);
        int colType, useColors = flag & DM_DRAW_USE_COLORS;
        int i, orig;
@@ -1291,7 +1291,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
        }
        else {
                GPUBuffer *buffer = NULL;
-               char *varray = NULL;
+               const char *varray = NULL;
                int numdata = 0, elementsize = 0, offset;
                int start = 0, numfaces = 0 /* , prevdraw = 0 */ /* UNUSED */, curface = 0;
                int i;
@@ -1429,7 +1429,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
                                                }
                                        }
                                        if (attribs.tottang && attribs.tang.array) {
-                                               float *tang = attribs.tang.array[a * 4 + 0];
+                                               const float *tang = attribs.tang.array[a * 4 + 0];
                                                copy_v4_v4((float *)&varray[elementsize * curface * 3 + offset], tang);
                                                tang = attribs.tang.array[a * 4 + 1];
                                                copy_v4_v4((float *)&varray[elementsize * curface * 3 + offset + elementsize], tang);
@@ -1474,7 +1474,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
                                                        }
                                                }
                                                if (attribs.tottang && attribs.tang.array) {
-                                                       float *tang = attribs.tang.array[a * 4 + 2];
+                                                       const float *tang = attribs.tang.array[a * 4 + 2];
                                                        copy_v4_v4((float *)&varray[elementsize * curface * 3 + offset], tang);
                                                        tang = attribs.tang.array[a * 4 + 3];
                                                        copy_v4_v4((float *)&varray[elementsize * curface * 3 + offset + elementsize], tang);
@@ -1651,7 +1651,7 @@ static void cdDM_foreachMappedVert(
         DMForeachFlag flag)
 {
        MVert *mv = CDDM_get_verts(dm);
-       int *index = DM_get_vert_data_layer(dm, CD_ORIGINDEX);
+       const int *index = DM_get_vert_data_layer(dm, CD_ORIGINDEX);
        int i;
 
        if (index) {
@@ -2836,7 +2836,7 @@ void CDDM_calc_edges(DerivedMesh *dm)
        EdgeHash *eh;
        unsigned int eh_reserve;
        int v1, v2;
-       int *eindex;
+       const int *eindex;
        int i, j, *index;
        const int numFaces = dm->numPolyData;
        const int numLoops = dm->numLoopData;
index 75d24fa3a49de259235ecfa9f2912dbf61a6bdae..e90f50d568ae1a5e246aa877d19b54b2bc4d02ff 100644 (file)
@@ -961,7 +961,7 @@ void BKE_histogram_update_sample_line(Histogram *hist, ImBuf *ibuf, const ColorM
                                       const ColorManagedDisplaySettings *display_settings)
 {
        int i, x, y;
-       float *fp;
+       const float *fp;
        float rgb[3];
        unsigned char *cp;
 
@@ -1024,7 +1024,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *
        int x, y, c;
        unsigned int nl, na, nr, ng, nb;
        double divl, diva, divr, divg, divb;
-       float *rf = NULL;
+       const float *rf = NULL;
        unsigned char *rc = NULL;
        unsigned int *bin_lum, *bin_r, *bin_g, *bin_b, *bin_a;
        int savedlines, saveline;
index ccc576e74b369b743c4b016df258ce0d5e382ee9..b55520a4c42a8477422c3bb77099717e2714ab72 100644 (file)
@@ -460,7 +460,7 @@ static void contarget_get_lattice_mat(Object *ob, const char *substring, float m
        Lattice *lt = (Lattice *)ob->data;
        
        DispList *dl = ob->curve_cache ? BKE_displist_find(&ob->curve_cache->disp, DL_VERTS) : NULL;
-       float *co = dl ? dl->verts : NULL;
+       const float *co = dl ? dl->verts : NULL;
        BPoint *bp = lt->def;
        
        MDeformVert *dv = lt->dvert;
index 96da03dde3dda4e0dde7326bbda50b5ec1459588..f0f9a95a1c5a82cdfe3e67593fdaf46d585f49cd 100644 (file)
@@ -1598,7 +1598,7 @@ float *BKE_curve_make_orco(Scene *scene, Object *ob, int *r_numVerts)
                                                fp[2] = 0.0;
                                        }
                                        else {
-                                               float *vert;
+                                               const float *vert;
                                                int realv = v % dl->nr;
                                                int realu = u % dl->parts;
 
@@ -3673,7 +3673,7 @@ float (*BKE_curve_nurbs_vertexCos_get(ListBase *lb, int *r_numVerts))[3]
 
 void BK_curve_nurbs_vertexCos_apply(ListBase *lb, float (*vertexCos)[3])
 {
-       float *co = vertexCos[0];
+       const float *co = vertexCos[0];
        Nurb *nu;
        int i;
 
@@ -3897,7 +3897,7 @@ bool BKE_nurb_type_convert(Nurb *nu, const short type, const bool use_handles)
                                        bp++;
                                }
                                else {
-                                       char *f = &bezt->f1;
+                                       const char *f = &bezt->f1;
                                        for (c = 0; c < 3; c++, f++) {
                                                copy_v3_v3(bp->vec, bezt->vec[c]);
                                                bp->vec[3] = 1.0;
index 78c88cdfd0fb1cb2fb68de555ccc042483f248a7..e942e790f0577d2b1e3b63c38fb689c7e4b67732 100644 (file)
@@ -1987,7 +1987,7 @@ static void CustomData_copy_data_layer(const CustomData *source, CustomData *des
        int src_offset;
        int dest_offset;
 
-       char *src_data = source->layers[src_i].data;
+       const char *src_data = source->layers[src_i].data;
        char *dest_data = dest->layers[dest_i].data;
 
        typeInfo = layerType_getInfo(source->layers[src_i].type);
@@ -2612,7 +2612,7 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest,
                if (dest->layers[dest_i].type == source->layers[src_i].type &&
                    strcmp(dest->layers[dest_i].name, source->layers[src_i].name) == 0)
                {
-                       char *src_data = (char *)src_block + source->layers[src_i].offset;
+                       const char *src_data = (char *)src_block + source->layers[src_i].offset;
                        char *dest_data = (char *)*dest_block + dest->layers[dest_i].offset;
 
                        typeInfo = layerType_getInfo(source->layers[src_i].type);
@@ -2931,7 +2931,7 @@ void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest,
                /* if we found a matching layer, copy the data */
                if (dest->layers[dest_i].type == source->layers[src_i].type) {
                        int offset = dest->layers[dest_i].offset;
-                       char *src_data = source->layers[src_i].data;
+                       const char *src_data = source->layers[src_i].data;
                        char *dest_data = (char *)*dest_block + offset;
 
                        typeInfo = layerType_getInfo(dest->layers[dest_i].type);
@@ -2981,7 +2981,7 @@ void CustomData_from_bmesh_block(const CustomData *source, CustomData *dest,
                /* if we found a matching layer, copy the data */
                if (dest->layers[dest_i].type == source->layers[src_i].type) {
                        int offset = source->layers[src_i].offset;
-                       char *src_data = (char *)src_block + offset;
+                       const char *src_data = (char *)src_block + offset;
                        char *dest_data = dest->layers[dest_i].data;
 
                        typeInfo = layerType_getInfo(dest->layers[dest_i].type);
index eeb4f0d7fc4740eb97925738ba22fd4a130938ec..7e4d6c47c5031715654907e9fdeb7522fd44d3b9 100644 (file)
@@ -891,7 +891,7 @@ static float (*displist_get_allverts(ListBase *dispbase, int *totvert))[3]
 static void displist_apply_allverts(ListBase *dispbase, float (*allverts)[3])
 {
        DispList *dl;
-       float *fp;
+       const float *fp;
 
        fp = (float *)allverts;
        for (dl = dispbase->first; dl; dl = dl->next) {
@@ -1794,7 +1794,7 @@ float *BKE_displist_make_orco(Scene *scene, Object *ob, DerivedMesh *dm_final,
 void BKE_displist_minmax(ListBase *dispbase, float min[3], float max[3])
 {
        DispList *dl;
-       float *vert;
+       const float *vert;
        int a, tot = 0;
        int doit = 0;
 
index 10a1d3067071e7d2d6c7bf4a515ed116c06999c2..e14282b9eacb2a0b9cada5fbdf9bfd0d51cf5864 100644 (file)
@@ -323,7 +323,7 @@ static void dynamicPaint_setPreview(DynamicPaintSurface *t_surface)
 
 bool dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, Object *ob, int output)
 {
-       char *name;
+       const char *name;
 
        if (output == 0)
                name = surface->output_name;
@@ -1678,7 +1678,7 @@ static void dynamicPaint_applySurfaceDisplace(DynamicPaintSurface *surface, Deri
        if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE) {
                MVert *mvert = result->getVertArray(result);
                int i;
-               float *value = (float *)sData->type_data;
+               const float *value = (float *)sData->type_data;
 
 #pragma omp parallel for schedule(static)
                for (i = 0; i < sData->total_points; i++) {
@@ -2103,7 +2103,7 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
                        float closest_point[2], lambda, dir_vec[2];
                        int target_uv1, target_uv2, final_pixel[2], final_index;
 
-                       float *s_uv1, *s_uv2, *t_uv1, *t_uv2;
+                       const float *s_uv1, *s_uv2, *t_uv1, *t_uv2;
 
                        pixel[0] = ((float)(px + neighX[n_index]) + 0.5f) / (float)w;
                        pixel[1] = ((float)(py + neighY[n_index]) + 0.5f) / (float)h;
@@ -2901,7 +2901,7 @@ static void mesh_faces_spherecast_dp(void *userdata, int index, const BVHTreeRay
        MFace *face = data->face + index;
        short quad = 0;
 
-       float *t0, *t1, *t2, *t3;
+       const float *t0, *t1, *t2, *t3;
        t0 = vert[face->v1].co;
        t1 = vert[face->v2].co;
        t2 = vert[face->v3].co;
@@ -2937,7 +2937,7 @@ static void mesh_faces_nearest_point_dp(void *userdata, int index, const float c
        MFace *face = data->face + index;
        short quad = 0;
 
-       float *t0, *t1, *t2, *t3;
+       const float *t0, *t1, *t2, *t3;
        t0 = vert[face->v1].co;
        t1 = vert[face->v2].co;
        t2 = vert[face->v3].co;
index e7093d4035f96e5c6c4d48d2e0332bf0aaedadb9..9668aa9f1e88bd3e404ce1af78644798cac8abab 100644 (file)
@@ -1256,7 +1256,7 @@ static int emDM_getNumPolys(DerivedMesh *dm)
 
 static void bmvert_to_mvert(BMesh *bm, BMVert *ev, MVert *r_vert)
 {
-       float *f;
+       const float *f;
 
        copy_v3_v3(r_vert->co, ev->co);
 
@@ -1366,7 +1366,7 @@ static void emDM_getEdge(DerivedMesh *dm, int index, MEdge *r_edge)
        EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
        BMesh *bm = bmdm->em->bm;
        BMEdge *e;
-       float *f;
+       const float *f;
 
        if (UNLIKELY(index < 0 || index >= bm->totedge)) {
                BLI_assert(!"error in emDM_getEdge");
@@ -1557,7 +1557,7 @@ static void *emDM_getTessFaceDataArray(DerivedMesh *dm, int type)
        if (type == CD_MTFACE || type == CD_MCOL) {
                const int type_from = (type == CD_MTFACE) ? CD_MTEXPOLY : CD_MLOOPCOL;
                int index;
-               char *data, *bmdata;
+               const char *data, *bmdata;
                index = CustomData_get_layer_index(&bm->pdata, type_from);
 
                if (index != -1) {
index 343d82e734149f1bb6d0240f2971c5362ee41616..dec890c4b685429f0b02bbb2056a9c292aade754 100644 (file)
@@ -1580,7 +1580,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
        }
 
        if (scene->r.stamp & R_STAMP_MARKER) {
-               char *name = BKE_scene_find_last_marker_name(scene, CFRA);
+               const char *name = BKE_scene_find_last_marker_name(scene, CFRA);
 
                if (name) BLI_strncpy(text, name, sizeof(text));
                else BLI_strncpy(text, "<none>", sizeof(text));
@@ -1902,7 +1902,7 @@ bool BKE_imbuf_alpha_test(ImBuf *ibuf)
 {
        int tot;
        if (ibuf->rect_float) {
-               float *buf = ibuf->rect_float;
+               const float *buf = ibuf->rect_float;
                for (tot = ibuf->x * ibuf->y; tot--; buf += 4) {
                        if (buf[3] < 1.0f) {
                                return true;
index 11c00576b611410eecf9dac862f97ec340fd6d9d..333119f1f8ef4b77739507de8e9388669c689160 100644 (file)
@@ -1681,7 +1681,7 @@ void BKE_key_convert_from_lattice(Lattice *lt, KeyBlock *kb)
 void BKE_key_convert_to_lattice(KeyBlock *kb, Lattice *lt)
 {
        BPoint *bp;
-       float *fp;
+       const float *fp;
        int a, tot;
 
        bp = lt->def;
@@ -1752,7 +1752,7 @@ void BKE_key_convert_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
        Nurb *nu;
        BezTriple *bezt;
        BPoint *bp;
-       float *fp;
+       const float *fp;
        int a, tot;
 
        nu = nurb->first;
@@ -1822,7 +1822,7 @@ void BKE_key_convert_from_mesh(Mesh *me, KeyBlock *kb)
 void BKE_key_convert_to_mesh(KeyBlock *kb, Mesh *me)
 {
        MVert *mvert;
-       float *fp;
+       const float *fp;
        int a, tot;
 
        mvert = me->mvert;
@@ -1839,7 +1839,7 @@ void BKE_key_convert_to_mesh(KeyBlock *kb, Mesh *me)
 float (*BKE_key_convert_to_vertcos(Object *ob, KeyBlock *kb))[3]
 {
        float (*vertCos)[3], *co;
-       float *fp = kb->data;
+       const float *fp = kb->data;
        int tot = 0, a;
 
        /* Count of vertex coords in array */
index 06a0327149ed2501a5056cc9d823aad4c954df14..30ca7b4c39617def01689e0f70811ad0a0e45816 100644 (file)
@@ -368,7 +368,7 @@ LatticeDeformData *init_latt_deform(Object *oblatt, Object *ob)
        Lattice *lt = oblatt->data;
        BPoint *bp;
        DispList *dl = oblatt->curve_cache ? BKE_displist_find(&oblatt->curve_cache->disp, DL_VERTS) : NULL;
-       float *co = dl ? dl->verts : NULL;
+       const float *co = dl ? dl->verts : NULL;
        float *fp, imat[4][4];
        float fu, fv, fw;
        int u, v, w;
index 91549f1ea0b38b349de9b1eb6af6bcd39447b343..3ebb3a09e5fa71ccfc612044e06e86c560452839 100644 (file)
  * also note that the id _must_ have a library - campbell */
 void BKE_id_lib_local_paths(Main *bmain, Library *lib, ID *id)
 {
-       char *bpath_user_data[2] = {bmain->name, lib->filepath};
+       const char *bpath_user_data[2] = {bmain->name, lib->filepath};
 
        BKE_bpath_traverse_id(bmain, id,
                              BKE_bpath_relocate_visitor,
index b303243b66ac60f7fc39c27af0ce846f72c06237..8548e3632331edb571ae6fcbc36d8f074c10d040 100644 (file)
@@ -1687,8 +1687,8 @@ void BKE_mask_layer_shape_to_mask_interp(MaskLayer *masklay,
 {
        int tot = BKE_mask_layer_shape_totvert(masklay);
        if (masklay_shape_a->tot_vert == tot && masklay_shape_b->tot_vert == tot) {
-               float *fp_a = masklay_shape_a->data;
-               float *fp_b = masklay_shape_b->data;
+               const float *fp_a = masklay_shape_a->data;
+               const float *fp_b = masklay_shape_b->data;
                const float ifac = 1.0f - fac;
 
                MaskSpline *spline;
@@ -2105,7 +2105,7 @@ void BKE_mask_clipboard_paste_to_layer(Main *bmain, MaskLayer *mask_layer)
                for (i = 0; i < spline_new->tot_point; i++) {
                        MaskSplinePoint *point = &spline_new->points[i];
                        if (point->parent.id) {
-                               char *id_name = BLI_ghash_lookup(mask_clipboard.id_hash, point->parent.id);
+                               const char *id_name = BLI_ghash_lookup(mask_clipboard.id_hash, point->parent.id);
                                ListBase *listbase;
 
                                BLI_assert(id_name != NULL);
index 33e74582750889205f3d4a7f617d2988c7ff344d..e67ffc8511bb7a6a909202d580ea17ab32bd5f84 100644 (file)
@@ -258,15 +258,15 @@ static void feather_bucket_check_intersect(
 {
        int i;
 
-       float *v1 = (float *) feather_points[cur_a];
-       float *v2 = (float *) feather_points[cur_b];
+       const float *v1 = (float *) feather_points[cur_a];
+       const float *v2 = (float *) feather_points[cur_b];
 
        for (i = 0; i < bucket->tot_segment; i++) {
                int check_a = bucket->segments[i][0];
                int check_b = bucket->segments[i][1];
 
-               float *v3 = (float *) feather_points[check_a];
-               float *v4 = (float *) feather_points[check_b];
+               const float *v3 = (float *) feather_points[check_a];
+               const float *v4 = (float *) feather_points[check_b];
 
                if (check_a >= cur_a - 1 || cur_b == check_a)
                        continue;
index ea039dabce438c2ee8dfcaf00f19ca1f631032cb..35207595103d828a1aae0abed24a2c307672a429 100644 (file)
@@ -841,8 +841,8 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
                                                open_spline_ranges[open_spline_index].vertex_total_cap_tail = 0;
 
                                                if (!is_cyclic) {
-                                                       float *fp_cent;
-                                                       float *fp_turn;
+                                                       const float *fp_cent;
+                                                       const float *fp_turn;
 
                                                        unsigned int k;
 
index f9af77b04bfea3e587d84f21d9507d10da9fdfb4..b0b9a4fa48d6e8a1aab7846235a4fc6b5d6000f7 100644 (file)
@@ -669,7 +669,7 @@ void BKE_material_clear_id(struct ID *id, bool update_data)
 Material *give_current_material(Object *ob, short act)
 {
        Material ***matarar, *ma;
-       short *totcolp;
+       const short *totcolp;
 
        if (ob == NULL) return NULL;
        
@@ -774,7 +774,7 @@ void test_object_materials(Main *bmain, ID *id)
 {
        /* make the ob mat-array same size as 'ob->data' mat-array */
        Object *ob;
-       short *totcol;
+       const short *totcol;
 
        if (id == NULL || (totcol = give_totcolp_id(id)) == NULL) {
                return;
index 7d8d98a45737d3bef73a184530a4f4b3ebb9b1d7..471e08145bb408be36bad0af1446fb104f800e0d 100644 (file)
@@ -1023,7 +1023,7 @@ void BKE_mesh_from_metaball(ListBase *lb, Mesh *me)
        MVert *mvert;
        MLoop *mloop, *allloop;
        MPoly *mpoly;
-       float *nors, *verts;
+       const float *nors, *verts;
        int a, *index;
        
        dl = lb->first;
@@ -1194,7 +1194,7 @@ int BKE_mesh_nurbs_displist_to_mdata(Object *ob, ListBase *dispbase,
        MLoop *mloop;
        MLoopUV *mloopuv = NULL;
        MEdge *medge;
-       float *data;
+       const float *data;
        int a, b, ofs, vertcount, startvert, totvert = 0, totedge = 0, totloop = 0, totvlak = 0;
        int p1, p2, p3, p4, *index;
        const bool conv_polys = ((CU_DO_2DFILL(cu) == false) ||  /* 2d polys are filled with DL_INDEX3 displists */
index 281e98e7b053e6f797d4d98c64325b2f9ec3430e..b272749a4bbd646b9aa552cb71454dcfa6bba9fd 100644 (file)
@@ -172,8 +172,8 @@ static void mesh_calc_normals_poly_accum(MPoly *mp, MLoop *ml,
        /* inline version of #BKE_mesh_calc_poly_normal, also does edge-vectors */
        {
                int i_prev = nverts - 1;
-               float const *v_prev = mvert[ml[i_prev].v].co;
-               float const *v_curr;
+               const float const *v_prev = mvert[ml[i_prev].v].co;
+               const float const *v_curr;
 
                zero_v3(polyno);
                /* Newell's Method */
@@ -287,7 +287,7 @@ void BKE_mesh_calc_normals_tessface(MVert *mverts, int numVerts, MFace *mfaces,
                MFace *mf = &mfaces[i];
                float *f_no = fnors[i];
                float *n4 = (mf->v4) ? tnorms[mf->v4] : NULL;
-               float *c4 = (mf->v4) ? mverts[mf->v4].co : NULL;
+               const float *c4 = (mf->v4) ? mverts[mf->v4].co : NULL;
 
                if (mf->v4)
                        normal_quad_v3(f_no, mverts[mf->v1].co, mverts[mf->v2].co, mverts[mf->v3].co, mverts[mf->v4].co);
@@ -738,8 +738,8 @@ static void mesh_calc_ngon_normal(MPoly *mpoly, MLoop *loopstart,
                                   MVert *mvert, float normal[3])
 {
        const int nverts = mpoly->totloop;
-       float const *v_prev = mvert[loopstart[nverts - 1].v].co;
-       float const *v_curr;
+       const float const *v_prev = mvert[loopstart[nverts - 1].v].co;
+       const float const *v_curr;
        int i;
 
        zero_v3(normal);
@@ -788,8 +788,8 @@ static void mesh_calc_ngon_normal_coords(MPoly *mpoly, MLoop *loopstart,
                                          const float (*vertex_coords)[3], float normal[3])
 {
        const int nverts = mpoly->totloop;
-       float const *v_prev = vertex_coords[loopstart[nverts - 1].v];
-       float const *v_curr;
+       const float const *v_prev = vertex_coords[loopstart[nverts - 1].v];
+       const float const *v_curr;
        int i;
 
        zero_v3(normal);
@@ -1178,7 +1178,7 @@ void BKE_mesh_loops_to_tessdata(CustomData *fdata, CustomData *ldata, CustomData
        const bool hasOrigSpace = CustomData_has_layer(ldata, CD_ORIGSPACE_MLOOP);
        const bool hasLoopNormal = CustomData_has_layer(ldata, CD_NORMAL);
        int findex, i, j;
-       int *pidx;
+       const int *pidx;
        unsigned int (*lidx)[4];
 
        for (i = 0; i < numTex; i++) {
index 94f29b5b1a417980fbac064d7ad3cf98fb67c3ab..4d63ed4e998f5ba4209ec5edcec64ed01c7e025c 100644 (file)
@@ -426,7 +426,7 @@ int *BKE_mesh_calc_smoothgroups(const MEdge *medge, const int totedge,
                        for (ml = &mloop[mp->loopstart], j = mp->totloop; j--; ml++) {
                                /* loop over poly users */
                                const MeshElemMap *map_ele = &edge_poly_map[ml->e];
-                               int *p = map_ele->indices;
+                               const int *p = map_ele->indices;
                                int i = map_ele->count;
                                if (!(medge[ml->e].flag & ME_SHARP)) {
                                        for (; i--; p++) {
index e80433580b07c3cf1bcc7ae2c3f3d0ea40b8b279..858fe83b43fed4c5a953f5186496f8e67fbe34d1 100644 (file)
@@ -565,7 +565,7 @@ bool BKE_mesh_validate_arrays(Mesh *mesh,
 
                                /* Now check that that poly does not use a same vertex more than once! */
                                if (!sp->invalid) {
-                                       int *prev_v = v = sp->verts;
+                                       const int *prev_v = v = sp->verts;
                                        j = sp->numverts;
 
                                        qsort(sp->verts, j, sizeof(int), int_cmp);
@@ -598,7 +598,7 @@ bool BKE_mesh_validate_arrays(Mesh *mesh,
 
                for (i = 1; i < totpoly; i++, sp++) {
                        int p1_nv = sp->numverts, p2_nv = prev_sp->numverts;
-                       int *p1_v = sp->verts, *p2_v = prev_sp->verts;
+                       const int *p1_v = sp->verts, *p2_v = prev_sp->verts;
                        short p1_sub = true, p2_sub = true;
                        if (sp->invalid)
                                break;
index 20b6f72a60be3abebc6d7a106731b50bdffc45b9..f6018409c620701749b87efa838b5ffeea998670 100644 (file)
@@ -2724,7 +2724,7 @@ void BKE_object_foreach_display_point(
                DispList *dl;
 
                for (dl = ob->curve_cache->disp.first; dl; dl = dl->next) {
-                       float *v3 = dl->verts;
+                       const float *v3 = dl->verts;
                        int totvert = dl->nr;
                        int i;
 
@@ -3656,7 +3656,7 @@ KDTree *BKE_object_as_kdtree(Object *ob, int *r_tot)
                        unsigned int i;
 
                        DerivedMesh *dm = ob->derivedDeform ? ob->derivedDeform : ob->derivedFinal;
-                       int *index;
+                       const int *index;
 
                        if (dm && (index = CustomData_get_layer(&dm->vertData, CD_ORIGINDEX))) {
                                MVert *mvert = dm->getVertArray(dm);
index 786c283cd09199cc648fde83c2d58ee342795201..d246a77c0f7d9706cbb1bb6de45239f7497dfc7b 100644 (file)
@@ -684,7 +684,7 @@ static void get_dupliface_transform(MPoly *mpoly, MLoop *mloop, MVert *mvert,
        BKE_mesh_calc_poly_center(mpoly, mloop, mvert, loc);
        /* rotation */
        {
-               float *v1, *v2, *v3;
+               const float *v1, *v2, *v3;
                BKE_mesh_calc_poly_normal(mpoly, mloop, mvert, f_no);
                v1 = mvert[mloop[0].v].co;
                v2 = mvert[mloop[1].v].co;
index 2b5bc88431581be8ce1daf31306e7f8485659363..b78529f51b4eddba355d3feca65e3417f2d7150a 100644 (file)
@@ -214,7 +214,7 @@ static void curves_apply_threaded(int width, int height, unsigned char *rect, fl
                                curvemapping_evaluate_premulRGBF(curve_mapping, result, pixel);
 
                                if (mask_rect_float) {
-                                       float *m = mask_rect_float + pixel_index;
+                                       const float *m = mask_rect_float + pixel_index;
 
                                        pixel[0] = pixel[0] * (1.0f - m[0]) + result[0] * m[0];
                                        pixel[1] = pixel[1] * (1.0f - m[1]) + result[1] * m[1];
@@ -454,7 +454,7 @@ static void brightcontrast_apply_threaded(int width, int height, unsigned char *
                                        v = a * i + b;
 
                                        if (mask_rect_float) {
-                                               float *m = mask_rect_float + pixel_index;
+                                               const float *m = mask_rect_float + pixel_index;
 
                                                pixel[c] = pixel[c] * (1.0f - m[c]) + v * m[c];
                                        }
@@ -518,7 +518,7 @@ static void maskmodifier_apply_threaded(int width, int height, unsigned char *re
                        else if (rect_float) {
                                int c;
                                float *pixel = rect_float + pixel_index;
-                               float *mask_pixel = mask_rect_float + pixel_index;
+                               const float *mask_pixel = mask_rect_float + pixel_index;
                                float mask = min_fff(mask_pixel[0], mask_pixel[1], mask_pixel[2]);
 
                                /* float buffers are premultiplied, so need to premul color
index d3b6e810b5531bd5480a5db7cbc41a28228704e5..ed95a0a37cdeaf5d3544053a27ca9d4b89ca6b62 100644 (file)
@@ -1767,8 +1767,8 @@ static void color_balance_byte_float(StripColorBalance *cb_, unsigned char *rect
 static void color_balance_float_float(StripColorBalance *cb_, float *rect_float, float *mask_rect_float, int width, int height, float mul)
 {
        float *p = rect_float;
-       float *e = rect_float + width * 4 * height;
-       float *m = mask_rect_float;
+       const float *e = rect_float + width * 4 * height;
+       const float *m = mask_rect_float;
        StripColorBalance cb = calc_cb(cb_);
 
        while (p < e) {
@@ -2415,7 +2415,7 @@ static ImBuf *seq_render_mask(const SeqRenderData *context, Mask *mask, float nr
 
        if (make_float) {
                /* pixels */
-               float *fp_src;
+               const float *fp_src;
                float *fp_dst;
 
                ibuf = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rectfloat);
@@ -2433,7 +2433,7 @@ static ImBuf *seq_render_mask(const SeqRenderData *context, Mask *mask, float nr
        }
        else {
                /* pixels */
-               float *fp_src;
+               const float *fp_src;
                unsigned char *ub_dst;
 
                ibuf = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rect);
index b906ff2b09177639c855e1b92488041ffeb2391e..65a1fa848676a4d442230dee36b63e81c844a6f3 100644 (file)
@@ -70,7 +70,7 @@ bSound *sound_new_file(struct Main *bmain, const char *filename)
        bSound *sound = NULL;
 
        char str[FILE_MAX];
-       char *path;
+       const char *path;
 
        size_t len;
 
index c34fe32296a7d2fc20a7be8e8057f24fe37007c6..b6d7e8922c46ad69770d0e6c97c040a4a2b708c6 100644 (file)
@@ -1367,7 +1367,7 @@ char *txt_to_buf(Text *text)
 int txt_find_string(Text *text, const char *findstr, int wrap, int match_case)
 {
        TextLine *tl, *startl;
-       char *s = NULL;
+       const char *s = NULL;
 
        if (!text || !text->curl || !text->sell) return 0;
        
@@ -2537,7 +2537,7 @@ void txt_backspace_char(Text *text)
        }
        else { /* Just backspacing a char */
                size_t c_len = 0;
-               char *prev = BLI_str_prev_char_utf8(text->curl->line + text->curc);
+               const char *prev = BLI_str_prev_char_utf8(text->curl->line + text->curc);
                c = BLI_str_utf8_as_unicode_and_size(prev, &c_len);
                
                /* source and destination overlap, don't use memcpy() */
@@ -2574,7 +2574,7 @@ static void txt_convert_tab_to_spaces(Text *text)
         * is added so that the indention of the line is the right width (i.e. aligned
         * to multiples of TXT_TABSIZE)
         */
-       char *sb = &tab_to_spaces[text->curc % TXT_TABSIZE];
+       const char *sb = &tab_to_spaces[text->curc % TXT_TABSIZE];
        txt_insert_buf(text, sb);
 }
 
index 6a05014385dc7d8695362e80ea0ad5b6456b7202..de6424f3145ef317d3f4531971dbaa8eaa96d136 100644 (file)
@@ -680,7 +680,7 @@ int bUnit_ReplaceString(char *str, int len_max, const char *str_prev, double sca
         * */
        {
                char *str_found = str;
-               char *ch = str;
+               const char *ch = str;
 
                while ((str_found = strchr(str_found, SEP_CHR))) {