code cleanup: incorrect sized array args, remove some redundant code.
authorCampbell Barton <ideasman42@gmail.com>
Sun, 17 Mar 2013 10:26:23 +0000 (10:26 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 17 Mar 2013 10:26:23 +0000 (10:26 +0000)
24 files changed:
intern/rigidbody/rb_bullet_api.cpp
source/blender/blenkernel/BKE_ccg.h
source/blender/blenkernel/intern/anim.c
source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/bmfont.c
source/blender/blenkernel/intern/mball.c
source/blender/blenkernel/intern/navmesh_conversion.c
source/blender/blenkernel/intern/pbvh_bmesh.c
source/blender/blenloader/intern/readfile.c
source/blender/bmesh/intern/bmesh_core.c
source/blender/bmesh/operators/bmo_smooth_laplacian.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/mesh/editmesh_rip.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sculpt_paint/sculpt_undo.c
source/blender/editors/space_clip/tracking_ops.c
source/blender/imbuf/intern/bmp.c
source/blender/imbuf/intern/jpeg.c
source/blender/imbuf/intern/rectop.c
source/blender/modifiers/intern/MOD_array.c
source/blender/modifiers/intern/MOD_laplaciansmooth.c
source/blender/python/bmesh/bmesh_py_types.h
source/tests/bl_run_operators.py

index a628c35..e9e5e2a 100644 (file)
@@ -57,7 +57,7 @@ subject to the following restrictions:
  */
 
 #include <stdio.h>
+
 #include "RBI_api.h"
 
 #include "btBulletDynamicsCommon.h"
@@ -112,7 +112,7 @@ static inline void copy_v3_btvec3(float vec[3], const btVector3 &btvec)
        vec[1] = (float)btvec[1];
        vec[2] = (float)btvec[2];
 }
