reduce sign comparisons for ghash and add more strict warnings for gcc.
This commit is contained in:
@@ -60,7 +60,7 @@ typedef struct GHash {
|
||||
|
||||
typedef struct GHashIterator {
|
||||
GHash *gh;
|
||||
int curBucket;
|
||||
unsigned int curBucket;
|
||||
struct Entry *curEntry;
|
||||
} GHashIterator;
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -41,6 +41,8 @@
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic error "-Wsign-conversion"
|
||||
# pragma GCC diagnostic error "-Wsign-compare"
|
||||
# pragma GCC diagnostic error "-Wconversion"
|
||||
#endif
|
||||
|
||||
/***/
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user