mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-04 05:25:00 +00:00
review fixes
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
Reference in New Issue
Block a user