mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-07-18 03:24:15 -04:00
Texture2DDecoderNative - Linux/macOS compatibility fix
+ CMakeLists.txt
This commit is contained in:
@ -316,9 +316,16 @@ namespace crnd
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#ifdef _WIN32
|
||||
#include <memory.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#define MALLOC_SIZE _msize
|
||||
#elif __APPLE__
|
||||
#include <cstring>
|
||||
#include <malloc/malloc.h>
|
||||
#define MALLOC_SIZE malloc_size
|
||||
#else // Linux
|
||||
#include <cstring>
|
||||
#include <malloc.h>
|
||||
#define MALLOC_SIZE malloc_usable_size
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
#include <new> // needed for placement new, _msize, _expand
|
||||
@ -2424,11 +2431,7 @@ namespace crnd
|
||||
|
||||
if (pActual_size)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
*pActual_size = p_new ? ::_msize(p_new) : 0;
|
||||
#else
|
||||
*pActual_size = p_new ? malloc_usable_size(p_new) : 0;
|
||||
#endif
|
||||
*pActual_size = p_new ? MALLOC_SIZE(p_new) : 0;
|
||||
}
|
||||
}
|
||||
else if (!size)
|
||||
@ -2460,11 +2463,7 @@ namespace crnd
|
||||
|
||||
if (pActual_size)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
*pActual_size = ::_msize(p_final_block);
|
||||
#else
|
||||
*pActual_size = ::malloc_usable_size(p_final_block);
|
||||
#endif
|
||||
*pActual_size = ::MALLOC_SIZE(p_final_block);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2474,11 +2473,7 @@ namespace crnd
|
||||
static size_t crnd_default_msize(void* p, void* pUser_data)
|
||||
{
|
||||
pUser_data;
|
||||
#ifdef _WIN32
|
||||
return p ? _msize(p) : 0;
|
||||
#else
|
||||
return p ? malloc_usable_size(p) : 0;
|
||||
#endif
|
||||
return p ? MALLOC_SIZE(p) : 0;
|
||||
}
|
||||
|
||||
static crnd_realloc_func g_pRealloc = crnd_default_realloc;
|
||||
|
Reference in New Issue
Block a user