1
0
mirror of https://github.com/anope/anope.git synced 2026-06-28 20:16:38 +02:00

Initialize the db_flatfile LoadData stream reference from the ctor.

This commit is contained in:
Sadie Powell
2025-03-26 09:32:29 +00:00
parent 65183c3c49
commit 49d86527ef
+8 -7
View File
@@ -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())