fixes
This commit is contained in:
		| @@ -115,7 +115,10 @@ file_manager::file_manager(app_config &config, i_provider &provider) | |||||||
|       throw startup_exception("failed to open db|" + db_path + '|' + |       throw startup_exception("failed to open db|" + db_path + '|' + | ||||||
|                               std::to_string(res) + '|' + sqlite3_errstr(res)); |                               std::to_string(res) + '|' + sqlite3_errstr(res)); | ||||||
|     } |     } | ||||||
|     db_.reset(db3); |     db_ = utils::db::sqlite::db3_t{ | ||||||
|  |         db3, | ||||||
|  |         utils::db::sqlite::sqlite3_deleter(), | ||||||
|  |     }; | ||||||
|  |  | ||||||
|     for (auto &&create_item : sql_create_tables) { |     for (auto &&create_item : sql_create_tables) { | ||||||
|       std::string err; |       std::string err; | ||||||
|   | |||||||
| @@ -1058,7 +1058,10 @@ auto encrypt_provider::start(api_item_added_callback /*api_item_added*/, | |||||||
|                                                  '|' + sqlite3_errstr(res)); |                                                  '|' + sqlite3_errstr(res)); | ||||||
|     return false; |     return false; | ||||||
|   } |   } | ||||||
|   db_.reset(db3); |   db_ = utils::db::sqlite::db3_t{ | ||||||
|  |       db3, | ||||||
|  |       utils::db::sqlite::sqlite3_deleter(), | ||||||
|  |   }; | ||||||
|  |  | ||||||
|   for (auto &&create : sql_create_tables) { |   for (auto &&create : sql_create_tables) { | ||||||
|     std::string err; |     std::string err; | ||||||
|   | |||||||
| @@ -48,7 +48,10 @@ meta_db::meta_db(const app_config &cfg) { | |||||||
|                                                  '|' + sqlite3_errstr(res)); |                                                  '|' + sqlite3_errstr(res)); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|   db_.reset(db3); |   db_ = utils::db::sqlite::db3_t{ | ||||||
|  |       db3, | ||||||
|  |       utils::db::sqlite::sqlite3_deleter(), | ||||||
|  |   }; | ||||||
|  |  | ||||||
|   const auto *create = "CREATE TABLE IF NOT EXISTS " |   const auto *create = "CREATE TABLE IF NOT EXISTS " | ||||||
|                        "meta " |                        "meta " | ||||||
|   | |||||||
| @@ -174,7 +174,7 @@ extern "C" { | |||||||
| } | } | ||||||
|  |  | ||||||
| struct netbios_ns_deleter final { | struct netbios_ns_deleter final { | ||||||
|   void operator()(netbios_ns *ns) { |   void operator()(netbios_ns *ns) const { | ||||||
|     if (ns != nullptr) { |     if (ns != nullptr) { | ||||||
|       netbios_ns_destroy(ns); |       netbios_ns_destroy(ns); | ||||||
|     } |     } | ||||||
| @@ -190,7 +190,7 @@ inline const auto smb_session_deleter = [](smb_session *session) { | |||||||
| using smb_session_t = std::shared_ptr<smb_session>; | using smb_session_t = std::shared_ptr<smb_session>; | ||||||
|  |  | ||||||
| struct smb_stat_deleter final { | struct smb_stat_deleter final { | ||||||
|   void operator()(smb_stat st) { |   void operator()(smb_stat st) const { | ||||||
|     if (st != nullptr) { |     if (st != nullptr) { | ||||||
|       smb_stat_destroy(st); |       smb_stat_destroy(st); | ||||||
|     } |     } | ||||||
| @@ -199,7 +199,7 @@ struct smb_stat_deleter final { | |||||||
| using smb_stat_t = std::unique_ptr<smb_file, smb_stat_deleter>; | using smb_stat_t = std::unique_ptr<smb_file, smb_stat_deleter>; | ||||||
|  |  | ||||||
| struct smb_stat_list_deleter final { | struct smb_stat_list_deleter final { | ||||||
|   void operator()(smb_file *list) { |   void operator()(smb_file *list) const { | ||||||
|     if (list != nullptr) { |     if (list != nullptr) { | ||||||
|       smb_stat_list_destroy(list); |       smb_stat_list_destroy(list); | ||||||
|     } |     } | ||||||
| @@ -241,7 +241,7 @@ using smb_stat_list_t = std::unique_ptr<smb_file, smb_stat_list_deleter>; | |||||||
| } | } | ||||||
|  |  | ||||||
| struct vlc_deleter final { | struct vlc_deleter final { | ||||||
|   void operator()(libvlc_instance_t *inst) { |   void operator()(libvlc_instance_t *inst) const { | ||||||
|     if (inst != nullptr) { |     if (inst != nullptr) { | ||||||
|       libvlc_release(inst); |       libvlc_release(inst); | ||||||
|     } |     } | ||||||
| @@ -250,7 +250,7 @@ struct vlc_deleter final { | |||||||
| using vlc_t = std::unique_ptr<libvlc_instance_t, vlc_deleter>; | using vlc_t = std::unique_ptr<libvlc_instance_t, vlc_deleter>; | ||||||
|  |  | ||||||
| struct vlc_media_deleter final { | struct vlc_media_deleter final { | ||||||
|   void operator()(libvlc_media_t *media) { |   void operator()(libvlc_media_t *media) const { | ||||||
|     if (media != nullptr) { |     if (media != nullptr) { | ||||||
|       libvlc_media_release(media); |       libvlc_media_release(media); | ||||||
|     } |     } | ||||||
| @@ -259,7 +259,7 @@ struct vlc_media_deleter final { | |||||||
| using vlc_media_t = std::unique_ptr<libvlc_media_t, vlc_media_deleter>; | using vlc_media_t = std::unique_ptr<libvlc_media_t, vlc_media_deleter>; | ||||||
|  |  | ||||||
| struct vlc_media_list_deleter final { | struct vlc_media_list_deleter final { | ||||||
|   void operator()(libvlc_media_list_t *media_list) { |   void operator()(libvlc_media_list_t *media_list) const { | ||||||
|     if (media_list != nullptr) { |     if (media_list != nullptr) { | ||||||
|       libvlc_media_list_release(media_list); |       libvlc_media_list_release(media_list); | ||||||
|     } |     } | ||||||
| @@ -269,7 +269,7 @@ using vlc_media_list_t = | |||||||
|     std::unique_ptr<libvlc_media_list_t, vlc_media_list_deleter>; |     std::unique_ptr<libvlc_media_list_t, vlc_media_list_deleter>; | ||||||
|  |  | ||||||
| struct vlc_string_deleter final { | struct vlc_string_deleter final { | ||||||
|   void operator()(char *str) { |   void operator()(char *str) const { | ||||||
|     if (str != nullptr) { |     if (str != nullptr) { | ||||||
|       libvlc_free(str); |       libvlc_free(str); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -27,7 +27,7 @@ namespace repertory::utils::db::sqlite { | |||||||
| using db_types_t = std::variant<std::int64_t, std::string>; | using db_types_t = std::variant<std::int64_t, std::string>; | ||||||
|  |  | ||||||
| struct sqlite3_deleter { | struct sqlite3_deleter { | ||||||
|   void operator()(sqlite3 *db3) { |   void operator()(sqlite3 *db3) const { | ||||||
|     if (db3 != nullptr) { |     if (db3 != nullptr) { | ||||||
|       sqlite3_close_v2(db3); |       sqlite3_close_v2(db3); | ||||||
|     } |     } | ||||||
| @@ -37,8 +37,9 @@ struct sqlite3_deleter { | |||||||
| using db3_t = std::unique_ptr<sqlite3, sqlite3_deleter>; | using db3_t = std::unique_ptr<sqlite3, sqlite3_deleter>; | ||||||
|  |  | ||||||
| struct sqlite3_statement_deleter { | struct sqlite3_statement_deleter { | ||||||
|   void operator()(sqlite3_stmt *stmt) { |   void operator()(sqlite3_stmt *stmt) const { | ||||||
|     if (stmt != nullptr) { |     if (stmt != nullptr) { | ||||||
|  |       sqlite3_reset(stmt); | ||||||
|       sqlite3_finalize(stmt); |       sqlite3_finalize(stmt); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| @@ -59,6 +60,9 @@ struct db_comp_data_t final { | |||||||
| struct db_context_t { | struct db_context_t { | ||||||
|   db_context_t(sqlite3 &db3_, std::string table_name_) |   db_context_t(sqlite3 &db3_, std::string table_name_) | ||||||
|       : db3(db3_), table_name(std::move(table_name_)) {} |       : db3(db3_), table_name(std::move(table_name_)) {} | ||||||
|  |  | ||||||
|  |   virtual ~db_context_t() = default; | ||||||
|  |  | ||||||
|   sqlite3 &db3; |   sqlite3 &db3; | ||||||
|   std::string table_name; |   std::string table_name; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -39,20 +39,19 @@ auto db_delete::dump() const -> std::string { | |||||||
| } | } | ||||||
|  |  | ||||||
| auto db_delete::go() const -> db_result<context> { | auto db_delete::go() const -> db_result<context> { | ||||||
|   static constexpr const std::string_view function_name{ |  | ||||||
|       static_cast<const char *>(__FUNCTION__), |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
|   sqlite3_stmt *stmt_ptr{nullptr}; |   sqlite3_stmt *stmt_ptr{nullptr}; | ||||||
|   auto query_str = dump(); |   auto query_str = dump(); | ||||||
|   auto res = sqlite3_prepare_v2(&context_->db3, query_str.c_str(), -1, |   auto res = sqlite3_prepare_v2(&context_->db3, query_str.c_str(), -1, | ||||||
|                                 &stmt_ptr, nullptr); |                                 &stmt_ptr, nullptr); | ||||||
|  |   context_->stmt = db3_stmt_t{ | ||||||
|  |       stmt_ptr, | ||||||
|  |       sqlite3_statement_deleter(), | ||||||
|  |   }; | ||||||
|  |  | ||||||
|   if (res != SQLITE_OK) { |   if (res != SQLITE_OK) { | ||||||
|     return {context_, res}; |     return {context_, res}; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   context_->stmt.reset(stmt_ptr); |  | ||||||
|  |  | ||||||
|   for (std::int32_t idx = 0; |   for (std::int32_t idx = 0; | ||||||
|        idx < static_cast<std::int32_t>(context_->where_values.size()); idx++) { |        idx < static_cast<std::int32_t>(context_->where_values.size()); idx++) { | ||||||
|     res = std::visit( |     res = std::visit( | ||||||
|   | |||||||
| @@ -68,12 +68,15 @@ auto db_insert::go() const -> db_result<context> { | |||||||
|   auto query_str = dump(); |   auto query_str = dump(); | ||||||
|   auto res = sqlite3_prepare_v2(&context_->db3, query_str.c_str(), -1, |   auto res = sqlite3_prepare_v2(&context_->db3, query_str.c_str(), -1, | ||||||
|                                 &stmt_ptr, nullptr); |                                 &stmt_ptr, nullptr); | ||||||
|  |   context_->stmt = db3_stmt_t{ | ||||||
|  |       stmt_ptr, | ||||||
|  |       sqlite3_statement_deleter(), | ||||||
|  |   }; | ||||||
|  |  | ||||||
|   if (res != SQLITE_OK) { |   if (res != SQLITE_OK) { | ||||||
|     return {context_, res}; |     return {context_, res}; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   context_->stmt.reset(stmt_ptr); |  | ||||||
|  |  | ||||||
|   for (std::int32_t idx = 0; |   for (std::int32_t idx = 0; | ||||||
|        idx < static_cast<std::int32_t>(context_->values.size()); idx++) { |        idx < static_cast<std::int32_t>(context_->values.size()); idx++) { | ||||||
|     res = std::visit( |     res = std::visit( | ||||||
|   | |||||||
| @@ -85,20 +85,19 @@ auto db_select::dump() const -> std::string { | |||||||
| } | } | ||||||
|  |  | ||||||
| auto db_select::go() const -> db_result<context> { | auto db_select::go() const -> db_result<context> { | ||||||
|   static constexpr const std::string_view function_name{ |  | ||||||
|       static_cast<const char *>(__FUNCTION__), |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
|   sqlite3_stmt *stmt_ptr{nullptr}; |   sqlite3_stmt *stmt_ptr{nullptr}; | ||||||
|   auto query_str = dump(); |   auto query_str = dump(); | ||||||
|   auto res = sqlite3_prepare_v2(&context_->db3, query_str.c_str(), -1, |   auto res = sqlite3_prepare_v2(&context_->db3, query_str.c_str(), -1, | ||||||
|                                 &stmt_ptr, nullptr); |                                 &stmt_ptr, nullptr); | ||||||
|  |   context_->stmt = db3_stmt_t{ | ||||||
|  |       stmt_ptr, | ||||||
|  |       sqlite3_statement_deleter(), | ||||||
|  |   }; | ||||||
|  |  | ||||||
|   if (res != SQLITE_OK) { |   if (res != SQLITE_OK) { | ||||||
|     return {context_, res}; |     return {context_, res}; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   context_->stmt.reset(stmt_ptr); |  | ||||||
|  |  | ||||||
|   for (std::int32_t idx = 0; |   for (std::int32_t idx = 0; | ||||||
|        idx < static_cast<std::int32_t>(context_->where_values.size()); idx++) { |        idx < static_cast<std::int32_t>(context_->where_values.size()); idx++) { | ||||||
|     res = std::visit( |     res = std::visit( | ||||||
|   | |||||||
| @@ -64,18 +64,18 @@ auto db_update::dump() const -> std::string { | |||||||
| } | } | ||||||
|  |  | ||||||
| auto db_update::go() const -> db_result<context> { | auto db_update::go() const -> db_result<context> { | ||||||
|   static constexpr const std::string_view function_name{ |  | ||||||
|       static_cast<const char *>(__FUNCTION__), |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
|   sqlite3_stmt *stmt_ptr{nullptr}; |   sqlite3_stmt *stmt_ptr{nullptr}; | ||||||
|   auto query_str = dump(); |   auto query_str = dump(); | ||||||
|   auto res = sqlite3_prepare_v2(&context_->db3, query_str.c_str(), -1, |   auto res = sqlite3_prepare_v2(&context_->db3, query_str.c_str(), -1, | ||||||
|                                 &stmt_ptr, nullptr); |                                 &stmt_ptr, nullptr); | ||||||
|  |   context_->stmt = db3_stmt_t{ | ||||||
|  |       stmt_ptr, | ||||||
|  |       sqlite3_statement_deleter(), | ||||||
|  |   }; | ||||||
|  |  | ||||||
|   if (res != SQLITE_OK) { |   if (res != SQLITE_OK) { | ||||||
|     return {context_, res}; |     return {context_, res}; | ||||||
|   } |   } | ||||||
|   context_->stmt.reset(stmt_ptr); |  | ||||||
|  |  | ||||||
|   for (std::int32_t idx = 0; |   for (std::int32_t idx = 0; | ||||||
|        idx < static_cast<std::int32_t>(context_->column_values.size()); idx++) { |        idx < static_cast<std::int32_t>(context_->column_values.size()); idx++) { | ||||||
|   | |||||||
| @@ -119,9 +119,11 @@ void file::open() { | |||||||
|   } |   } | ||||||
|  |  | ||||||
| #if defined(_WIN32) | #if defined(_WIN32) | ||||||
|   file_.reset(_fsopen(path_.c_str(), read_only_ ? "rb" : "rb+", _SH_DENYNO)); |   file_ = file_t(_fsopen(path_.c_str(), read_only_ ? "rb" : "rb+", _SH_DENYNO), | ||||||
|  |                  file_deleter()); | ||||||
| #else  // !defined(_WIN32) | #else  // !defined(_WIN32) | ||||||
|   file_.reset(fopen(path_.c_str(), read_only_ ? "rb" : "rb+")); |   file_ = | ||||||
|  |       file_t(fopen(path_.c_str(), read_only_ ? "rb" : "rb+"), file_deleter()); | ||||||
| #endif // defined(_WIN32) | #endif // defined(_WIN32) | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -34,8 +34,14 @@ auto smb_directory::open(std::string_view host, std::string_view user, | |||||||
|   }; |   }; | ||||||
|  |  | ||||||
|   try { |   try { | ||||||
|     smb_session_t session{smb_session_new(), smb_session_deleter}; |     smb_session_t session{ | ||||||
|     netbios_ns_t ns{netbios_ns_new()}; |         smb_session_new(), | ||||||
|  |         smb_session_deleter(), | ||||||
|  |     }; | ||||||
|  |     netbios_ns_t ns{ | ||||||
|  |         netbios_ns_new(), | ||||||
|  |         netbios_ns_deleter(), | ||||||
|  |     }; | ||||||
|  |  | ||||||
|     sockaddr_in addr{}; |     sockaddr_in addr{}; | ||||||
|  |  | ||||||
| @@ -137,7 +143,9 @@ auto smb_directory::count(bool recursive) const -> std::uint64_t { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     smb_stat_list_t list{ |     smb_stat_list_t list{ | ||||||
|         smb_find(session_.get(), tid_, smb_create_search_path(path_).c_str())}; |         smb_find(session_.get(), tid_, smb_create_search_path(path_).c_str()), | ||||||
|  |         smb_stat_list_deleter(), | ||||||
|  |     }; | ||||||
|     auto count = smb_stat_list_count(list.get()); |     auto count = smb_stat_list_count(list.get()); | ||||||
|  |  | ||||||
|     if (not recursive) { |     if (not recursive) { | ||||||
| @@ -247,8 +255,11 @@ auto smb_directory::exists() const -> bool { | |||||||
|       throw std::runtime_error("session not found|" + path_); |       throw std::runtime_error("session not found|" + path_); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     smb_stat_t st{smb_fstat(session_.get(), tid_, |     smb_stat_t st{ | ||||||
|                             smb_create_relative_path(path_).c_str())}; |         smb_fstat(session_.get(), tid_, | ||||||
|  |                   smb_create_relative_path(path_).c_str()), | ||||||
|  |         smb_stat_deleter(), | ||||||
|  |     }; | ||||||
|     if (not st) { |     if (not st) { | ||||||
|       return false; |       return false; | ||||||
|     } |     } | ||||||
| @@ -275,7 +286,10 @@ auto smb_directory::get_directory(std::string_view path) const | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     auto rel_path = smb_create_and_validate_relative_path(path_, path); |     auto rel_path = smb_create_and_validate_relative_path(path_, path); | ||||||
|     smb_stat_t st{smb_fstat(session_.get(), tid_, rel_path.c_str())}; |     smb_stat_t st{ | ||||||
|  |         smb_fstat(session_.get(), tid_, rel_path.c_str()), | ||||||
|  |         smb_stat_deleter(), | ||||||
|  |     }; | ||||||
|     if (not st) { |     if (not st) { | ||||||
|       throw std::runtime_error("failed to stat directory|" + rel_path); |       throw std::runtime_error("failed to stat directory|" + rel_path); | ||||||
|     } |     } | ||||||
| @@ -313,7 +327,9 @@ auto smb_directory::get_directories() const -> std::vector<fs_directory_t> { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     smb_stat_list_t list{ |     smb_stat_list_t list{ | ||||||
|         smb_find(session_.get(), tid_, smb_create_search_path(path_).c_str())}; |         smb_find(session_.get(), tid_, smb_create_search_path(path_).c_str()), | ||||||
|  |         smb_stat_list_deleter(), | ||||||
|  |     }; | ||||||
|     if (not list) { |     if (not list) { | ||||||
|       throw std::runtime_error("failed to get directory list|" + path_); |       throw std::runtime_error("failed to get directory list|" + path_); | ||||||
|     } |     } | ||||||
| @@ -365,7 +381,10 @@ auto smb_directory::get_file(std::string_view path) const -> fs_file_t { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     auto rel_path = smb_create_and_validate_relative_path(path_, path); |     auto rel_path = smb_create_and_validate_relative_path(path_, path); | ||||||
|     smb_stat_t st{smb_fstat(session_.get(), tid_, rel_path.c_str())}; |     smb_stat_t st{ | ||||||
|  |         smb_fstat(session_.get(), tid_, rel_path.c_str()), | ||||||
|  |         smb_stat_deleter(), | ||||||
|  |     }; | ||||||
|     if (not st) { |     if (not st) { | ||||||
|       throw std::runtime_error("failed to stat file|" + rel_path); |       throw std::runtime_error("failed to stat file|" + rel_path); | ||||||
|     } |     } | ||||||
| @@ -398,7 +417,9 @@ auto smb_directory::get_files() const -> std::vector<fs_file_t> { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     smb_stat_list_t list{ |     smb_stat_list_t list{ | ||||||
|         smb_find(session_.get(), tid_, smb_create_search_path(path_).c_str())}; |         smb_find(session_.get(), tid_, smb_create_search_path(path_).c_str()), | ||||||
|  |         smb_stat_list_deleter(), | ||||||
|  |     }; | ||||||
|     if (not list) { |     if (not list) { | ||||||
|       throw std::runtime_error("failed to get file list|" + path_); |       throw std::runtime_error("failed to get file list|" + path_); | ||||||
|     } |     } | ||||||
| @@ -440,7 +461,9 @@ auto smb_directory::get_items() const -> std::vector<fs_item_t> { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     smb_stat_list_t list{ |     smb_stat_list_t list{ | ||||||
|         smb_find(session_.get(), tid_, smb_create_search_path(path_).c_str())}; |         smb_find(session_.get(), tid_, smb_create_search_path(path_).c_str()), | ||||||
|  |         smb_stat_list_deleter(), | ||||||
|  |     }; | ||||||
|     if (not list) { |     if (not list) { | ||||||
|       throw std::runtime_error("failed to get item list|" + path_); |       throw std::runtime_error("failed to get item list|" + path_); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -70,8 +70,11 @@ auto smb_file::exists() const -> bool { | |||||||
|       throw std::runtime_error("session not found|" + path_); |       throw std::runtime_error("session not found|" + path_); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     smb_stat_t st{smb_fstat(session_.get(), tid_, |     smb_stat_t st{ | ||||||
|                             smb_create_relative_path(path_).c_str())}; |         smb_fstat(session_.get(), tid_, | ||||||
|  |                   smb_create_relative_path(path_).c_str()), | ||||||
|  |         smb_stat_deleter(), | ||||||
|  |     }; | ||||||
|     if (not st) { |     if (not st) { | ||||||
|       return false; |       return false; | ||||||
|     } |     } | ||||||
| @@ -113,7 +116,10 @@ auto smb_file::get_time(smb_session *session, smb_tid tid, std::string path, | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     auto rel_path = smb_create_relative_path(path); |     auto rel_path = smb_create_relative_path(path); | ||||||
|     smb_stat_t st{smb_fstat(session, tid, rel_path.c_str())}; |     smb_stat_t st{ | ||||||
|  |         smb_fstat(session, tid, rel_path.c_str()), | ||||||
|  |         smb_stat_deleter(), | ||||||
|  |     }; | ||||||
|     if (not st) { |     if (not st) { | ||||||
|       throw std::runtime_error("failed to stat directory|" + rel_path); |       throw std::runtime_error("failed to stat directory|" + rel_path); | ||||||
|     } |     } | ||||||
| @@ -368,7 +374,10 @@ auto smb_file::size() const -> std::optional<std::uint64_t> { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     auto rel_path = smb_create_relative_path(path_); |     auto rel_path = smb_create_relative_path(path_); | ||||||
|     smb_stat_t st{smb_fstat(session_.get(), tid_, rel_path.c_str())}; |     smb_stat_t st{ | ||||||
|  |         smb_fstat(session_.get(), tid_, rel_path.c_str()), | ||||||
|  |         smb_stat_deleter(), | ||||||
|  |     }; | ||||||
|     if (not st) { |     if (not st) { | ||||||
|       throw std::runtime_error("failed to stat directory|" + rel_path); |       throw std::runtime_error("failed to stat directory|" + rel_path); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -34,7 +34,10 @@ public: | |||||||
|       auto res = sqlite3_open(":memory:", &db3_ptr); |       auto res = sqlite3_open(":memory:", &db3_ptr); | ||||||
|       ASSERT_EQ(SQLITE_OK, res); |       ASSERT_EQ(SQLITE_OK, res); | ||||||
|       ASSERT_TRUE(db3_ptr != nullptr); |       ASSERT_TRUE(db3_ptr != nullptr); | ||||||
|       db3.reset(db3_ptr); |       db3 = utils::db::sqlite::db3_t{ | ||||||
|  |           db3_ptr, | ||||||
|  |           utils::db::sqlite::sqlite3_deleter(), | ||||||
|  |       }; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     utils::db::sqlite::db3_stmt_t db3_stmt; |     utils::db::sqlite::db3_stmt_t db3_stmt; | ||||||
| @@ -47,8 +50,11 @@ public: | |||||||
|       sqlite3_stmt *stmt_ptr{nullptr}; |       sqlite3_stmt *stmt_ptr{nullptr}; | ||||||
|       auto res = |       auto res = | ||||||
|           sqlite3_prepare_v2(db3.get(), sql.c_str(), -1, &stmt_ptr, nullptr); |           sqlite3_prepare_v2(db3.get(), sql.c_str(), -1, &stmt_ptr, nullptr); | ||||||
|  |       db3_stmt = utils::db::sqlite::db3_stmt_t{ | ||||||
|  |           stmt_ptr, | ||||||
|  |           utils::db::sqlite::sqlite3_statement_deleter(), | ||||||
|  |       }; | ||||||
|       ASSERT_EQ(SQLITE_OK, res); |       ASSERT_EQ(SQLITE_OK, res); | ||||||
|       db3_stmt.reset(stmt_ptr); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     auto res = sqlite3_step(db3_stmt.get()); |     auto res = sqlite3_step(db3_stmt.get()); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user