-static inline void copy_quat_btquat(float quat[3], const btQuaternion &btquat)
+static inline void copy_quat_btquat(float quat[4], const btQuaternion &btquat)
 {
        quat[0] = btquat.getW();
        quat[1] = btquat.getX();
index 6d39d42..fb62115 100644 (file)
@@ -126,7 +126,7 @@ BLI_INLINE CCGElem *CCG_elem_offset(const CCGKey *key, CCGElem *elem, int offset
 
 BLI_INLINE CCGElem *CCG_grid_elem(const CCGKey *key, CCGElem *elem, int x, int y)
 {
-       BLI_assert(x < key->grid_size && y < key->grid_size);
+//     BLI_assert(x < key->grid_size && y < key->grid_size);
        return CCG_elem_offset(key, elem, (y * key->grid_size + x));
 }
 
index 4eb26e8..ddb4cc4 100644 (file)
@@ -1154,10 +1154,6 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
                                        if (ob->type != OB_MBALL) ob->flag |= OB_DONE;  /* doesnt render */
 
                                        for (a = 0, mp = mpoly; a < totface; a++, mp++) {
-                                               int mv1;
-                                               int mv2;
-                                               int mv3;
-                                               /* int mv4; */ /* UNUSED */
                                                float *v1;
                                                float *v2;
                                                float *v3;
@@ -1171,9 +1167,9 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
                                                }
                                                else {
                                                        BKE_mesh_calc_poly_normal(mp, mloop + mp->loopstart, mvert, f_no);
-                                                       v1 = mvert[(mv1 = loopstart[0].v)].co;
-                                                       v2 = mvert[(mv2 = loopstart[1].v)].co;
-                                                       v3 = mvert[(mv3 = loopstart[2].v)].co;
+                                                       v1 = mvert[loopstart[0].v].co;
+                                                       v2 = mvert[loopstart[1].v].co;
+                                                       v3 = mvert[loopstart[2].v].co;
                                                }
 
                                                /* translation */
index 480814a..ffe6a31 100644 (file)
@@ -1596,7 +1596,7 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
                }
                else if (pchan->bone->layer & layer_protected) {
                        ListBase proxylocal_constraints = {NULL, NULL};
-                       bPoseChannel pchanw = {NULL};
+                       bPoseChannel pchanw;
                        
                        /* copy posechannel to temp, but restore important pointers */
                        pchanw = *pchanp;
index e82a2a5..78da4f5 100644 (file)
@@ -198,7 +198,7 @@ void detectBitmapFont(ImBuf *ibuf)
                                                        readBitmapFontVersion0(ibuf, rect, 4);
                                                }
                                                else {
-                                                       printf("detectBitmapFont :Unsupported version %d\n", version);
+                                                       printf("detectBitmapFont :Unsupported version %d\n", (int)version);
                                                }
 
                                                /* on succes ibuf->userdata points to the bitmapfont */
index 9250409..7228413 100644 (file)
@@ -1501,7 +1501,7 @@ static void add_cube(PROCESS *mbproc, int i, int j, int k, int count)
 static void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
 {
        MetaElem *ml;
-       float f = 0.0f;
+       float f;
 
        ml = G_mb.mainb[a];
        f = 1.0f - (mb->thresh / ml->s);
index 3bf5f86..1d662ae 100644 (file)
@@ -436,7 +436,7 @@ int buildNavMeshDataByDerivedMesh(DerivedMesh *dm, int *vertsPerPoly,
                                   unsigned short **polys, int **dtrisToPolysMap,
                                   int **dtrisToTrisMap, int **trisToFacesMap)
 {
-       int res = 1;
+       int res;
        int ntris = 0, *recastData = NULL;
        unsigned short *tris = NULL;
 
index bb4a376..0ca73b9 100644 (file)
@@ -496,7 +496,7 @@ static int check_mask_half(BMesh *bm, BMVert *v)
        const float *mask;
 
        mask = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_PAINT_MASK);
-       return ((*mask) < 0.5);
+       return ((*mask) < 0.5f);
 }
 
 static void edge_queue_insert(EdgeQueue *q, BLI_mempool *pool, BMEdge *e,
index 335e80e..928ec17 100644 (file)
@@ -378,7 +378,7 @@ static void *oldnewmap_liblookup(OldNewMap *onm, void *addr, void *lib)
 
                for (i = 0, entry = onm->entries; i < nentries; i++, entry++) {
                        if (entry->old == addr) {
-                               ID *id = id = entry->newp;
+                               ID *id = entry->newp;
                                if (id && (!lib || id->lib)) {
                                        return id;
                                }
index cb37e6c..a11d45a 100644 (file)
@@ -1700,8 +1700,8 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool check_e
 BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
 {
        BMLoop *l_iter, *l_f1 = NULL, *l_f2 = NULL;
-       int newlen = 0, i, f1len = 0, f2len = 0, edok;
-
+       int newlen = 0, i, f1len = 0, f2len = 0;
+       bool edok;
        /* can't join a face to itself */
        if (f1 == f2) {
                return NULL;
index 311fe64..6b91d5f 100644 (file)
@@ -84,7 +84,6 @@ static void delete_void_pointer(void *data)
 {
        if (data) {
                MEM_freeN(data);
-               data = NULL;
        }
 }
 
index 3ca400e..12a6343 100644 (file)
@@ -3154,9 +3154,6 @@ static bool ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data,
                BLI_rctf_clamp_pt_v(&but->rect, data->ungrab_mval);
        }
 #endif
-       if (is_horizontal == false) {
-               mx_fl = my_fl;
-       }
        /* done correcting mouse */
 
 
index 103c9a0..eeddd8c 100644 (file)
@@ -2140,10 +2140,10 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
 
                uiLayoutRow(layout, TRUE);
                uiBlockSetNFunc(block, curvemap_buttons_update, MEM_dupallocN(cb), cumap);
-               bt = uiDefButF(block, NUM, 0, "X", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y,
-                              &cmp->x, bounds.xmin, bounds.xmax, 1, 5, "");
-               bt = uiDefButF(block, NUM, 0, "Y", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y,
-                              &cmp->y, bounds.ymin, bounds.ymax, 1, 5, "");
+               uiDefButF(block, NUM, 0, "X", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y,
+                         &cmp->x, bounds.xmin, bounds.xmax, 1, 5, "");
+               uiDefButF(block, NUM, 0, "Y", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y,
+                         &cmp->y, bounds.ymin, bounds.ymax, 1, 5, "");
        }
 
        /* black/white levels */
index 533ae26..8198e08 100644 (file)
@@ -499,16 +499,9 @@ static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *u
                                BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter);
                        }
                        else {
-                               if (v_shared == f_verts[0]) {
-                                       BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter); l_iter = l_iter->next;
-                                       BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter); l_iter = l_iter->next;
-                                       BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[1]->e, l_iter), l_iter);
-                               }
-                               else {
-                                       BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter); l_iter = l_iter->next;
-                                       BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter); l_iter = l_iter->next;
-                                       BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[1]->e, l_iter), l_iter);
-                               }
+                               BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter); l_iter = l_iter->next;
+                               BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter); l_iter = l_iter->next;
+                               BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[1]->e, l_iter), l_iter);
                        }
 
                }
