From e5ba8f1e4d771a0921b1be0dc1e66a2263b26a44 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Wed, 17 Aug 2016 12:50:43 +0200 Subject: Core/MMAPs: Update recast Update recast to https://github.com/recastnavigation/recastnavigation/commit/64385e9ed0822427bca5814d03a3f4c4d7a6db9f (cherry picked from commit 1d7013e0e2758b1468a488dd17e3f5c5ce5f265d) # Conflicts: # dep/PackageList.txt --- dep/recastnavigation/Recast/Source/RecastAlloc.cpp | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'dep/recastnavigation/Recast/Source/RecastAlloc.cpp') diff --git a/dep/recastnavigation/Recast/Source/RecastAlloc.cpp b/dep/recastnavigation/Recast/Source/RecastAlloc.cpp index b5ec1516146..453b5fa6a60 100644 --- a/dep/recastnavigation/Recast/Source/RecastAlloc.cpp +++ b/dep/recastnavigation/Recast/Source/RecastAlloc.cpp @@ -19,8 +19,9 @@ #include #include #include "RecastAlloc.h" +#include "RecastAssert.h" -static void *rcAllocDefault(int size, rcAllocHint) +static void *rcAllocDefault(size_t size, rcAllocHint) { return malloc(size); } @@ -41,7 +42,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 +73,14 @@ 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); + rcAssert(newData); + if (m_size && newData) memcpy(newData, m_data, m_size*sizeof(int)); + rcFree(m_data); + m_data = newData; } -- cgit v1.2.3