This commit is contained in:
Adam Hathcock
2025-12-19 14:33:24 +00:00
parent 95749234f5
commit 6cf2e054bf
3 changed files with 12 additions and 10 deletions

View File

@@ -466,8 +466,9 @@ public class LzmaStream : Stream, IStreamStack
if (control >= 0xC0)
{
_needProps = false;
await this.ReadExactlyAsync(controlBuffer, 0, 1, cancellationToken).ConfigureAwait(false);
Properties[0] = controlBuffer[0];
await this.ReadExactlyAsync(controlBuffer, 0, 1, cancellationToken)
.ConfigureAwait(false);
Properties[0] = controlBuffer[0];
_inputPosition++;
_decoder = new Decoder();

View File

@@ -44,19 +44,20 @@ internal static class StreamExtensions
}
}
internal static async Task ReadExactlyAsync(this Stream stream,
byte[] buffer,
int offset,
int count,
CancellationToken cancellationToken
internal static async Task ReadExactlyAsync(
this Stream stream,
byte[] buffer,
int offset,
int count,
CancellationToken cancellationToken
)
{
var totalRead = 0;
while (totalRead < count)
{
var read = await stream
.ReadAsync(buffer, offset + totalRead, count - totalRead, cancellationToken)
.ConfigureAwait(false);
.ReadAsync(buffer, offset + totalRead, count - totalRead, cancellationToken)
.ConfigureAwait(false);
if (read == 0)
{
throw new EndOfStreamException();

View File

@@ -8,7 +8,7 @@ using Xunit;
namespace SharpCompress.Test;
public class ExtractAllTests: TestBase
public class ExtractAllTests : TestBase
{
[Theory]
[InlineData("Zip.deflate.zip")]