Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update csharpier and fix formatting #781

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.25.0",
"version": "0.26.1",
"commands": [
"dotnet-csharpier"
]
Expand Down
3 changes: 2 additions & 1 deletion src/SharpCompress/Archives/ArchiveFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public static IArchive Open(Stream stream, ReaderOptions? readerOptions = null)

public static IWritableArchive Create(ArchiveType type)
{
var factory = Factory.Factories
var factory = Factory
.Factories
.OfType<IWriteableArchiveFactory>()
.FirstOrDefault(item => item.KnownArchiveType == type);

Expand Down
6 changes: 3 additions & 3 deletions src/SharpCompress/Archives/Rar/RarArchive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ protected override IEnumerable<RarVolume> LoadVolumes(SourceStream srcStream)
streams[1].Position = 0;
SrcStream.Position = 0;

return srcStream.Streams.Select(
a => new StreamRarArchiveVolume(a, ReaderOptions, idx++)
);
return srcStream
.Streams
.Select(a => new StreamRarArchiveVolume(a, ReaderOptions, idx++));
}
else //split mode or single file
{
Expand Down
12 changes: 7 additions & 5 deletions src/SharpCompress/Archives/SevenZip/SevenZipArchive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,13 @@ var group in entries.Where(x => !x.IsDirectory).GroupBy(x => x.FilePart.Folder)
}
else
{
currentStream = archive.database.GetFolderStream(
stream,
currentFolder,
new PasswordProvider(Options.Password)
);
currentStream = archive
.database
.GetFolderStream(
stream,
currentFolder,
new PasswordProvider(Options.Password)
);
}
foreach (var entry in group)
{
Expand Down
9 changes: 4 additions & 5 deletions src/SharpCompress/Common/Rar/Headers/FileHeader.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#nullable disable

using System;
using System.IO;
using System.Text;
using SharpCompress.IO;
#if !Rar2017_64bit
using size_t = System.UInt32;
#else
Expand All @@ -8,11 +12,6 @@
using size_t = System.UInt64;
#endif

using SharpCompress.IO;
using System;
using System.IO;
using System.Text;

namespace SharpCompress.Common.Rar.Headers;

internal class FileHeader : RarHeader
Expand Down
10 changes: 5 additions & 5 deletions src/SharpCompress/Common/Rar/RarVolume.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ internal IEnumerable<RarFilePart> GetVolumeFileParts()
var part = CreateFilePart(lastMarkHeader!, fh);
var buffer = new byte[fh.CompressedSize];
part.GetCompressedStream().Read(buffer, 0, buffer.Length);
Comment = System.Text.Encoding.UTF8.GetString(
buffer,
0,
buffer.Length - 1
);
Comment = System
.Text
.Encoding
.UTF8
.GetString(buffer, 0, buffer.Length - 1);
}
}
break;
Expand Down
1 change: 0 additions & 1 deletion src/SharpCompress/Common/ReaderCancelledException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace SharpCompress.Common;

public class ReaderCancelledException : Exception

