[Bf-blender-cvs] [83220ab] master: Cycles: Use size_t for aligned allocator

Sergey Sharybin noreply at git.blender.org
Thu Feb 19 18:19:59 CET 2015


Commit: 83220ab7fb9af6a34b30cdcb0ba9394e710d418b
Author: Sergey Sharybin
Date:   Thu Feb 19 22:17:42 2015 +0500
Branches: master
https://developer.blender.org/rB83220ab7fb9af6a34b30cdcb0ba9394e710d418b

Cycles: Use size_t for aligned allocator

Seems it got changes by accident to int during guarded allocation work,
causing bad memory allocations.

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

M	intern/cycles/util/util_aligned_malloc.cpp
M	intern/cycles/util/util_aligned_malloc.h

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

diff --git a/intern/cycles/util/util_aligned_malloc.cpp b/intern/cycles/util/util_aligned_malloc.cpp
index 3e825ce..9ff857e 100644
--- a/intern/cycles/util/util_aligned_malloc.cpp
+++ b/intern/cycles/util/util_aligned_malloc.cpp
@@ -40,7 +40,7 @@
 
 CCL_NAMESPACE_BEGIN
 
-void *util_aligned_malloc(int size, int alignment)
+void *util_aligned_malloc(size_t size, int alignment)
 {
 #ifdef WITH_BLENDER_GUARDEDALLOC
 	return MEM_mallocN_aligned(size, alignment, "Cycles Aligned Alloc");
diff --git a/intern/cycles/util/util_aligned_malloc.h b/intern/cycles/util/util_aligned_malloc.h
index 28c240a..ecc0f28 100644
--- a/intern/cycles/util/util_aligned_malloc.h
+++ b/intern/cycles/util/util_aligned_malloc.h
@@ -17,10 +17,12 @@
 #ifndef __UTIL_ALIGNED_MALLOC_H__
 #define __UTIL_ALIGNED_MALLOC_H__
 
+#include "util_types.h"
+
 CCL_NAMESPACE_BEGIN
 
 /* Allocate block of size bytes at least aligned to a given value. */
-void *util_aligned_malloc(int size, int alignment);
+void *util_aligned_malloc(size_t size, int alignment);
 
 /* Free memory allocated by util_aligned_malloc. */
 void util_aligned_free(void *ptr);




More information about the Bf-blender-cvs mailing list