diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 95caafeb65..bca2d7934a 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -54,7 +54,7 @@ ResultVal ArchiveManager::OpenArchive(ArchiveIdCode id_code, ++next_handle; } handle_map.emplace(next_handle, std::move(res)); - return MakeResult(next_handle++); + return MakeResult(next_handle++); } ResultCode ArchiveManager::CloseArchive(ArchiveHandle handle) { @@ -79,21 +79,22 @@ ResultCode ArchiveManager::RegisterArchiveType(std::unique_ptr>, std::chrono::nanoseconds> +std::pair>, std::chrono::nanoseconds> ArchiveManager::OpenFileFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path, const FileSys::Mode mode) { ArchiveBackend* archive = GetArchive(archive_handle); - if (archive == nullptr) - return std::make_tuple(FileSys::ERR_INVALID_ARCHIVE_HANDLE, - static_cast(0)); + if (archive == nullptr) { + return std::make_pair(FileSys::ERR_INVALID_ARCHIVE_HANDLE, std::chrono::nanoseconds{0}); + } - std::chrono::nanoseconds open_timeout_ns{archive->GetOpenDelayNs()}; + const std::chrono::nanoseconds open_timeout_ns{archive->GetOpenDelayNs()}; auto backend = archive->OpenFile(path, mode); - if (backend.Failed()) - return std::make_tuple(backend.Code(), open_timeout_ns); + if (backend.Failed()) { + return std::make_pair(backend.Code(), open_timeout_ns); + } auto file = std::make_shared(system.Kernel(), std::move(backend).Unwrap(), path); - return std::make_tuple(MakeResult>(std::move(file)), open_timeout_ns); + return std::make_pair(MakeResult(std::move(file)), open_timeout_ns); } ResultCode ArchiveManager::DeleteFileFromArchive(ArchiveHandle archive_handle, @@ -178,22 +179,25 @@ ResultCode ArchiveManager::RenameDirectoryBetweenArchives(ArchiveHandle src_arch ResultVal> ArchiveManager::OpenDirectoryFromArchive( ArchiveHandle archive_handle, const FileSys::Path& path) { ArchiveBackend* archive = GetArchive(archive_handle); - if (archive == nullptr) + if (archive == nullptr) { return FileSys::ERR_INVALID_ARCHIVE_HANDLE; + } auto backend = archive->OpenDirectory(path); - if (backend.Failed()) + if (backend.Failed()) { return backend.Code(); + } auto directory = std::make_shared(std::move(backend).Unwrap(), path); - return MakeResult>(std::move(directory)); + return MakeResult(std::move(directory)); } ResultVal ArchiveManager::GetFreeBytesInArchive(ArchiveHandle archive_handle) { - ArchiveBackend* archive = GetArchive(archive_handle); - if (archive == nullptr) + const ArchiveBackend* archive = GetArchive(archive_handle); + if (archive == nullptr) { return FileSys::ERR_INVALID_ARCHIVE_HANDLE; - return MakeResult(archive->GetFreeBytes()); + } + return MakeResult(archive->GetFreeBytes()); } ResultCode ArchiveManager::FormatArchive(ArchiveIdCode id_code, diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h index 9959145783..4ce61a3c1c 100644 --- a/src/core/hle/service/fs/archive.h +++ b/src/core/hle/service/fs/archive.h @@ -86,10 +86,10 @@ public: * @param archive_handle Handle to an open Archive object * @param path Path to the File inside of the Archive * @param mode Mode under which to open the File - * @return Tuple of the opened File object and the open delay + * @return Pair containing the opened File object and the open delay */ - std::tuple>, std::chrono::nanoseconds> OpenFileFromArchive( - ArchiveHandle archive_handle, const FileSys::Path& path, const FileSys::Mode mode); + std::pair>, std::chrono::nanoseconds> OpenFileFromArchive( + ArchiveHandle archive_handle, const FileSys::Path& path, FileSys::Mode mode); /** * Delete a File from an Archive