diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-06-20 23:39:29 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-06-20 23:39:29 +0400 |
commit | 2efea8cf03f9bcb923d969b9ba4c905503e306dc (patch) | |
tree | 0179a6aa6b050d825ec8132cbbe8e982bcc89f95 | |
parent | 6a269e2a8e327fdc81f158b4e24c8909837f013c (diff) |
reduce sign comparisons for ghash and add more strict warnings for gcc.
-rw-r--r-- | source/blender/blenlib/BLI_ghash.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_ghash.c | 10 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_heap.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_mempool.c | 6 |
4 files changed, 13 insertions, 7 deletions
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index 07ab6f3869e..930715b4bc6 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -60,7 +60,7 @@ typedef struct GHash { typedef struct GHashIterator { GHash *gh; - int curBucket; + unsigned int curBucket; struct Entry *curEntry; } GHashIterator; diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 749c008d8c3..5cd5a904996 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -44,6 +44,8 @@ #ifdef __GNUC__ # pragma GCC diagnostic error "-Wsign-conversion" +# pragma GCC diagnostic error "-Wsign-compare" +# pragma GCC diagnostic error "-Wconversion" #endif const unsigned int hashsizes[] = { @@ -152,7 +154,7 @@ bool BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFr void BLI_ghash_clear(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp) { - int i; + unsigned int i; if (keyfreefp || valfreefp) { for (i = 0; i < gh->nbuckets; i++) { @@ -220,7 +222,7 @@ bool BLI_ghash_haskey(GHash *gh, const void *key) void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp) { - int i; + unsigned int i; if (keyfreefp || valfreefp) { for (i = 0; i < gh->nbuckets; i++) { @@ -252,7 +254,7 @@ GHashIterator *BLI_ghashIterator_new(GHash *gh) GHashIterator *ghi = MEM_mallocN(sizeof(*ghi), "ghash iterator"); ghi->gh = gh; ghi->curEntry = NULL; - ghi->curBucket = -1; + ghi->curBucket = (unsigned int)-1; while (!ghi->curEntry) { ghi->curBucket++; if (ghi->curBucket == ghi->gh->nbuckets) @@ -265,7 +267,7 @@ void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh) { ghi->gh = gh; ghi->curEntry = NULL; - ghi->curBucket = -1; + ghi->curBucket = (unsigned int)-1; while (!ghi->curEntry) { ghi->curBucket++; if (ghi->curBucket == ghi->gh->nbuckets) diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c index c62c79b492f..93c99fed8e2 100644 --- a/source/blender/blenlib/intern/BLI_heap.c +++ b/source/blender/blenlib/intern/BLI_heap.c @@ -41,6 +41,8 @@ #ifdef __GNUC__ # pragma GCC diagnostic error "-Wsign-conversion" +# pragma GCC diagnostic error "-Wsign-compare" +# pragma GCC diagnostic error "-Wconversion" #endif /***/ diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index 136ecc244fa..ff9a5abfaa1 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -45,6 +45,8 @@ #ifdef __GNUC__ # pragma GCC diagnostic error "-Wsign-conversion" +# pragma GCC diagnostic error "-Wsign-compare" +# pragma GCC diagnostic error "-Wconversion" #endif /* note: copied from BLO_blend_defs.h, don't use here because we're in BLI */ @@ -102,8 +104,8 @@ BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag) } /* set the elem size */ - if (esize < MEMPOOL_ELEM_SIZE_MIN) { - esize = MEMPOOL_ELEM_SIZE_MIN; + if (esize < (int)MEMPOOL_ELEM_SIZE_MIN) { + esize = (int)MEMPOOL_ELEM_SIZE_MIN; } if (flag & BLI_MEMPOOL_ALLOW_ITER) { |