diff options
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_smallhash.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_ghash.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_heap.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_memarena.c | 17 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_mempool.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/edgehash.c | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/smallhash.c | 9 |
7 files changed, 35 insertions, 23 deletions
diff --git a/source/blender/blenlib/BLI_smallhash.h b/source/blender/blenlib/BLI_smallhash.h index b6acc06159a..275599a612c 100644 --- a/source/blender/blenlib/BLI_smallhash.h +++ b/source/blender/blenlib/BLI_smallhash.h @@ -56,7 +56,7 @@ typedef struct SmallHash { typedef struct { SmallHash *hash; - int i; + unsigned int i; } SmallHashIter; #ifdef __GNUC__ diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 1b585b940e4..78b91c7ef5a 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -44,10 +44,10 @@ #ifdef __GNUC__ # 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 +# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 /* gcc4.6+ only */ +# pragma GCC diagnostic error "-Wsign-compare" +# pragma GCC diagnostic error "-Wconversion" +# endif #endif const unsigned int hashsizes[] = { diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c index 8b849753df7..16005ce6617 100644 --- a/source/blender/blenlib/intern/BLI_heap.c +++ b/source/blender/blenlib/intern/BLI_heap.c @@ -41,10 +41,10 @@ #ifdef __GNUC__ # 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 +# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 /* gcc4.6+ only */ +# pragma GCC diagnostic error "-Wsign-compare" +# pragma GCC diagnostic error "-Wconversion" +# endif #endif /***/ diff --git a/source/blender/blenlib/intern/BLI_memarena.c b/source/blender/blenlib/intern/BLI_memarena.c index b6b5b600ab1..ef10cb805ad 100644 --- a/source/blender/blenlib/intern/BLI_memarena.c +++ b/source/blender/blenlib/intern/BLI_memarena.c @@ -35,6 +35,14 @@ #include "BLI_memarena.h" #include "BLI_linklist.h" +#ifdef __GNUC__ +# 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 + struct MemArena { unsigned char *curbuf; int bufsize, cursize; @@ -79,7 +87,7 @@ void BLI_memarena_free(MemArena *ma) } /* amt must be power of two */ -#define PADUP(num, amt) ((num + (amt - 1)) & ~(amt - 1)) +#define PADUP(num, amt) (((num) + ((amt) - 1)) & ~((amt) - 1)) void *BLI_memarena_alloc(MemArena *ma, int size) { @@ -99,15 +107,15 @@ void *BLI_memarena_alloc(MemArena *ma, int size) ma->cursize = ma->bufsize; if (ma->use_calloc) - ma->curbuf = MEM_callocN(ma->cursize, ma->name); + ma->curbuf = MEM_callocN((size_t)ma->cursize, ma->name); else - ma->curbuf = MEM_mallocN(ma->cursize, ma->name); + ma->curbuf = MEM_mallocN((size_t)ma->cursize, ma->name); BLI_linklist_prepend(&ma->bufs, ma->curbuf); /* align alloc'ed memory (needed if align > 8) */ tmp = (unsigned char *)PADUP( (intptr_t) ma->curbuf, ma->align); - ma->cursize -= (tmp - ma->curbuf); + ma->cursize -= (int)(tmp - ma->curbuf); ma->curbuf = tmp; } @@ -117,4 +125,3 @@ void *BLI_memarena_alloc(MemArena *ma, int size) return ptr; } - diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index 59372534340..87179a93e83 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -45,10 +45,10 @@ #ifdef __GNUC__ # 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 +# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 /* gcc4.6+ only */ +# pragma GCC diagnostic error "-Wsign-compare" +# pragma GCC diagnostic error "-Wconversion" +# endif #endif /* note: copied from BLO_blend_defs.h, don't use here because we're in BLI */ diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c index 3c153cc5998..68eab5f60e7 100644 --- a/source/blender/blenlib/intern/edgehash.c +++ b/source/blender/blenlib/intern/edgehash.c @@ -42,8 +42,11 @@ #include "BLI_mempool.h" #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 /**************inlined code************/ @@ -265,4 +268,3 @@ bool BLI_edgehashIterator_isDone(EdgeHashIterator *ehi) { return (ehi->curEntry == NULL); } - 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__); |