Merge pull request #1643 from MerryMage/make_unique
Common: Remove Common::make_unique, use std::make_unique
This commit is contained in:
commit
aa6380e5bc
24 changed files with 46 additions and 73 deletions
|
@ -3,12 +3,12 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/file_util.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/make_unique.h"
|
||||
#include "common/string_util.h"
|
||||
|
||||
#include "core/file_sys/archive_extsavedata.h"
|
||||
|
@ -84,7 +84,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_ExtSaveData::Open(cons
|
|||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||
}
|
||||
}
|
||||
auto archive = Common::make_unique<DiskArchive>(fullpath);
|
||||
auto archive = std::make_unique<DiskArchive>(fullpath);
|
||||
return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include "common/common_types.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/make_unique.h"
|
||||
|
||||
#include "core/file_sys/archive_romfs.h"
|
||||
#include "core/file_sys/ivfc_archive.h"
|
||||
|
@ -25,7 +24,7 @@ ArchiveFactory_RomFS::ArchiveFactory_RomFS(Loader::AppLoader& app_loader) {
|
|||
}
|
||||
|
||||
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_RomFS::Open(const Path& path) {
|
||||
auto archive = Common::make_unique<IVFCArchive>(romfs_file, data_offset, data_size);
|
||||
auto archive = std::make_unique<IVFCArchive>(romfs_file, data_offset, data_size);
|
||||
return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
|
||||
}
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/file_util.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/make_unique.h"
|
||||
#include "common/string_util.h"
|
||||
|
||||
#include "core/file_sys/archive_savedata.h"
|
||||
|
@ -53,7 +53,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveData::Open(const P
|
|||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||
}
|
||||
|
||||
auto archive = Common::make_unique<DiskArchive>(std::move(concrete_mount_point));
|
||||
auto archive = std::make_unique<DiskArchive>(std::move(concrete_mount_point));
|
||||
return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
|
||||
}
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/file_util.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/make_unique.h"
|
||||
#include "common/string_util.h"
|
||||
|
||||
#include "core/file_sys/archive_savedatacheck.h"
|
||||
|
@ -44,7 +44,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveDataCheck::Open(co
|
|||
}
|
||||
auto size = file->GetSize();
|
||||
|
||||
auto archive = Common::make_unique<IVFCArchive>(file, 0, size);
|
||||
auto archive = std::make_unique<IVFCArchive>(file, 0, size);
|
||||
return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
|
||||
}
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
#include "common/file_util.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/make_unique.h"
|
||||
|
||||
#include "core/file_sys/archive_sdmc.h"
|
||||
#include "core/file_sys/disk_archive.h"
|
||||
|
@ -36,7 +36,7 @@ bool ArchiveFactory_SDMC::Initialize() {
|
|||
}
|
||||
|
||||
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SDMC::Open(const Path& path) {
|
||||
auto archive = Common::make_unique<DiskArchive>(sdmc_directory);
|
||||
auto archive = std::make_unique<DiskArchive>(sdmc_directory);
|
||||
return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
|
||||
}
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/file_util.h"
|
||||
#include "common/make_unique.h"
|
||||
#include "common/string_util.h"
|
||||
|
||||
#include "core/file_sys/archive_systemsavedata.h"
|
||||
|
@ -59,7 +59,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SystemSaveData::Open(c
|
|||
return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS,
|
||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||
}
|
||||
auto archive = Common::make_unique<DiskArchive>(fullpath);
|
||||
auto archive = std::make_unique<DiskArchive>(fullpath);
|
||||
return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
|
||||
}
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/file_util.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/make_unique.h"
|
||||
|
||||
#include "core/file_sys/disk_archive.h"
|
||||
|
||||
|
@ -19,7 +19,7 @@ namespace FileSys {
|
|||
|
||||
ResultVal<std::unique_ptr<FileBackend>> DiskArchive::OpenFile(const Path& path, const Mode mode) const {
|
||||
LOG_DEBUG(Service_FS, "called path=%s mode=%01X", path.DebugStr().c_str(), mode.hex);
|
||||
auto file = Common::make_unique<DiskFile>(*this, path, mode);
|
||||
auto file = std::make_unique<DiskFile>(*this, path, mode);
|
||||
ResultCode result = file->Open();
|
||||
if (result.IsError())
|
||||
return result;
|
||||
|
@ -83,7 +83,7 @@ bool DiskArchive::RenameDirectory(const Path& src_path, const Path& dest_path) c
|
|||
|
||||
std::unique_ptr<DirectoryBackend> DiskArchive::OpenDirectory(const Path& path) const {
|
||||
LOG_DEBUG(Service_FS, "called path=%s", path.DebugStr().c_str());
|
||||
auto directory = Common::make_unique<DiskDirectory>(*this, path);
|
||||
auto directory = std::make_unique<DiskDirectory>(*this, path);
|
||||
if (!directory->Open())
|
||||
return nullptr;
|
||||
return std::move(directory);
|
||||
|
@ -132,7 +132,7 @@ ResultCode DiskFile::Open() {
|
|||
// Open the file in binary mode, to avoid problems with CR/LF on Windows systems
|
||||
mode_string += "b";
|
||||
|
||||
file = Common::make_unique<FileUtil::IOFile>(path, mode_string.c_str());
|
||||
file = std::make_unique<FileUtil::IOFile>(path, mode_string.c_str());
|
||||
if (file->IsOpen())
|
||||
return RESULT_SUCCESS;
|
||||
return ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS, ErrorSummary::NotFound, ErrorLevel::Status);
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include "common/common_types.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/make_unique.h"
|
||||
|
||||
#include "core/file_sys/ivfc_archive.h"
|
||||
|
||||
|
@ -21,7 +20,7 @@ std::string IVFCArchive::GetName() const {
|
|||
}
|
||||
|
||||
ResultVal<std::unique_ptr<FileBackend>> IVFCArchive::OpenFile(const Path& path, const Mode mode) const {
|
||||
return MakeResult<std::unique_ptr<FileBackend>>(Common::make_unique<IVFCFile>(romfs_file, data_offset, data_size));
|
||||
return MakeResult<std::unique_ptr<FileBackend>>(std::make_unique<IVFCFile>(romfs_file, data_offset, data_size));
|
||||
}
|
||||
|
||||
ResultCode IVFCArchive::DeleteFile(const Path& path) const {
|
||||
|
@ -58,7 +57,7 @@ bool IVFCArchive::RenameDirectory(const Path& src_path, const Path& dest_path) c
|
|||
}
|
||||
|
||||
std::unique_ptr<DirectoryBackend> IVFCArchive::OpenDirectory(const Path& path) const {
|
||||
return Common::make_unique<IVFCDirectory>();
|
||||
return std::make_unique<IVFCDirectory>();
|
||||
}
|
||||
|
||||
u64 IVFCArchive::GetFreeBytes() const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue