From a5597c8cd2ebaa8c8ecd5e7a0793b1fe68b29a29 Mon Sep 17 00:00:00 2001 From: canepat <16927169+canepat@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:06:32 +0100 Subject: [PATCH] fix more warnings --- silkworm/node/db/db_utils_test.cpp | 3 +-- silkworm/node/db/mdbx.hpp | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/silkworm/node/db/db_utils_test.cpp b/silkworm/node/db/db_utils_test.cpp index 367336301b..729c7e351b 100644 --- a/silkworm/node/db/db_utils_test.cpp +++ b/silkworm/node/db/db_utils_test.cpp @@ -28,8 +28,7 @@ namespace silkworm::db { TEST_CASE("db access layer addendum") { TemporaryDirectory tmp_dir; - db::EnvConfig db_config{tmp_dir.path().string(), /*create*/ true}; - db_config.in_memory = true; + db::EnvConfig db_config{.path = tmp_dir.path().string(), .create = true, .in_memory = true}; auto db = db::open_env(db_config); db::RWAccess rw_access(db); diff --git a/silkworm/node/db/mdbx.hpp b/silkworm/node/db/mdbx.hpp index 600d2c4f2b..5bc9ea2655 100644 --- a/silkworm/node/db/mdbx.hpp +++ b/silkworm/node/db/mdbx.hpp @@ -338,7 +338,8 @@ class RWTxnUnmanaged : public RWTxn, protected ::mdbx::txn { //! \brief This class create ROTxn(s) on demand, it is used to enforce in some method signatures the type of db access class ROAccess { public: - explicit ROAccess(mdbx::env env) : env_{std::move(env)} {} + explicit ROAccess(const mdbx::env& env) : env_{env} {} + explicit ROAccess(mdbx::env&& env) : env_{std::move(env)} {} ROAccess(const ROAccess&) noexcept = default; ROAccess(ROAccess&&) noexcept = default; @@ -353,7 +354,8 @@ class ROAccess { //! \brief This class create RWTxn(s) on demand, it is used to enforce in some method signatures the type of db access class RWAccess : public ROAccess { public: - explicit RWAccess(mdbx::env env) : ROAccess{std::move(env)} {} + explicit RWAccess(const mdbx::env& env) : ROAccess{env} {} + explicit RWAccess(mdbx::env&& env) : ROAccess{std::move(env)} {} RWAccess(const RWAccess&) noexcept = default; RWAccess(RWAccess&&) noexcept = default;