From 1a916117fadc5d86bcf634b89193d06b9225d849 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Wed, 1 Apr 2020 17:23:22 -0400 Subject: [PATCH] A few more stdlib macros for Apple --- mojoshader_internal.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/mojoshader_internal.h b/mojoshader_internal.h index 7dacbcf7..5ae4385c 100644 --- a/mojoshader_internal.h +++ b/mojoshader_internal.h @@ -29,7 +29,13 @@ typedef Uint64 uint64; /* stdio.h */ #define sscanf SDL_sscanf +#ifdef snprintf +#undef snprintf +#endif #define snprintf SDL_snprintf +#ifdef vsnprintf +#undef vsnprintf +#endif #define vsnprintf SDL_vsnprintf /* math.h */ @@ -47,8 +53,6 @@ typedef Uint64 uint64; /* string.h */ #define strchr SDL_strchr #define strcmp SDL_strcmp -/* TODO: Move MojoShader away from strcpy! This len is awful! */ -#define strcpy(dst, src) SDL_strlcpy(dst, src, SDL_strlen(src) + 1) #define strlen SDL_strlen #define strncmp SDL_strncmp #define strstr SDL_strstr @@ -63,9 +67,14 @@ typedef Uint64 uint64; #endif #define memcpy SDL_memcpy #ifdef memset -#define memset +#undef memset #endif #define memset SDL_memset +#ifdef strcpy +#undef strcpy +#endif +/* TODO: Move MojoShader away from strcpy! This len is awful! */ +#define strcpy(dst, src) SDL_strlcpy(dst, src, SDL_strlen(src) + 1) #else /* MOJOSHADER_USE_SDL_STDLIB */ #include #include