diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-04-20 20:49:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-04-20 20:49:02 +0400 |
commit | 46b40e112b075a9a5a9d26e089f8e28c20257f19 (patch) | |
tree | aa12733862ecdf0abb93f8deb56bd389f1ae997d | |
parent | 106d41699aaa94ed8917c44c6f18a71f8a25e7a3 (diff) |
skip checks in statvis_calc_thickness(). also remove paranoid NULL checks in smallhash.c
-rw-r--r-- | source/blender/blenkernel/intern/editderivedmesh.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/smallhash.c | 20 |
2 files changed, 7 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index cd4844fbc68..fcc2d7b0ed0 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -1684,7 +1684,7 @@ static void statvis_calc_thickness( #define FACE_RAY_TEST_ANGLE \ f_hit = BKE_bmbvh_ray_cast(bmtree, ray_co, ray_no, \ &dist, NULL, NULL); \ - if (f_hit) { \ + if (f_hit && dist < face_dists[index]) { \ float angle_fac = fabsf(dot_v3v3(ltri[0]->f->no, f_hit->no)); \ angle_fac = 1.0f - angle_fac; \ angle_fac = angle_fac * angle_fac * angle_fac; \ diff --git a/source/blender/blenlib/intern/smallhash.c b/source/blender/blenlib/intern/smallhash.c index 64bb503fa3c..c24b495bfb6 100644 --- a/source/blender/blenlib/intern/smallhash.c +++ b/source/blender/blenlib/intern/smallhash.c @@ -43,6 +43,10 @@ #define SMHASH_CELL_UNUSED ((void *)0x7FFFFFFF) #define SMHASH_CELL_FREE ((void *)0x7FFFFFFD) +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wstrict-overflow" +#endif + BLI_INLINE int smhash_nonzero(const int n) { return n + !n; @@ -83,10 +87,6 @@ void BLI_smallhash_init(SmallHash *hash) /*NOTE: does *not* free *hash itself! only the direct data!*/ void BLI_smallhash_release(SmallHash *hash) { - if (hash == NULL) { - return; - } - if (hash->table != hash->stacktable) { MEM_freeN(hash->table); } @@ -181,10 +181,6 @@ void *BLI_smallhash_lookup(SmallHash *hash, uintptr_t key) h = ABS((int)key); - if (hash->table == NULL) { - return NULL; - } - while ((hash->table[h % hash->size].key != key) || (hash->table[h % hash->size].val == SMHASH_CELL_UNUSED)) { @@ -209,10 +205,6 @@ int BLI_smallhash_haskey(SmallHash *hash, uintptr_t key) int h = ABS((int)key); int hoff = 1; - if (hash->table == NULL) { - return 0; - } - while ((hash->table[h % hash->size].key != key) || (hash->table[h % hash->size].val == SMHASH_CELL_UNUSED)) { @@ -234,8 +226,8 @@ int BLI_smallhash_count(SmallHash *hash) void *BLI_smallhash_iternext(SmallHashIter *iter, uintptr_t *key) { while (iter->i < iter->hash->size) { - if ( (iter->hash->table[iter->i].val != SMHASH_CELL_UNUSED) && - (iter->hash->table[iter->i].val != SMHASH_CELL_FREE)) + if ((iter->hash->table[iter->i].val != SMHASH_CELL_UNUSED) && + (iter->hash->table[iter->i].val != SMHASH_CELL_FREE)) { if (key) { *key = iter->hash->table[iter->i].key; |