diff options
author | Sadie Powell <sadie@witchery.services> | 2025-03-26 10:22:42 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2025-03-26 10:22:42 +0000 |
commit | dc09408f1a68356ee21969cb4f4fb28e94bf6512 (patch) | |
tree | d0fba596df118c6c37088806eb27772b2a6e03f7 /modules | |
parent | 49d86527efd5265d835ed5b57e97d5b2a40c6b32 (diff) |
Add a typedef for the serializable id.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/database/db_flatfile.cpp | 4 | ||||
-rw-r--r-- | modules/database/db_json.cpp | 2 | ||||
-rw-r--r-- | modules/database/db_redis.cpp | 2 | ||||
-rw-r--r-- | modules/database/db_sql.cpp | 2 | ||||
-rw-r--r-- | modules/database/db_sql_live.cpp | 6 |
5 files changed, 8 insertions, 8 deletions
diff --git a/modules/database/db_flatfile.cpp b/modules/database/db_flatfile.cpp index 2b2ede625..a68d80633 100644 --- a/modules/database/db_flatfile.cpp +++ b/modules/database/db_flatfile.cpp @@ -41,7 +41,7 @@ class LoadData final { public: std::fstream *fs; - uint64_t id = 0; + Serializable::Id id = 0; std::map<Anope::string, Anope::string> data; std::stringstream ss; bool read = false; @@ -59,7 +59,7 @@ public: { if (token.find("ID ") == 0) { - this->id = Anope::Convert<uint64_t>(token.substr(3), 0); + this->id = Anope::Convert<Serializable::Id>(token.substr(3), 0); continue; } else if (token.find("DATA ") != 0) diff --git a/modules/database/db_json.cpp b/modules/database/db_json.cpp index a0b966e62..a3587a2dc 100644 --- a/modules/database/db_json.cpp +++ b/modules/database/db_json.cpp @@ -41,7 +41,7 @@ class Data final { public: // If non-zero then the id of the database entry. - uint64_t id = 0; + Serializable::Id id = 0; // Data in this database entry. Anope::map<std::stringstream> data; diff --git a/modules/database/db_redis.cpp b/modules/database/db_redis.cpp index c3a23a23c..45d3385ad 100644 --- a/modules/database/db_redis.cpp +++ b/modules/database/db_redis.cpp @@ -492,7 +492,7 @@ void SubscriptionListener::OnResult(const Reply &r) if (s_type == NULL) return; - auto oid = Anope::TryConvert<uint64_t>(id); + auto oid = Anope::TryConvert<Serializable::Id>(id); if (!oid.has_value()) return; diff --git a/modules/database/db_sql.cpp b/modules/database/db_sql.cpp index b2d430fa2..18572b197 100644 --- a/modules/database/db_sql.cpp +++ b/modules/database/db_sql.cpp @@ -255,7 +255,7 @@ public: Serializable *obj = sb->Unserialize(NULL, data); if (obj) { - auto oid = Anope::TryConvert<unsigned int>(res.Get(j, "id")); + auto oid = Anope::TryConvert<Serializable::Id>(res.Get(j, "id")); if (oid.has_value()) obj->id = oid.value(); else diff --git a/modules/database/db_sql_live.cpp b/modules/database/db_sql_live.cpp index 9389e5a59..c20a11a9f 100644 --- a/modules/database/db_sql_live.cpp +++ b/modules/database/db_sql_live.cpp @@ -190,7 +190,7 @@ public: - auto oid = Anope::TryConvert<unsigned int>(res.Get(i, "id")); + auto oid = Anope::TryConvert<Serializable::Id>(res.Get(i, "id")); if (!oid.has_value()) { Log(LOG_DEBUG) << "Unable to convert id from " << obj->GetName(); @@ -201,7 +201,7 @@ public: if (res.Get(i, "timestamp").empty()) { clear_null = true; - std::map<uint64_t, Serializable *>::iterator it = obj->objects.find(id); + auto it = obj->objects.find(id); if (it != obj->objects.end()) delete it->second; // This also removes this object from the map } @@ -213,7 +213,7 @@ public: data[key] << value; Serializable *s = NULL; - std::map<uint64_t, Serializable *>::iterator it = obj->objects.find(id); + auto it = obj->objects.find(id); if (it != obj->objects.end()) s = it->second; |