diff --git a/repertory/librepertory/src/providers/sia/sia_provider.cpp b/repertory/librepertory/src/providers/sia/sia_provider.cpp index e4577d9e..751d2923 100644 --- a/repertory/librepertory/src/providers/sia/sia_provider.cpp +++ b/repertory/librepertory/src/providers/sia/sia_provider.cpp @@ -111,8 +111,8 @@ auto sia_provider::get_directory_item_count(const std::string &api_path) const if (object_list.contains("entries")) { for (const auto &entry : object_list.at("entries")) { try { - auto name = entry.at("name").get(); - auto entry_api_path = utils::path::create_api_path(name); + auto name{entry.at("name").get()}; + auto entry_api_path{utils::path::create_api_path(name)}; if (utils::string::ends_with(name, "/") && (entry_api_path == api_path)) { continue; @@ -148,10 +148,10 @@ auto sia_provider::get_directory_items_impl(const std::string &api_path, if (object_list.contains("entries")) { for (const auto &entry : object_list.at("entries")) { try { - auto name = entry.at("name").get(); - auto entry_api_path = utils::path::create_api_path(name); + auto name{entry.at("name").get()}; + auto entry_api_path{utils::path::create_api_path(name)}; - auto directory = utils::string::ends_with(name, "/"); + auto directory{utils::string::ends_with(name, "/")}; if (directory && (entry_api_path == api_path)) { continue; } @@ -164,7 +164,7 @@ auto sia_provider::get_directory_items_impl(const std::string &api_path, : entry["size"].get(), get_last_modified(entry)); get_api_item_added()(directory, file); - auto res = get_item_meta(entry_api_path, meta); + auto res{get_item_meta(entry_api_path, meta)}; if (res != api_error::success) { utils::error::raise_api_path_error(function_name, entry_api_path, res, "failed to get item meta"); @@ -201,18 +201,19 @@ auto sia_provider::get_file(const std::string &api_path, api_file &file) const try { json file_data{}; - auto res = get_object_info(api_path, file_data); + auto res{get_object_info(api_path, file_data)}; if (res != api_error::success) { return res; } - auto slabs = file_data["object"]["Slabs"]; - auto size = std::accumulate( - slabs.begin(), slabs.end(), std::uint64_t(0U), - [](std::uint64_t total_size, - const nlohmann::json &slab) -> std::uint64_t { - return total_size + slab["Length"].get(); - }); + auto slabs{file_data["object"]["Slabs"]}; + auto size{ + std::accumulate( + slabs.begin(), slabs.end(), std::uint64_t(0U), + [](std::uint64_t total_size, auto &&slab) -> std::uint64_t { + return total_size + slab["Length"].get(); + }), + }; api_meta_map meta{}; if (get_item_meta(api_path, meta) == api_error::item_not_found) { @@ -247,8 +248,8 @@ auto sia_provider::get_file_list(api_file_list &list, if (object_list.contains("entries")) { for (const auto &entry : object_list.at("entries")) { - auto name = entry.at("name").get(); - auto entry_api_path = utils::path::create_api_path(name); + auto name{entry.at("name").get()}; + auto entry_api_path{utils::path::create_api_path(name)}; if (utils::string::ends_with(name, "/")) { if (entry_api_path == utils::path::create_api_path(api_path)) { @@ -258,12 +259,14 @@ auto sia_provider::get_file_list(api_file_list &list, api_meta_map meta{}; if (get_item_meta(entry_api_path, meta) == api_error::item_not_found) { - auto dir = create_api_file(entry_api_path, "", 0U, - get_last_modified(entry)); + auto dir{ + create_api_file(entry_api_path, "", 0U, + get_last_modified(entry)), + }; get_api_item_added()(true, dir); } - auto res = get_files_in_dir(entry_api_path); + auto res{get_files_in_dir(entry_api_path)}; if (res != api_error::success) { return res; } @@ -480,7 +483,7 @@ auto sia_provider::is_file(const std::string &api_path, bool &exists) const } json file_data{}; - auto res = get_object_info(api_path, file_data); + auto res{get_object_info(api_path, file_data)}; if (res == api_error::item_not_found) { return api_error::success; }