\#10 Address compiler warnings
This commit is contained in:
parent
5dff8927da
commit
b137b57dbc
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
### Issues
|
### Issues
|
||||||
|
|
||||||
|
* \#10 Address compiler warnings
|
||||||
|
|
||||||
### Changes from v2.0.0-rc
|
### Changes from v2.0.0-rc
|
||||||
|
|
||||||
* Removed MSVC compilation support (MinGW-64 should be used)
|
* Removed MSVC compilation support (MinGW-64 should be used)
|
||||||
|
@ -68,9 +68,9 @@ using event_consumer = event_system::event_consumer;
|
|||||||
|
|
||||||
#define E_PROP(type, name, short_name, ts) \
|
#define E_PROP(type, name, short_name, ts) \
|
||||||
private: \
|
private: \
|
||||||
void init_##short_name(const type &val) { \
|
void init_##short_name(const type &val_##name) { \
|
||||||
ss_ << "|" << #short_name << "|" << ts(val); \
|
ss_ << "|" << #short_name << "|" << ts(val_##name); \
|
||||||
j_[#name] = ts(val); \
|
j_[#name] = ts(val_##name); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
public: \
|
public: \
|
||||||
|
@ -264,18 +264,18 @@ auto file_manager::ring_buffer_open_file::read(std::size_t read_size,
|
|||||||
res = do_io([this, &buffer, &chunk, &data, read_offset,
|
res = do_io([this, &buffer, &chunk, &data, read_offset,
|
||||||
&to_read]() -> api_error {
|
&to_read]() -> api_error {
|
||||||
std::size_t bytes_read{};
|
std::size_t bytes_read{};
|
||||||
auto res = nf_->read_bytes(buffer.data(), buffer.size(),
|
auto ret = nf_->read_bytes(buffer.data(), buffer.size(),
|
||||||
((chunk % ring_state_.size()) * chunk_size_),
|
((chunk % ring_state_.size()) * chunk_size_),
|
||||||
bytes_read)
|
bytes_read)
|
||||||
? api_error::success
|
? api_error::success
|
||||||
: api_error::os_error;
|
: api_error::os_error;
|
||||||
if (res == api_error::success) {
|
if (ret == api_error::success) {
|
||||||
data.insert(data.end(), buffer.begin() + read_offset,
|
data.insert(data.end(), buffer.begin() + read_offset,
|
||||||
buffer.begin() + read_offset + to_read);
|
buffer.begin() + read_offset + to_read);
|
||||||
reset_timeout();
|
reset_timeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return ret;
|
||||||
});
|
});
|
||||||
read_offset = 0u;
|
read_offset = 0u;
|
||||||
read_size -= to_read;
|
read_size -= to_read;
|
||||||
|
@ -407,8 +407,7 @@ void base_provider::remove_deleted_files() {
|
|||||||
removed_files.pop_back();
|
removed_files.pop_back();
|
||||||
|
|
||||||
bool exists{};
|
bool exists{};
|
||||||
auto res = is_directory(api_path, exists);
|
if (is_directory(api_path, exists) != api_error::success) {
|
||||||
if (res != api_error::success) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,7 +420,7 @@ void base_provider::remove_deleted_files() {
|
|||||||
fm_->perform_locked_operation(
|
fm_->perform_locked_operation(
|
||||||
[this, &api_path, &source_path](i_provider &) -> bool {
|
[this, &api_path, &source_path](i_provider &) -> bool {
|
||||||
if (fm_->has_no_open_file_handles()) {
|
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) {
|
if (res == api_error::success) {
|
||||||
event_system::instance().raise<file_removed_externally>(
|
event_system::instance().raise<file_removed_externally>(
|
||||||
api_path, source_path);
|
api_path, source_path);
|
||||||
|
@ -222,21 +222,23 @@ auto encrypt_provider::get_directory_items(const std::string &api_path,
|
|||||||
for (const auto &dir_entry :
|
for (const auto &dir_entry :
|
||||||
std::filesystem::directory_iterator(source_path)) {
|
std::filesystem::directory_iterator(source_path)) {
|
||||||
try {
|
try {
|
||||||
std::string api_path{};
|
std::string entry_api_path{};
|
||||||
if (dir_entry.is_directory()) {
|
if (dir_entry.is_directory()) {
|
||||||
db_->Get(rocksdb::ReadOptions(), dir_family_,
|
db_->Get(rocksdb::ReadOptions(), dir_family_,
|
||||||
dir_entry.path().string(), &api_path);
|
dir_entry.path().string(), &entry_api_path);
|
||||||
if (api_path.empty()) {
|
if (entry_api_path.empty()) {
|
||||||
const auto cfg = config_.get_encrypt_config();
|
const auto cfg = config_.get_encrypt_config();
|
||||||
for (const auto &child_dir_entry :
|
for (const auto &child_dir_entry :
|
||||||
std::filesystem::directory_iterator(dir_entry.path())) {
|
std::filesystem::directory_iterator(dir_entry.path())) {
|
||||||
if (process_directory_entry(child_dir_entry, cfg, api_path)) {
|
if (process_directory_entry(child_dir_entry, cfg,
|
||||||
api_path = utils::path::get_parent_api_path(api_path);
|
entry_api_path)) {
|
||||||
|
entry_api_path =
|
||||||
|
utils::path::get_parent_api_path(entry_api_path);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api_path.empty()) {
|
if (entry_api_path.empty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -246,16 +248,16 @@ auto encrypt_provider::get_directory_items(const std::string &api_path,
|
|||||||
dir_entry.path().string(), &api_path_data);
|
dir_entry.path().string(), &api_path_data);
|
||||||
if (api_path_data.empty()) {
|
if (api_path_data.empty()) {
|
||||||
const auto cfg = config_.get_encrypt_config();
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
api_path =
|
entry_api_path =
|
||||||
json::parse(api_path_data).at("api_path").get<std::string>();
|
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());
|
dir_entry.path().string());
|
||||||
|
|
||||||
directory_item di{};
|
directory_item di{};
|
||||||
@ -464,13 +466,13 @@ auto encrypt_provider::get_filesystem_item(const std::string &api_path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (directory) {
|
if (directory) {
|
||||||
std::string api_path{};
|
std::string db_api_path{};
|
||||||
db_->Get(rocksdb::ReadOptions(), dir_family_, source_path, &api_path);
|
db_->Get(rocksdb::ReadOptions(), dir_family_, source_path, &db_api_path);
|
||||||
if (api_path.empty()) {
|
if (db_api_path.empty()) {
|
||||||
return api_error::item_not_found;
|
return api_error::item_not_found;
|
||||||
}
|
}
|
||||||
fsi.api_parent = utils::path::get_parent_api_path(api_path);
|
fsi.api_parent = utils::path::get_parent_api_path(db_api_path);
|
||||||
fsi.api_path = api_path;
|
fsi.api_path = db_api_path;
|
||||||
fsi.directory = true;
|
fsi.directory = true;
|
||||||
fsi.size = 0U;
|
fsi.size = 0U;
|
||||||
fsi.source_path = source_path;
|
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 (get_item_meta(iterator->key().ToString(), meta) == api_error::success) {
|
||||||
if (utils::string::to_bool(meta[META_DIRECTORY])) {
|
if (utils::string::to_bool(meta[META_DIRECTORY])) {
|
||||||
bool exists{};
|
bool exists{};
|
||||||
auto res = is_directory(iterator->key().ToString(), exists);
|
if (is_directory(iterator->key().ToString(), exists) !=
|
||||||
if (res != api_error::success) {
|
api_error::success) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (not exists) {
|
if (not exists) {
|
||||||
@ -973,8 +973,7 @@ void sia_provider::remove_deleted_files() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool exists{};
|
bool exists{};
|
||||||
auto res = is_file(iterator->key().ToString(), exists);
|
if (is_file(iterator->key().ToString(), exists) != api_error::success) {
|
||||||
if (res != api_error::success) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (not exists) {
|
if (not exists) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user