Fix last couple of commits

This commit is contained in:
Matt Nadareski
2025-09-29 23:12:23 -04:00
parent f44059e16a
commit 4bee14835c
3 changed files with 9 additions and 8 deletions

View File

@@ -1,3 +1,5 @@
using System.Collections.Generic;
namespace SabreTools.Data.Extensions
{
public static class XZ
@@ -17,15 +19,15 @@ namespace SabreTools.Data.Extensions
if (maxSize > 9)
maxSize = 9;
ulong output = value[0] & 0x7F;
ulong output = (ulong)(value[0] & 0x7F);
int i = 0;
while (value[i++] & 0x80 != 0)
while ((value[i++] & 0x80) != 0)
{
if (i >= maxSize || value[i] == 0x00)
return 0;
output |= (value[i] & 0x7F) << (i * 7);
output |= (ulong)(value[i] & 0x7F) << (i * 7);
}
return output;
@@ -44,10 +46,9 @@ namespace SabreTools.Data.Extensions
var output = new List<byte>();
int i = 0;
while (value >= 0x80)
{
output.Add((byte)value | 0x80);
output.Add((byte)(value | 0x80));
value >>= 7;
}
@@ -55,4 +56,4 @@ namespace SabreTools.Data.Extensions
return [.. output];
}
}
}
}

View File

@@ -6,4 +6,4 @@ namespace SabreTools.Data.Models.XZ
public static readonly byte[] FooterSignatureBytes = [0x59, 0x5A];
}
}
}

View File

@@ -6,7 +6,7 @@ namespace SabreTools.Data.Models.XZ
/// Unpadded size of the block
/// </summary>
/// <remarks>Stored as a variable-length integer</remarks>
public byte UnpaddedSize { get; set; }
public byte[]? UnpaddedSize { get; set; }
/// <summary>
/// Uncompressed size of the block