From b1ffa740432f9322bf937101bbc3d0fe78876b62 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Sep 2016 19:15:27 -0400 Subject: NANDContentLoader: Make CNANDContentData's Get function return by non-const value const specifiers like this are practically pointless and can inhibit move construction. --- Source/Core/DiscIO/NANDContentLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/NANDContentLoader.cpp') diff --git a/Source/Core/DiscIO/NANDContentLoader.cpp b/Source/Core/DiscIO/NANDContentLoader.cpp index 98978d98b0..6d4ec186c1 100644 --- a/Source/Core/DiscIO/NANDContentLoader.cpp +++ b/Source/Core/DiscIO/NANDContentLoader.cpp @@ -107,7 +107,7 @@ void CNANDContentDataFile::Open() { EnsureOpen(); } -const std::vector CNANDContentDataFile::Get() +std::vector CNANDContentDataFile::Get() { std::vector result; EnsureOpen(); -- cgit v1.2.3 From 89c65be703c9ea5fc136b34f8d37286605dbc6d6 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Sep 2016 19:41:38 -0400 Subject: NANDContentLoader: Delay vector construction until needed in Get() No need to construct the vector right off the bat. --- Source/Core/DiscIO/NANDContentLoader.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Source/Core/DiscIO/NANDContentLoader.cpp') diff --git a/Source/Core/DiscIO/NANDContentLoader.cpp b/Source/Core/DiscIO/NANDContentLoader.cpp index 6d4ec186c1..3f2c746bd6 100644 --- a/Source/Core/DiscIO/NANDContentLoader.cpp +++ b/Source/Core/DiscIO/NANDContentLoader.cpp @@ -109,16 +109,16 @@ void CNANDContentDataFile::Open() } std::vector CNANDContentDataFile::Get() { - std::vector result; EnsureOpen(); + if (!m_file->IsGood()) - return result; + return {}; u64 size = m_file->GetSize(); if (size == 0) - return result; + return {}; - result.resize(size); + std::vector result(size); m_file->ReadBytes(result.data(), result.size()); return result; -- cgit v1.2.3