diff --git a/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_server.cpp b/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_server.cpp index 3a35ce11..3bff5c2b 100644 --- a/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_server.cpp +++ b/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_server.cpp @@ -113,7 +113,9 @@ auto remote_server::fuse_access(const char *path, const std::int32_t &mask) const auto file_path = construct_path(path); const auto windows_mask = utils::unix_access_mask_to_windows(mask); - const auto res = _access(file_path.c_str(), windows_mask); + auto res{ + _access(file_path.c_str(), windows_mask), + }; const auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; @@ -188,7 +190,9 @@ auto remote_server::fuse_fgetattr( const auto file_path = construct_path(path); memset(&r_stat, 0, sizeof(remote::stat)); - auto res = has_compat_open_info(handle, EBADF); + auto res{ + has_compat_open_info(handle, EBADF), + }; if (res == 0) { directory = utils::file::directory(file_path).exists(); struct _stat64 unix_st {}; @@ -225,7 +229,9 @@ auto remote_server::fuse_fsync( const auto file_path = construct_path(path); - auto res = has_compat_open_info(handle, EBADF); + auto res{ + has_compat_open_info(handle, EBADF), + }; if (res == 0) { res = -1; errno = EBADF; @@ -254,7 +260,9 @@ auto remote_server::fuse_ftruncate( const auto file_path = construct_path(path); - auto res = has_compat_open_info(handle, EBADF); + auto res{ + has_compat_open_info(handle, EBADF), + }; if (res == 0) { res = -1; errno = EBADF; @@ -289,7 +297,9 @@ auto remote_server::fuse_getattr(const char *path, remote::stat &r_st, directory = utils::file::directory(file_path).exists(); struct _stat64 st1 {}; - const auto res = _stat64(file_path.c_str(), &st1); + auto res{ + _stat64(file_path.c_str(), &st1), + }; if (res == 0) { populate_stat(path, directory, r_st, st1); } @@ -349,7 +359,9 @@ auto remote_server::fuse_mkdir(const char *path, }; const auto file_path = construct_path(path); - const auto res = _mkdir(file_path.c_str()); + auto res{ + _mkdir(file_path.c_str()), + }; const auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; @@ -363,7 +375,7 @@ auto remote_server::fuse_opendir(const char *path, remote::file_handle &handle) const auto file_path = construct_path(path); const auto unicode_file_path = utils::string::from_utf8(file_path); - auto res = -1; + auto res{-1}; errno = ENOENT; if (::PathIsDirectoryW(unicode_file_path.c_str()) != 0) { @@ -406,8 +418,9 @@ auto remote_server::fuse_create(const char *path, const remote::file_mode &mode, ret = -EACCES; } else { int file = -1; - const auto res = - _sopen_s(&file, file_path.c_str(), open_flags, _SH_DENYNO, perms); + auto res{ + _sopen_s(&file, file_path.c_str(), open_flags, _SH_DENYNO, perms), + }; if (res == 0) { handle = static_cast(file); ret = 0; @@ -429,7 +442,7 @@ auto remote_server::fuse_open(const char *path, const remote::open_flags &flags, }; const auto file_path = construct_path(path); - auto res = -1; + auto res{-1}; if ((flags & remote::open_flags::directory) == remote::open_flags::directory) { @@ -464,13 +477,13 @@ auto remote_server::fuse_read( const auto file_path = construct_path(path); auto &data = *reinterpret_cast(buffer); - auto res = 0; + auto res{0}; if (read_size > std::numeric_limits::max()) { res = -1; errno = ERANGE; } else if ((res = has_compat_open_info(handle, EBADF)) == 0) { - res = _lseeki64(static_cast(handle), static_cast<__int64>(read_offset), - SEEK_SET); + res = static_cast(_lseeki64( + static_cast(handle), static_cast<__int64>(read_offset), SEEK_SET)); if (res != -1) { data.resize(read_size); res = read(static_cast(handle), data.data(), @@ -498,7 +511,9 @@ auto remote_server::fuse_rename(const char *from, const auto from_path = utils::path::combine(mount_location_, {from}); const auto to_path = utils::path::combine(mount_location_, {to}); - const auto res = rename(from_path.c_str(), to_path.c_str()); + auto res{ + rename(from_path.c_str(), to_path.c_str()), + }; const auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, from + std::string("|") + to, @@ -516,15 +531,16 @@ auto remote_server::fuse_write( const auto file_path = construct_path(path); std::size_t bytes_written{}; - auto res = 0; + auto res{0}; if (write_size > std::numeric_limits::max()) { res = -1; errno = ERANGE; } else { res = has_compat_open_info(handle, EBADF); if (res == 0) { - res = _lseeki64(static_cast(handle), - static_cast<__int64>(write_offset), SEEK_SET); + res = static_cast( + _lseeki64(static_cast(handle), + static_cast<__int64>(write_offset), SEEK_SET)); if (res != -1) { res = write(static_cast(handle), buffer, static_cast(write_size)); @@ -560,7 +576,7 @@ auto remote_server::fuse_readdir(const char *path, }; const auto file_path = construct_path(path); - auto res = 0; + auto res{0}; if (offset > std::numeric_limits::max()) { errno = ERANGE; res = -1; @@ -588,7 +604,9 @@ auto remote_server::fuse_release( const auto file_path = construct_path(path); remove_compat_open_info(handle); - const auto res = _close(static_cast(handle)); + auto res{ + _close(static_cast(handle)), + }; const auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); @@ -620,7 +638,9 @@ 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()); + auto res{ + _rmdir(file_path.c_str()), + }; const auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; @@ -761,7 +781,7 @@ auto remote_server::fuse_truncate( const auto file_path = construct_path(path); const auto unicode_file_path = utils::string::from_utf8(file_path); - auto res = -1; + auto res{-1}; errno = ENOENT; const auto flags_and_attributes = @@ -796,7 +816,9 @@ auto remote_server::fuse_unlink(const char *path) -> packet::error_type { }; const auto file_path = construct_path(path); - const auto res = _unlink(file_path.c_str()); + auto res{ + _unlink(file_path.c_str()), + }; const auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; @@ -812,7 +834,7 @@ auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv, const auto file_path = construct_path(path); const auto unicode_file_path = utils::string::from_utf8(file_path); - auto res = -1; + auto res{-1}; errno = ENOENT; const auto flags_and_attributes = @@ -874,7 +896,7 @@ auto remote_server::json_create_directory_snapshot( const auto file_path = construct_path(path); - auto res = -1; + auto res{-1}; errno = ENOENT; if (utils::file::directory(file_path).exists()) { @@ -1481,4 +1503,4 @@ auto remote_server::winfsp_get_dir_buffer(PVOID /*file_desc*/, PVOID *& /*ptr*/) } } // namespace repertory::remote_winfsp -#endif // _WIN32 +#endif // defined(_WIN32)