From 03dd9ee579b2c5d82c4943f1ee028d2c1a487833 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Fri, 2 Aug 2024 13:05:15 -0500 Subject: [PATCH] refactor --- .../include/utils/unix/unix_utils.hpp | 2 +- .../drives/fuse/remotefuse/remote_server.cpp | 19 +++++++++++++------ .../winfsp/remotewinfsp/remote_client.cpp | 4 ++-- .../src/utils/unix/unix_utils.cpp | 2 +- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/repertory/librepertory/include/utils/unix/unix_utils.hpp b/repertory/librepertory/include/utils/unix/unix_utils.hpp index 8ec75a3d..1d19242c 100644 --- a/repertory/librepertory/include/utils/unix/unix_utils.hpp +++ b/repertory/librepertory/include/utils/unix/unix_utils.hpp @@ -41,7 +41,7 @@ inline const std::array attribute_namespaces = { [[nodiscard]] auto to_api_error(int err) -> api_error; -[[nodiscard]] auto unix_error_to_windows(int err) -> std::int32_t; +[[nodiscard]] auto unix_error_to_windows(int err) -> std::uint32_t; [[nodiscard]] auto unix_time_to_windows_time(const remote::file_time &file_time) -> UINT64; diff --git a/repertory/librepertory/src/drives/fuse/remotefuse/remote_server.cpp b/repertory/librepertory/src/drives/fuse/remotefuse/remote_server.cpp index 0fb676c2..837237d8 100644 --- a/repertory/librepertory/src/drives/fuse/remotefuse/remote_server.cpp +++ b/repertory/librepertory/src/drives/fuse/remotefuse/remote_server.cpp @@ -1211,7 +1211,8 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options, populate_file_info(api_path, 0, attributes, *file_info); } - auto ret = utils::unix_error_to_windows((res < 0) ? errno : 0); + auto ret = static_cast( + utils::unix_error_to_windows((res < 0) ? errno : 0)); RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -1345,7 +1346,8 @@ auto remote_server::winfsp_open( } } - auto ret = utils::unix_error_to_windows((res < 0) ? errno : 0); + auto ret = static_cast( + utils::unix_error_to_windows((res < 0) ? errno : 0)); RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -1398,7 +1400,8 @@ auto remote_server::winfsp_overwrite( static_cast(handle))), *file_info); } else { - ret = utils::unix_error_to_windows(errno); + ret = + static_cast(utils::unix_error_to_windows(errno)); } } @@ -1426,7 +1429,8 @@ auto remote_server::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, if (res >= 0) { *bytes_transferred = static_cast(res); } else { - ret = utils::unix_error_to_windows(errno); + ret = + static_cast(utils::unix_error_to_windows(errno)); } } @@ -1497,7 +1501,9 @@ auto remote_server::winfsp_rename( construct_api_path(new_file_path)); } - auto ret = ((res < 0) ? utils::unix_error_to_windows(errno) : 0); + auto ret = ((res < 0) ? static_cast( + utils::unix_error_to_windows(errno)) + : 0); RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, file_path + "|" + new_file_path, ret); return ret; @@ -1649,7 +1655,8 @@ auto remote_server::winfsp_write( static_cast(handle))), *file_info); } else { - ret = utils::unix_error_to_windows(errno); + ret = static_cast( + utils::unix_error_to_windows(errno)); } } } diff --git a/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_client.cpp b/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_client.cpp index a70761ec..2093b61a 100644 --- a/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_client.cpp +++ b/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_client.cpp @@ -256,10 +256,10 @@ auto remote_client::winfsp_get_dir_buffer([[maybe_unused]] PVOID file_desc, -> packet::error_type { #if defined(_WIN32) if (get_directory_buffer(reinterpret_cast(file_desc), ptr)) { - return STATUS_SUCCESS; + return static_cast(STATUS_SUCCESS); } #endif - return STATUS_INVALID_HANDLE; + return static_cast(STATUS_INVALID_HANDLE); } auto remote_client::winfsp_get_file_info( diff --git a/repertory/librepertory/src/utils/unix/unix_utils.cpp b/repertory/librepertory/src/utils/unix/unix_utils.cpp index 3d19389f..428ae4e8 100644 --- a/repertory/librepertory/src/utils/unix/unix_utils.cpp +++ b/repertory/librepertory/src/utils/unix/unix_utils.cpp @@ -161,7 +161,7 @@ auto to_api_error(int err) -> api_error { } } -auto unix_error_to_windows(int err) -> std::int32_t { +auto unix_error_to_windows(int err) -> std::uint32_t { switch (err) { case 0: return STATUS_SUCCESS;