Address compiler warnings #10
All checks were successful
BlockStorage/repertory_osx/pipeline/head This commit looks good
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good

This commit is contained in:
Scott E. Graves 2023-10-30 11:49:56 -05:00
parent 383c3b4be6
commit c0e720498d

View File

@ -227,9 +227,10 @@ auto remote_server::fuse_create(const char *path, const remote::file_mode &mode,
-> packet::error_type {
const auto file_path = construct_path(path);
const auto res =
open(file_path.c_str(), remote::create_os_open_flags(flags), mode);
open(file_path.c_str(),
static_cast<int>(remote::create_os_open_flags(flags)), mode);
if (res >= 0) {
handle = res;
handle = static_cast<remote::file_handle>(res);
set_open_info(res, open_info{0, "", nullptr, file_path});
}
@ -560,9 +561,10 @@ auto remote_server::fuse_open(const char *path, const remote::open_flags &flags,
remote::file_handle &handle)
-> packet::error_type {
const auto file_path = construct_path(path);
const auto res = open(file_path.c_str(), remote::create_os_open_flags(flags));
const auto res = open(file_path.c_str(),
static_cast<int>(remote::create_os_open_flags(flags)));
if (res >= 0) {
handle = res;
handle = static_cast<remote::file_handle>(res);
set_open_info(res, open_info{0, "", nullptr, file_path});
}
auto ret = ((res < 0) ? -errno : 0);
@ -917,8 +919,10 @@ auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
-> packet::error_type {
const auto relative_path = utils::string::to_utf8(file_name);
const auto file_path = construct_path(relative_path);
auto ret = has_open_info(reinterpret_cast<remote::file_handle>(file_desc),
STATUS_INVALID_HANDLE);
auto ret =
has_open_info(static_cast<native_handle>(
reinterpret_cast<remote::file_handle>(file_desc)),
STATUS_INVALID_HANDLE);
if (ret == STATUS_SUCCESS) {
ret =
utils::file::is_directory(file_path)
@ -1207,14 +1211,17 @@ auto remote_server::winfsp_overwrite(PVOID file_desc, UINT32 attributes,
drive_.set_item_meta(api_path, META_ATTRIBUTES,
std::to_string(attributes));
}
ret = populate_file_info(construct_api_path(get_open_file_path(handle)),
ret = populate_file_info(construct_api_path(get_open_file_path(
static_cast<native_handle>(handle))),
*file_info);
} else {
ret = utils::unix_error_to_windows(errno);
}
}
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, get_open_file_path(handle), ret);
RAISE_REMOTE_FUSE_SERVER_EVENT(
__FUNCTION__, get_open_file_path(static_cast<native_handle>(handle)),
ret);
return ret;
}
@ -1224,17 +1231,20 @@ auto remote_server::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
*bytes_transferred = 0;
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
auto ret =
has_open_info(static_cast<native_handle>(handle), STATUS_INVALID_HANDLE);
if (ret == STATUS_SUCCESS) {
const auto res = pread64(handle, buffer, length, offset);
if (res >= 0) {
*bytes_transferred = res;
*bytes_transferred = static_cast<UINT32>(res);
} else {
ret = utils::unix_error_to_windows(errno);
}
}
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, get_open_file_path(handle), ret);
RAISE_REMOTE_FUSE_SERVER_EVENT(
__FUNCTION__, get_open_file_path(static_cast<native_handle>(handle)),
ret);
return ret;
}
@ -1244,9 +1254,11 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
item_list.clear();
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
auto ret =
has_open_info(static_cast<native_handle>(handle), STATUS_INVALID_HANDLE);
if (ret == STATUS_SUCCESS) {
const auto api_path = construct_api_path(get_open_file_path(handle));
const auto api_path = construct_api_path(
get_open_file_path(static_cast<native_handle>(handle)));
auto list = drive_.get_directory_items(api_path);
directory_iterator iterator(std::move(list));
auto offset = marker
@ -1265,7 +1277,9 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
ret = STATUS_SUCCESS;
}
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, get_open_file_path(handle), ret);
RAISE_REMOTE_FUSE_SERVER_EVENT(
__FUNCTION__, get_open_file_path(static_cast<native_handle>(handle)),
ret);
return ret;
}
@ -1300,9 +1314,11 @@ auto remote_server::winfsp_set_basic_info(
UINT64 last_access_time, UINT64 last_write_time, UINT64 change_time,
remote::file_info *file_info) -> packet::error_type {
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
auto ret =
has_open_info(static_cast<native_handle>(handle), STATUS_INVALID_HANDLE);
if (ret == STATUS_SUCCESS) {
const auto file_path = get_open_file_path(handle);
const auto file_path =
get_open_file_path(static_cast<native_handle>(handle));
if (attributes == INVALID_FILE_ATTRIBUTES) {
attributes = 0;
} else if (attributes == 0) {
@ -1349,7 +1365,9 @@ auto remote_server::winfsp_set_basic_info(
ret = populate_file_info(api_path, *file_info);
}
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, get_open_file_path(handle), ret);
RAISE_REMOTE_FUSE_SERVER_EVENT(
__FUNCTION__, get_open_file_path(static_cast<native_handle>(handle)),
ret);
return ret;
}
@ -1358,17 +1376,24 @@ auto remote_server::winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
remote::file_info *file_info)
-> packet::error_type {
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
auto ret =
has_open_info(static_cast<native_handle>(handle), STATUS_INVALID_HANDLE);
if (ret == STATUS_SUCCESS) {
const auto res = set_allocation_size ? 0 : ftruncate(handle, new_size);
const auto res =
set_allocation_size
? 0
: ftruncate(static_cast<native_handle>(handle), new_size);
ret = ((res < 0) ? utils::unix_error_to_windows(errno) : 0);
if (ret == 0) {
ret = populate_file_info(construct_api_path(get_open_file_path(handle)),
ret = populate_file_info(construct_api_path(get_open_file_path(
static_cast<native_handle>(handle))),
*file_info);
}
}
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, get_open_file_path(handle), ret);
RAISE_REMOTE_FUSE_SERVER_EVENT(
__FUNCTION__, get_open_file_path(static_cast<native_handle>(handle)),
ret);
return ret;
}
@ -1387,9 +1412,11 @@ auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
-> packet::error_type {
*bytes_transferred = 0;
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
auto ret =
has_open_info(static_cast<native_handle>(handle), STATUS_INVALID_HANDLE);
if (ret == STATUS_SUCCESS) {
const auto api_path = construct_api_path(get_open_file_path(handle));
const auto api_path = construct_api_path(
get_open_file_path(static_cast<native_handle>(handle)));
const auto file_size = drive_.get_file_size(api_path);
if (write_to_end) {
offset = file_size;
@ -1401,7 +1428,7 @@ auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
ret = STATUS_SUCCESS;
should_write = false;
} else if ((offset + length) > file_size) {
length = static_cast<UINT64>(file_size - offset);
length = static_cast<UINT32>(file_size - offset);
}
}
@ -1409,9 +1436,10 @@ auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
if (length > 0) {
const auto res = pwrite64(handle, buffer, length, offset);
if (res >= 0) {
*bytes_transferred = res;
ret = populate_file_info(
construct_api_path(get_open_file_path(handle)), *file_info);
*bytes_transferred = static_cast<UINT32>(res);
ret = populate_file_info(construct_api_path(get_open_file_path(
static_cast<native_handle>(handle))),
*file_info);
} else {
ret = utils::unix_error_to_windows(errno);
}
@ -1419,7 +1447,9 @@ auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
}
}
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, get_open_file_path(handle), ret);
RAISE_REMOTE_FUSE_SERVER_EVENT(
__FUNCTION__, get_open_file_path(static_cast<native_handle>(handle)),
ret);
return ret;
}