aboutsummaryrefslogtreecommitdiff
path: root/core/src/Utils
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/Utils')
-rw-r--r--core/src/Utils/IO/Archive.cpp8
-rw-r--r--core/src/Utils/IO/DataStream.hpp2
-rw-r--r--core/src/Utils/IO/FileStream.hpp4
3 files changed, 9 insertions, 5 deletions
diff --git a/core/src/Utils/IO/Archive.cpp b/core/src/Utils/IO/Archive.cpp
index aa47b67..f6e7b27 100644
--- a/core/src/Utils/IO/Archive.cpp
+++ b/core/src/Utils/IO/Archive.cpp
@@ -17,7 +17,9 @@ std::span<const uint8_t, 8> DataArchive::GetMagicNumbers()
std::optional<InputDataStream> DataArchive::LoadFile(const std::filesystem::path& path)
{
- auto stream = InputDataStream(InputFileStream(path));
+ InputFileStream fileStream(path);
+ fileStream.SetReadInSize(1024);
+ InputDataStream stream(std::move(fileStream));
uint8_t magicNumbers[kMagicNumberCount];
stream.ReadBytes(kMagicNumberCount, magicNumbers);
@@ -42,7 +44,9 @@ std::optional<InputDataStream> DataArchive::LoadFile(const std::filesystem::path
std::optional<OutputDataStream> DataArchive::SaveFile(const std::filesystem::path& path)
{
- auto stream = OutputDataStream(OutputFileStream(path, OutputFileStream::TruncateFile));
+ OutputFileStream fileStream(path, OutputFileStream::TruncateFile);
+ fileStream.SetMaxBufferSize(1024);
+ OutputDataStream stream(std::move(fileStream));
stream.WriteBytes(kMagicNumberCount, kMagicNumbers);
stream.Write(kByteOrderMark);
diff --git a/core/src/Utils/IO/DataStream.hpp b/core/src/Utils/IO/DataStream.hpp
index 3c00f4c..c0891ac 100644
--- a/core/src/Utils/IO/DataStream.hpp
+++ b/core/src/Utils/IO/DataStream.hpp
@@ -164,7 +164,7 @@ public:
}
template <class TObject>
- void WriteObject(const TObject& obj)
+ void WriteObject(const TObject& obj)
{
obj.WriteToDataStream(*this);
}
diff --git a/core/src/Utils/IO/FileStream.hpp b/core/src/Utils/IO/FileStream.hpp
index 224f3b6..9f5f24a 100644
--- a/core/src/Utils/IO/FileStream.hpp
+++ b/core/src/Utils/IO/FileStream.hpp
@@ -29,7 +29,7 @@ private:
// mBuffer is always mReadInSize size
std::unique_ptr<std::byte[]> mBuffer;
- int mReadInSize = 1024;
+ int mReadInSize;
int mFirstByteIdx = 0;
int mAvailableBytes = 0;
@@ -65,7 +65,7 @@ public:
private:
alignas(void*) char mOsFileHandle[sizeof(void*)];
std::unique_ptr<std::byte[]> mBuffer;
- int mMaxBufferSize = 1024;
+ int mMaxBufferSize;
int mCurrentBufferSize = 0;
public: