summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/CompressedBlob.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2022-01-29 11:59:58 +0100
committerGitHub <noreply@github.com>2022-01-29 11:59:58 +0100
commitaf5678ea758d493c419ca53c56a0ce4f8fa0ca0f (patch)
tree6e76a1fee0e79d593d95c9680d2353f9033b0ac6 /Source/Core/DiscIO/CompressedBlob.cpp
parentfbe7cf675cf412af12d2f750c6162f6e4151c52c (diff)
parenta336c4386c154746ef2ea732b13872f5293666be (diff)
Merge pull request #10403 from AdmiralCurtiss/iofile-seek
Minor IOFile cleanup.
Diffstat (limited to 'Source/Core/DiscIO/CompressedBlob.cpp')
-rw-r--r--Source/Core/DiscIO/CompressedBlob.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/Source/Core/DiscIO/CompressedBlob.cpp b/Source/Core/DiscIO/CompressedBlob.cpp
index 8f491a41c6..056c2f4fd3 100644
--- a/Source/Core/DiscIO/CompressedBlob.cpp
+++ b/Source/Core/DiscIO/CompressedBlob.cpp
@@ -38,7 +38,7 @@ CompressedBlobReader::CompressedBlobReader(File::IOFile file, const std::string&
: m_file(std::move(file)), m_file_name(filename)
{
m_file_size = m_file.GetSize();
- m_file.Seek(0, SEEK_SET);
+ m_file.Seek(0, File::SeekOrigin::Begin);
m_file.ReadArray(&m_header, 1);
SetSectorSize(m_header.block_size);
@@ -104,12 +104,12 @@ bool CompressedBlobReader::GetBlock(u64 block_num, u8* out_ptr)
// clear unused part of zlib buffer. maybe this can be deleted when it works fully.
memset(&m_zlib_buffer[comp_block_size], 0, m_zlib_buffer.size() - comp_block_size);
- m_file.Seek(offset, SEEK_SET);
+ m_file.Seek(offset, File::SeekOrigin::Begin);
if (!m_file.ReadBytes(m_zlib_buffer.data(), comp_block_size))
{
ERROR_LOG_FMT(DISCIO, "The disc image \"{}\" is truncated, some of the data is missing.",
m_file_name);
- m_file.Clear();
+ m_file.ClearError();
return false;
}
@@ -301,9 +301,9 @@ bool ConvertToGCZ(BlobReader* infile, const std::string& infile_path,
std::vector<u32> hashes(header.num_blocks);
// seek past the header (we will write it at the end)
- outfile.Seek(sizeof(CompressedBlobHeader), SEEK_CUR);
+ outfile.Seek(sizeof(CompressedBlobHeader), File::SeekOrigin::Current);
// seek past the offset and hash tables (we will write them at the end)
- outfile.Seek((sizeof(u64) + sizeof(u32)) * header.num_blocks, SEEK_CUR);
+ outfile.Seek((sizeof(u64) + sizeof(u32)) * header.num_blocks, File::SeekOrigin::Current);
// Now we are ready to write compressed data!
u64 inpos = 0;
@@ -361,7 +361,7 @@ bool ConvertToGCZ(BlobReader* infile, const std::string& infile_path,
else
{
// Okay, go back and fill in headers
- outfile.Seek(0, SEEK_SET);
+ outfile.Seek(0, File::SeekOrigin::Begin);
outfile.WriteArray(&header, 1);
outfile.WriteArray(offsets.data(), header.num_blocks);
outfile.WriteArray(hashes.data(), header.num_blocks);
@@ -385,11 +385,11 @@ bool ConvertToGCZ(BlobReader* infile, const std::string& infile_path,
bool IsGCZBlob(File::IOFile& file)
{
const u64 position = file.Tell();
- if (!file.Seek(0, SEEK_SET))
+ if (!file.Seek(0, File::SeekOrigin::Begin))
return false;
CompressedBlobHeader header;
bool is_gcz = file.ReadArray(&header, 1) && header.magic_cookie == GCZ_MAGIC;
- file.Seek(position, SEEK_SET);
+ file.Seek(position, File::SeekOrigin::Begin);
return is_gcz;
}