From 176538f61360fb54f0e4ce209fc7d7632bce1401 Mon Sep 17 00:00:00 2001 From: Reinier de Blois Date: Tue, 5 Apr 2016 20:34:00 +0200 Subject: Update Recast version to 1.5.0 The version of Recast that Blender ships with is from 2009. This patch updates the Recast version to the latest version, 1.5.0. The Detour version remains untouched. Reviewers: campbellbarton, moguri Reviewed By: moguri Projects: #bf_blender Differential Revision: https://developer.blender.org/D1747 --- .../recastnavigation/Recast/Source/RecastAlloc.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'extern/recastnavigation/Recast/Source/RecastAlloc.cpp') diff --git a/extern/recastnavigation/Recast/Source/RecastAlloc.cpp b/extern/recastnavigation/Recast/Source/RecastAlloc.cpp index b5ec1516146..ee1039f2f4f 100644 --- a/extern/recastnavigation/Recast/Source/RecastAlloc.cpp +++ b/extern/recastnavigation/Recast/Source/RecastAlloc.cpp @@ -20,7 +20,7 @@ #include #include "RecastAlloc.h" -static void *rcAllocDefault(int size, rcAllocHint) +static void *rcAllocDefault(size_t size, rcAllocHint) { return malloc(size); } @@ -41,7 +41,7 @@ void rcAllocSetCustom(rcAllocFunc *allocFunc, rcFreeFunc *freeFunc) } /// @see rcAllocSetCustom -void* rcAlloc(int size, rcAllocHint hint) +void* rcAlloc(size_t size, rcAllocHint hint) { return sRecastAllocFunc(size, hint); } @@ -72,17 +72,13 @@ void rcFree(void* ptr) /// Using this method ensures the array is at least large enough to hold /// the specified number of elements. This can improve performance by /// avoiding auto-resizing during use. -void rcIntArray::resize(int n) +void rcIntArray::doResize(int n) { - if (n > m_cap) - { - if (!m_cap) m_cap = n; - while (m_cap < n) m_cap *= 2; - int* newData = (int*)rcAlloc(m_cap*sizeof(int), RC_ALLOC_TEMP); - if (m_size && newData) memcpy(newData, m_data, m_size*sizeof(int)); - rcFree(m_data); - m_data = newData; - } - m_size = n; + if (!m_cap) m_cap = n; + while (m_cap < n) m_cap *= 2; + int* newData = (int*)rcAlloc(m_cap*sizeof(int), RC_ALLOC_TEMP); + if (m_size && newData) memcpy(newData, m_data, m_size*sizeof(int)); + rcFree(m_data); + m_data = newData; } -- cgit v1.2.3