Skip to content

Commit 47edc64

Browse files
committed
fix unused variable errors
1 parent 2bcc0c6 commit 47edc64

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

oxenss/storage/database.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,10 @@ user_pubkey load_pubkey(uint8_t type, std::string pk) {
238238
return {type, std::move(pk)};
239239
}
240240

241-
void sqlite_swarm_space(sqlite3_context* sqlite_context, int argc, sqlite3_value** argv, bool hi) {
241+
void sqlite_swarm_space(
242+
sqlite3_context* sqlite_context, [[maybe_unused]] int argc, sqlite3_value** argv, bool hi) {
242243
assert(argc == 1);
243-
auto sz = sqlite3_value_bytes(argv[0]);
244-
assert(sz == 32);
244+
assert(sqlite3_value_bytes(argv[0]));
245245
auto* key_blob = sqlite3_value_blob(argv[0]);
246246
auto pubkey = load_pubkey(0 /* irrelevant */, {reinterpret_cast<const char*>(key_blob), 32});
247247
auto swarm_space = pubkey_to_swarm_space(pubkey);
@@ -774,9 +774,14 @@ int64_t Database::get_used_bytes() {
774774
impl->prepared_get<int64_t>("PRAGMA freelist_count") * impl->page_size;
775775
}
776776

777-
static std::optional<message> get_message(DatabaseImpl& impl, SQLite::Statement& st) {
777+
std::optional<message> Database::retrieve_by_hash(const std::string& msg_hash) {
778+
auto impl = get_impl(false);
779+
auto st = impl->prepared_st(
780+
"SELECT hash, type, pubkey, namespace, timestamp, expiry, data"
781+
" FROM owned_messages WHERE hash = ?");
782+
st->bindNoCopy(1, msg_hash);
778783
std::optional<message> msg;
779-
while (st.executeStep()) {
784+
while (st->executeStep()) {
780785
assert(!msg);
781786
auto [hash, otype, opubkey, ns, ts, exp, data] =
782787
get<std::string, uint8_t, std::string, namespace_id, int64_t, int64_t, std::string>(
@@ -792,15 +797,6 @@ static std::optional<message> get_message(DatabaseImpl& impl, SQLite::Statement&
792797
return msg;
793798
}
794799

795-
std::optional<message> Database::retrieve_by_hash(const std::string& msg_hash) {
796-
auto impl = get_impl(false);
797-
auto st = impl->prepared_st(
798-
"SELECT hash, type, pubkey, namespace, timestamp, expiry, data"
799-
" FROM owned_messages WHERE hash = ?");
800-
st->bindNoCopy(1, msg_hash);
801-
return get_message(*impl, st);
802-
}
803-
804800
StoreResult Database::store(const message& msg, std::chrono::system_clock::time_point* expiry) {
805801

806802
auto impl = get_impl(true);

0 commit comments

Comments
 (0)