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.
This commit is contained in:
parent
9fb01ecc73
commit
24be8c0814
|
@ -410,8 +410,13 @@ bool DecompressBlobToFile(const std::string& infile_path, const std::string& out
|
||||||
|
|
||||||
bool IsGCZBlob(File::IOFile& file)
|
bool IsGCZBlob(File::IOFile& file)
|
||||||
{
|
{
|
||||||
|
const u64 position = file.Tell();
|
||||||
|
if (!file.Seek(0, SEEK_SET))
|
||||||
|
return false;
|
||||||
CompressedBlobHeader header;
|
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
|
} // namespace
|
||||||
|
|
Loading…
Reference in New Issue