Address compiler warnings #10
This commit is contained in:
@ -602,18 +602,20 @@ auto remote_server::fuse_read(const char *path, char *buffer,
|
||||
-> packet::error_type {
|
||||
const auto file_path = construct_path(path);
|
||||
auto &data = *reinterpret_cast<data_buffer *>(buffer);
|
||||
auto res = has_open_info(static_cast<native_handle>(handle), EBADF);
|
||||
if (res == 0) {
|
||||
|
||||
ssize_t bytes_read{has_open_info(static_cast<native_handle>(handle), EBADF)};
|
||||
if (bytes_read == 0) {
|
||||
data.resize(read_size);
|
||||
res = pread64(static_cast<native_handle>(handle), data.data(), read_size,
|
||||
static_cast<off_t>(read_offset));
|
||||
bytes_read = pread64(static_cast<native_handle>(handle), data.data(),
|
||||
read_size, static_cast<off_t>(read_offset));
|
||||
}
|
||||
|
||||
auto ret = ((res < 0) ? -errno : res);
|
||||
auto ret = ((bytes_read < 0) ? -errno : bytes_read);
|
||||
if (ret < 0) {
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, file_path, ret);
|
||||
}
|
||||
return ret;
|
||||
|
||||
return static_cast<packet::error_type>(ret);
|
||||
}
|
||||
|
||||
auto remote_server::fuse_rename(const char *from, const char *to)
|
||||
@ -638,7 +640,7 @@ auto remote_server::fuse_readdir(const char *path,
|
||||
res = -1;
|
||||
} else {
|
||||
auto *iterator = reinterpret_cast<directory_iterator *>(handle);
|
||||
if (iterator) {
|
||||
if (iterator != nullptr) {
|
||||
res = iterator->get(static_cast<std::size_t>(offset), item_path);
|
||||
} else {
|
||||
res = -1;
|
||||
@ -699,7 +701,7 @@ auto remote_server::fuse_rmdir(const char *path) -> packet::error_type {
|
||||
const auto file_path = construct_path(path);
|
||||
const auto res = rmdir(file_path.c_str());
|
||||
if (res == 0) {
|
||||
auto iterator =
|
||||
auto *iterator =
|
||||
directory_cache_.remove_directory(utils::path::create_api_path(path));
|
||||
if (iterator == nullptr) {
|
||||
utils::error::raise_error(
|
||||
@ -892,17 +894,20 @@ auto remote_server::fuse_write(const char *path, const char *buffer,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
const auto file_path = construct_path(path);
|
||||
auto res = has_open_info(static_cast<native_handle>(handle), EBADF);
|
||||
if (res == 0) {
|
||||
res = pwrite64(static_cast<native_handle>(handle), buffer, write_size,
|
||||
static_cast<off_t>(write_offset));
|
||||
|
||||
ssize_t bytes_written{
|
||||
has_open_info(static_cast<native_handle>(handle), EBADF)};
|
||||
if (bytes_written == 0) {
|
||||
bytes_written = pwrite64(static_cast<native_handle>(handle), buffer,
|
||||
write_size, static_cast<off_t>(write_offset));
|
||||
}
|
||||
|
||||
auto ret = ((res < 0) ? -errno : res);
|
||||
auto ret = ((bytes_written < 0) ? -errno : bytes_written);
|
||||
if (ret < 0) {
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, file_path, ret);
|
||||
}
|
||||
return ret;
|
||||
|
||||
return static_cast<packet::error_type>(ret);
|
||||
}
|
||||
|
||||
auto remote_server::fuse_write_base64(
|
||||
@ -1012,7 +1017,7 @@ auto remote_server::winfsp_close(PVOID file_desc) -> packet::error_type {
|
||||
|
||||
auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options,
|
||||
UINT32 granted_access, UINT32 attributes,
|
||||
UINT64 /*allocationSize*/, PVOID *file_desc,
|
||||
UINT64 /*allocation_size*/, PVOID *file_desc,
|
||||
remote::file_info *file_info,
|
||||
std::string &normalized_name, BOOLEAN &exists)
|
||||
-> packet::error_type {
|
||||
@ -1098,8 +1103,8 @@ auto remote_server::winfsp_get_file_info(PVOID file_desc,
|
||||
|
||||
auto remote_server::winfsp_get_security_by_name(
|
||||
PWSTR file_name, PUINT32 attributes,
|
||||
std::uint64_t * /*securityDescriptorSize*/,
|
||||
std::wstring & /*strDescriptor*/) -> packet::error_type {
|
||||
std::uint64_t * /*security_descriptor_size*/,
|
||||
std::wstring & /*str_descriptor*/) -> packet::error_type {
|
||||
auto ret = STATUS_SUCCESS;
|
||||
const auto file_path = construct_path(file_name);
|
||||
if (utils::file::is_file(file_path) ||
|
||||
@ -1173,7 +1178,7 @@ auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options,
|
||||
|
||||
auto remote_server::winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||
BOOLEAN replace_attributes,
|
||||
UINT64 /*allocationSize*/,
|
||||
UINT64 /*allocation_size*/,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type {
|
||||
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
|
||||
@ -1234,7 +1239,8 @@ auto remote_server::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||
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);
|
||||
const auto res = pread64(static_cast<native_handle>(handle), buffer, length,
|
||||
static_cast<off_t>(offset));
|
||||
if (res >= 0) {
|
||||
*bytes_transferred = static_cast<UINT32>(res);
|
||||
} else {
|
||||
@ -1434,7 +1440,8 @@ auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||
|
||||
if (should_write) {
|
||||
if (length > 0) {
|
||||
const auto res = pwrite64(handle, buffer, length, offset);
|
||||
const auto res = pwrite64(static_cast<native_handle>(handle), buffer,
|
||||
length, static_cast<off_t>(offset));
|
||||
if (res >= 0) {
|
||||
*bytes_transferred = static_cast<UINT32>(res);
|
||||
ret = populate_file_info(construct_api_path(get_open_file_path(
|
||||
@ -1486,8 +1493,8 @@ auto remote_server::json_read_directory_snapshot(
|
||||
std::uint32_t page, json &json_data) -> packet::error_type {
|
||||
const auto file_path = construct_path(path);
|
||||
auto *iterator = reinterpret_cast<directory_iterator *>(handle);
|
||||
std::size_t offset = 0u;
|
||||
int res;
|
||||
std::size_t offset{};
|
||||
int res{};
|
||||
json item_json;
|
||||
while ((json_data["directory_list"].size() < REPERTORY_DIRECTORY_PAGE_SIZE) &&
|
||||
(res = iterator->get_json(
|
||||
|
Reference in New Issue
Block a user