mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-25 00:15:15 +00:00
update csharpier
This commit is contained in:
@@ -141,7 +141,7 @@ internal static class Adler32 // From https://github.com/SixLabors/ImageSharp/bl
|
||||
4,
|
||||
3,
|
||||
2,
|
||||
1 // tap2
|
||||
1, // tap2
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -6,5 +6,5 @@ public enum ArchiveType
|
||||
Zip,
|
||||
Tar,
|
||||
SevenZip,
|
||||
GZip
|
||||
GZip,
|
||||
}
|
||||
|
||||
@@ -21,5 +21,5 @@ public enum CompressionType
|
||||
Reduce2,
|
||||
Reduce3,
|
||||
Reduce4,
|
||||
Explode
|
||||
Explode,
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public enum HeaderType : byte
|
||||
Sign,
|
||||
NewSub,
|
||||
EndArchive,
|
||||
Crypt
|
||||
Crypt,
|
||||
}
|
||||
|
||||
internal static class HeaderCodeV
|
||||
|
||||
@@ -86,7 +86,7 @@ internal class SevenZipFilePart : FilePart
|
||||
K_LZMA or K_LZMA2 => CompressionType.LZMA,
|
||||
K_PPMD => CompressionType.PPMd,
|
||||
K_B_ZIP2 => CompressionType.BZip2,
|
||||
_ => throw new NotImplementedException()
|
||||
_ => throw new NotImplementedException(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -14,5 +14,5 @@ internal enum EntryType : byte
|
||||
LongName = (byte)'L',
|
||||
SparseFile = (byte)'S',
|
||||
VolumeHeader = (byte)'V',
|
||||
GlobalExtendedHeader = (byte)'g'
|
||||
GlobalExtendedHeader = (byte)'g',
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ internal sealed class TarHeader
|
||||
(byte)' ',
|
||||
(byte)' ',
|
||||
(byte)' ',
|
||||
(byte)' '
|
||||
(byte)' ',
|
||||
};
|
||||
|
||||
internal static bool checkChecksum(byte[] buf)
|
||||
|
||||
@@ -13,5 +13,5 @@ internal enum HeaderFlags : ushort
|
||||
EnhancedDeflate = 16,
|
||||
|
||||
//Bit 11: Language encoding flag
|
||||
Efs = 2048
|
||||
Efs = 2048,
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ internal enum ExtraDataType : ushort
|
||||
// -Info-ZIP Unicode Path Extra Field
|
||||
UnicodePathExtraField = 0x7075,
|
||||
Zip64ExtendedInformationExtraField = 0x0001,
|
||||
UnixTimeExtraField = 0x5455
|
||||
UnixTimeExtraField = 0x5455,
|
||||
}
|
||||
|
||||
internal class ExtraData
|
||||
@@ -229,7 +229,7 @@ internal sealed class UnixTimeExtraField : ExtraData
|
||||
None = 0,
|
||||
LastModified = 1,
|
||||
LastAccessed = 2,
|
||||
Created = 4
|
||||
Created = 4,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,11 +238,14 @@ internal static class LocalEntryHeaderExtraFactory
|
||||
internal static ExtraData Create(ExtraDataType type, ushort length, byte[] extraData) =>
|
||||
type switch
|
||||
{
|
||||
ExtraDataType.UnicodePathExtraField
|
||||
=> new ExtraUnicodePathExtraField(type, length, extraData),
|
||||
ExtraDataType.Zip64ExtendedInformationExtraField
|
||||
=> new Zip64ExtendedInformationExtraField(type, length, extraData),
|
||||
ExtraDataType.UnicodePathExtraField => new ExtraUnicodePathExtraField(
|
||||
type,
|
||||
length,
|
||||
extraData
|
||||
),
|
||||
ExtraDataType.Zip64ExtendedInformationExtraField =>
|
||||
new Zip64ExtendedInformationExtraField(type, length, extraData),
|
||||
ExtraDataType.UnixTimeExtraField => new UnixTimeExtraField(type, length, extraData),
|
||||
_ => new ExtraData(type, length, extraData)
|
||||
_ => new ExtraData(type, length, extraData),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,5 +8,5 @@ internal enum ZipHeaderType
|
||||
DirectoryEnd,
|
||||
Split,
|
||||
Zip64DirectoryEnd,
|
||||
Zip64DirectoryEndLocator
|
||||
Zip64DirectoryEndLocator,
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace SharpCompress.Common.Zip;
|
||||
internal enum CryptoMode
|
||||
{
|
||||
Encrypt,
|
||||
Decrypt
|
||||
Decrypt,
|
||||
}
|
||||
|
||||
internal class PkwareTraditionalCryptoStream : Stream
|
||||
|
||||
@@ -4,5 +4,5 @@ internal enum WinzipAesKeySize
|
||||
{
|
||||
KeySize128 = 1,
|
||||
KeySize192 = 2,
|
||||
KeySize256 = 3
|
||||
KeySize256 = 3,
|
||||
}
|
||||
|
||||
@@ -16,5 +16,5 @@ internal enum ZipCompressionMethod
|
||||
ZStd = 93,
|
||||
Xz = 95,
|
||||
PPMd = 98,
|
||||
WinzipAes = 0x63 //http://www.winzip.com/aes_info.htm
|
||||
WinzipAes = 0x63, //http://www.winzip.com/aes_info.htm
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ZipEntry : Entry
|
||||
ZipCompressionMethod.Reduce3 => CompressionType.Reduce3,
|
||||
ZipCompressionMethod.Reduce4 => CompressionType.Reduce4,
|
||||
ZipCompressionMethod.Explode => CompressionType.Explode,
|
||||
_ => CompressionType.Unknown
|
||||
_ => CompressionType.Unknown,
|
||||
};
|
||||
|
||||
public override long Crc => _filePart?.Header.Crc ?? 0;
|
||||
|
||||
@@ -555,6 +555,6 @@ internal class BZip2Constants
|
||||
858,
|
||||
364,
|
||||
936,
|
||||
638
|
||||
638,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1829,7 +1829,7 @@ internal sealed class CBZip2OutputStream : Stream
|
||||
88573,
|
||||
265720,
|
||||
797161,
|
||||
2391484
|
||||
2391484,
|
||||
};
|
||||
|
||||
private void AllocateCompressStructures()
|
||||
|
||||
@@ -288,7 +288,7 @@ internal class CRC
|
||||
unchecked((int)0xbcb4666d),
|
||||
unchecked((int)0xb8757bda),
|
||||
unchecked((int)0xb5365d03),
|
||||
unchecked((int)0xb1f740b4)
|
||||
unchecked((int)0xb1f740b4),
|
||||
};
|
||||
|
||||
public CRC() => InitialiseCRC();
|
||||
|
||||
@@ -3,5 +3,5 @@ namespace SharpCompress.Compressors;
|
||||
public enum CompressionMode
|
||||
{
|
||||
Compress = 0,
|
||||
Decompress = 1
|
||||
Decompress = 1,
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ internal sealed partial class DeflateManager
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
0
|
||||
0,
|
||||
};
|
||||
|
||||
// extra bits for each distance code
|
||||
@@ -141,7 +141,7 @@ internal sealed partial class DeflateManager
|
||||
12,
|
||||
12,
|
||||
13,
|
||||
13
|
||||
13,
|
||||
};
|
||||
|
||||
internal enum BlockState
|
||||
@@ -149,14 +149,14 @@ internal sealed partial class DeflateManager
|
||||
NeedMore = 0, // block not completed, need more input or more output
|
||||
BlockDone, // block flush performed
|
||||
FinishStarted, // finish started, need only more output at next deflate
|
||||
FinishDone // finish done, accept no more input or output
|
||||
FinishDone, // finish done, accept no more input or output
|
||||
}
|
||||
|
||||
internal enum DeflateFlavor
|
||||
{
|
||||
Store,
|
||||
Fast,
|
||||
Slow
|
||||
Slow,
|
||||
}
|
||||
|
||||
private const int MEM_LEVEL_MAX = 9;
|
||||
@@ -214,7 +214,7 @@ internal sealed partial class DeflateManager
|
||||
new Config(8, 16, 128, 128, DeflateFlavor.Slow),
|
||||
new Config(8, 32, 128, 256, DeflateFlavor.Slow),
|
||||
new Config(32, 128, 258, 1024, DeflateFlavor.Slow),
|
||||
new Config(32, 258, 258, 4096, DeflateFlavor.Slow)
|
||||
new Config(32, 258, 258, 4096, DeflateFlavor.Slow),
|
||||
};
|
||||
|
||||
private static readonly Config[] Table;
|
||||
@@ -233,7 +233,7 @@ internal sealed partial class DeflateManager
|
||||
"insufficient memory",
|
||||
"buffer error",
|
||||
"incompatible version",
|
||||
""
|
||||
"",
|
||||
};
|
||||
|
||||
// preset dictionary flag in zlib header
|
||||
@@ -1793,7 +1793,7 @@ internal sealed partial class DeflateManager
|
||||
DeflateFlavor.Store => DeflateNone,
|
||||
DeflateFlavor.Fast => DeflateFast,
|
||||
DeflateFlavor.Slow => DeflateSlow,
|
||||
_ => DeflateFunction
|
||||
_ => DeflateFunction,
|
||||
};
|
||||
|
||||
internal int SetParams(CompressionLevel level, CompressionStrategy strategy)
|
||||
|
||||
@@ -39,5 +39,5 @@ public enum FlushType
|
||||
Full,
|
||||
|
||||
/// <summary>Signals the end of the compression/decompression stream.</summary>
|
||||
Finish
|
||||
Finish,
|
||||
}
|
||||
|
||||
@@ -1615,7 +1615,7 @@ internal sealed class InfTree
|
||||
79,
|
||||
0,
|
||||
9,
|
||||
255
|
||||
255,
|
||||
};
|
||||
|
||||
//UPGRADE_NOTE: Final was removed from the declaration of 'fixed_td'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
|
||||
@@ -1716,7 +1716,7 @@ internal sealed class InfTree
|
||||
193,
|
||||
192,
|
||||
5,
|
||||
24577
|
||||
24577,
|
||||
};
|
||||
|
||||
// Tables for deflate from PKZIP's appnote.txt.
|
||||
@@ -1753,7 +1753,7 @@ internal sealed class InfTree
|
||||
227,
|
||||
258,
|
||||
0,
|
||||
0
|
||||
0,
|
||||
};
|
||||
|
||||
// see note #13 above about 258
|
||||
@@ -1790,7 +1790,7 @@ internal sealed class InfTree
|
||||
5,
|
||||
0,
|
||||
112,
|
||||
112
|
||||
112,
|
||||
};
|
||||
|
||||
//UPGRADE_NOTE: Final was removed from the declaration of 'cpdist'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
|
||||
@@ -1825,7 +1825,7 @@ internal sealed class InfTree
|
||||
8193,
|
||||
12289,
|
||||
16385,
|
||||
24577
|
||||
24577,
|
||||
};
|
||||
|
||||
//UPGRADE_NOTE: Final was removed from the declaration of 'cpdext'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
|
||||
@@ -1860,7 +1860,7 @@ internal sealed class InfTree
|
||||
12,
|
||||
12,
|
||||
13,
|
||||
13
|
||||
13,
|
||||
};
|
||||
|
||||
// If BMAX needs to be larger than 16, then h and x[] should be uLong.
|
||||
|
||||
@@ -93,7 +93,7 @@ internal sealed class InflateBlocks
|
||||
2,
|
||||
14,
|
||||
1,
|
||||
15
|
||||
15,
|
||||
};
|
||||
|
||||
internal ZlibCodec _codec; // pointer back to this zlib stream
|
||||
@@ -815,7 +815,7 @@ internal sealed class InflateBlocks
|
||||
CODES = 6, // processing fixed or dynamic block
|
||||
DRY = 7, // output remaining window bytes
|
||||
DONE = 8, // finished last block, done
|
||||
BAD = 9 // ot a data error--stuck here
|
||||
BAD = 9, // ot a data error--stuck here
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -842,7 +842,7 @@ internal static class InternalInflateConstants
|
||||
0x00001fff,
|
||||
0x00003fff,
|
||||
0x00007fff,
|
||||
0x0000ffff
|
||||
0x0000ffff,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2054,7 +2054,7 @@ internal sealed class InflateManager
|
||||
CHECK2 = 10, // two check bytes to go
|
||||
CHECK1 = 11, // one check byte to go
|
||||
DONE = 12, // finished check, done
|
||||
BAD = 13 // got an error--stay here
|
||||
BAD = 13, // got an error--stay here
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -95,7 +95,7 @@ internal sealed partial class DeflateManager
|
||||
2,
|
||||
14,
|
||||
1,
|
||||
15
|
||||
15,
|
||||
};
|
||||
|
||||
// The lengths of the bit length codes are sent in order of decreasing
|
||||
@@ -618,7 +618,7 @@ internal sealed partial class DeflateManager
|
||||
29,
|
||||
29,
|
||||
29,
|
||||
29
|
||||
29,
|
||||
};
|
||||
|
||||
internal static readonly sbyte[] LengthCode =
|
||||
@@ -878,7 +878,7 @@ internal sealed partial class DeflateManager
|
||||
27,
|
||||
27,
|
||||
27,
|
||||
28
|
||||
28,
|
||||
};
|
||||
|
||||
internal static readonly int[] LengthBase =
|
||||
@@ -911,7 +911,7 @@ internal sealed partial class DeflateManager
|
||||
160,
|
||||
192,
|
||||
224,
|
||||
0
|
||||
0,
|
||||
};
|
||||
|
||||
internal static readonly int[] DistanceBase =
|
||||
@@ -945,7 +945,7 @@ internal sealed partial class DeflateManager
|
||||
8192,
|
||||
12288,
|
||||
16384,
|
||||
24576
|
||||
24576,
|
||||
};
|
||||
|
||||
internal short[] dyn_tree; // the dynamic tree
|
||||
|
||||
@@ -143,7 +143,7 @@ public enum CompressionLevel
|
||||
/// <summary>
|
||||
/// A synonym for BestCompression.
|
||||
/// </summary>
|
||||
Level9 = BestCompression
|
||||
Level9 = BestCompression,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -171,7 +171,7 @@ public enum CompressionStrategy
|
||||
/// Using <c>HuffmanOnly</c> will force the compressor to do Huffman encoding only, with no
|
||||
/// string matching.
|
||||
/// </summary>
|
||||
HuffmanOnly = 2
|
||||
HuffmanOnly = 2,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -859,7 +859,7 @@ internal sealed class StaticTree
|
||||
99,
|
||||
8,
|
||||
227,
|
||||
8
|
||||
8,
|
||||
};
|
||||
|
||||
internal static readonly short[] distTreeCodes =
|
||||
@@ -923,7 +923,7 @@ internal sealed class StaticTree
|
||||
7,
|
||||
5,
|
||||
23,
|
||||
5
|
||||
5,
|
||||
};
|
||||
|
||||
// extra bits for each bit length code
|
||||
@@ -947,7 +947,7 @@ internal sealed class StaticTree
|
||||
0,
|
||||
2,
|
||||
3,
|
||||
7
|
||||
7,
|
||||
};
|
||||
|
||||
internal static readonly StaticTree Literals;
|
||||
|
||||
@@ -39,7 +39,7 @@ internal enum ZlibStreamFlavor
|
||||
{
|
||||
ZLIB = 1950,
|
||||
DEFLATE = 1951,
|
||||
GZIP = 1952
|
||||
GZIP = 1952,
|
||||
}
|
||||
|
||||
internal class ZlibBaseStream : Stream
|
||||
@@ -655,6 +655,6 @@ internal class ZlibBaseStream : Stream
|
||||
{
|
||||
Writer,
|
||||
Reader,
|
||||
Undefined
|
||||
Undefined,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,5 +8,5 @@ internal enum BlockType
|
||||
{
|
||||
Uncompressed = 0,
|
||||
Static = 1,
|
||||
Dynamic = 2
|
||||
Dynamic = 2,
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ internal static class FastEncoderStatics
|
||||
0x7e,
|
||||
0x7c,
|
||||
0x1f,
|
||||
0x3f
|
||||
0x3f,
|
||||
};
|
||||
|
||||
internal static ReadOnlySpan<byte> B_FINAL_FAST_ENCODER_TREE_STRUCTURE_DATA =>
|
||||
@@ -214,7 +214,7 @@ internal static class FastEncoderStatics
|
||||
0x7e,
|
||||
0x7c,
|
||||
0x1f,
|
||||
0x3f
|
||||
0x3f,
|
||||
};
|
||||
|
||||
// Output a currentMatch with length matchLen (>= MIN_MATCH) and displacement matchPos
|
||||
@@ -762,7 +762,7 @@ internal static class FastEncoderStatics
|
||||
0x0039e7f1,
|
||||
0x003be7f1,
|
||||
0x003de7f1,
|
||||
0x000047eb
|
||||
0x000047eb,
|
||||
};
|
||||
|
||||
internal static readonly uint[] FAST_ENCODER_DISTANCE_CODE_INFO =
|
||||
@@ -798,7 +798,7 @@ internal static class FastEncoderStatics
|
||||
0x000007d5,
|
||||
0x000017d5,
|
||||
0x00000000,
|
||||
0x00000100
|
||||
0x00000100,
|
||||
};
|
||||
|
||||
internal static readonly uint[] BIT_MASK =
|
||||
@@ -818,7 +818,7 @@ internal static class FastEncoderStatics
|
||||
4095,
|
||||
8191,
|
||||
16383,
|
||||
32767
|
||||
32767,
|
||||
};
|
||||
internal static readonly byte[] EXTRA_LENGTH_BITS =
|
||||
{
|
||||
@@ -850,7 +850,7 @@ internal static class FastEncoderStatics
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
0
|
||||
0,
|
||||
};
|
||||
internal static readonly byte[] EXTRA_DISTANCE_BITS =
|
||||
{
|
||||
@@ -885,7 +885,7 @@ internal static class FastEncoderStatics
|
||||
13,
|
||||
13,
|
||||
0,
|
||||
0
|
||||
0,
|
||||
};
|
||||
internal const int NUM_CHARS = 256;
|
||||
internal const int NUM_LENGTH_BASE_CODES = 29;
|
||||
|
||||
@@ -70,7 +70,7 @@ internal sealed class InflaterManaged
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
16
|
||||
16,
|
||||
};
|
||||
|
||||
// The base length for length code 257 - 285.
|
||||
@@ -105,7 +105,7 @@ internal sealed class InflaterManaged
|
||||
163,
|
||||
195,
|
||||
227,
|
||||
3
|
||||
3,
|
||||
};
|
||||
|
||||
// The base distance for distance code 0 - 31
|
||||
@@ -143,7 +143,7 @@ internal sealed class InflaterManaged
|
||||
16385,
|
||||
24577,
|
||||
32769,
|
||||
49153
|
||||
49153,
|
||||
};
|
||||
|
||||
// code lengths for code length alphabet is stored in following order
|
||||
@@ -184,7 +184,7 @@ internal sealed class InflaterManaged
|
||||
0x07,
|
||||
0x17,
|
||||
0x0f,
|
||||
0x1f
|
||||
0x1f,
|
||||
};
|
||||
|
||||
private readonly OutputWindow _output;
|
||||
|
||||
@@ -37,5 +37,5 @@ internal enum InflaterState
|
||||
ReadingFooter = 22,
|
||||
VerifyingFooter = 23,
|
||||
|
||||
Done = 24 // Finished
|
||||
Done = 24, // Finished
|
||||
}
|
||||
|
||||
@@ -8,5 +8,5 @@ internal enum MatchState
|
||||
{
|
||||
HasSymbol = 1,
|
||||
HasMatch = 2,
|
||||
HasSymbolAndMatch = 3
|
||||
HasSymbolAndMatch = 3,
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class ExplodeStream : Stream
|
||||
0x1fff,
|
||||
0x3fff,
|
||||
0x7fff,
|
||||
0xffff
|
||||
0xffff,
|
||||
};
|
||||
|
||||
/* Tables for length and distance */
|
||||
@@ -171,7 +171,7 @@ public class ExplodeStream : Stream
|
||||
62,
|
||||
63,
|
||||
64,
|
||||
65
|
||||
65,
|
||||
};
|
||||
|
||||
static int[] cplen3 = new int[]
|
||||
@@ -239,7 +239,7 @@ public class ExplodeStream : Stream
|
||||
63,
|
||||
64,
|
||||
65,
|
||||
66
|
||||
66,
|
||||
};
|
||||
|
||||
static int[] extra = new int[]
|
||||
@@ -307,7 +307,7 @@ public class ExplodeStream : Stream
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
8
|
||||
8,
|
||||
};
|
||||
|
||||
static int[] cpdist4 = new int[]
|
||||
@@ -375,7 +375,7 @@ public class ExplodeStream : Stream
|
||||
3841,
|
||||
3905,
|
||||
3969,
|
||||
4033
|
||||
4033,
|
||||
};
|
||||
|
||||
static int[] cpdist8 = new int[]
|
||||
@@ -443,7 +443,7 @@ public class ExplodeStream : Stream
|
||||
7681,
|
||||
7809,
|
||||
7937,
|
||||
8065
|
||||
8065,
|
||||
};
|
||||
|
||||
private int get_tree(int[] arrBitLengths, int numberExpected)
|
||||
|
||||
@@ -199,7 +199,7 @@ public static class HuftTree
|
||||
{
|
||||
NumberOfBitsUsed = arrLX[stackOfBitsPerTable + tableLevel - 1], /* bits to dump before this table */
|
||||
NumberOfExtraBits = 32 + counter, /* bits in this table */
|
||||
ChildNodes = pointerToCurrentTable /* pointer to this table */
|
||||
ChildNodes = pointerToCurrentTable, /* pointer to this table */
|
||||
};
|
||||
|
||||
counter =
|
||||
@@ -212,7 +212,7 @@ public static class HuftTree
|
||||
/* set up table entry in r */
|
||||
huftNode vHuft1 = new huftNode
|
||||
{
|
||||
NumberOfBitsUsed = numberOfBitsInCurrentCode - bitsBeforeThisTable
|
||||
NumberOfBitsUsed = numberOfBitsInCurrentCode - bitsBeforeThisTable,
|
||||
};
|
||||
|
||||
if (pIndex >= numberOfCodes)
|
||||
|
||||
@@ -13,7 +13,7 @@ internal class BCJFilter : Filter
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
false,
|
||||
};
|
||||
|
||||
private static readonly int[] MASK_TO_BIT_NUMBER = { 0, 1, 2, 2, 3, 3, 3, 3 };
|
||||
|
||||
@@ -39,7 +39,7 @@ internal class BCJFilterIA64 : Filter
|
||||
4,
|
||||
4,
|
||||
0,
|
||||
0
|
||||
0,
|
||||
};
|
||||
|
||||
public BCJFilterIA64(bool isEncoder, Stream baseStream)
|
||||
|
||||
@@ -147,7 +147,7 @@ internal enum CoderPropId
|
||||
/// <summary>
|
||||
/// Specifies mode with end marker.
|
||||
/// </summary>
|
||||
EndMarker
|
||||
EndMarker,
|
||||
}
|
||||
|
||||
internal interface ISetCoderProperties
|
||||
|
||||
@@ -205,7 +205,7 @@ public sealed class LZipStream : Stream
|
||||
(byte)'I',
|
||||
(byte)'P',
|
||||
1,
|
||||
113
|
||||
113,
|
||||
};
|
||||
|
||||
public static void WriteHeaderSize(Stream stream)
|
||||
@@ -235,6 +235,6 @@ public sealed class LZipStream : Stream
|
||||
(byte)(dictionarySize & 0xff),
|
||||
(byte)((dictionarySize >> 8) & 0xff),
|
||||
(byte)((dictionarySize >> 16) & 0xff),
|
||||
(byte)((dictionarySize >> 24) & 0xff)
|
||||
(byte)((dictionarySize >> 24) & 0xff),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ internal class Encoder : ICoder, ISetCoderProperties, IWriteCoderProperties
|
||||
private enum EMatchFinderType
|
||||
{
|
||||
Bt2,
|
||||
Bt4
|
||||
Bt4,
|
||||
}
|
||||
|
||||
private const uint K_IFINITY_PRICE = 0xFFFFFFF;
|
||||
|
||||
@@ -38,7 +38,7 @@ public class LzmaEncoderProperties
|
||||
CoderPropId.Algorithm,
|
||||
CoderPropId.NumFastBytes,
|
||||
CoderPropId.MatchFinder,
|
||||
CoderPropId.EndMarker
|
||||
CoderPropId.EndMarker,
|
||||
};
|
||||
_properties = new object[]
|
||||
{
|
||||
@@ -49,7 +49,7 @@ public class LzmaEncoderProperties
|
||||
algorithm,
|
||||
numFastBytes,
|
||||
mf,
|
||||
eos
|
||||
eos,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ internal class ModelPpm
|
||||
0x64A1,
|
||||
0x5ABC,
|
||||
0x6632,
|
||||
0x6051
|
||||
0x6051,
|
||||
};
|
||||
|
||||
// Temp fields
|
||||
|
||||
@@ -59,7 +59,7 @@ internal partial class Model
|
||||
0x64A1,
|
||||
0x5ABC,
|
||||
0x6632,
|
||||
0x6051
|
||||
0x6051,
|
||||
};
|
||||
|
||||
private static ReadOnlySpan<byte> EXPONENTIAL_ESCAPES =>
|
||||
|
||||
@@ -24,5 +24,5 @@ internal enum ModelRestorationMethod
|
||||
/// <summary>
|
||||
/// Freeze the context tree (in some cases may result in poor compression).
|
||||
/// </summary>
|
||||
Freeze = 2
|
||||
Freeze = 2,
|
||||
}
|
||||
|
||||
@@ -4,5 +4,5 @@ public enum PpmdVersion
|
||||
{
|
||||
H,
|
||||
H7Z,
|
||||
I1
|
||||
I1,
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ internal class RarBLAKE2spStream : RarStream
|
||||
0x510E527FU,
|
||||
0x9B05688CU,
|
||||
0x1F83D9ABU,
|
||||
0x5BE0CD19U
|
||||
0x5BE0CD19U,
|
||||
};
|
||||
|
||||
static readonly byte[][] k_BLAKE2S_Sigma =
|
||||
|
||||
@@ -10,5 +10,5 @@ internal enum CodeType
|
||||
CODE_STARTFILE,
|
||||
CODE_ENDFILE,
|
||||
CODE_VM,
|
||||
CODE_VMDATA
|
||||
CODE_VMDATA,
|
||||
}
|
||||
|
||||
@@ -12,5 +12,5 @@ internal enum FilterType : byte
|
||||
FILTER_RGB,
|
||||
FILTER_ITANIUM,
|
||||
FILTER_PPM,
|
||||
FILTER_NONE
|
||||
FILTER_NONE,
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@ namespace SharpCompress.Compressors.Rar.UnpackV1.PPM;
|
||||
internal enum BlockTypes
|
||||
{
|
||||
BLOCK_LZ = 0,
|
||||
BLOCK_PPM = 1
|
||||
BLOCK_PPM = 1,
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ internal sealed partial class Unpack : BitInput, IRarUnpack, IDisposable
|
||||
2,
|
||||
14,
|
||||
0,
|
||||
12
|
||||
12,
|
||||
};
|
||||
|
||||
private FileHeader fileHeader;
|
||||
|
||||
@@ -88,7 +88,7 @@ internal partial class Unpack
|
||||
0xf000,
|
||||
0xf200,
|
||||
0xf200,
|
||||
0xffff
|
||||
0xffff,
|
||||
};
|
||||
|
||||
private static readonly int[] PosL1 = { 0, 0, 0, 2, 3, 5, 7, 11, 16, 20, 24, 32, 32 };
|
||||
@@ -106,7 +106,7 @@ internal partial class Unpack
|
||||
0xf000,
|
||||
0xf200,
|
||||
0xf240,
|
||||
0xffff
|
||||
0xffff,
|
||||
};
|
||||
|
||||
private static readonly int[] PosL2 = { 0, 0, 0, 0, 5, 7, 9, 13, 18, 22, 26, 34, 36 };
|
||||
@@ -123,7 +123,7 @@ internal partial class Unpack
|
||||
0xf200,
|
||||
0xf200,
|
||||
0xf200,
|
||||
0xffff
|
||||
0xffff,
|
||||
};
|
||||
|
||||
private static readonly int[] PosHf0 = { 0, 0, 0, 0, 0, 8, 16, 24, 33, 33, 33, 33, 33 };
|
||||
@@ -139,7 +139,7 @@ internal partial class Unpack
|
||||
0xf200,
|
||||
0xf200,
|
||||
0xf7e0,
|
||||
0xffff
|
||||
0xffff,
|
||||
};
|
||||
|
||||
private static readonly int[] PosHf1 = { 0, 0, 0, 0, 0, 0, 4, 44, 60, 76, 80, 80, 127 };
|
||||
@@ -155,7 +155,7 @@ internal partial class Unpack
|
||||
0xfa00,
|
||||
0xffff,
|
||||
0xffff,
|
||||
0xffff
|
||||
0xffff,
|
||||
};
|
||||
|
||||
private static readonly int[] PosHf2 = { 0, 0, 0, 0, 0, 0, 2, 7, 53, 117, 233, 0, 0 };
|
||||
@@ -170,7 +170,7 @@ internal partial class Unpack
|
||||
0xfe80,
|
||||
0xffff,
|
||||
0xffff,
|
||||
0xffff
|
||||
0xffff,
|
||||
};
|
||||
|
||||
private static readonly int[] PosHf3 = { 0, 0, 0, 0, 0, 0, 0, 2, 16, 218, 251, 0, 0 };
|
||||
@@ -199,7 +199,7 @@ internal partial class Unpack
|
||||
0x90,
|
||||
0x98,
|
||||
0x9c,
|
||||
0xb0
|
||||
0xb0,
|
||||
};
|
||||
|
||||
private static readonly int[] ShortLen2 = { 2, 3, 3, 3, 4, 4, 5, 6, 6, 4, 4, 5, 6, 6, 4, 0 };
|
||||
@@ -220,7 +220,7 @@ internal partial class Unpack
|
||||
0x90,
|
||||
0x98,
|
||||
0x9c,
|
||||
0xb0
|
||||
0xb0,
|
||||
};
|
||||
|
||||
private void unpack15(bool solid)
|
||||
|
||||
@@ -64,7 +64,7 @@ internal partial class Unpack
|
||||
128,
|
||||
160,
|
||||
192,
|
||||
224
|
||||
224,
|
||||
};
|
||||
|
||||
private static ReadOnlySpan<byte> LBits =>
|
||||
@@ -97,7 +97,7 @@ internal partial class Unpack
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
5
|
||||
5,
|
||||
};
|
||||
|
||||
private static readonly int[] DDecode =
|
||||
@@ -149,7 +149,7 @@ internal partial class Unpack
|
||||
786432,
|
||||
851968,
|
||||
917504,
|
||||
983040
|
||||
983040,
|
||||
};
|
||||
|
||||
private static readonly int[] DBits =
|
||||
@@ -201,7 +201,7 @@ internal partial class Unpack
|
||||
16,
|
||||
16,
|
||||
16,
|
||||
16
|
||||
16,
|
||||
};
|
||||
|
||||
private static readonly int[] SDDecode = { 0, 4, 8, 16, 32, 64, 128, 192 };
|
||||
|
||||
@@ -19,7 +19,7 @@ internal partial class Unpack
|
||||
0xf000,
|
||||
0xf200,
|
||||
0xf200,
|
||||
0xffff
|
||||
0xffff,
|
||||
};
|
||||
|
||||
private static readonly uint[] PosL1 = { 0, 0, 0, 2, 3, 5, 7, 11, 16, 20, 24, 32, 32 };
|
||||
@@ -37,7 +37,7 @@ internal partial class Unpack
|
||||
0xf000,
|
||||
0xf200,
|
||||
0xf240,
|
||||
0xffff
|
||||
0xffff,
|
||||
};
|
||||
|
||||
private static readonly uint[] PosL2 = { 0, 0, 0, 0, 5, 7, 9, 13, 18, 22, 26, 34, 36 };
|
||||
@@ -54,7 +54,7 @@ internal partial class Unpack
|
||||
0xf200,
|
||||
0xf200,
|
||||
0xf200,
|
||||
0xffff
|
||||
0xffff,
|
||||
};
|
||||
|
||||
private static readonly uint[] PosHf0 = { 0, 0, 0, 0, 0, 8, 16, 24, 33, 33, 33, 33, 33 };
|
||||
@@ -70,7 +70,7 @@ internal partial class Unpack
|
||||
0xf200,
|
||||
0xf200,
|
||||
0xf7e0,
|
||||
0xffff
|
||||
0xffff,
|
||||
};
|
||||
|
||||
private static readonly uint[] PosHf1 = { 0, 0, 0, 0, 0, 0, 4, 44, 60, 76, 80, 80, 127 };
|
||||
@@ -86,7 +86,7 @@ internal partial class Unpack
|
||||
0xfa00,
|
||||
0xffff,
|
||||
0xffff,
|
||||
0xffff
|
||||
0xffff,
|
||||
};
|
||||
|
||||
private static readonly uint[] PosHf2 = { 0, 0, 0, 0, 0, 0, 2, 7, 53, 117, 233, 0, 0 };
|
||||
@@ -101,7 +101,7 @@ internal partial class Unpack
|
||||
0xfe80,
|
||||
0xffff,
|
||||
0xffff,
|
||||
0xffff
|
||||
0xffff,
|
||||
};
|
||||
|
||||
private static readonly uint[] PosHf3 = { 0, 0, 0, 0, 0, 0, 0, 2, 16, 218, 251, 0, 0 };
|
||||
@@ -225,7 +225,7 @@ internal partial class Unpack
|
||||
6,
|
||||
6,
|
||||
4,
|
||||
0
|
||||
0,
|
||||
};
|
||||
public static readonly uint[] ShortXor1 =
|
||||
{
|
||||
@@ -243,7 +243,7 @@ internal partial class Unpack
|
||||
0x90,
|
||||
0x98,
|
||||
0x9c,
|
||||
0xb0
|
||||
0xb0,
|
||||
};
|
||||
public static readonly uint[] ShortLen2 =
|
||||
{
|
||||
@@ -262,7 +262,7 @@ internal partial class Unpack
|
||||
6,
|
||||
6,
|
||||
4,
|
||||
0
|
||||
0,
|
||||
};
|
||||
public static readonly uint[] ShortXor2 =
|
||||
{
|
||||
@@ -280,7 +280,7 @@ internal partial class Unpack
|
||||
0x90,
|
||||
0x98,
|
||||
0x9c,
|
||||
0xb0
|
||||
0xb0,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ internal partial class Unpack
|
||||
128,
|
||||
160,
|
||||
192,
|
||||
224
|
||||
224,
|
||||
};
|
||||
public static readonly byte[] LBits =
|
||||
{
|
||||
@@ -84,7 +84,7 @@ internal partial class Unpack
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
5
|
||||
5,
|
||||
};
|
||||
public static readonly uint[] DDecode =
|
||||
{
|
||||
@@ -135,7 +135,7 @@ internal partial class Unpack
|
||||
786432,
|
||||
851968,
|
||||
917504,
|
||||
983040
|
||||
983040,
|
||||
};
|
||||
public static readonly byte[] DBits =
|
||||
{
|
||||
@@ -186,7 +186,7 @@ internal partial class Unpack
|
||||
16,
|
||||
16,
|
||||
16,
|
||||
16
|
||||
16,
|
||||
};
|
||||
public static readonly byte[] SDDecode = { 0, 4, 8, 16, 32, 64, 128, 192 };
|
||||
public static readonly byte[] SDBits = { 2, 2, 3, 4, 5, 6, 6, 6 };
|
||||
|
||||
@@ -1115,7 +1115,7 @@ internal sealed class RarVM : BitInput
|
||||
new(29, 0x0e06077d, VMStandardFilters.VMSF_DELTA),
|
||||
new(149, 0x1c2c5dc8, VMStandardFilters.VMSF_RGB),
|
||||
new(216, 0xbc85e701, VMStandardFilters.VMSF_AUDIO),
|
||||
new(40, 0x46b9c560, VMStandardFilters.VMSF_UPCASE)
|
||||
new(40, 0x46b9c560, VMStandardFilters.VMSF_UPCASE),
|
||||
};
|
||||
var CodeCRC = RarCRC.CheckCrc(0xffffffff, code, 0, code.Length) ^ 0xffffffff;
|
||||
for (var i = 0; i < stdList.Length; i++)
|
||||
|
||||
@@ -53,6 +53,6 @@ internal class VMCmdFlags
|
||||
VMCF_OP2 | VMCF_BYTEMODE,
|
||||
VMCF_OP2 | VMCF_BYTEMODE | VMCF_USEFLAGS | VMCF_CHFLAGS,
|
||||
VMCF_OP2 | VMCF_BYTEMODE | VMCF_USEFLAGS | VMCF_CHFLAGS,
|
||||
VMCF_OP0
|
||||
VMCF_OP0,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -66,5 +66,5 @@ internal enum VMCommands
|
||||
VM_NEGB = 52,
|
||||
VM_NEGD = 53,
|
||||
|
||||
VM_STANDARD = 54
|
||||
VM_STANDARD = 54,
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ internal enum VMFlags
|
||||
None = 0,
|
||||
VM_FC = 1,
|
||||
VM_FZ = 2,
|
||||
VM_FS = 80000000
|
||||
VM_FS = 80000000,
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ internal enum VMOpType
|
||||
VM_OPREG = 0,
|
||||
VM_OPINT = 1,
|
||||
VM_OPREGMEM = 2,
|
||||
VM_OPNONE = 3
|
||||
VM_OPNONE = 3,
|
||||
}
|
||||
|
||||
@@ -9,5 +9,5 @@ internal enum VMStandardFilters
|
||||
VMSF_RGB = 4,
|
||||
VMSF_AUDIO = 5,
|
||||
VMSF_DELTA = 6,
|
||||
VMSF_UPCASE = 7
|
||||
VMSF_UPCASE = 7,
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class ReduceStream : Stream
|
||||
0x1fff,
|
||||
0x3fff,
|
||||
0x7fff,
|
||||
0xffff
|
||||
0xffff,
|
||||
};
|
||||
|
||||
private int bitBufferCount;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace SharpCompress.Compressors.Shrink
|
||||
8191U,
|
||||
16383U,
|
||||
(uint)short.MaxValue,
|
||||
(uint)ushort.MaxValue
|
||||
(uint)ushort.MaxValue,
|
||||
};
|
||||
|
||||
public BitStream(byte[] src, int srcLen)
|
||||
|
||||
@@ -387,7 +387,7 @@ namespace SharpCompress.Compressors.Shrink
|
||||
{
|
||||
Ok,
|
||||
Full,
|
||||
Error
|
||||
Error,
|
||||
}
|
||||
|
||||
private struct CodeQueue
|
||||
|
||||
@@ -5,5 +5,5 @@ public enum CheckType : byte
|
||||
NONE = 0x00,
|
||||
CRC32 = 0x01,
|
||||
CRC64 = 0x04,
|
||||
SHA256 = 0x0A
|
||||
SHA256 = 0x0A,
|
||||
}
|
||||
|
||||
@@ -15,20 +15,19 @@ public abstract class BlockFilter : ReadOnlyStream
|
||||
ArchArmFilter = 0x07,
|
||||
ArchArmThumbFilter = 0x08,
|
||||
ArchSparcFilter = 0x09,
|
||||
Lzma2 = 0x21
|
||||
Lzma2 = 0x21,
|
||||
}
|
||||
|
||||
private static readonly Dictionary<FilterTypes, Func<BlockFilter>> FILTER_MAP =
|
||||
new()
|
||||
{
|
||||
{ FilterTypes.ArchX86Filter, () => new X86Filter() },
|
||||
{ FilterTypes.ArchPowerPcFilter, () => new PowerPCFilter() },
|
||||
{ FilterTypes.ArchIa64Filter, () => new IA64Filter() },
|
||||
{ FilterTypes.ArchArmFilter, () => new ArmFilter() },
|
||||
{ FilterTypes.ArchArmThumbFilter, () => new ArmThumbFilter() },
|
||||
{ FilterTypes.ArchSparcFilter, () => new SparcFilter() },
|
||||
{ FilterTypes.Lzma2, () => new Lzma2Filter() }
|
||||
};
|
||||
private static readonly Dictionary<FilterTypes, Func<BlockFilter>> FILTER_MAP = new()
|
||||
{
|
||||
{ FilterTypes.ArchX86Filter, () => new X86Filter() },
|
||||
{ FilterTypes.ArchPowerPcFilter, () => new PowerPCFilter() },
|
||||
{ FilterTypes.ArchIa64Filter, () => new IA64Filter() },
|
||||
{ FilterTypes.ArchArmFilter, () => new ArmFilter() },
|
||||
{ FilterTypes.ArchArmThumbFilter, () => new ArmThumbFilter() },
|
||||
{ FilterTypes.ArchSparcFilter, () => new SparcFilter() },
|
||||
{ FilterTypes.Lzma2, () => new Lzma2Filter() },
|
||||
};
|
||||
|
||||
public abstract bool AllowAsLast { get; }
|
||||
public abstract bool AllowAsNonLast { get; }
|
||||
|
||||
@@ -3,5 +3,5 @@ namespace SharpCompress.IO;
|
||||
public enum StreamingMode
|
||||
{
|
||||
Streaming,
|
||||
Seekable
|
||||
Seekable,
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class TarReader : AbstractReader<TarEntry, TarVolume>
|
||||
CompressionType.Xz => new XZStream(stream),
|
||||
CompressionType.Lzw => new LzwStream(stream),
|
||||
CompressionType.None => stream,
|
||||
_ => throw new NotSupportedException("Invalid compression type: " + compressionType)
|
||||
_ => throw new NotSupportedException("Invalid compression type: " + compressionType),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class ZipWriter : AbstractWriter
|
||||
CompressionType.BZip2 => ZipCompressionMethod.BZip2,
|
||||
CompressionType.LZMA => ZipCompressionMethod.LZMA,
|
||||
CompressionType.PPMd => ZipCompressionMethod.PPMd,
|
||||
_ => throw new InvalidFormatException("Invalid compression method: " + compressionType)
|
||||
_ => throw new InvalidFormatException("Invalid compression method: " + compressionType),
|
||||
};
|
||||
|
||||
public override void Write(string entryPath, Stream source, DateTime? modificationTime) =>
|
||||
@@ -100,7 +100,7 @@ public class ZipWriter : AbstractWriter
|
||||
)
|
||||
{
|
||||
Comment = options.EntryComment,
|
||||
ModificationTime = options.ModificationDateTime
|
||||
ModificationTime = options.ModificationDateTime,
|
||||
};
|
||||
|
||||
// Use the archive default setting for zip64 and allow overrides
|
||||
|
||||
Reference in New Issue
Block a user