Revision: 57656
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57656
Author:   campbellbarton
Date:     2013-06-22 20:20:06 +0000 (Sat, 22 Jun 2013)
Log Message:
-----------
reduce sign conversion comparisons for smallhash and tweak warnings elsewhere.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/BLI_smallhash.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_memarena.c
    trunk/blender/source/blender/blenlib/intern/BLI_mempool.c
    trunk/blender/source/blender/blenlib/intern/edgehash.c
    trunk/blender/source/blender/blenlib/intern/smallhash.c

Modified: trunk/blender/source/blender/blenlib/BLI_smallhash.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_smallhash.h        2013-06-22 
20:00:17 UTC (rev 57655)
+++ trunk/blender/source/blender/blenlib/BLI_smallhash.h        2013-06-22 
20:20:06 UTC (rev 57656)
@@ -56,7 +56,7 @@
 
 typedef struct {
        SmallHash *hash;
-       int i;
+       unsigned int i;
 } SmallHashIter;
 
 #ifdef __GNUC__

Modified: trunk/blender/source/blender/blenlib/intern/BLI_ghash.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_ghash.c     2013-06-22 
20:00:17 UTC (rev 57655)
+++ trunk/blender/source/blender/blenlib/intern/BLI_ghash.c     2013-06-22 
20:20:06 UTC (rev 57656)
@@ -44,11 +44,11 @@
 
 #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"
+#  if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406  /* gcc4.6+ only */
+#    pragma GCC diagnostic error "-Wsign-compare"
+#    pragma GCC diagnostic error "-Wconversion"
+#  endif
 #endif
-#endif
 
 const unsigned int hashsizes[] = {
        5, 11, 17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209, 

Modified: trunk/blender/source/blender/blenlib/intern/BLI_heap.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_heap.c      2013-06-22 
20:00:17 UTC (rev 57655)
+++ trunk/blender/source/blender/blenlib/intern/BLI_heap.c      2013-06-22 
20:20:06 UTC (rev 57656)
@@ -41,11 +41,11 @@
 
 #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"
+#  if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406  /* gcc4.6+ only */
+#    pragma GCC diagnostic error "-Wsign-compare"
+#    pragma GCC diagnostic error "-Wconversion"
+#  endif
 #endif
-#endif
 
 /***/
 

Modified: trunk/blender/source/blender/blenlib/intern/BLI_memarena.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_memarena.c  2013-06-22 
20:00:17 UTC (rev 57655)
+++ trunk/blender/source/blender/blenlib/intern/BLI_memarena.c  2013-06-22 
20:20:06 UTC (rev 57656)
@@ -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 @@
 }
 
 /* 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 @@
                        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 @@
 
        return ptr;
 }
-

Modified: trunk/blender/source/blender/blenlib/intern/BLI_mempool.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_mempool.c   2013-06-22 
20:00:17 UTC (rev 57655)
+++ trunk/blender/source/blender/blenlib/intern/BLI_mempool.c   2013-06-22 
20:20:06 UTC (rev 57656)
@@ -45,11 +45,11 @@
 
 #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"
+#  if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406  /* gcc4.6+ only */
+#    pragma GCC diagnostic error "-Wsign-compare"
+#    pragma GCC diagnostic error "-Wconversion"
+#  endif
 #endif
-#endif
 
 /* note: copied from BLO_blend_defs.h, don't use here because we're in BLI */
 #ifdef __BIG_ENDIAN__

Modified: trunk/blender/source/blender/blenlib/intern/edgehash.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/edgehash.c      2013-06-22 
20:00:17 UTC (rev 57655)
+++ trunk/blender/source/blender/blenlib/intern/edgehash.c      2013-06-22 
20:20:06 UTC (rev 57656)
@@ -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 @@
 {
        return (ehi->curEntry == NULL);
 }
-

Modified: trunk/blender/source/blender/blenlib/intern/smallhash.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/smallhash.c     2013-06-22 
20:00:17 UTC (rev 57655)
+++ trunk/blender/source/blender/blenlib/intern/smallhash.c     2013-06-22 
20:20:06 UTC (rev 57656)
@@ -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 @@
 
 void BLI_smallhash_init(SmallHash *hash)
 {
-       int i;
+       unsigned int i;
 
        memset(hash, 0, sizeof(*hash));
 
@@ -90,7 +93,7 @@
        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__);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to