index e38b92a..2bdcda1 100644 (file)
@@ -1478,7 +1478,7 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv,
        MDeformWeight *ndw;
        MDeformWeight *odw;
 
-       float changed_sum = 0.0f;
+       // float changed_sum = 0.0f;  // UNUSED
 
        char *change_status;
 
@@ -1507,7 +1507,7 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv,
                }
                else if (ndw->weight != odw->weight) { /* changed groups are handled here */
                        totchange += ndw->weight - odw->weight;
-                       changed_sum += ndw->weight;
+                       // changed_sum += ndw->weight;  // UNUSED
                        change_status[i] = 2; /* was altered already */
                        total_changed++;
                } /* unchanged, unlocked bone groups are handled here */
index fafb537..2cc09ea 100644 (file)
@@ -379,7 +379,6 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
        DerivedMesh *dm;
        SculptSession *ss = ob->sculpt;
        SculptUndoNode *unode;
-       MultiresModifierData *mmd;
        int update = FALSE, rebuild = FALSE;
        int need_mask = FALSE;
 
@@ -450,7 +449,7 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
                BKE_pbvh_search_callback(ss->pbvh, NULL, NULL, update_cb, &rebuild);
                BKE_pbvh_update(ss->pbvh, PBVH_UpdateBB | PBVH_UpdateOriginalBB | PBVH_UpdateRedraw, NULL);
 
