diff options
author | Sadie Powell <sadie@witchery.services> | 2025-03-26 09:32:29 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2025-03-26 09:32:29 +0000 |
commit | 49d86527efd5265d835ed5b57e97d5b2a40c6b32 (patch) | |
tree | 4a5063e5ead1f8d4a9d0c99e53d7c0e7ab754e3b /modules | |
parent | 65183c3c490666e22dd78f74c95f75f1ed85eb71 (diff) |
Initialize the db_flatfile LoadData stream reference from the ctor.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/database/db_flatfile.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/modules/database/db_flatfile.cpp b/modules/database/db_flatfile.cpp index 4940fce5b..2b2ede625 100644 --- a/modules/database/db_flatfile.cpp +++ b/modules/database/db_flatfile.cpp @@ -40,12 +40,17 @@ class LoadData final : public Serialize::Data { public: - std::fstream *fs = nullptr; + std::fstream *fs; uint64_t id = 0; std::map<Anope::string, Anope::string> data; std::stringstream ss; bool read = false; + LoadData(std::fstream &fsref) + : fs(&fsref) + { + } + std::iostream &operator[](const Anope::string &key) override { if (!read) @@ -240,9 +245,7 @@ public: if (buf.find("OBJECT ") == 0) positions[buf.substr(7)].push_back(fd.tellg()); - LoadData ld; - ld.fs = &fd; - + LoadData ld(fd); for (const auto &type_order : Serialize::Type::GetTypeOrder()) { Serialize::Type *stype = Serialize::Type::Find(type_order); @@ -389,9 +392,7 @@ public: return; } - LoadData ld; - ld.fs = &fd; - + LoadData ld(fd); for (Anope::string buf; std::getline(fd, buf.str());) { if (buf == "OBJECT " + stype->GetName()) |