From 36cfcb530f6810afca93e75c47f767a453a99361 Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Sat, 29 Jan 2022 05:58:31 +0100 Subject: IOFile: Make origin parameter to Seek() an enum class. --- Source/Core/DiscIO/CompressedBlob.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Source/Core/DiscIO/CompressedBlob.cpp') diff --git a/Source/Core/DiscIO/CompressedBlob.cpp b/Source/Core/DiscIO/CompressedBlob.cpp index 8f491a41c6..f537d8b583 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,7 +104,7 @@ 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.", @@ -301,9 +301,9 @@ bool ConvertToGCZ(BlobReader* infile, const std::string& infile_path, std::vector 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; } -- cgit v1.2.3 From a336c4386c154746ef2ea732b13872f5293666be Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Sat, 29 Jan 2022 06:01:03 +0100 Subject: IOFile: Rename Clear() to ClearError() for clarity. --- Source/Core/DiscIO/CompressedBlob.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/CompressedBlob.cpp') diff --git a/Source/Core/DiscIO/CompressedBlob.cpp b/Source/Core/DiscIO/CompressedBlob.cpp index f537d8b583..056c2f4fd3 100644 --- a/Source/Core/DiscIO/CompressedBlob.cpp +++ b/Source/Core/DiscIO/CompressedBlob.cpp @@ -109,7 +109,7 @@ bool CompressedBlobReader::GetBlock(u64 block_num, u8* out_ptr) { 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; } -- cgit v1.2.3