-               if ((mmd = sculpt_multires_active(scene, ob))) {
+               if (sculpt_multires_active(scene, ob)) {
                        if (rebuild)
                                multires_mark_as_modified(ob, MULTIRES_HIDDEN_MODIFIED);
                        else
index 817d380..a51315d 100644 (file)
@@ -3258,7 +3258,7 @@ static int clean_tracks_exec(bContext *C, wmOperator *op)
                next = track->next;
 
                if ((track->flag & TRACK_HIDDEN) == 0 && (track->flag & TRACK_LOCKED) == 0) {
-                       int ok = 1;
+                       bool ok;
 
                        ok = (is_track_clean(track, frames, action == TRACKING_CLEAN_DELETE_SEGMENT)) &&
                             (error == 0.0f || (track->flag & TRACK_HAS_BUNDLE) == 0  || track->error < error);
index d850153..856124a 100644 (file)
@@ -61,6 +61,7 @@ typedef struct BMPINFOHEADER {
        unsigned int    biClrImportant;
 } BMPINFOHEADER;
 
+#if 0
 typedef struct BMPHEADER {
        unsigned short biType;
        unsigned int biSize;
@@ -68,6 +69,7 @@ typedef struct BMPHEADER {
        unsigned short biRes2;
        unsigned int biOffBits;
 } BMPHEADER;
+#endif
 
 #define BMP_FILEHEADER_SIZE 14
 
index 05495b9..bf0e418 100644 (file)
@@ -121,10 +121,12 @@ static void jpeg_error(j_common_ptr cinfo)
  * INPUT HANDLER FROM MEMORY
  *---------------------------------------------------------- */
 
+#if 0
 typedef struct {
        unsigned char  *buffer;
        int             filled;
 } buffer_struct;
+#endif
 
 typedef struct {
        struct jpeg_source_mgr pub; /* public fields */
index 3a79ea0..8b60d1a 100644 (file)
@@ -121,7 +121,7 @@ static void blend_color_darken(char cp[3], const char cp1[3], const char cp2[3],
        }
 }
 
-static void blend_color_erase_alpha(char cp[3], const char cp1[3], const char cp2[3], const int fac)
+static void blend_color_erase_alpha(char cp[4], const char cp1[4], const char cp2[4], const int fac)
 {
        int temp = (cp1[3] - fac * cp2[3] / 255);
 
@@ -131,7 +131,7 @@ static void blend_color_erase_alpha(char cp[3], const char cp1[3], const char cp
        cp[3] = (temp < 0) ? 0 : temp;
 }
 
-static void blend_color_add_alpha(char cp[3], const char cp1[3], const char cp2[3], const int fac)
+static void blend_color_add_alpha(char cp[4], const char cp1[4], const char cp2[4], const int fac)
 {
        int temp = (cp1[3] + fac * cp2[3] / 255);
 
@@ -251,7 +251,7 @@ static void blend_color_darken_float(float cp[3], const float cp1[3], const floa
                blend_color_mix_float(cp, cp1, cp2, fac);
 }
 
-static void blend_color_erase_alpha_float(float cp[3], const float cp1[3], const float cp2[3], const float fac)
+static void blend_color_erase_alpha_float(float cp[4], const float cp1[4], const float cp2[4], const float fac)
 {
        cp[0] = cp1[0];
        cp[1] = cp1[1];
@@ -261,7 +261,7 @@ static void blend_color_erase_alpha_float(float cp[3], const float cp1[3], const
        if (cp[3] < 0.0f) cp[3] = 0.0f;
 }
 
-static void blend_color_add_alpha_float(float cp[3], const float cp1[3], const float cp2[3], const float fac)
+static void blend_color_add_alpha_float(float cp[4], const float cp1[4], const float cp2[4], const float fac)
 {
        cp[0] = cp1[0];
        cp[1] = cp1[1];
index 3ca2c36..bc65b27 100644 (file)
@@ -338,7 +338,6 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
        /* offset matrix */
        float offset[4][4];
        float final_offset[4][4];
-       float tmp_mat[4][4];
        float length = amd->length;
        int count = amd->count, maxVerts;
        int *indexMap = NULL;
@@ -418,6 +417,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
        unit_m4(final_offset);
 
        for (j = 0; j < count - 1; j++) {
+               float tmp_mat[4][4];
                mult_m4_m4m4(tmp_mat, offset, final_offset);
                copy_m4_m4(final_offset, tmp_mat);
        }
index b2ca1b0..743cd1a 100644 (file)
@@ -100,7 +100,6 @@ static void delete_void_pointer(void *data)
 {
        if (data) {
                MEM_freeN(data);
-               data = NULL;
        }
 }
 
@@ -242,7 +241,7 @@ static CustomDataMask required_data_mask(Object *UNUSED(ob), ModifierData *md)
 
 static float average_area_quad_v3(float *v1, float *v2, float *v3, float *v4)
 {
-       float areaq = 0.0f;
+       float areaq;
        areaq = area_tri_v3(v1, v2, v3) + area_tri_v3(v1, v2, v4) + area_tri_v3(v1, v3, v4);
        return areaq / 2.0f;
 }
index 8e6d04e..f02b94b 100644 (file)
@@ -168,7 +168,7 @@ int       BPy_BMElem_CheckHType(PyTypeObject *type, const char htype);
 char     *BPy_BMElem_StringFromHType_ex(const char htype, char ret[32]);
 char     *BPy_BMElem_StringFromHType(const char htype);
 
-void bpy_bm_generic_invalidate(BPy_BMGeneric *self);
+// void bpy_bm_generic_invalidate(BPy_BMGeneric *self);
 int  bpy_bm_generic_valid_check(BPy_BMGeneric *self);
 int  bpy_bm_generic_valid_check_source(BPy_BMGeneric *self, BMesh *bm_source, const char *error_prefix);
 
index 0202f7c..e6f1cc5 100644 (file)
@@ -139,7 +139,9 @@ if USE_ATTRSET:
 
             if subvalue == parent:
                 continue
-
+            # grr, recursive!
+            if prop == "point_caches":
+                continue
             subvalue_type = type(subvalue)
             yield value, prop, subvalue_type
             subvalue_id = getattr(subvalue, "id_data", Ellipsis)