Minor improvements

This commit is contained in:
SirLynix
2023-12-04 00:22:36 +01:00
parent f7f31431cb
commit 6059f608c0
3 changed files with 4 additions and 6 deletions

View File

@@ -5,6 +5,7 @@
#include <Nazara/Core/Posix/DynLibImpl.hpp>
#include <NazaraUtils/Algorithm.hpp>
#include <dlfcn.h>
#include <bit>
#include <cstring>
#include <Nazara/Core/Debug.hpp>
@@ -26,11 +27,7 @@ namespace Nz
static_assert(sizeof(DynLibFunc) == sizeof(void*));
// poor man's std::bit_cast
DynLibFunc funcPtr;
std::memcpy(&funcPtr, &ptr, sizeof(funcPtr));
return funcPtr;
return std::bit_cast<DynLibFunc>(ptr);
}
bool DynLibImpl::Load(const std::filesystem::path& libraryPath, std::string* errorMessage)

View File

@@ -87,7 +87,7 @@ namespace Nz::GL
if (func && wrapErrorHandling)
{
if (std::strcmp(funcName, "glGetError") != 0) //< Prevent infinite recursion
if constexpr (FuncIndex != UnderlyingCast(FunctionIndex::glGetError)) //< Prevent infinite recursion
{
using Wrapper = GLWrapper<FuncType, FuncIndex, FuncType>;
func = Wrapper::WrapErrorHandling();