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 <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)

View File

@ -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();

View File

@ -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("", "*"));