mirror of https://github.com/encounter/SDL.git
Fixed bug 3702 - Clear error messages of SDL_LoadObject for optional libraries
Simon Hug Some code in SDL loads libraries with SDL_LoadObject to get more information or use newer APIs. SDL_LoadObject may fail, set an error message and SDL will continue with some fallback code. Since SDL will overwrite the error or exit the function with a return value that indicates success, the error form SDL_LoadObject for the optional stuff might as well be cleared right away.
This commit is contained in:
parent
6e1b11bae4
commit
96305832bc
|
@ -150,6 +150,7 @@ LoadLibSampleRate(void)
|
||||||
SDL_assert(SRC_lib == NULL);
|
SDL_assert(SRC_lib == NULL);
|
||||||
SRC_lib = SDL_LoadObject(SDL_LIBSAMPLERATE_DYNAMIC);
|
SRC_lib = SDL_LoadObject(SDL_LIBSAMPLERATE_DYNAMIC);
|
||||||
if (!SRC_lib) {
|
if (!SRC_lib) {
|
||||||
|
SDL_ClearError();
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,9 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (SDL_strcasecmp(d3dcompiler, "none") != 0) {
|
if (SDL_strcasecmp(d3dcompiler, "none") != 0) {
|
||||||
SDL_LoadObject(d3dcompiler);
|
if (SDL_LoadObject(d3dcompiler) == NULL) {
|
||||||
|
SDL_ClearError();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -351,6 +351,7 @@ IME_Init(SDL_VideoData *videodata, HWND hwnd)
|
||||||
videodata->ime_himm32 = SDL_LoadObject("imm32.dll");
|
videodata->ime_himm32 = SDL_LoadObject("imm32.dll");
|
||||||
if (!videodata->ime_himm32) {
|
if (!videodata->ime_himm32) {
|
||||||
videodata->ime_available = SDL_FALSE;
|
videodata->ime_available = SDL_FALSE;
|
||||||
|
SDL_ClearError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
videodata->ImmLockIMC = (LPINPUTCONTEXT2 (WINAPI *)(HIMC))SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMC");
|
videodata->ImmLockIMC = (LPINPUTCONTEXT2 (WINAPI *)(HIMC))SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMC");
|
||||||
|
|
|
@ -113,11 +113,15 @@ WIN_CreateDevice(int devindex)
|
||||||
data->CloseTouchInputHandle = (BOOL (WINAPI *)(HTOUCHINPUT)) SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle");
|
data->CloseTouchInputHandle = (BOOL (WINAPI *)(HTOUCHINPUT)) SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle");
|
||||||
data->GetTouchInputInfo = (BOOL (WINAPI *)(HTOUCHINPUT, UINT, PTOUCHINPUT, int)) SDL_LoadFunction(data->userDLL, "GetTouchInputInfo");
|
data->GetTouchInputInfo = (BOOL (WINAPI *)(HTOUCHINPUT, UINT, PTOUCHINPUT, int)) SDL_LoadFunction(data->userDLL, "GetTouchInputInfo");
|
||||||
data->RegisterTouchWindow = (BOOL (WINAPI *)(HWND, ULONG)) SDL_LoadFunction(data->userDLL, "RegisterTouchWindow");
|
data->RegisterTouchWindow = (BOOL (WINAPI *)(HWND, ULONG)) SDL_LoadFunction(data->userDLL, "RegisterTouchWindow");
|
||||||
|
} else {
|
||||||
|
SDL_ClearError();
|
||||||
}
|
}
|
||||||
|
|
||||||
data->shcoreDLL = SDL_LoadObject("SHCORE.DLL");
|
data->shcoreDLL = SDL_LoadObject("SHCORE.DLL");
|
||||||
if (data->shcoreDLL) {
|
if (data->shcoreDLL) {
|
||||||
data->GetDpiForMonitor = (HRESULT (WINAPI *)(HMONITOR, MONITOR_DPI_TYPE, UINT *, UINT *)) SDL_LoadFunction(data->shcoreDLL, "GetDpiForMonitor");
|
data->GetDpiForMonitor = (HRESULT (WINAPI *)(HMONITOR, MONITOR_DPI_TYPE, UINT *, UINT *)) SDL_LoadFunction(data->shcoreDLL, "GetDpiForMonitor");
|
||||||
|
} else {
|
||||||
|
SDL_ClearError();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
|
|
Loading…
Reference in New Issue