mirror of
https://github.com/lifegpc/GARbro.git
synced 2026-06-06 05:28:49 +08:00
(Adler32): skip checksum update for zero-length arrays.
This commit is contained in:
@@ -114,6 +114,8 @@ namespace GameRes.Utility
|
||||
|
||||
public static uint Compute (byte[] buf, int pos, int len)
|
||||
{
|
||||
if (0 == len)
|
||||
return 1;
|
||||
unsafe
|
||||
{
|
||||
fixed (byte* ptr = &buf[pos])
|
||||
@@ -224,6 +226,8 @@ namespace GameRes.Utility
|
||||
|
||||
public void Update (byte[] buf, int pos, int len)
|
||||
{
|
||||
if (0 == len)
|
||||
return;
|
||||
unsafe
|
||||
{
|
||||
fixed (byte* ptr = &buf[pos])
|
||||
|
||||
@@ -179,8 +179,11 @@ namespace GameRes.Compression
|
||||
|
||||
public override void Write (byte[] buffer, int offset, int count)
|
||||
{
|
||||
m_adler.Write (buffer, offset, count);
|
||||
m_total_in += count;
|
||||
if (count > 0)
|
||||
{
|
||||
m_adler.Write (buffer, offset, count);
|
||||
m_total_in += count;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteByte (byte value)
|
||||
|
||||
Reference in New Issue
Block a user