diff options
| author | Lioncash <mathew1800@gmail.com> | 2017-01-04 14:31:38 -0500 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2017-01-04 16:06:21 -0500 |
| commit | 4a9bc2340bc6aed0570da0189064b6d3b05b551f (patch) | |
| tree | f1d09058106d6a1f5dcd3bfd1a1c4d6b69e0b457 /Source/Core/DiscIO/CompressedBlob.cpp | |
| parent | 389f8297c3bb1829cf7c62f5461457f4d4c501bc (diff) | |
DiscScrubber: Convert into a class
Allows potential multiple scrubbers to run at once. Also gets rid of the
need to explicitly clean up resources.
Diffstat (limited to 'Source/Core/DiscIO/CompressedBlob.cpp')
| -rw-r--r-- | Source/Core/DiscIO/CompressedBlob.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Source/Core/DiscIO/CompressedBlob.cpp b/Source/Core/DiscIO/CompressedBlob.cpp index 68edf369e6..680ca8d179 100644 --- a/Source/Core/DiscIO/CompressedBlob.cpp +++ b/Source/Core/DiscIO/CompressedBlob.cpp @@ -173,9 +173,10 @@ bool CompressFileToBlob(const std::string& infile, const std::string& outfile, u return false; } + DiscScrubber disc_scrubber; if (sub_type == 1) { - if (!DiscScrubber::SetupScrub(infile, block_size)) + if (!disc_scrubber.SetupScrub(infile, block_size)) { PanicAlertT("\"%s\" failed to be scrubbed. Probably the image is corrupt.", infile.c_str()); return false; @@ -186,10 +187,7 @@ bool CompressFileToBlob(const std::string& infile, const std::string& outfile, u z_stream z = {}; if (deflateInit(&z, 9) != Z_OK) - { - DiscScrubber::Cleanup(); return false; - } callback(GetStringT("Files opened, ready to compress."), 0, arg); @@ -243,7 +241,7 @@ bool CompressFileToBlob(const std::string& infile, const std::string& outfile, u size_t read_bytes; if (scrubbing) - read_bytes = DiscScrubber::GetNextBlock(inf, in_buf.data()); + read_bytes = disc_scrubber.GetNextBlock(inf, in_buf.data()); else inf.ReadArray(in_buf.data(), header.block_size, &read_bytes); if (read_bytes < header.block_size) @@ -318,7 +316,6 @@ bool CompressFileToBlob(const std::string& infile, const std::string& outfile, u // Cleanup deflateEnd(&z); - DiscScrubber::Cleanup(); if (success) { |
