(Adler32): skip checksum update for zero-length arrays.

This commit is contained in:
morkt 2016-09-14 20:08:13 +04:00
parent 3678e02fec
commit 98d0c47cfb
2 changed files with 9 additions and 2 deletions

View File

@ -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])

View File

@ -178,10 +178,13 @@ namespace GameRes.Compression
}
public override void Write (byte[] buffer, int offset, int count)
{
if (count > 0)
{
m_adler.Write (buffer, offset, count);
m_total_in += count;
}
}
public override void WriteByte (byte value)
{