Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.

I think this also fixes the bug relating to non-latin characters in filenames, since UNICODE wasn't defined in SDL_rwops.c
This commit is contained in:
Sam Lantinga
2011-01-24 21:20:30 -08:00
parent e1e1122ee0
commit 01fa14dc42
37 changed files with 274 additions and 273 deletions

View File

@@ -27,8 +27,7 @@
#if defined(__WIN32__) && !defined(_WIN32_WCE)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "../core/windows/SDL_windows.h"
/* Note this isn't thread-safe! */
@@ -41,12 +40,12 @@ SDL_setenv(const char *name, const char *value, int overwrite)
{
if (!overwrite) {
char ch = 0;
const size_t len = GetEnvironmentVariable(name, &ch, sizeof (ch));
const size_t len = GetEnvironmentVariableA(name, &ch, sizeof (ch));
if (len > 0) {
return 0; /* asked not to overwrite existing value. */
}
}
if (!SetEnvironmentVariable(name, *value ? value : NULL)) {
if (!SetEnvironmentVariableA(name, *value ? value : NULL)) {
return -1;
}
return 0;
@@ -59,7 +58,7 @@ SDL_getenv(const char *name)
size_t bufferlen;
bufferlen =
GetEnvironmentVariable(name, SDL_envmem, (DWORD) SDL_envmemlen);
GetEnvironmentVariableA(name, SDL_envmem, (DWORD) SDL_envmemlen);
if (bufferlen == 0) {
return NULL;
}
@@ -70,7 +69,7 @@ SDL_getenv(const char *name)
}
SDL_envmem = newmem;
SDL_envmemlen = bufferlen;
GetEnvironmentVariable(name, SDL_envmem, (DWORD) SDL_envmemlen);
GetEnvironmentVariableA(name, SDL_envmem, (DWORD) SDL_envmemlen);
}
return SDL_envmem;
}