fixes
This commit is contained in:
@ -111,8 +111,8 @@ auto get_free_drive_space(std::string_view path)
|
||||
try {
|
||||
#if defined(_WIN32)
|
||||
ULARGE_INTEGER li{};
|
||||
if (not ::GetDiskFreeSpaceEx(std::string{path}.c_str(), &li, nullptr,
|
||||
nullptr)) {
|
||||
if (not::GetDiskFreeSpaceEx(std::string{path}.c_str(), &li, nullptr,
|
||||
nullptr)) {
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
"failed to get free disk space",
|
||||
@ -125,7 +125,7 @@ auto get_free_drive_space(std::string_view path)
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
#if defined(__linux__)
|
||||
struct statfs64 st {};
|
||||
struct statfs64 st{};
|
||||
if (statfs64(std::string{path}.c_str(), &st) != 0) {
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
@ -139,7 +139,7 @@ auto get_free_drive_space(std::string_view path)
|
||||
#endif // defined(__linux__)
|
||||
|
||||
#if defined(__APPLE__)
|
||||
struct statvfs st {};
|
||||
struct statvfs st{};
|
||||
if (statvfs(path.c_str(), &st) != 0) {
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
@ -165,8 +165,8 @@ auto get_free_drive_space(std::wstring_view path)
|
||||
return get_free_drive_space(utils::string::to_utf8(path));
|
||||
}
|
||||
|
||||
auto get_time(std::string_view path,
|
||||
time_type type) -> std::optional<std::uint64_t> {
|
||||
auto get_time(std::string_view path, time_type type)
|
||||
-> std::optional<std::uint64_t> {
|
||||
auto times = get_times(path);
|
||||
if (times.has_value()) {
|
||||
return times->get(type);
|
||||
@ -175,8 +175,8 @@ auto get_time(std::string_view path,
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
auto get_time(std::wstring_view path,
|
||||
time_type type) -> std::optional<std::uint64_t> {
|
||||
auto get_time(std::wstring_view path, time_type type)
|
||||
-> std::optional<std::uint64_t> {
|
||||
return get_time(utils::string::to_utf8(path), type);
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ auto get_times(std::string_view path) -> std::optional<file_times> {
|
||||
}
|
||||
}
|
||||
|
||||
struct _stat64 st {};
|
||||
struct _stat64 st{};
|
||||
if (_stat64(std::string{path}.c_str(), &st) != 0) {
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
@ -222,7 +222,7 @@ auto get_times(std::string_view path) -> std::optional<file_times> {
|
||||
ret.modified = utils::time::windows_time_t_to_unix_time(st.st_mtime);
|
||||
ret.written = utils::time::windows_time_t_to_unix_time(st.st_mtime);
|
||||
#else // !defined(_WIN32)
|
||||
struct stat64 st {};
|
||||
struct stat64 st{};
|
||||
if (stat64(std::string{path}.c_str(), &st) != 0) {
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
@ -268,8 +268,8 @@ auto get_total_drive_space(std::string_view path)
|
||||
try {
|
||||
#if defined(_WIN32)
|
||||
ULARGE_INTEGER li{};
|
||||
if (not ::GetDiskFreeSpaceEx(std::string{path}.c_str(), nullptr, &li,
|
||||
nullptr)) {
|
||||
if (not::GetDiskFreeSpaceEx(std::string{path}.c_str(), nullptr, &li,
|
||||
nullptr)) {
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
"failed to get total disk space",
|
||||
@ -282,7 +282,7 @@ auto get_total_drive_space(std::string_view path)
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
#if defined(__linux__)
|
||||
struct statfs64 st {};
|
||||
struct statfs64 st{};
|
||||
if (statfs64(std::string{path}.c_str(), &st) != 0) {
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
@ -296,7 +296,7 @@ auto get_total_drive_space(std::string_view path)
|
||||
#endif // defined(__linux__)
|
||||
|
||||
#if defined(__APPLE__)
|
||||
struct statvfs st {};
|
||||
struct statvfs st{};
|
||||
if (statvfs(path.c_str(), &st) != 0) {
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
@ -368,7 +368,7 @@ auto read_json_file(std::string_view path, nlohmann::json &data) -> bool {
|
||||
try {
|
||||
auto abs_path = utils::path::absolute(path);
|
||||
auto file = file::open_file(abs_path);
|
||||
if (not *file) {
|
||||
if (not*file) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -416,8 +416,8 @@ auto read_json_file(std::string_view path, nlohmann::json &data) -> bool {
|
||||
auto write_json_file(std::string_view path, const nlohmann::json &data,
|
||||
std::optional<std::string_view> password) -> bool {
|
||||
#else // !defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST)
|
||||
auto write_json_file(std::string_view path,
|
||||
const nlohmann::json &data) -> bool {
|
||||
auto write_json_file(std::string_view path, const nlohmann::json &data)
|
||||
-> bool {
|
||||
#endif // defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST)
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
@ -482,8 +482,8 @@ auto read_json_file(std::wstring_view path, nlohmann::json &data) -> bool {
|
||||
return read_json_file(utils::string::to_utf8(path), data);
|
||||
}
|
||||
|
||||
auto write_json_file(std::wstring_view path,
|
||||
const nlohmann::json &data) -> bool {
|
||||
auto write_json_file(std::wstring_view path, const nlohmann::json &data)
|
||||
-> bool {
|
||||
return write_json_file(utils::string::to_utf8(path), data);
|
||||
}
|
||||
#endif // defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST)
|
||||
@ -498,8 +498,8 @@ static constexpr const auto validate_smb_path =
|
||||
std::count(path.begin(), path.end(), '/') >= 3U);
|
||||
};
|
||||
|
||||
auto smb_create_smb_path(std::string_view smb_path,
|
||||
std::string_view rel_path) -> std::string {
|
||||
auto smb_create_smb_path(std::string_view smb_path, std::string_view rel_path)
|
||||
-> std::string {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
if (not validate_smb_path(smb_path)) {
|
||||
@ -532,8 +532,9 @@ auto smb_create_smb_path(std::string_view smb_path,
|
||||
return path;
|
||||
}
|
||||
|
||||
auto smb_create_and_validate_relative_path(
|
||||
std::string_view smb_path, std::string_view path) -> std::string {
|
||||
auto smb_create_and_validate_relative_path(std::string_view smb_path,
|
||||
std::string_view path)
|
||||
-> std::string {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
if (not validate_smb_path(smb_path)) {
|
||||
@ -689,8 +690,8 @@ auto smb_get_uri_path(std::string_view smb_path, std::string_view user,
|
||||
std::string{smb_path.substr(2U)};
|
||||
}
|
||||
|
||||
auto smb_parent_is_same(std::string_view smb_path1,
|
||||
std::string_view smb_path2) -> bool {
|
||||
auto smb_parent_is_same(std::string_view smb_path1, std::string_view smb_path2)
|
||||
-> bool {
|
||||
if (not(validate_smb_path(smb_path1) && validate_smb_path(smb_path2))) {
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user