mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-06 06:32:56 +01:00
Initialise fields of MemoryStream in header
This makes all the constructors use these defaulted values
This commit is contained in:
committed by
GitHub
parent
afbe1dda0f
commit
171d973e55
@@ -18,17 +18,6 @@
|
||||
#include "Memory.hpp"
|
||||
#include "MemoryStream.h"
|
||||
|
||||
MemoryStream::MemoryStream()
|
||||
{
|
||||
_access = MEMORY_ACCESS_READ |
|
||||
MEMORY_ACCESS_WRITE |
|
||||
MEMORY_ACCESS_OWNER;
|
||||
_dataCapacity = 0;
|
||||
_dataSize = 0;
|
||||
_data = nullptr;
|
||||
_position = nullptr;
|
||||
}
|
||||
|
||||
MemoryStream::MemoryStream(const MemoryStream ©)
|
||||
{
|
||||
_access = copy._access;
|
||||
@@ -44,11 +33,7 @@ MemoryStream::MemoryStream(const MemoryStream ©)
|
||||
|
||||
MemoryStream::MemoryStream(size_t capacity)
|
||||
{
|
||||
_access = MEMORY_ACCESS_READ |
|
||||
MEMORY_ACCESS_WRITE |
|
||||
MEMORY_ACCESS_OWNER;
|
||||
_dataCapacity = capacity;
|
||||
_dataSize = 0;
|
||||
_data = Memory::Allocate<void>(capacity);
|
||||
_position = _data;
|
||||
}
|
||||
|
||||
@@ -32,15 +32,15 @@ enum MEMORY_ACCESS
|
||||
class MemoryStream final : public IStream
|
||||
{
|
||||
private:
|
||||
uint16 _access;
|
||||
size_t _dataCapacity;
|
||||
size_t _dataSize;
|
||||
void * _data;
|
||||
void * _position;
|
||||
uint16 _access = MEMORY_ACCESS_READ | MEMORY_ACCESS_WRITE | MEMORY_ACCESS_OWNER;
|
||||
size_t _dataCapacity = 0;
|
||||
size_t _dataSize = 0;
|
||||
void * _data = nullptr;
|
||||
void * _position = nullptr;
|
||||
|
||||
public:
|
||||
MemoryStream();
|
||||
MemoryStream(const MemoryStream ©);
|
||||
MemoryStream(const MemoryStream & copy);
|
||||
explicit MemoryStream(size_t capacity);
|
||||
MemoryStream(void * data, size_t dataSize, uint32 access = MEMORY_ACCESS_READ);
|
||||
MemoryStream(const void * data, size_t dataSize);
|
||||
|
||||
Reference in New Issue
Block a user