mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
DiscIO: Make factory methods return unique_ptrs
Rather than rely on the developer to do the right thing, just make the default behavior safely deallocate resources. If shared semantics are ever needed in the future, the constructor that takes a unique_ptr for shared_ptr can be used.
This commit is contained in:
@ -55,12 +55,12 @@ CompressedBlobReader::CompressedBlobReader(const std::string& filename) : m_file
|
||||
memset(m_zlib_buffer, 0, m_zlib_buffer_size);
|
||||
}
|
||||
|
||||
CompressedBlobReader* CompressedBlobReader::Create(const std::string& filename)
|
||||
std::unique_ptr<CompressedBlobReader> CompressedBlobReader::Create(const std::string& filename)
|
||||
{
|
||||
if (IsGCZBlob(filename))
|
||||
return new CompressedBlobReader(filename);
|
||||
else
|
||||
return nullptr;
|
||||
return std::unique_ptr<CompressedBlobReader>(new CompressedBlobReader(filename));
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CompressedBlobReader::~CompressedBlobReader()
|
||||
|
Reference in New Issue
Block a user