From de68e6d9a59455f04115fd0a21806216d78afb9c Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Fri, 31 Jul 2026 12:16:58 +0000 Subject: [PATCH] [CodeFactor] Apply fixes --- .../Licensing/HuggingFaceModelDownloader.cs | 2 +- .../Licensing/ModelDownloaderAdapter.cs | 2 +- src/Trackdub.Infrastructure/Updates/UpdateService.cs | 2 +- src/Trackdub.Media/Extraction/Pcm16WaveClipExtractor.cs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Trackdub.Infrastructure/Licensing/HuggingFaceModelDownloader.cs b/src/Trackdub.Infrastructure/Licensing/HuggingFaceModelDownloader.cs index 17599cb..8762d6a 100644 --- a/src/Trackdub.Infrastructure/Licensing/HuggingFaceModelDownloader.cs +++ b/src/Trackdub.Infrastructure/Licensing/HuggingFaceModelDownloader.cs @@ -200,7 +200,7 @@ await ParallelRangeDownloader.TryDownloadAsync( byte[] buffer = new byte[BufferSize]; int bytesRead; - while ((bytesRead = await contentStream.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false)) != 0) + while ((bytesRead = await contentStream.ReadAsync(buffer, cancellationToken).ConfigureAwait(false)) != 0) { await fileStream.WriteAsync(buffer, 0, bytesRead, cancellationToken).ConfigureAwait(false); totalBytesRead += bytesRead; diff --git a/src/Trackdub.Infrastructure/Licensing/ModelDownloaderAdapter.cs b/src/Trackdub.Infrastructure/Licensing/ModelDownloaderAdapter.cs index a4411b1..cf16b79 100644 --- a/src/Trackdub.Infrastructure/Licensing/ModelDownloaderAdapter.cs +++ b/src/Trackdub.Infrastructure/Licensing/ModelDownloaderAdapter.cs @@ -196,7 +196,7 @@ sourceUri.Scheme is not ("http" or "https")) byte[] buffer = new byte[BufferSize]; int bytesRead; while ((bytesRead = await contentStream - .ReadAsync(buffer, 0, buffer.Length, cancellationToken) +.ReadAsync(buffer, cancellationToken) .ConfigureAwait(false)) != 0) { await fileStream diff --git a/src/Trackdub.Infrastructure/Updates/UpdateService.cs b/src/Trackdub.Infrastructure/Updates/UpdateService.cs index a0b0f40..01cd2c2 100644 --- a/src/Trackdub.Infrastructure/Updates/UpdateService.cs +++ b/src/Trackdub.Infrastructure/Updates/UpdateService.cs @@ -297,7 +297,7 @@ private async Task DownloadFileAsync( int bytesRead; while ((bytesRead = await contentStream - .ReadAsync(buffer, 0, buffer.Length, cancellationToken) +.ReadAsync(buffer, cancellationToken) .ConfigureAwait(false)) != 0) { await fileStream diff --git a/src/Trackdub.Media/Extraction/Pcm16WaveClipExtractor.cs b/src/Trackdub.Media/Extraction/Pcm16WaveClipExtractor.cs index 96e8136..7f1082e 100644 --- a/src/Trackdub.Media/Extraction/Pcm16WaveClipExtractor.cs +++ b/src/Trackdub.Media/Extraction/Pcm16WaveClipExtractor.cs @@ -64,7 +64,7 @@ public async Task ExtractAsync( await using (FileStream sourceStream = new FileStream(sourceWavePath, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize: 4096, useAsync: true)) { byte[] headerBuffer = new byte[4096]; - int headerBytesRead = await sourceStream.ReadAsync(headerBuffer, 0, headerBuffer.Length, cancellationToken).ConfigureAwait(false); + int headerBytesRead = await sourceStream.ReadAsync(headerBuffer, cancellationToken).ConfigureAwait(false); if (headerBytesRead < 44) { throw new InvalidOperationException("Source wave file is too small to contain a valid header."); @@ -248,7 +248,7 @@ private static async Task CopySliceAsync( while (remainingBytes > 0) { int bytesToRead = Math.Min(buffer.Length, remainingBytes); - int bytesRead = await source.ReadAsync(buffer, 0, bytesToRead, cancellationToken).ConfigureAwait(false); + int bytesRead = await source.ReadAsync(buffer.AsMemory(0, bytesToRead), cancellationToken).ConfigureAwait(false); if (bytesRead == 0) { throw new InvalidOperationException("Unexpected end of wave file while reading clip data.");