mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-07-03 09:41:50 +00:00
Fix more gcc compilation issues
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "Game/IW4/IW4.h"
|
||||
#include "Loading/Exception/InvalidHashException.h"
|
||||
@ -80,8 +80,7 @@ public:
|
||||
m_hash_function->GetHashSize()) != 0)
|
||||
throw InvalidHashException();
|
||||
|
||||
memcpy_s(m_chunk_hashes_buffer.get(), m_authed_chunk_count * m_hash_function->GetHashSize(),
|
||||
m_chunk_buffer.get(), m_authed_chunk_count * m_hash_function->GetHashSize());
|
||||
memcpy(m_chunk_hashes_buffer.get(), m_chunk_buffer.get(), m_authed_chunk_count * m_hash_function->GetHashSize());
|
||||
|
||||
m_current_chunk_in_group++;
|
||||
}
|
||||
@ -122,8 +121,8 @@ public:
|
||||
if (sizeToWrite > m_current_chunk_size - m_current_chunk_offset)
|
||||
sizeToWrite = m_current_chunk_size - m_current_chunk_offset;
|
||||
|
||||
memcpy_s(&static_cast<uint8_t*>(buffer)[loadedSize], length - loadedSize,
|
||||
&m_chunk_buffer[m_current_chunk_offset], sizeToWrite);
|
||||
assert(length - loadedSize >= sizeToWrite);
|
||||
memcpy(&static_cast<uint8_t*>(buffer)[loadedSize], &m_chunk_buffer[m_current_chunk_offset], sizeToWrite);
|
||||
loadedSize += sizeToWrite;
|
||||
m_current_chunk_offset += sizeToWrite;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "ProcessorCaptureData.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
ProcessorCaptureData::ProcessorCaptureData(const size_t captureSize)
|
||||
: m_data(std::make_unique<uint8_t[]>(captureSize)),
|
||||
@ -23,7 +24,8 @@ size_t ProcessorCaptureData::Load(void* buffer, const size_t length)
|
||||
dataToCapture = length;
|
||||
|
||||
size_t loadedSize = m_base_stream->Load(&m_data[m_captured_data_size], dataToCapture);
|
||||
memcpy_s(buffer, length, &m_data[m_captured_data_size], loadedSize);
|
||||
assert(length >= loadedSize);
|
||||
memcpy(buffer, &m_data[m_captured_data_size], loadedSize);
|
||||
|
||||
m_captured_data_size += loadedSize;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "ProcessorInflate.h"
|
||||
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <zlib.h>
|
||||
@ -33,7 +33,7 @@ public:
|
||||
|
||||
if (ret != Z_OK)
|
||||
{
|
||||
throw std::exception("Initializing inflate failed");
|
||||
throw std::runtime_error("Initializing inflate failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
class DBLoadStream
|
||||
{
|
||||
@ -294,14 +295,15 @@ public:
|
||||
|
||||
if (sizeToRead > bytesLeftInCurrentChunk)
|
||||
{
|
||||
memcpy_s(bufferPos, sizeToRead, &m_current_chunk[m_current_chunk_offset], bytesLeftInCurrentChunk);
|
||||
assert(sizeToRead >= bytesLeftInCurrentChunk);
|
||||
memcpy(bufferPos, &m_current_chunk[m_current_chunk_offset], bytesLeftInCurrentChunk);
|
||||
loadedSize += bytesLeftInCurrentChunk;
|
||||
|
||||
NextStream();
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy_s(bufferPos, sizeToRead, &m_current_chunk[m_current_chunk_offset], sizeToRead);
|
||||
memcpy(bufferPos, &m_current_chunk[m_current_chunk_offset], sizeToRead);
|
||||
loadedSize += sizeToRead;
|
||||
m_current_chunk_offset += sizeToRead;
|
||||
|
||||
|
@ -1,7 +1,10 @@
|
||||
#include "ChunkProcessorInflate.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "zlib.h"
|
||||
#include "zutil.h"
|
||||
#include <exception>
|
||||
|
||||
#include "Loading/Exception/InvalidCompressionException.h"
|
||||
|
||||
size_t ChunkProcessorInflate::Process(int streamNumber, const uint8_t* input, const size_t inputLength, uint8_t* output, const size_t outputBufferSize)
|
||||
@ -14,7 +17,7 @@ size_t ChunkProcessorInflate::Process(int streamNumber, const uint8_t* input, co
|
||||
int ret = inflateInit2(&stream, -DEF_WBITS);
|
||||
if(ret != Z_OK)
|
||||
{
|
||||
throw std::exception("Initializing inflate failed.");
|
||||
throw std::runtime_error("Initializing inflate failed.");
|
||||
}
|
||||
|
||||
stream.avail_in = inputLength;
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
class IXChunkProcessor
|
||||
{
|
||||
|
Reference in New Issue
Block a user