Fixed ISO C99 compatibility

SDL now builds with gcc 7.2 with the following command line options:
-Wall -pedantic-errors -Wno-deprecated-declarations -Wno-overlength-strings --std=c99
This commit is contained in:
Sam Lantinga
2018-01-30 18:08:34 -08:00
parent e1d85985b2
commit 90e72bf4e2
40 changed files with 176 additions and 196 deletions

View File

@@ -151,11 +151,11 @@ LoadLibSampleRate(void)
return SDL_FALSE;
}
SRC_src_new = (SRC_STATE* (*)(int converter_type, int channels, int *error))SDL_LoadFunction(SRC_lib, "src_new");
SRC_src_process = (int (*)(SRC_STATE *state, SRC_DATA *data))SDL_LoadFunction(SRC_lib, "src_process");
SRC_src_reset = (int(*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_reset");
SRC_src_delete = (SRC_STATE* (*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_delete");
SRC_src_strerror = (const char* (*)(int error))SDL_LoadFunction(SRC_lib, "src_strerror");
*(void **)&SRC_src_new = SDL_LoadFunction(SRC_lib, "src_new");
*(void **)&SRC_src_process = SDL_LoadFunction(SRC_lib, "src_process");
*(void **)&SRC_src_reset = SDL_LoadFunction(SRC_lib, "src_reset");
*(void **)&SRC_src_delete = SDL_LoadFunction(SRC_lib, "src_delete");
*(void **)&SRC_src_strerror = SDL_LoadFunction(SRC_lib, "src_strerror");
if (!SRC_src_new || !SRC_src_process || !SRC_src_reset || !SRC_src_delete || !SRC_src_strerror) {
SDL_UnloadObject(SRC_lib);

View File

@@ -74,7 +74,7 @@ DSOUND_Load(void)
} else {
/* Now make sure we have DirectX 8 or better... */
#define DSOUNDLOAD(f) { \
p##f = (fn##f) SDL_LoadFunction(DSoundDLL, #f); \
*(void**)&p##f = SDL_LoadFunction(DSoundDLL, #f); \
if (!p##f) loaded = 0; \
}
loaded = 1; /* will reset if necessary. */

View File

@@ -256,8 +256,8 @@ WASAPI_PlatformInit(void)
libavrt = LoadLibraryW(L"avrt.dll"); /* this library is available in Vista and later. No WinXP, so have to LoadLibrary to use it for now! */
if (libavrt) {
pAvSetMmThreadCharacteristicsW = (pfnAvSetMmThreadCharacteristicsW) GetProcAddress(libavrt, "AvSetMmThreadCharacteristicsW");
pAvRevertMmThreadCharacteristics = (pfnAvRevertMmThreadCharacteristics) GetProcAddress(libavrt, "AvRevertMmThreadCharacteristics");
*(void **)&pAvSetMmThreadCharacteristicsW = GetProcAddress(libavrt, "AvSetMmThreadCharacteristicsW");
*(void **)&pAvRevertMmThreadCharacteristics = GetProcAddress(libavrt, "AvRevertMmThreadCharacteristics");
}
return 0;