Minor improvements
This commit is contained in:
parent
f7f31431cb
commit
6059f608c0
|
|
@ -5,6 +5,7 @@
|
||||||
#include <Nazara/Core/Posix/DynLibImpl.hpp>
|
#include <Nazara/Core/Posix/DynLibImpl.hpp>
|
||||||
#include <NazaraUtils/Algorithm.hpp>
|
#include <NazaraUtils/Algorithm.hpp>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#include <bit>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <Nazara/Core/Debug.hpp>
|
#include <Nazara/Core/Debug.hpp>
|
||||||
|
|
||||||
|
|
@ -26,11 +27,7 @@ namespace Nz
|
||||||
|
|
||||||
static_assert(sizeof(DynLibFunc) == sizeof(void*));
|
static_assert(sizeof(DynLibFunc) == sizeof(void*));
|
||||||
|
|
||||||
// poor man's std::bit_cast
|
return std::bit_cast<DynLibFunc>(ptr);
|
||||||
DynLibFunc funcPtr;
|
|
||||||
std::memcpy(&funcPtr, &ptr, sizeof(funcPtr));
|
|
||||||
|
|
||||||
return funcPtr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynLibImpl::Load(const std::filesystem::path& libraryPath, std::string* errorMessage)
|
bool DynLibImpl::Load(const std::filesystem::path& libraryPath, std::string* errorMessage)
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ namespace Nz::GL
|
||||||
|
|
||||||
if (func && wrapErrorHandling)
|
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>;
|
using Wrapper = GLWrapper<FuncType, FuncIndex, FuncType>;
|
||||||
func = Wrapper::WrapErrorHandling();
|
func = Wrapper::WrapErrorHandling();
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ SCENARIO("String", "[CORE][STRING]")
|
||||||
CHECK(Nz::MatchPattern("Lynix", "?????"));
|
CHECK(Nz::MatchPattern("Lynix", "?????"));
|
||||||
CHECK(Nz::MatchPattern("Lynix", "*Lynix"));
|
CHECK(Nz::MatchPattern("Lynix", "*Lynix"));
|
||||||
CHECK(Nz::MatchPattern("Lynox", "*Lyn?x"));
|
CHECK(Nz::MatchPattern("Lynox", "*Lyn?x"));
|
||||||
|
CHECK_FALSE(Nz::MatchPattern("Lynix", "Lynixx"));
|
||||||
CHECK_FALSE(Nz::MatchPattern("Lynix", "Ly"));
|
CHECK_FALSE(Nz::MatchPattern("Lynix", "Ly"));
|
||||||
CHECK_FALSE(Nz::MatchPattern("", "?"));
|
CHECK_FALSE(Nz::MatchPattern("", "?"));
|
||||||
CHECK_FALSE(Nz::MatchPattern("", "*"));
|
CHECK_FALSE(Nz::MatchPattern("", "*"));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue