diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-20 18:50:50 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-20 18:50:50 +0400 |
commit | f414d2980a70bd544d1ab2a560859a5622cba9e5 (patch) | |
tree | 8e327922ede6579a394c0e8f22080c6e42f88c8a /source | |
parent | 160dd1dc3b31e68c82b92fe69a8438e999c2ed35 (diff) |
code cleanup: remove some paranoid checks which would have crashed anyway earlier on.
Also some minor formatting.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/CCGSubSurf.c | 21 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 3 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_decimate_collapse.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 12 |
5 files changed, 25 insertions, 18 deletions
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index bbda6f8a292..2079c783898 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -1416,18 +1416,25 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss, float no[3]; for (S = 0; S < f->numVerts; S++) { - for (y = 0; y < gridSize - 1; y++) - for (x = 0; x < gridSize - 1; x++) + for (y = 0; y < gridSize - 1; y++) { + for (x = 0; x < gridSize - 1; x++) { NormZero(FACE_getIFNo(f, lvl, S, x, y)); + } + } - if (FACE_getEdges(f)[(S - 1 + f->numVerts) % f->numVerts]->flags & Edge_eEffected) - for (x = 0; x < gridSize - 1; x++) + if (FACE_getEdges(f)[(S - 1 + f->numVerts) % f->numVerts]->flags & Edge_eEffected) { + for (x = 0; x < gridSize - 1; x++) { NormZero(FACE_getIFNo(f, lvl, S, x, gridSize - 1)); - if (FACE_getEdges(f)[S]->flags & Edge_eEffected) - for (y = 0; y < gridSize - 1; y++) + } + } + if (FACE_getEdges(f)[S]->flags & Edge_eEffected) { + for (y = 0; y < gridSize - 1; y++) { NormZero(FACE_getIFNo(f, lvl, S, gridSize - 1, y)); - if (FACE_getVerts(f)[S]->flags & Vert_eEffected) + } + } + if (FACE_getVerts(f)[S]->flags & Vert_eEffected) { NormZero(FACE_getIFNo(f, lvl, S, gridSize - 1, gridSize - 1)); + } } for (S = 0; S < f->numVerts; S++) { diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 97948683e22..2f21e588b85 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -308,8 +308,9 @@ static void ptcache_particle_read(int index, void *psys_v, void **data, float cf pa->lifetime = times[2]; } - if (boid) + if (boid) { PTCACHE_DATA_TO(data, BPHYS_DATA_BOIDS, 0, &boid->data); + } /* determine velocity from previous location */ if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_VELOCITY]) { diff --git a/source/blender/bmesh/tools/bmesh_decimate_collapse.c b/source/blender/bmesh/tools/bmesh_decimate_collapse.c index 57a35d2f6a9..e94bb9f5417 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_collapse.c +++ b/source/blender/bmesh/tools/bmesh_decimate_collapse.c @@ -517,7 +517,7 @@ static void bm_edge_collapse_loop_customdata(BMesh *bm, BMLoop *l, BMVert *v_cle const int type = bm->ldata.layers[i].type; void *cd_src[2] = {(char *)src[0] + offset, (char *)src[1] + offset}; - void *cd_iter = (char *)l_iter->head.data + offset;; + void *cd_iter = (char *)l_iter->head.data + offset; /* detect seams */ if (CustomData_data_equals(type, cd_src[0], cd_iter)) { diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 719179c35b8..5b04bdb8ee7 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2598,9 +2598,8 @@ static int set_vpaint(bContext *C, wmOperator *op) /* toggle */ BKE_paint_init(&vp->paint, PAINT_CURSOR_VERTEX_PAINT); } - if (me) - /* update modifier stack for mapping requirements */ - DAG_id_tag_update(&me->id, 0); + /* update modifier stack for mapping requirements */ + DAG_id_tag_update(&me->id, 0); WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index eb4b5d5eed9..aecc114f328 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1505,7 +1505,7 @@ int RNA_property_path_from_ID_check(PointerRNA *ptr, PropertyRNA *prop) static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop) { - int is_rna = (prop->magic == RNA_MAGIC); + const bool is_rna = (prop->magic == RNA_MAGIC); prop = rna_ensure_property(prop); if (is_rna) { @@ -1585,19 +1585,19 @@ static ListBase rna_updates_cache = {NULL, NULL}; void RNA_property_update_cache_add(PointerRNA *ptr, PropertyRNA *prop) { + const bool is_rna = (prop->magic == RNA_MAGIC); tRnaUpdateCacheElem *uce = NULL; UpdateFunc fn = NULL; LinkData *ld; - short is_rna = (prop->magic == RNA_MAGIC); /* sanity check */ - if (ELEM(NULL, ptr, prop)) + if (NULL == ptr) return; prop = rna_ensure_property(prop); /* we can only handle update calls with no context args for now (makes animsys updates easier) */ - if ((is_rna == 0) || (prop->update == NULL) || (prop->flag & PROP_CONTEXT_UPDATE)) + if ((is_rna == false) || (prop->update == NULL) || (prop->flag & PROP_CONTEXT_UPDATE)) return; fn = prop->update; @@ -4210,11 +4210,11 @@ char *RNA_path_from_ID_to_struct(PointerRNA *ptr) char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop) { - int is_rna = (prop->magic == RNA_MAGIC); + const bool is_rna = (prop->magic == RNA_MAGIC); const char *propname; char *ptrpath, *path; - if (!ptr->id.data || !ptr->data || !prop) + if (!ptr->id.data || !ptr->data) return NULL; /* path from ID to the struct holding this property */ |