From 90eb10aa0fcd9aa1d0c2f6f965100c7aefdc48fb Mon Sep 17 00:00:00 2001 From: Vitor Kiguchi Date: Wed, 24 Mar 2021 12:47:45 -0300 Subject: [PATCH] clang format --- src/core/file_sys/archive_backend.cpp | 2 +- src/core/file_sys/archive_backend.h | 2 ++ src/core/file_sys/archive_sdmc.cpp | 36 +++++++++++++------- src/core/file_sys/archive_systemsavedata.cpp | 6 ++-- src/core/file_sys/savedata_archive.cpp | 36 +++++++++++++------- src/core/hle/service/fs/archive.cpp | 3 +- 6 files changed, 55 insertions(+), 30 deletions(-) diff --git a/src/core/file_sys/archive_backend.cpp b/src/core/file_sys/archive_backend.cpp index 75cf0417a..fcab55be9 100644 --- a/src/core/file_sys/archive_backend.cpp +++ b/src/core/file_sys/archive_backend.cpp @@ -5,9 +5,9 @@ #include #include #include +#include "common/file_util.h" #include "common/logging/log.h" #include "common/string_util.h" -#include "common/file_util.h" #include "core/file_sys/archive_backend.h" #include "core/memory.h" diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h index c4ef06dfa..f158aa2e7 100644 --- a/src/core/file_sys/archive_backend.h +++ b/src/core/file_sys/archive_backend.h @@ -198,6 +198,7 @@ public: protected: std::unique_ptr delay_generator; static std::string base_path; + private: template void serialize(Archive& ar, const unsigned int) { @@ -243,6 +244,7 @@ public: static std::string sdmc_directory; static std::string nand_directory; + private: template void serialize(Archive& ar, const unsigned int) {} diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp index a5f60876e..28d8d697d 100644 --- a/src/core/file_sys/archive_sdmc.cpp +++ b/src/core/file_sys/archive_sdmc.cpp @@ -81,7 +81,8 @@ ResultVal> SDMCArchive::OpenFileBase(const Path& pa switch (path_parser.GetHostStatus(ArchiveBackend::base_path + mount_point)) { case PathParser::InvalidMountPoint: - LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", ArchiveBackend::base_path + mount_point); + LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", + ArchiveBackend::base_path + mount_point); return ERROR_NOT_FOUND; case PathParser::PathNotFound: case PathParser::FileInPath: @@ -127,7 +128,8 @@ ResultCode SDMCArchive::DeleteFile(const Path& path) const { switch (path_parser.GetHostStatus(ArchiveBackend::base_path + mount_point)) { case PathParser::InvalidMountPoint: - LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", ArchiveBackend::base_path + mount_point); + LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", + ArchiveBackend::base_path + mount_point); return ERROR_NOT_FOUND; case PathParser::PathNotFound: case PathParser::FileInPath: @@ -165,8 +167,10 @@ ResultCode SDMCArchive::RenameFile(const Path& src_path, const Path& dest_path) return ERROR_INVALID_PATH; } - const auto src_path_full = path_parser_src.BuildHostPath(ArchiveBackend::base_path + mount_point); - const auto dest_path_full = path_parser_dest.BuildHostPath(ArchiveBackend::base_path + mount_point); + const auto src_path_full = + path_parser_src.BuildHostPath(ArchiveBackend::base_path + mount_point); + const auto dest_path_full = + path_parser_dest.BuildHostPath(ArchiveBackend::base_path + mount_point); if (FileUtil::Rename(src_path_full, dest_path_full)) { return RESULT_SUCCESS; @@ -218,12 +222,14 @@ static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mou } ResultCode SDMCArchive::DeleteDirectory(const Path& path) const { - return DeleteDirectoryHelper(path, ArchiveBackend::base_path + mount_point, FileUtil::DeleteDir); + return DeleteDirectoryHelper(path, ArchiveBackend::base_path + mount_point, + FileUtil::DeleteDir); } ResultCode SDMCArchive::DeleteDirectoryRecursively(const Path& path) const { return DeleteDirectoryHelper( - path, ArchiveBackend::base_path + mount_point, [](const std::string& p) { return FileUtil::DeleteDirRecursively(p); }); + path, ArchiveBackend::base_path + mount_point, + [](const std::string& p) { return FileUtil::DeleteDirRecursively(p); }); } ResultCode SDMCArchive::CreateFile(const FileSys::Path& path, u64 size) const { @@ -238,7 +244,8 @@ ResultCode SDMCArchive::CreateFile(const FileSys::Path& path, u64 size) const { switch (path_parser.GetHostStatus(ArchiveBackend::base_path + mount_point)) { case PathParser::InvalidMountPoint: - LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", ArchiveBackend::base_path + mount_point); + LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", + ArchiveBackend::base_path + mount_point); return ERROR_NOT_FOUND; case PathParser::PathNotFound: case PathParser::FileInPath: @@ -283,7 +290,8 @@ ResultCode SDMCArchive::CreateDirectory(const Path& path) const { switch (path_parser.GetHostStatus(ArchiveBackend::base_path + mount_point)) { case PathParser::InvalidMountPoint: - LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", ArchiveBackend::base_path + mount_point); + LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", + ArchiveBackend::base_path + mount_point); return ERROR_NOT_FOUND; case PathParser::PathNotFound: case PathParser::FileInPath: @@ -301,7 +309,8 @@ ResultCode SDMCArchive::CreateDirectory(const Path& path) const { return RESULT_SUCCESS; } - LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", ArchiveBackend::base_path + mount_point); + LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", + ArchiveBackend::base_path + mount_point); return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled, ErrorLevel::Status); } @@ -322,8 +331,10 @@ ResultCode SDMCArchive::RenameDirectory(const Path& src_path, const Path& dest_p return ERROR_INVALID_PATH; } - const auto src_path_full = path_parser_src.BuildHostPath(ArchiveBackend::base_path + mount_point); - const auto dest_path_full = path_parser_dest.BuildHostPath(ArchiveBackend::base_path + mount_point); + const auto src_path_full = + path_parser_src.BuildHostPath(ArchiveBackend::base_path + mount_point); + const auto dest_path_full = + path_parser_dest.BuildHostPath(ArchiveBackend::base_path + mount_point); if (FileUtil::Rename(src_path_full, dest_path_full)) { return RESULT_SUCCESS; @@ -347,7 +358,8 @@ ResultVal> SDMCArchive::OpenDirectory(const Pa switch (path_parser.GetHostStatus(ArchiveBackend::base_path + mount_point)) { case PathParser::InvalidMountPoint: - LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", ArchiveBackend::base_path + mount_point); + LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", + ArchiveBackend::base_path + mount_point); return ERROR_NOT_FOUND; case PathParser::PathNotFound: case PathParser::NotFound: diff --git a/src/core/file_sys/archive_systemsavedata.cpp b/src/core/file_sys/archive_systemsavedata.cpp index 03592fdae..69b6db761 100644 --- a/src/core/file_sys/archive_systemsavedata.cpp +++ b/src/core/file_sys/archive_systemsavedata.cpp @@ -54,7 +54,8 @@ Path ConstructSystemSaveDataBinaryPath(u32 high, u32 low) { ResultVal> ArchiveFactory_SystemSaveData::Open(const Path& path, u64 program_id) { - const std::string fullpath = GetSystemSaveDataPath(GetSystemSaveDataContainerPath(ArchiveFactory::nand_directory), path); + const std::string fullpath = + GetSystemSaveDataPath(GetSystemSaveDataContainerPath(ArchiveFactory::nand_directory), path); std::string relative_path = GetSystemSaveDataPath(GetSystemSaveDataContainerPath("nand/"), path); if (!FileUtil::Exists(fullpath)) { @@ -68,7 +69,8 @@ ResultVal> ArchiveFactory_SystemSaveData::Open(c ResultCode ArchiveFactory_SystemSaveData::Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info, u64 program_id) { - std::string fullpath = GetSystemSaveDataPath(GetSystemSaveDataContainerPath(ArchiveFactory::nand_directory), path); + std::string fullpath = + GetSystemSaveDataPath(GetSystemSaveDataContainerPath(ArchiveFactory::nand_directory), path); FileUtil::DeleteDirRecursively(fullpath); FileUtil::CreateFullPath(fullpath); return RESULT_SUCCESS; diff --git a/src/core/file_sys/savedata_archive.cpp b/src/core/file_sys/savedata_archive.cpp index 51b902c7f..7d1f38cee 100644 --- a/src/core/file_sys/savedata_archive.cpp +++ b/src/core/file_sys/savedata_archive.cpp @@ -63,7 +63,8 @@ ResultVal> SaveDataArchive::OpenFile(const Path& pa switch (path_parser.GetHostStatus(ArchiveBackend::base_path + mount_point)) { case PathParser::InvalidMountPoint: - LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", ArchiveBackend::base_path + mount_point); + LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", + ArchiveBackend::base_path + mount_point); return ERROR_FILE_NOT_FOUND; case PathParser::PathNotFound: LOG_ERROR(Service_FS, "Path not found {}", full_path); @@ -109,7 +110,8 @@ ResultCode SaveDataArchive::DeleteFile(const Path& path) const { switch (path_parser.GetHostStatus(ArchiveBackend::base_path + mount_point)) { case PathParser::InvalidMountPoint: - LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", ArchiveBackend::base_path + mount_point); + LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", + ArchiveBackend::base_path + mount_point); return ERROR_FILE_NOT_FOUND; case PathParser::PathNotFound: LOG_ERROR(Service_FS, "Path not found {}", full_path); @@ -147,8 +149,10 @@ ResultCode SaveDataArchive::RenameFile(const Path& src_path, const Path& dest_pa return ERROR_INVALID_PATH; } - const auto src_path_full = path_parser_src.BuildHostPath(ArchiveBackend::base_path + mount_point); - const auto dest_path_full = path_parser_dest.BuildHostPath(ArchiveBackend::base_path + mount_point); + const auto src_path_full = + path_parser_src.BuildHostPath(ArchiveBackend::base_path + mount_point); + const auto dest_path_full = + path_parser_dest.BuildHostPath(ArchiveBackend::base_path + mount_point); if (FileUtil::Rename(src_path_full, dest_path_full)) { return RESULT_SUCCESS; @@ -200,13 +204,14 @@ static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mou } ResultCode SaveDataArchive::DeleteDirectory(const Path& path) const { - return DeleteDirectoryHelper(path, ArchiveBackend::base_path + mount_point, FileUtil::DeleteDir); + return DeleteDirectoryHelper(path, ArchiveBackend::base_path + mount_point, + FileUtil::DeleteDir); } ResultCode SaveDataArchive::DeleteDirectoryRecursively(const Path& path) const { - return DeleteDirectoryHelper(path, ArchiveBackend::base_path + mount_point, [](const std::string& p) { - return FileUtil::DeleteDirRecursively(p); - }); + return DeleteDirectoryHelper( + path, ArchiveBackend::base_path + mount_point, + [](const std::string& p) { return FileUtil::DeleteDirRecursively(p); }); } ResultCode SaveDataArchive::CreateFile(const FileSys::Path& path, u64 size) const { @@ -221,7 +226,8 @@ ResultCode SaveDataArchive::CreateFile(const FileSys::Path& path, u64 size) cons switch (path_parser.GetHostStatus(ArchiveBackend::base_path + mount_point)) { case PathParser::InvalidMountPoint: - LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", ArchiveBackend::base_path + mount_point); + LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", + ArchiveBackend::base_path + mount_point); return ERROR_FILE_NOT_FOUND; case PathParser::PathNotFound: LOG_ERROR(Service_FS, "Path not found {}", full_path); @@ -266,7 +272,8 @@ ResultCode SaveDataArchive::CreateDirectory(const Path& path) const { switch (path_parser.GetHostStatus(ArchiveBackend::base_path + mount_point)) { case PathParser::InvalidMountPoint: - LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", ArchiveBackend::base_path + mount_point); + LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", + ArchiveBackend::base_path + mount_point); return ERROR_FILE_NOT_FOUND; case PathParser::PathNotFound: LOG_ERROR(Service_FS, "Path not found {}", full_path); @@ -308,8 +315,10 @@ ResultCode SaveDataArchive::RenameDirectory(const Path& src_path, const Path& de return ERROR_INVALID_PATH; } - const auto src_path_full = path_parser_src.BuildHostPath(ArchiveBackend::base_path + mount_point); - const auto dest_path_full = path_parser_dest.BuildHostPath(ArchiveBackend::base_path + mount_point); + const auto src_path_full = + path_parser_src.BuildHostPath(ArchiveBackend::base_path + mount_point); + const auto dest_path_full = + path_parser_dest.BuildHostPath(ArchiveBackend::base_path + mount_point); if (FileUtil::Rename(src_path_full, dest_path_full)) { return RESULT_SUCCESS; @@ -334,7 +343,8 @@ ResultVal> SaveDataArchive::OpenDirectory( switch (path_parser.GetHostStatus(ArchiveBackend::base_path + mount_point)) { case PathParser::InvalidMountPoint: - LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", ArchiveBackend::base_path + mount_point); + LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", + ArchiveBackend::base_path + mount_point); return ERROR_FILE_NOT_FOUND; case PathParser::PathNotFound: case PathParser::NotFound: diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 66c2001ed..bf060b004 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -362,8 +362,7 @@ void ArchiveManager::RegisterArchiveTypes() { auto savedatacheck_factory = std::make_unique(); RegisterArchiveType(std::move(savedatacheck_factory), ArchiveIdCode::NCCH); - auto systemsavedata_factory = - std::make_unique(); + auto systemsavedata_factory = std::make_unique(); RegisterArchiveType(std::move(systemsavedata_factory), ArchiveIdCode::SystemSaveData); auto selfncch_factory = std::make_unique();