[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57620] trunk/blender/source/blender/ blenlib: reduce sign comparisons for ghash and add more strict warnings for gcc.

Campbell Barton ideasman42 at gmail.com
Thu Jun 20 21:39:29 CEST 2013


Revision: 57620
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57620
Author:   campbellbarton
Date:     2013-06-20 19:39:29 +0000 (Thu, 20 Jun 2013)
Log Message:
-----------
reduce sign comparisons for ghash and add more strict warnings for gcc.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/BLI_ghash.h
    trunk/blender/source/blender/blenlib/intern/BLI_ghash.c
    trunk/blender/source/blender/blenlib/intern/BLI_heap.c
    trunk/blender/source/blender/blenlib/intern/BLI_mempool.c

Modified: trunk/blender/source/blender/blenlib/BLI_ghash.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_ghash.h	2013-06-20 19:19:11 UTC (rev 57619)
+++ trunk/blender/source/blender/blenlib/BLI_ghash.h	2013-06-20 19:39:29 UTC (rev 57620)
@@ -60,7 +60,7 @@
 
 typedef struct GHashIterator {
 	GHash *gh;
-	int curBucket;
+	unsigned int curBucket;
 	struct Entry *curEntry;
 } GHashIterator;
 

Modified: trunk/blender/source/blender/blenlib/intern/BLI_ghash.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_ghash.c	2013-06-20 19:19:11 UTC (rev 57619)
+++ trunk/blender/source/blender/blenlib/intern/BLI_ghash.c	2013-06-20 19:39:29 UTC (rev 57620)
@@ -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 @@
 
 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 @@
 
 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 *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 @@
 {
 	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)

Modified: trunk/blender/source/blender/blenlib/intern/BLI_heap.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_heap.c	2013-06-20 19:19:11 UTC (rev 57619)
+++ trunk/blender/source/blender/blenlib/intern/BLI_heap.c	2013-06-20 19:39:29 UTC (rev 57620)
@@ -41,6 +41,8 @@
 
 #ifdef __GNUC__
 #  pragma GCC diagnostic error "-Wsign-conversion"
+#  pragma GCC diagnostic error "-Wsign-compare"
+#  pragma GCC diagnostic error "-Wconversion"
 #endif
 
 /***/

Modified: trunk/blender/source/blender/blenlib/intern/BLI_mempool.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_mempool.c	2013-06-20 19:19:11 UTC (rev 57619)
+++ trunk/blender/source/blender/blenlib/intern/BLI_mempool.c	2013-06-20 19:39:29 UTC (rev 57620)
@@ -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 @@
 	}
 
 	/* 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) {




More information about the Bf-blender-cvs mailing list