From 31caa22d309d85131480d10917f0868c9331fbf2 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 9 Dec 2013 13:30:35 -0500 Subject: [PATCH] Patched stdlib changes to compile on Windows. --- src/atomic/SDL_atomic.c | 4 +++- src/stdlib/SDL_getenv.c | 3 +-- src/stdlib/SDL_string.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/atomic/SDL_atomic.c b/src/atomic/SDL_atomic.c index 60d6f511bee09..265d0bd520657 100644 --- a/src/atomic/SDL_atomic.c +++ b/src/atomic/SDL_atomic.c @@ -152,7 +152,9 @@ SDL_AtomicSet(SDL_atomic_t *a, int v) void* SDL_AtomicSetPtr(void **a, void *v) { -#ifdef HAVE_MSC_ATOMICS +#if defined(HAVE_MSC_ATOMICS) && (_M_IX86) + return (void *) _InterlockedExchange((long *)a, (long) v); +#elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86) return _InterlockedExchangePointer(a, v); #elif defined(HAVE_GCC_ATOMICS) return __sync_lock_test_and_set(a, v); diff --git a/src/stdlib/SDL_getenv.c b/src/stdlib/SDL_getenv.c index 10fa7c5c1bdd4..55b93e39ec830 100644 --- a/src/stdlib/SDL_getenv.c +++ b/src/stdlib/SDL_getenv.c @@ -26,13 +26,12 @@ #include "SDL_stdinc.h" -#if !defined(SDL_setenv) && defined(__WIN32__) +#if defined(__WIN32__) && (!defined(HAVE_SETENV) || !defined(HAVE_GETENV)) /* Note this isn't thread-safe! */ static char *SDL_envmem = NULL; /* Ugh, memory leak */ static size_t SDL_envmemlen = 0; #endif - /* Put a variable into the environment */ #if defined(HAVE_SETENV) int diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c index d291f38280da3..be07ebb45b1b8 100644 --- a/src/stdlib/SDL_string.c +++ b/src/stdlib/SDL_string.c @@ -986,7 +986,7 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) } #else int -SDL_vsscanf(const char *text, const char *fmt, ...) +SDL_vsscanf(const char *text, const char *fmt, va_list ap) { int retval = 0;