file_sys: std::move std::shared_ptr instances in constructors where applicable
By default, a regular copy requires an atomic increment and decrement. A move avoids this from occurring, which makes sense when the constructor is taking the shared_ptr by value.
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include "common/common_types.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/file_sys/ivfc_archive.h"
|
||||
@ -13,6 +14,9 @@
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
IVFCArchive::IVFCArchive(std::shared_ptr<FileUtil::IOFile> file, u64 offset, u64 size)
|
||||
: romfs_file(std::move(file)), data_offset(offset), data_size(size) {}
|
||||
|
||||
std::string IVFCArchive::GetName() const {
|
||||
return "IVFC";
|
||||
}
|
||||
@ -85,6 +89,9 @@ u64 IVFCArchive::GetFreeBytes() const {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IVFCFile::IVFCFile(std::shared_ptr<FileUtil::IOFile> file, u64 offset, u64 size)
|
||||
: romfs_file(std::move(file)), data_offset(offset), data_size(size) {}
|
||||
|
||||
ResultVal<size_t> IVFCFile::Read(const u64 offset, const size_t length, u8* buffer) const {
|
||||
LOG_TRACE(Service_FS, "called offset=%llu, length=%zu", offset, length);
|
||||
romfs_file->Seek(data_offset + offset, SEEK_SET);
|
||||
|
Reference in New Issue
Block a user