Merge commit '852f2a6343518919e5ca8d3c1bbcab9f493e3cd8'
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@ -46,7 +46,7 @@ void *SDL_LoadObject(const char *sofile)
|
||||
|
||||
handle = dlopen(sofile, RTLD_NOW | RTLD_LOCAL);
|
||||
loaderror = dlerror();
|
||||
if (handle == NULL) {
|
||||
if (!handle) {
|
||||
SDL_SetError("Failed loading %s: %s", sofile, loaderror);
|
||||
}
|
||||
return handle;
|
||||
@ -55,7 +55,7 @@ void *SDL_LoadObject(const char *sofile)
|
||||
SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name)
|
||||
{
|
||||
void *symbol = dlsym(handle, name);
|
||||
if (symbol == NULL) {
|
||||
if (!symbol) {
|
||||
/* prepend an underscore for platforms that need that. */
|
||||
SDL_bool isstack;
|
||||
size_t len = SDL_strlen(name) + 1;
|
||||
@ -64,7 +64,7 @@ SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name)
|
||||
SDL_memcpy(&_name[1], name, len);
|
||||
symbol = dlsym(handle, _name);
|
||||
SDL_small_free(_name, isstack);
|
||||
if (symbol == NULL) {
|
||||
if (!symbol) {
|
||||
SDL_SetError("Failed loading %s: %s", name,
|
||||
(const char *)dlerror());
|
||||
}
|
||||
@ -74,7 +74,7 @@ SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name)
|
||||
|
||||
void SDL_UnloadObject(void *handle)
|
||||
{
|
||||
if (handle != NULL) {
|
||||
if (handle) {
|
||||
dlclose(handle);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@ -32,7 +32,7 @@ void *SDL_LoadObject(const char *sofile)
|
||||
void *handle;
|
||||
LPTSTR tstr;
|
||||
|
||||
if (sofile == NULL) {
|
||||
if (!sofile) {
|
||||
SDL_InvalidParamError("sofile");
|
||||
return NULL;
|
||||
}
|
||||
@ -49,7 +49,7 @@ void *SDL_LoadObject(const char *sofile)
|
||||
SDL_free(tstr);
|
||||
|
||||
/* Generate an error message if all loads failed */
|
||||
if (handle == NULL) {
|
||||
if (!handle) {
|
||||
char errbuf[512];
|
||||
SDL_strlcpy(errbuf, "Failed loading ", SDL_arraysize(errbuf));
|
||||
SDL_strlcat(errbuf, sofile, SDL_arraysize(errbuf));
|
||||
@ -61,7 +61,7 @@ void *SDL_LoadObject(const char *sofile)
|
||||
SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name)
|
||||
{
|
||||
void *symbol = (void *)GetProcAddress((HMODULE)handle, name);
|
||||
if (symbol == NULL) {
|
||||
if (!symbol) {
|
||||
char errbuf[512];
|
||||
SDL_strlcpy(errbuf, "Failed loading ", SDL_arraysize(errbuf));
|
||||
SDL_strlcat(errbuf, name, SDL_arraysize(errbuf));
|
||||
@ -72,7 +72,7 @@ SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name)
|
||||
|
||||
void SDL_UnloadObject(void *handle)
|
||||
{
|
||||
if (handle != NULL) {
|
||||
if (handle) {
|
||||
FreeLibrary((HMODULE)handle);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user