refactor
This commit is contained in:
		| @@ -41,7 +41,7 @@ inline const std::array<std::string, 4U> attribute_namespaces = { | |||||||
|  |  | ||||||
| [[nodiscard]] auto to_api_error(int err) -> api_error; | [[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 | [[nodiscard]] auto | ||||||
| unix_time_to_windows_time(const remote::file_time &file_time) -> UINT64; | unix_time_to_windows_time(const remote::file_time &file_time) -> UINT64; | ||||||
|   | |||||||
| @@ -1211,7 +1211,8 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options, | |||||||
|     populate_file_info(api_path, 0, attributes, *file_info); |     populate_file_info(api_path, 0, attributes, *file_info); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   auto ret = utils::unix_error_to_windows((res < 0) ? errno : 0); |   auto ret = static_cast<packet::error_type>( | ||||||
|  |       utils::unix_error_to_windows((res < 0) ? errno : 0)); | ||||||
|   RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, file_path, ret); |   RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, file_path, ret); | ||||||
|   return 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<packet::error_type>( | ||||||
|  |       utils::unix_error_to_windows((res < 0) ? errno : 0)); | ||||||
|   RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, file_path, ret); |   RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, file_path, ret); | ||||||
|   return ret; |   return ret; | ||||||
| } | } | ||||||
| @@ -1398,7 +1400,8 @@ auto remote_server::winfsp_overwrite( | |||||||
|                                    static_cast<native_handle>(handle))), |                                    static_cast<native_handle>(handle))), | ||||||
|                                *file_info); |                                *file_info); | ||||||
|     } else { |     } else { | ||||||
|       ret = utils::unix_error_to_windows(errno); |       ret = | ||||||
|  |           static_cast<packet::error_type>(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) { |     if (res >= 0) { | ||||||
|       *bytes_transferred = static_cast<UINT32>(res); |       *bytes_transferred = static_cast<UINT32>(res); | ||||||
|     } else { |     } else { | ||||||
|       ret = utils::unix_error_to_windows(errno); |       ret = | ||||||
|  |           static_cast<packet::error_type>(utils::unix_error_to_windows(errno)); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -1497,7 +1501,9 @@ auto remote_server::winfsp_rename( | |||||||
|                                   construct_api_path(new_file_path)); |                                   construct_api_path(new_file_path)); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   auto ret = ((res < 0) ? utils::unix_error_to_windows(errno) : 0); |   auto ret = ((res < 0) ? static_cast<packet::error_type>( | ||||||
|  |                               utils::unix_error_to_windows(errno)) | ||||||
|  |                         : 0); | ||||||
|   RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, file_path + "|" + new_file_path, |   RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, file_path + "|" + new_file_path, | ||||||
|                                  ret); |                                  ret); | ||||||
|   return ret; |   return ret; | ||||||
| @@ -1649,7 +1655,8 @@ auto remote_server::winfsp_write( | |||||||
|                                        static_cast<native_handle>(handle))), |                                        static_cast<native_handle>(handle))), | ||||||
|                                    *file_info); |                                    *file_info); | ||||||
|         } else { |         } else { | ||||||
|           ret = utils::unix_error_to_windows(errno); |           ret = static_cast<packet::error_type>( | ||||||
|  |               utils::unix_error_to_windows(errno)); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -256,10 +256,10 @@ auto remote_client::winfsp_get_dir_buffer([[maybe_unused]] PVOID file_desc, | |||||||
|     -> packet::error_type { |     -> packet::error_type { | ||||||
| #if defined(_WIN32) | #if defined(_WIN32) | ||||||
|   if (get_directory_buffer(reinterpret_cast<native_handle>(file_desc), ptr)) { |   if (get_directory_buffer(reinterpret_cast<native_handle>(file_desc), ptr)) { | ||||||
|     return STATUS_SUCCESS; |     return static_cast<packet::error_type>(STATUS_SUCCESS); | ||||||
|   } |   } | ||||||
| #endif | #endif | ||||||
|   return STATUS_INVALID_HANDLE; |   return static_cast<packet::error_type>(STATUS_INVALID_HANDLE); | ||||||
| } | } | ||||||
|  |  | ||||||
| auto remote_client::winfsp_get_file_info( | auto remote_client::winfsp_get_file_info( | ||||||
|   | |||||||
| @@ -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) { |   switch (err) { | ||||||
|   case 0: |   case 0: | ||||||
|     return STATUS_SUCCESS; |     return STATUS_SUCCESS; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user