[Bf-blender-cvs] [fdc3f56234e] master: Cleanup: convert unsigned to signed comparison in assert

Jacques Lucke noreply at git.blender.org
Tue Jul 21 09:03:45 CEST 2020


Commit: fdc3f56234e1bde5ed1d3108501c4d1812da1d7f
Author: Jacques Lucke
Date:   Tue Jul 21 09:03:37 2020 +0200
Branches: master
https://developer.blender.org/rBfdc3f56234e1bde5ed1d3108501c4d1812da1d7f

Cleanup: convert unsigned to signed comparison in assert

Thanks to Campbell for pointing this out.

===================================================================

M	source/blender/blenlib/BLI_allocator.hh

===================================================================

diff --git a/source/blender/blenlib/BLI_allocator.hh b/source/blender/blenlib/BLI_allocator.hh
index d49b98cb33b..47d8156476f 100644
--- a/source/blender/blenlib/BLI_allocator.hh
+++ b/source/blender/blenlib/BLI_allocator.hh
@@ -84,8 +84,8 @@ class RawAllocator {
     void *ptr = malloc(size + alignment + sizeof(MemHead));
     void *used_ptr = (void *)((uintptr_t)POINTER_OFFSET(ptr, alignment + sizeof(MemHead)) &
                               ~((uintptr_t)alignment - 1));
-    int offset = (int)((uintptr_t)used_ptr - (uintptr_t)ptr);
-    BLI_assert((size_t)offset >= sizeof(MemHead));
+    int offset = (int)((intptr_t)used_ptr - (intptr_t)ptr);
+    BLI_assert(offset >= (int)sizeof(MemHead));
     ((MemHead *)used_ptr - 1)->offset = (int)offset;
     return used_ptr;
   }



More information about the Bf-blender-cvs mailing list