Skip to content

Commit

Permalink
Fix whitespace from dotnet format
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhathcock committed Oct 2, 2021
1 parent ce5432e commit ec2be28
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void RemoveDirectory(string d)
Target(Format, () =>
{
Run("dotnet", "tool restore");
Run("dotnet", "format");
Run("dotnet", "format --check");
});

Target(Build, DependsOn(Format),
Expand All @@ -59,7 +59,7 @@ IEnumerable<string> GetFiles(string d)
{
return Glob.Files(".", d);
}
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && framework == "net461")
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && framework == "net461")
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Archives/Rar/RarArchive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace SharpCompress.Archives.Rar
{
public class
public class
RarArchive : AbstractArchive<RarArchiveEntry, RarVolume>
{
internal Lazy<IRarUnpack> UnpackV2017 { get; } = new Lazy<IRarUnpack>(() => new SharpCompress.Compressors.Rar.UnpackV2017.Unpack());
Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Common/ExtractionMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static void WriteEntryToDirectory(IEntry entry,
{
string destinationFileName;
string fullDestinationDirectoryPath = Path.GetFullPath(destinationDirectory);

//check for trailing slash.
if (fullDestinationDirectoryPath[fullDestinationDirectoryPath.Length - 1] != Path.DirectorySeparatorChar)
{
Expand Down
12 changes: 6 additions & 6 deletions src/SharpCompress/Common/Zip/SeekableZipHeaderFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal IEnumerable<ZipHeader> ReadSeekableHeader(Stream stream)
// ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR should be before the EOCD
stream.Seek(eocd_location - ZIP64_EOCD_LENGTH - 4, SeekOrigin.Begin);
uint zip64_locator = reader.ReadUInt32();
if( zip64_locator != ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR )
if (zip64_locator != ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR)
{
throw new ArchiveException("Failed to locate the Zip64 Directory Locator");
}
Expand Down Expand Up @@ -86,11 +86,11 @@ internal IEnumerable<ZipHeader> ReadSeekableHeader(Stream stream)
}
}

private static bool IsMatch( byte[] haystack, int position, byte[] needle)
private static bool IsMatch(byte[] haystack, int position, byte[] needle)
{
for( int i = 0; i < needle.Length; i++ )
for (int i = 0; i < needle.Length; i++)
{
if( haystack[ position + i ] != needle[ i ] )
if (haystack[position + i] != needle[i])
{
return false;
}
Expand Down Expand Up @@ -120,9 +120,9 @@ private static void SeekBackToHeader(Stream stream, BinaryReader reader)
// don't exclude the minimum eocd region, otherwise you fail to locate the header in empty zip files
var max_search_area = len; // - MINIMUM_EOCD_LENGTH;

for( int pos_from_end = 0; pos_from_end < max_search_area; ++pos_from_end)
for (int pos_from_end = 0; pos_from_end < max_search_area; ++pos_from_end)
{
if( IsMatch(seek, pos_from_end, needle) )
if (IsMatch(seek, pos_from_end, needle))
{
stream.Seek(-pos_from_end, SeekOrigin.End);
return;
Expand Down
4 changes: 2 additions & 2 deletions src/SharpCompress/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ private static byte[] GetTransferByteArray()
{
return ArrayPool<byte>.Shared.Rent(81920);
}

public static bool ReadFully(this Stream stream, byte[] buffer)
{
int total = 0;
Expand All @@ -295,7 +295,7 @@ public static bool ReadFully(this Stream stream, byte[] buffer)
}
return (total >= buffer.Length);
}

public static bool ReadFully(this Stream stream, Span<byte> buffer)
{
int total = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/SharpCompress.Test/Zip/ZipArchiveTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ public void Zip_LongComment_Read()
{
string zipPath = Path.Combine(TEST_ARCHIVES_PATH, "Zip.LongComment.zip");

using(ZipArchive za = ZipArchive.Open(zipPath))
using (ZipArchive za = ZipArchive.Open(zipPath))
{
var count = za.Entries.Count;
Assert.Equal(1, count);
Expand Down
8 changes: 4 additions & 4 deletions tests/SharpCompress.Test/Zip/ZipReaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,16 +268,16 @@ public void Zip_Deflate_WinzipAES_Read()
}
VerifyFiles();
}

[Fact]
public void Zip_Deflate_ZipCrypto_Read()
{
int count = 0;
using (Stream stream = File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "zipcrypto.zip")))
using (var reader = ZipReader.Open(stream, new ReaderOptions()
{
Password = "test"
}))
{
Password = "test"
}))
{
while (reader.MoveToNextEntry())
{
Expand Down

0 comments on commit ec2be28

Please sign in to comment.