From 35cb6636a16debd6a7a21b7e0a14feabb2da395f Mon Sep 17 00:00:00 2001 From: Jan Laupetin Date: Fri, 2 May 2025 23:26:12 +0200 Subject: [PATCH] fix: linux build --- src/ZoneLoading/Loading/ContentLoaderBase.cpp | 3 +++ src/ZoneLoading/Loading/ContentLoaderBase.h | 4 ++-- src/ZoneLoading/Loading/IHashProvider.h | 1 + src/ZoneLoading/Loading/ILoadingStream.h | 1 + src/ZoneLoading/Loading/Processor/ProcessorAuthedBlocks.cpp | 3 ++- src/ZoneLoading/Loading/Processor/ProcessorCaptureData.cpp | 3 ++- src/ZoneLoading/Loading/Processor/ProcessorXChunks.cpp | 5 +++-- src/ZoneLoading/Loading/Steps/StepVerifyHash.cpp | 1 + src/ZoneLoading/Zone/Stream/ZoneInputStream.cpp | 1 + 9 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/ZoneLoading/Loading/ContentLoaderBase.cpp b/src/ZoneLoading/Loading/ContentLoaderBase.cpp index 664a35cd..1b4420f6 100644 --- a/src/ZoneLoading/Loading/ContentLoaderBase.cpp +++ b/src/ZoneLoading/Loading/ContentLoaderBase.cpp @@ -2,6 +2,9 @@ #include +const void* ContentLoaderBase::PTR_FOLLOWING = reinterpret_cast(-1); +const void* ContentLoaderBase::PTR_INSERT = reinterpret_cast(-2); + ContentLoaderBase::ContentLoaderBase(Zone& zone) : varXString(nullptr), m_zone(zone), diff --git a/src/ZoneLoading/Loading/ContentLoaderBase.h b/src/ZoneLoading/Loading/ContentLoaderBase.h index 05b35143..51fe7cc8 100644 --- a/src/ZoneLoading/Loading/ContentLoaderBase.h +++ b/src/ZoneLoading/Loading/ContentLoaderBase.h @@ -6,8 +6,8 @@ class ContentLoaderBase { protected: - static constexpr auto PTR_FOLLOWING = reinterpret_cast(-1); - static constexpr auto PTR_INSERT = reinterpret_cast(-2); + static const void* PTR_FOLLOWING; + static const void* PTR_INSERT; public: virtual ~ContentLoaderBase() = default; diff --git a/src/ZoneLoading/Loading/IHashProvider.h b/src/ZoneLoading/Loading/IHashProvider.h index 7ba464ac..16d4d1d2 100644 --- a/src/ZoneLoading/Loading/IHashProvider.h +++ b/src/ZoneLoading/Loading/IHashProvider.h @@ -1,5 +1,6 @@ #pragma once +#include #include class IHashProvider diff --git a/src/ZoneLoading/Loading/ILoadingStream.h b/src/ZoneLoading/Loading/ILoadingStream.h index a6486e30..d9512718 100644 --- a/src/ZoneLoading/Loading/ILoadingStream.h +++ b/src/ZoneLoading/Loading/ILoadingStream.h @@ -1,5 +1,6 @@ #pragma once +#include #include class ILoadingStream diff --git a/src/ZoneLoading/Loading/Processor/ProcessorAuthedBlocks.cpp b/src/ZoneLoading/Loading/Processor/ProcessorAuthedBlocks.cpp index acc6bae6..1f3498cc 100644 --- a/src/ZoneLoading/Loading/Processor/ProcessorAuthedBlocks.cpp +++ b/src/ZoneLoading/Loading/Processor/ProcessorAuthedBlocks.cpp @@ -7,6 +7,7 @@ #include #include +#include #include class ProcessorAuthedBlocks final : public StreamProcessor @@ -49,7 +50,7 @@ public: sizeToWrite = std::min(sizeToWrite, m_current_chunk_size - m_current_chunk_offset); assert(length - loadedSize >= sizeToWrite); - memcpy(&static_cast(buffer)[loadedSize], &m_chunk_buffer[m_current_chunk_offset], sizeToWrite); + std::memcpy(&static_cast(buffer)[loadedSize], &m_chunk_buffer[m_current_chunk_offset], sizeToWrite); loadedSize += sizeToWrite; m_current_chunk_offset += sizeToWrite; } diff --git a/src/ZoneLoading/Loading/Processor/ProcessorCaptureData.cpp b/src/ZoneLoading/Loading/Processor/ProcessorCaptureData.cpp index 1ae0a125..2cf88b17 100644 --- a/src/ZoneLoading/Loading/Processor/ProcessorCaptureData.cpp +++ b/src/ZoneLoading/Loading/Processor/ProcessorCaptureData.cpp @@ -2,6 +2,7 @@ #include #include +#include namespace { @@ -25,7 +26,7 @@ namespace auto loadedSize = m_base_stream->Load(&m_data[m_captured_data_size], dataToCapture); assert(length >= loadedSize); - memcpy(buffer, &m_data[m_captured_data_size], loadedSize); + std::memcpy(buffer, &m_data[m_captured_data_size], loadedSize); m_captured_data_size += loadedSize; diff --git a/src/ZoneLoading/Loading/Processor/ProcessorXChunks.cpp b/src/ZoneLoading/Loading/Processor/ProcessorXChunks.cpp index 8f4fc161..6d73eafc 100644 --- a/src/ZoneLoading/Loading/Processor/ProcessorXChunks.cpp +++ b/src/ZoneLoading/Loading/Processor/ProcessorXChunks.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -164,14 +165,14 @@ namespace if (sizeToRead > bytesLeftInCurrentChunk) { assert(sizeToRead >= bytesLeftInCurrentChunk); - memcpy(bufferPos, &m_current_chunk[m_current_chunk_offset], bytesLeftInCurrentChunk); + std::memcpy(bufferPos, &m_current_chunk[m_current_chunk_offset], bytesLeftInCurrentChunk); loadedSize += bytesLeftInCurrentChunk; NextStream(); } else { - memcpy(bufferPos, &m_current_chunk[m_current_chunk_offset], sizeToRead); + std::memcpy(bufferPos, &m_current_chunk[m_current_chunk_offset], sizeToRead); loadedSize += sizeToRead; m_current_chunk_offset += sizeToRead; diff --git a/src/ZoneLoading/Loading/Steps/StepVerifyHash.cpp b/src/ZoneLoading/Loading/Steps/StepVerifyHash.cpp index e5d4fdfc..41887c8b 100644 --- a/src/ZoneLoading/Loading/Steps/StepVerifyHash.cpp +++ b/src/ZoneLoading/Loading/Steps/StepVerifyHash.cpp @@ -2,6 +2,7 @@ #include "Loading/Exception/InvalidHashException.h" +#include #include namespace diff --git a/src/ZoneLoading/Zone/Stream/ZoneInputStream.cpp b/src/ZoneLoading/Zone/Stream/ZoneInputStream.cpp index 7979ae98..86e3343f 100644 --- a/src/ZoneLoading/Zone/Stream/ZoneInputStream.cpp +++ b/src/ZoneLoading/Zone/Stream/ZoneInputStream.cpp @@ -7,6 +7,7 @@ #include "Utils/Alignment.h" #include +#include #include namespace