diff --git a/src/FAudio_internal.h b/src/FAudio_internal.h index 283e33409..ed255f1d5 100644 --- a/src/FAudio_internal.h +++ b/src/FAudio_internal.h @@ -28,6 +28,7 @@ #include "FAPOBase.h" #include + #ifdef FAUDIO_WIN32_PLATFORM #include #include @@ -40,6 +41,9 @@ #define WIN32_LEAN_AND_MEAN #include +#define NO_MEMCPY_OVERRIDE +#define NO_MEMSET_OVERRIDE + #define FAudio_malloc malloc #define FAudio_realloc realloc #define FAudio_free free @@ -138,6 +142,14 @@ extern void FAudio_Log(char const *msg); #define FAudio_swap64BE(x) SDL_SwapBE64(x) #endif +/* SDL3 allows memcpy/memset for compiler optimization reasons */ +#ifndef SDL_SLOW_MEMCPY +#define NO_MEMCPY_OVERRIDE +#endif +#ifndef SDL_SLOW_MEMSET +#define NO_MEMSET_OVERRIDE +#endif + #define FAudio_malloc SDL_malloc #define FAudio_realloc SDL_realloc #define FAudio_free SDL_free diff --git a/src/XNA_Song.c b/src/XNA_Song.c index a8755833c..f6de26c2d 100644 --- a/src/XNA_Song.c +++ b/src/XNA_Song.c @@ -33,14 +33,18 @@ #define malloc FAudio_malloc #define realloc FAudio_realloc #define free FAudio_free +#ifndef NO_MEMSET_OVERRIDE #ifdef memset /* Thanks, Apple! */ #undef memset #endif #define memset FAudio_memset +#endif /* NO_MEMSET_OVERRIDE */ +#ifndef NO_MEMCPY_OVERRIDE #ifdef memcpy /* Thanks, Apple! */ #undef memcpy #endif #define memcpy FAudio_memcpy +#endif /* NO_MEMCPY_OVERRIDE */ #define memcmp FAudio_memcmp #define pow FAudio_pow diff --git a/src/stb.h b/src/stb.h index 5f1724a73..5665cc48b 100644 --- a/src/stb.h +++ b/src/stb.h @@ -207,7 +207,7 @@ CREDITS * binding various stdlib functions stb.h uses to FAudio's stdlib. * -flibit */ -#ifndef FAUDIO_WIN32_PLATFORM +#ifndef NO_MEMCPY_OVERRIDE #ifdef memcpy /* Thanks Apple! */ #undef memcpy #endif