\#10 Address compiler warnings
This commit is contained in:
@@ -407,8 +407,7 @@ void base_provider::remove_deleted_files() {
|
||||
removed_files.pop_back();
|
||||
|
||||
bool exists{};
|
||||
auto res = is_directory(api_path, exists);
|
||||
if (res != api_error::success) {
|
||||
if (is_directory(api_path, exists) != api_error::success) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -421,7 +420,7 @@ void base_provider::remove_deleted_files() {
|
||||
fm_->perform_locked_operation(
|
||||
[this, &api_path, &source_path](i_provider &) -> bool {
|
||||
if (fm_->has_no_open_file_handles()) {
|
||||
const auto res = meta_db_->remove_item_meta(api_path);
|
||||
auto res = meta_db_->remove_item_meta(api_path);
|
||||
if (res == api_error::success) {
|
||||
event_system::instance().raise<file_removed_externally>(
|
||||
api_path, source_path);
|
||||
|
@@ -222,21 +222,23 @@ auto encrypt_provider::get_directory_items(const std::string &api_path,
|
||||
for (const auto &dir_entry :
|
||||
std::filesystem::directory_iterator(source_path)) {
|
||||
try {
|
||||
std::string api_path{};
|
||||
std::string entry_api_path{};
|
||||
if (dir_entry.is_directory()) {
|
||||
db_->Get(rocksdb::ReadOptions(), dir_family_,
|
||||
dir_entry.path().string(), &api_path);
|
||||
if (api_path.empty()) {
|
||||
dir_entry.path().string(), &entry_api_path);
|
||||
if (entry_api_path.empty()) {
|
||||
const auto cfg = config_.get_encrypt_config();
|
||||
for (const auto &child_dir_entry :
|
||||
std::filesystem::directory_iterator(dir_entry.path())) {
|
||||
if (process_directory_entry(child_dir_entry, cfg, api_path)) {
|
||||
api_path = utils::path::get_parent_api_path(api_path);
|
||||
if (process_directory_entry(child_dir_entry, cfg,
|
||||
entry_api_path)) {
|
||||
entry_api_path =
|
||||
utils::path::get_parent_api_path(entry_api_path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (api_path.empty()) {
|
||||
if (entry_api_path.empty()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -246,16 +248,16 @@ auto encrypt_provider::get_directory_items(const std::string &api_path,
|
||||
dir_entry.path().string(), &api_path_data);
|
||||
if (api_path_data.empty()) {
|
||||
const auto cfg = config_.get_encrypt_config();
|
||||
if (not process_directory_entry(dir_entry, cfg, api_path)) {
|
||||
if (not process_directory_entry(dir_entry, cfg, entry_api_path)) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
api_path =
|
||||
entry_api_path =
|
||||
json::parse(api_path_data).at("api_path").get<std::string>();
|
||||
}
|
||||
}
|
||||
|
||||
auto file = create_api_file(api_path, dir_entry.is_directory(),
|
||||
auto file = create_api_file(entry_api_path, dir_entry.is_directory(),
|
||||
dir_entry.path().string());
|
||||
|
||||
directory_item di{};
|
||||
@@ -464,13 +466,13 @@ auto encrypt_provider::get_filesystem_item(const std::string &api_path,
|
||||
}
|
||||
|
||||
if (directory) {
|
||||
std::string api_path{};
|
||||
db_->Get(rocksdb::ReadOptions(), dir_family_, source_path, &api_path);
|
||||
if (api_path.empty()) {
|
||||
std::string db_api_path{};
|
||||
db_->Get(rocksdb::ReadOptions(), dir_family_, source_path, &db_api_path);
|
||||
if (db_api_path.empty()) {
|
||||
return api_error::item_not_found;
|
||||
}
|
||||
fsi.api_parent = utils::path::get_parent_api_path(api_path);
|
||||
fsi.api_path = api_path;
|
||||
fsi.api_parent = utils::path::get_parent_api_path(db_api_path);
|
||||
fsi.api_path = db_api_path;
|
||||
fsi.directory = true;
|
||||
fsi.size = 0U;
|
||||
fsi.source_path = source_path;
|
||||
|
@@ -961,8 +961,8 @@ void sia_provider::remove_deleted_files() {
|
||||
if (get_item_meta(iterator->key().ToString(), meta) == api_error::success) {
|
||||
if (utils::string::to_bool(meta[META_DIRECTORY])) {
|
||||
bool exists{};
|
||||
auto res = is_directory(iterator->key().ToString(), exists);
|
||||
if (res != api_error::success) {
|
||||
if (is_directory(iterator->key().ToString(), exists) !=
|
||||
api_error::success) {
|
||||
continue;
|
||||
}
|
||||
if (not exists) {
|
||||
@@ -973,8 +973,7 @@ void sia_provider::remove_deleted_files() {
|
||||
}
|
||||
|
||||
bool exists{};
|
||||
auto res = is_file(iterator->key().ToString(), exists);
|
||||
if (res != api_error::success) {
|
||||
if (is_file(iterator->key().ToString(), exists) != api_error::success) {
|
||||
continue;
|
||||
}
|
||||
if (not exists) {
|
||||
|
Reference in New Issue
Block a user