Skip to content

Commit 6963f93

Browse files
author
Jiang Yin
committed
优化压缩方法
1 parent d709666 commit 6963f93

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Scripts/Runtime/Utility/DefaultZipHelper.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ public bool Compress(byte[] bytes, int offset, int length, Stream compressedStre
5353
using (GZipOutputStream gZipOutputStream = new GZipOutputStream(compressedStream))
5454
{
5555
gZipOutputStream.Write(bytes, offset, length);
56-
if (compressedStream.Length >= 8)
56+
if (compressedStream.Length >= 8L)
5757
{
58-
compressedStream.Position = 4;
58+
long current = compressedStream.Position;
59+
compressedStream.Position = 4L;
5960
compressedStream.WriteByte(25);
6061
compressedStream.WriteByte(134);
6162
compressedStream.WriteByte(2);
6263
compressedStream.WriteByte(32);
64+
compressedStream.Position = current;
6365
}
6466
}
6567

0 commit comments

Comments
 (0)