From d950460e149d78962508f221c5e81717798cb228 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Thu, 28 Oct 2021 04:19:05 -0400 Subject: try to fix some more compilation errors/warnings --- discord/store.cpp | 8 ++++++-- discord/store.hpp | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/discord/store.cpp b/discord/store.cpp index e7715b4..159e3dd 100644 --- a/discord/store.cpp +++ b/discord/store.cpp @@ -261,7 +261,7 @@ void Store::SetGuildMember(Snowflake guild_id, Snowflake user_id, const GuildMem s->Bind(9, data.IsPending); if (!s->Insert()) - fprintf(stderr, "member insert failed for %" PRIu64 "/% " PRIu64 ": %s\n", static_cast(user_id), static_cast(guild_id), m_db.ErrStr()); + fprintf(stderr, "member insert failed for %" PRIu64 "/%" PRIu64 ": %s\n", static_cast(user_id), static_cast(guild_id), m_db.ErrStr()); s->Reset(); @@ -661,7 +661,7 @@ std::optional Store::GetChannel(Snowflake id) const { s->Get(0, r); } s->Reset(); - if (recipients.size() > 0) + if (!recipients.empty()) r.RecipientIDs = std::move(recipients); } @@ -2173,6 +2173,10 @@ int Store::Statement::Bind(int index, size_t num) { return m_db->SetError(sqlite3_bind_int64(m_stmt, index, num)); } +int Store::Statement::Bind(int index, Snowflake id) { + return m_db->SetError(sqlite3_bind_int64(m_stmt, index, static_cast(id))); +} + int Store::Statement::Bind(int index, const char *str, size_t len) { if (len == -1) len = strlen(str); return m_db->SetError(sqlite3_bind_blob(m_stmt, index, str, len, SQLITE_TRANSIENT)); diff --git a/discord/store.hpp b/discord/store.hpp index 7bb1af1..b30d4f4 100644 --- a/discord/store.hpp +++ b/discord/store.hpp @@ -103,6 +103,7 @@ private: int Bind(int index, int32_t num); int Bind(int index, uint32_t num); int Bind(int index, size_t num); + int Bind(int index, Snowflake id); int Bind(int index, const char *str, size_t len = -1); int Bind(int index, const std::string &str); int Bind(int index, bool val); -- cgit v1.2.3