review fixes

This commit is contained in:
Adam Hathcock
2025-10-31 10:55:33 +00:00
parent eb188051d4
commit ccc8587e5f
8 changed files with 10 additions and 10 deletions

View File

@@ -129,7 +129,7 @@ public static class ADCBase
{
result.BytesRead = 0;
result.Output = null;
return await Task.FromResult(result);
return result;
}
var start = (int)input.Position;

View File

@@ -256,7 +256,7 @@ public sealed class ADCStream : Stream, IStreamStack
_outPosition += toCopy;
_position += toCopy;
copied += toCopy;
return await Task.FromResult(copied);
return copied;
}
public override long Seek(long offset, SeekOrigin origin) => throw new NotSupportedException();

View File

@@ -1129,7 +1129,7 @@ internal class CBZip2InputStream : Stream, IStreamStack
return k;
}
public override async Task<int> ReadAsync(
public override Task<int> ReadAsync(
byte[] buffer,
int offset,
int count,
@@ -1148,7 +1148,7 @@ internal class CBZip2InputStream : Stream, IStreamStack
}
buffer[k + offset] = (byte)c;
}
return await Task.FromResult(k);
return Task.FromResult(k);
}
public override long Seek(long offset, SeekOrigin origin) => 0;

View File

@@ -2024,7 +2024,7 @@ internal sealed class CBZip2OutputStream : Stream, IStreamStack
}
}
public override async Task WriteAsync(
public override Task WriteAsync(
byte[] buffer,
int offset,
int count,
@@ -2036,7 +2036,7 @@ internal sealed class CBZip2OutputStream : Stream, IStreamStack
cancellationToken.ThrowIfCancellationRequested();
WriteByte(buffer[k + offset]);
}
await Task.CompletedTask;
return Task.CompletedTask;
}
public override bool CanRead => false;

View File

@@ -160,7 +160,7 @@ public class ZipWriter : AbstractWriter
WriteDirectoryEntry(normalizedName, options);
}
public override async Task WriteDirectoryAsync(
public override Task WriteDirectoryAsync(
string directoryName,
DateTime? modificationTime,
CancellationToken cancellationToken = default
@@ -168,7 +168,7 @@ public class ZipWriter : AbstractWriter
{
// Synchronous implementation is sufficient for directory entries
WriteDirectory(directoryName, modificationTime);
await Task.CompletedTask.ConfigureAwait(false);
return Task.CompletedTask;
}
private void WriteDirectoryEntry(string directoryPath, ZipWriterEntryOptions options)

View File

@@ -51,7 +51,7 @@ public class AdcAsyncTest : TestBase
using var cmpFs = File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "adc_compressed.bin"));
using var decStream = new ADCStream(cmpFs);
var test = new byte[512];
var cts = new System.Threading.CancellationTokenSource();
using var cts = new System.Threading.CancellationTokenSource();
// Read should complete without cancellation
var bytesRead = await decStream.ReadAsync(test, 0, test.Length, cts.Token);

View File

@@ -117,7 +117,7 @@ public class BZip2StreamAsyncTests
)
{
var buffer = new byte[1024];
var cts = new System.Threading.CancellationTokenSource();
using var cts = new System.Threading.CancellationTokenSource();
// Read should complete without cancellation
var bytesRead = await bzip2Stream.ReadAsync(buffer, 0, buffer.Length, cts.Token);