diff options
| author | BhaaL <bhaal@0x1337.org> | 2017-01-21 21:26:19 +0100 |
|---|---|---|
| committer | BhaaL <bhaal@0x1337.org> | 2017-01-21 21:42:57 +0100 |
| commit | 24be8c0814943b845ab3037d552d28f77ef8bbc9 (patch) | |
| tree | c8df9cc0662ad888d5343fbfaa265415707b9876 /Source/Core/DiscIO/CompressedBlob.cpp | |
| parent | 9fb01ecc730a9fdf9d053b270ac4bd17ed937446 (diff) | |
IsGCZBlob: try to leave the file position where it was before
callers that don't seek afterwards might be missing a few bytes that way.
Diffstat (limited to 'Source/Core/DiscIO/CompressedBlob.cpp')
| -rw-r--r-- | Source/Core/DiscIO/CompressedBlob.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Source/Core/DiscIO/CompressedBlob.cpp b/Source/Core/DiscIO/CompressedBlob.cpp index 0cf8dbc5b3..447088de61 100644 --- a/Source/Core/DiscIO/CompressedBlob.cpp +++ b/Source/Core/DiscIO/CompressedBlob.cpp @@ -410,8 +410,13 @@ bool DecompressBlobToFile(const std::string& infile_path, const std::string& out bool IsGCZBlob(File::IOFile& file) { + const u64 position = file.Tell(); + if (!file.Seek(0, SEEK_SET)) + return false; CompressedBlobHeader header; - return file.Seek(0, SEEK_SET) && file.ReadArray(&header, 1) && header.magic_cookie == GCZ_MAGIC; + bool is_gcz = file.ReadArray(&header, 1) && header.magic_cookie == GCZ_MAGIC; + file.Seek(position, SEEK_SET); + return is_gcz; } } // namespace |
