From 1fb980e7df3587982e9117c409f4c1e5af50c90a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 22 Jun 2013 20:20:06 +0000 Subject: reduce sign conversion comparisons for smallhash and tweak warnings elsewhere. --- source/blender/blenlib/intern/smallhash.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source/blender/blenlib/intern/smallhash.c') diff --git a/source/blender/blenlib/intern/smallhash.c b/source/blender/blenlib/intern/smallhash.c index 600433fe1b1..d255b4a9af6 100644 --- a/source/blender/blenlib/intern/smallhash.c +++ b/source/blender/blenlib/intern/smallhash.c @@ -44,8 +44,11 @@ #define SMHASH_CELL_FREE ((void *)0x7FFFFFFD) #ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wstrict-overflow" # pragma GCC diagnostic error "-Wsign-conversion" +# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 /* gcc4.6+ only */ +# pragma GCC diagnostic error "-Wsign-compare" +# pragma GCC diagnostic error "-Wconversion" +# endif #endif /* typically this re-assigns 'h' */ @@ -59,7 +62,7 @@ extern unsigned int hashsizes[]; void BLI_smallhash_init(SmallHash *hash) { - int i; + unsigned int i; memset(hash, 0, sizeof(*hash)); @@ -90,7 +93,7 @@ void BLI_smallhash_insert(SmallHash *hash, uintptr_t key, void *item) if (hash->size < hash->used * 3) { unsigned int newsize = hashsizes[++hash->curhash]; SmallHashEntry *tmp; - int i = 0; + unsigned int i = 0; if (hash->table != hash->stacktable || newsize > SMSTACKSIZE) { tmp = MEM_callocN(sizeof(*hash->table) * newsize, __func__); -- cgit v1.2.3