From 8d54bbc52803a2e665e58a8a9b1b22182c7f0027 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 21 Dec 2016 12:50:15 +0100 Subject: Don't create new IOFiles when creating a blob ...except for WBFS, which is special because it has the ability to open multiple files. --- Source/Core/DiscIO/FileBlob.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'Source/Core/DiscIO/FileBlob.cpp') diff --git a/Source/Core/DiscIO/FileBlob.cpp b/Source/Core/DiscIO/FileBlob.cpp index 7d1dabe198..3547ef658d 100644 --- a/Source/Core/DiscIO/FileBlob.cpp +++ b/Source/Core/DiscIO/FileBlob.cpp @@ -2,22 +2,23 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. -#include "DiscIO/FileBlob.h" #include #include +#include + +#include "DiscIO/FileBlob.h" namespace DiscIO { -PlainFileReader::PlainFileReader(std::FILE* file) : m_file(file) +PlainFileReader::PlainFileReader(File::IOFile file) : m_file(std::move(file)) { m_size = m_file.GetSize(); } -std::unique_ptr PlainFileReader::Create(const std::string& filename) +std::unique_ptr PlainFileReader::Create(File::IOFile file) { - File::IOFile f(filename, "rb"); - if (f) - return std::unique_ptr(new PlainFileReader(f.ReleaseHandle())); + if (file) + return std::unique_ptr(new PlainFileReader(std::move(file))); return nullptr; } -- cgit v1.2.3