Skip to content

Commit

Permalink
Buildfixes for latest SDL3 stdinc
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Aug 30, 2024
1 parent a3b8bf7 commit 0cf2bce
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/FAudio_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "FAPOBase.h"
#include <stdarg.h>


#ifdef FAUDIO_WIN32_PLATFORM
#include <stdio.h>
#include <stdlib.h>
Expand All @@ -40,6 +41,9 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

#define NO_MEMCPY_OVERRIDE
#define NO_MEMSET_OVERRIDE

#define FAudio_malloc malloc
#define FAudio_realloc realloc
#define FAudio_free free
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/XNA_Song.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/stb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0cf2bce

Please sign in to comment.