mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-26 23:24:00 +08:00
(Adler32): skip checksum update for zero-length arrays.
This commit is contained in:
parent
3678e02fec
commit
98d0c47cfb
@ -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])
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user