Random code cleanup

This commit is contained in:
SirLynix
2023-06-05 18:05:16 +02:00
parent 1a55b550fb
commit b9c1559d97
10 changed files with 31 additions and 46 deletions

View File

@@ -3,7 +3,6 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/Win32/DynLibImpl.hpp>
#include <Nazara/Core/DynLib.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/StringExt.hpp>
#include <memory>
@@ -11,11 +10,6 @@
namespace Nz
{
DynLibImpl::DynLibImpl(DynLib*) :
m_handle(nullptr)
{
}
DynLibImpl::~DynLibImpl()
{
if (m_handle)
@@ -24,7 +18,7 @@ namespace Nz
DynLibFunc DynLibImpl::GetSymbol(const char* symbol, std::string* errorMessage) const
{
DynLibFunc sym = reinterpret_cast<DynLibFunc>(GetProcAddress(m_handle, symbol));
DynLibFunc sym = reinterpret_cast<DynLibFunc>(::GetProcAddress(m_handle, symbol));
if (!sym)
*errorMessage = Error::GetLastSystemError();

View File

@@ -9,27 +9,28 @@
#include <NazaraUtils/Prerequisites.hpp>
#include <Nazara/Core/DynLib.hpp>
#include <NazaraUtils/MovablePtr.hpp>
#include <filesystem>
#include <windows.h>
#include <Windows.h>
namespace Nz
{
class DynLibImpl
{
public:
DynLibImpl(DynLib* m_parent);
DynLibImpl() = default;
DynLibImpl(const DynLibImpl&) = delete;
DynLibImpl(DynLibImpl&&) = delete; ///TODO?
DynLibImpl(DynLibImpl&&) noexcept = default;
~DynLibImpl();
DynLibFunc GetSymbol(const char* symbol, std::string* errorMessage) const;
bool Load(const std::filesystem::path& libraryPath, std::string* errorMessage);
DynLibImpl& operator=(const DynLibImpl&) = delete;
DynLibImpl& operator=(DynLibImpl&&) = delete; ///TODO?
DynLibImpl& operator=(DynLibImpl&&) noexcept = default;
private:
HMODULE m_handle;
MovablePtr<std::remove_pointer_t<HMODULE>> m_handle;
};
}