{
public ReaderCancelledException(string message)
: base(message) { }
Expand Down
4 changes: 2 additions & 2 deletions src/SharpCompress/Common/Tar/TarReadOnlySubStream.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using SharpCompress.IO;
using System;
using System;
using System.IO;
using SharpCompress.IO;

namespace SharpCompress.Common.Tar;

Expand Down
6 changes: 3 additions & 3 deletions src/SharpCompress/Common/Zip/ZipHeaderFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ private void LoadHeader(ZipFileEntry entryHeader, Stream stream)

if (entryHeader.CompressionMethod == ZipCompressionMethod.WinzipAes)
{
var data = entryHeader.Extra.SingleOrDefault(
x => x.Type == ExtraDataType.WinZipAes
);
var data = entryHeader
.Extra
.SingleOrDefault(x => x.Type == ExtraDataType.WinZipAes);
if (data != null)
{
var keySize = (WinzipAesKeySize)data.DataBytes[4];
Expand Down
5 changes: 3 additions & 2 deletions src/SharpCompress/Compressors/Deflate/DeflateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
// -----------------------------------------------------------------------

using System;

using SharpCompress.Algorithms;

namespace SharpCompress.Compressors.Deflate;
Expand Down Expand Up @@ -1959,7 +1958,9 @@ _codec.OutputBuffer is null
// returning Z_STREAM_END instead of Z_BUFF_ERROR.
}
else if (
_codec.AvailableBytesIn == 0 && (int)flush <= old_flush && flush != FlushType.Finish
_codec.AvailableBytesIn == 0
&& (int)flush <= old_flush
&& flush != FlushType.Finish
)
{
// workitem 8557
Expand Down
1 change: 0 additions & 1 deletion src/SharpCompress/Compressors/Deflate/Inflate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
// -----------------------------------------------------------------------

using System;

using SharpCompress.Algorithms;

namespace SharpCompress.Compressors.Deflate;
Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Compressors/Deflate/ZlibBaseStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
using System.Buffers.Binary;
using System.Collections.Generic;
using System.IO;
using SharpCompress.Common.Tar.Headers;
using System.Text;
using SharpCompress.Common.Tar.Headers;

namespace SharpCompress.Compressors.Deflate;

Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Compressors/Deflate64/Deflate64Stream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

#nullable disable

using SharpCompress.Common.Zip;
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.CompilerServices;
using SharpCompress.Common.Zip;

namespace SharpCompress.Compressors.Deflate64;

Expand Down
3 changes: 2 additions & 1 deletion src/SharpCompress/Compressors/PPMd/I1/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,8 @@ PpmContext foundStateSuccessor
);
}
else if (
(currentContext.SummaryFrequency += 4) > 128 + (4 * currentContext.NumberStatistics)
(currentContext.SummaryFrequency += 4)
> 128 + (4 * currentContext.NumberStatistics)
)
{
Refresh((uint)((currentContext.NumberStatistics + 2) >> 1), true, currentContext);
Expand Down
7 changes: 4 additions & 3 deletions src/SharpCompress/Compressors/Rar/UnpackV1/Unpack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1269,9 +1269,10 @@ private bool AddVMCode(int firstByte, List<byte> vmCode, int length)
if (CurSize < DataSize + RarVM.VM_FIXEDGLOBALSIZE)
{
// StackFilter->Prg.GlobalData.Add(DataSize+VM_FIXEDGLOBALSIZE-CurSize);
StackFilter.Program.GlobalData.SetSize(
DataSize + RarVM.VM_FIXEDGLOBALSIZE - CurSize
);
StackFilter
.Program
.GlobalData
.SetSize(DataSize + RarVM.VM_FIXEDGLOBALSIZE - CurSize);
}
var offset = RarVM.VM_FIXEDGLOBALSIZE;
globalData = StackFilter.Program.GlobalData;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;

using SharpCompress.Compressors.Rar.VM;

namespace SharpCompress.Compressors.Rar.UnpackV1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#nullable disable

using System;
#if !Rar2017_64bit
using size_t = System.UInt32;
#else
using nint = System.Int64;
using nuint = System.UInt64;
using size_t = System.UInt64;
#endif
using System;

namespace SharpCompress.Compressors.Rar.UnpackV2017;

Expand Down
8 changes: 4 additions & 4 deletions src/SharpCompress/Compressors/Rar/UnpackV2017/Unpack.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#if !Rar2017_64bit
using System;
using System.IO;
using SharpCompress.Common.Rar.Headers;
#if !Rar2017_64bit
using size_t = System.UInt32;
#else
using nint = System.Int64;
using nuint = System.UInt64;
using size_t = System.UInt64;
#endif
using System;
using System.IO;
using SharpCompress.Common.Rar.Headers;

namespace SharpCompress.Compressors.Rar.UnpackV2017;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#if !Rar2017_64bit
using uint32 = System.UInt32;

/*#if !Rar2017_64bit
#else
using nint = System.Int64;
using nuint = System.UInt64;
using size_t = System.UInt64;
#endif
using uint32 = System.UInt32;
#endif*/


namespace SharpCompress.Compressors.Rar.UnpackV2017;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#if !Rar2017_64bit
using System;
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
using static SharpCompress.Compressors.Rar.UnpackV2017.Unpack.Unpack20Local;

/*#if !Rar2017_64bit
#else
using nint = System.Int64;
using nuint = System.UInt64;
using size_t = System.UInt64;
#endif
using System;
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
using static SharpCompress.Compressors.Rar.UnpackV2017.Unpack.Unpack20Local;
#endif*/


namespace SharpCompress.Compressors.Rar.UnpackV2017;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
#nullable disable

using System;
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
using static SharpCompress.Compressors.Rar.UnpackV2017.UnpackGlobal;
using int64 = System.Int64;
#if !Rar2017_64bit
using size_t = System.UInt32;
#else
using nint = System.Int64;
using nuint = System.UInt64;
using size_t = System.UInt64;
#endif
using int64 = System.Int64;

using System;
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
using static SharpCompress.Compressors.Rar.UnpackV2017.UnpackGlobal;

namespace SharpCompress.Compressors.Rar.UnpackV2017;

Expand Down
51 changes: 25 additions & 26 deletions src/SharpCompress/Compressors/Rar/UnpackV2017/Unpack.unpack_cpp.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#nullable disable

using System;
using SharpCompress.Common;
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
using static SharpCompress.Compressors.Rar.UnpackV2017.UnpackGlobal;
#if !Rar2017_64bit
using size_t = System.UInt32;
#else
Expand All @@ -8,11 +12,6 @@
using size_t = System.UInt64;
#endif

using System;
using SharpCompress.Common;
using static SharpCompress.Compressors.Rar.UnpackV2017.UnpackGlobal;
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;

namespace SharpCompress.Compressors.Rar.UnpackV2017;

internal sealed partial class Unpack : BitInput
Expand All @@ -30,12 +29,12 @@ public Unpack( /* ComprDataIO *DataIO */
Suspended = false;
UnpAllBuf = false;
UnpSomeRead = false;
#if RarV2017_RAR_SMP
MaxUserThreads = 1;
UnpThreadPool = CreateThreadPool();
ReadBufMT = null;
UnpThreadData = null;
#endif
/*#if RarV2017_RAR_SMP
MaxUserThreads = 1;
UnpThreadPool = CreateThreadPool();
ReadBufMT = null;
UnpThreadData = null;
#endif*/
MaxWinSize = 0;
MaxWinMask = 0;

Expand Down Expand Up @@ -199,21 +198,21 @@ private void DoUnpack(uint Method, bool Solid)
break;
#endif
case 50: // RAR 5.0 compression algorithm.
#if RarV2017_RAR_SMP
if (MaxUserThreads > 1)
{
// We do not use the multithreaded unpack routine to repack RAR archives
// in 'suspended' mode, because unlike the single threaded code it can
// write more than one dictionary for same loop pass. So we would need
// larger buffers of unknown size. Also we do not support multithreading
// in fragmented window mode.
if (!Fragmented)
{
Unpack5MT(Solid);
break;
}
}
#endif
/*#if RarV2017_RAR_SMP
if (MaxUserThreads > 1)
{
// We do not use the multithreaded unpack routine to repack RAR archives
// in 'suspended' mode, because unlike the single threaded code it can
// write more than one dictionary for same loop pass. So we would need
// larger buffers of unknown size. Also we do not support multithreading
// in fragmented window mode.
if (!Fragmented)
{
Unpack5MT(Solid);
break;
}
}
#endif*/
Unpack5(Solid);
break;
#if !Rar2017_NOSTRICT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#if !Rar2017_64bit
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;

/*#if !Rar2017_64bit
#else
using nint = System.Int64;
using nuint = System.UInt64;
using size_t = System.UInt64;
#endif
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
#endif*/


namespace SharpCompress.Compressors.Rar.UnpackV2017;

Expand Down
Loading