diff options
author | Reinier de Blois <rddeblois@gmail.com> | 2016-04-05 21:34:00 +0300 |
---|---|---|
committer | Porteries Tristan <republicthunderbolt9@gmail.com> | 2016-04-05 22:38:52 +0300 |
commit | 176538f61360fb54f0e4ce209fc7d7632bce1401 (patch) | |
tree | fdc3534cd6b8e2e1376925a9700e8d20c50734d4 /extern/recastnavigation/Recast/Source/RecastAlloc.cpp | |
parent | 214e384fc4ac0924fcad26f5eb64fc9e4c24b8a8 (diff) |
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
Diffstat (limited to 'extern/recastnavigation/Recast/Source/RecastAlloc.cpp')
-rw-r--r-- | extern/recastnavigation/Recast/Source/RecastAlloc.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
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 <string.h> #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; } |