/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Engine/Foundation/Platform/NoImpl/MemoryMappedFile_NoImpl.h
56 строк
1 KB
C-Core
Re-enabled security relevant warnings (#1339)
25 июн 2024, 12:03
Не верифицирован
25 июн 2024, 12:03
7083663
Код
Авторство
О чём код?
#include <Foundation/FoundationPCH.h> EZ_FOUNDATION_INTERNAL_HEADER #include <Foundation/IO/MemoryMappedFile.h> #include <Foundation/Logging/Log.h> #include <Foundation/Strings/PathUtils.h> struct ezMemoryMappedFileImpl { ezMemoryMappedFile::Mode m_Mode = ezMemoryMappedFile::Mode::None; void* m_pMappedFilePtr = nullptr; ezUInt64 m_uiFileSize = 0; ~ezMemoryMappedFileImpl() {} }; ezMemoryMappedFile::ezMemoryMappedFile() { m_pImpl = EZ_DEFAULT_NEW(ezMemoryMappedFileImpl); } ezMemoryMappedFile::~ezMemoryMappedFile() { Close(); } void ezMemoryMappedFile::Close() { m_pImpl = EZ_DEFAULT_NEW(ezMemoryMappedFileImpl); } ezMemoryMappedFile::Mode ezMemoryMappedFile::GetMode() const { return m_pImpl->m_Mode; } const void* ezMemoryMappedFile::GetReadPointer(ezUInt64 uiOffset /*= 0*/, OffsetBase base /*= OffsetBase::Start*/) const { EZ_IGNORE_UNUSED(uiOffset); EZ_IGNORE_UNUSED(base); EZ_ASSERT_DEBUG(m_pImpl->m_Mode >= Mode::ReadOnly, "File must be opened with read access before accessing it for reading."); return m_pImpl->m_pMappedFilePtr; } void* ezMemoryMappedFile::GetWritePointer(ezUInt64 uiOffset /*= 0*/, OffsetBase base /*= OffsetBase::Start*/) { EZ_IGNORE_UNUSED(uiOffset); EZ_IGNORE_UNUSED(base); EZ_ASSERT_DEBUG(m_pImpl->m_Mode >= Mode::ReadWrite, "File must be opened with read/write access before accessing it for writing."); return m_pImpl->m_pMappedFilePtr; } ezUInt64 ezMemoryMappedFile::GetFileSize() const { return m_pImpl->m_uiFileSize; }