From a4b10749f74eaafc6517340f7c060d953f7d902d Mon Sep 17 00:00:00 2001 From: SirLynix Date: Tue, 14 Nov 2023 15:40:48 +0100 Subject: [PATCH] C++20 fixes --- documentation/generator/src/main.cpp | 2 +- examples/MeshInfos/main.cpp | 2 +- src/Nazara/Core/Posix/DynLibImpl.cpp | 3 ++- src/Nazara/Core/Posix/FileImpl.cpp | 3 ++- tests/UnitTests/Engine/Math/EulerAnglesTest.cpp | 4 ++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/documentation/generator/src/main.cpp b/documentation/generator/src/main.cpp index 872ba9294..825c61105 100644 --- a/documentation/generator/src/main.cpp +++ b/documentation/generator/src/main.cpp @@ -124,7 +124,7 @@ int main() for (auto&& headerFile : std::filesystem::recursive_directory_iterator(entry.path())) { - if (!headerFile.is_regular_file() || headerFile.path().extension().generic_u8string() != ".hpp") + if (!headerFile.is_regular_file() || Nz::PathToString(headerFile.path().extension()) != ".hpp") continue; std::string filepath = Nz::PathToString(headerFile.path()); diff --git a/examples/MeshInfos/main.cpp b/examples/MeshInfos/main.cpp index 782747e0d..45cc08225 100644 --- a/examples/MeshInfos/main.cpp +++ b/examples/MeshInfos/main.cpp @@ -33,7 +33,7 @@ int main() continue; const std::filesystem::path& filePath = p.path(); - if (Nz::MeshLoader::IsExtensionSupported(filePath.extension().generic_u8string())) // L'extension est-elle supportée par le MeshLoader ? + if (Nz::MeshLoader::IsExtensionSupported(Nz::PathToString(filePath.extension()))) // L'extension est-elle supportée par le MeshLoader ? models.push_back(filePath); } diff --git a/src/Nazara/Core/Posix/DynLibImpl.cpp b/src/Nazara/Core/Posix/DynLibImpl.cpp index 0cdf5f507..3ceb72fa7 100644 --- a/src/Nazara/Core/Posix/DynLibImpl.cpp +++ b/src/Nazara/Core/Posix/DynLibImpl.cpp @@ -3,6 +3,7 @@ // For conditions of distribution and use, see copyright notice in Config.hpp #include +#include #include #include #include @@ -35,7 +36,7 @@ namespace Nz bool DynLibImpl::Load(const std::filesystem::path& libraryPath, std::string* errorMessage) { dlerror(); // Clear error flag - m_handle = dlopen(libraryPath.generic_u8string().data(), RTLD_LAZY | RTLD_GLOBAL); + m_handle = dlopen(Nz::PathToString(libraryPath).data(), RTLD_LAZY | RTLD_GLOBAL); if (!m_handle) { diff --git a/src/Nazara/Core/Posix/FileImpl.cpp b/src/Nazara/Core/Posix/FileImpl.cpp index bb07a5efa..f62cfa5c9 100644 --- a/src/Nazara/Core/Posix/FileImpl.cpp +++ b/src/Nazara/Core/Posix/FileImpl.cpp @@ -3,6 +3,7 @@ // For conditions of distribution and use, see copyright notice in Config.hpp #include +#include #include #include #include @@ -78,7 +79,7 @@ namespace Nz if (mode & OpenMode::Truncate) flags |= O_TRUNC; - int fileDescriptor = Open_def(filePath.generic_u8string().data(), flags, permissions); + int fileDescriptor = Open_def(Nz::PathToString(filePath).data(), flags, permissions); if (fileDescriptor == -1) { NazaraErrorFmt("failed to open \"{0}\": {1}", filePath, Error::GetLastSystemError()); diff --git a/tests/UnitTests/Engine/Math/EulerAnglesTest.cpp b/tests/UnitTests/Engine/Math/EulerAnglesTest.cpp index 157049b70..b9867c0e8 100644 --- a/tests/UnitTests/Engine/Math/EulerAnglesTest.cpp +++ b/tests/UnitTests/Engine/Math/EulerAnglesTest.cpp @@ -38,8 +38,8 @@ SCENARIO("EulerAngles", "[MATH][EULERANGLES]") THEN("They are the same") { CHECK(firstZero.ToQuaternion() == secondZero.ToQuaternion()); - CHECK(firstZero.ToQuaternion() == Nz::EulerAnglesf(Nz::Quaternionf(1.f, 0.f, 0.f, 0.f))); - CHECK(secondZero.ToQuaternion() == Nz::EulerAnglesf(Nz::Quaternionf(1.f, 0.f, 0.f, 0.f))); + CHECK(firstZero.ToQuaternion() == Nz::Quaternionf(1.f, 0.f, 0.f, 0.f)); + CHECK(secondZero.ToQuaternion() == Nz::Quaternionf(1.f, 0.f, 0.f, 0.f)); } } }