mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
[PR #1052] [MERGED] Move ZstdSharp into SharpCompress - Complete Integration #1473
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/adamhathcock/sharpcompress/pull/1052
Author: @Copilot
Created: 11/29/2025
Status: ✅ Merged
Merged: 12/18/2025
Merged by: @adamhathcock
Base:
master← Head:copilot/move-zstdsharp-into-sharpcompress📝 Commits (10+)
0d671a0Initial plan94c64b2Add initial ZStandard infrastructure types for ZstdSharp integrationd3428b0Fix XML documentation comments in buffer structs4021208Add core ZStandard infrastructure: UnsafeHelper, ThrowHelper, and Unsafe Methodsb9b159bAdd ZStandard compression parameter types and enums3a6d24bAdd ZStandard frame and dictionary types1b3002cInitial plan8680e3bDrop .NET 6 support and add .NET 10 supportb4c5437Fix .NET 10.0 formatting in READMEa08f953Remove netstandard2.0 and net481 targets, keep net48, net8.0, net10.0📊 Changes
239 files changed (+55774 additions, -75 deletions)
View changed files
📝
src/SharpCompress/AssemblyInfo.cs(+2 -1)📝
src/SharpCompress/Common/Zip/ZipFilePart.cs(+1 -1)📝
src/SharpCompress/Compressors/LZMA/Registry.cs(+1 -1)➕
src/SharpCompress/Compressors/ZStandard/BitOperations.cs(+311 -0)➕
src/SharpCompress/Compressors/ZStandard/CompressionStream.cs(+301 -0)➕
src/SharpCompress/Compressors/ZStandard/Compressor.cs(+204 -0)➕
src/SharpCompress/Compressors/ZStandard/Constants.cs(+8 -0)➕
src/SharpCompress/Compressors/ZStandard/DecompressionStream.cs(+293 -0)➕
src/SharpCompress/Compressors/ZStandard/Decompressor.cs(+176 -0)➕
src/SharpCompress/Compressors/ZStandard/JobThreadPool.cs(+141 -0)➕
src/SharpCompress/Compressors/ZStandard/SafeHandles.cs(+163 -0)➕
src/SharpCompress/Compressors/ZStandard/SynchronizationWrapper.cs(+22 -0)➕
src/SharpCompress/Compressors/ZStandard/ThrowHelper.cs(+48 -0)➕
src/SharpCompress/Compressors/ZStandard/UnmanagedObject.cs(+18 -0)➕
src/SharpCompress/Compressors/ZStandard/Unsafe/Allocations.cs(+52 -0)➕
src/SharpCompress/Compressors/ZStandard/Unsafe/BIT_CStream_t.cs(+14 -0)➕
src/SharpCompress/Compressors/ZStandard/Unsafe/BIT_DStream_status.cs(+16 -0)➕
src/SharpCompress/Compressors/ZStandard/Unsafe/BIT_DStream_t.cs(+13 -0)➕
src/SharpCompress/Compressors/ZStandard/Unsafe/Bits.cs(+60 -0)➕
src/SharpCompress/Compressors/ZStandard/Unsafe/Bitstream.cs(+739 -0)...and 80 more files
📄 Description
Completes the full integration of ZstdSharp directly into SharpCompress, removing the external ZstdSharp.Port dependency (addresses #1030, started in #949).
Overview
This PR integrates all ~217 ZstdSharp implementation files into SharpCompress, providing a fully self-contained ZStandard compression/decompression implementation without external dependencies.
Changes Made
Core Infrastructure
ZSTD_ErrorCodeenum,ZstdExceptionclass,ThrowHelperwith extension methodsUnsafeHelperwith malloc, calloc, free, memcpy, memset, memmove, memcmpZSTD_inBuffer_s,ZSTD_outBuffer_s,ZSTD_customMemZSTD_cParameter,ZSTD_compressionParameters,ZSTD_strategy) and decompression (ZSTD_dParameter) parametersZSTD_frameType_e,ZSTD_frameHeader,ZSTD_frameParameters,ZSTD_parametersZSTD_dictContentType_e,ZSTD_dictLoadMethod_eZSTD_EndDirective,ZSTD_ResetDirectiveComplete Unsafe Implementation (~217 files)
Fse.cs,FseCompress.cs,FseDecompress.cs)Huf.cs,HufCompress.cs,HufDecompress.cs)Cover.cs,Fastcover.cs,Zdict.cs)ZstdCompress.cs,ZstdCompressInternal.cs,ZstdCompressLiterals.cs,ZstdCompressSequences.cs,ZstdCompressSuperblock.csZstdDecompress.cs,ZstdDecompressBlock.cs,ZstdDecompressInternal.csZstdFast.cs,ZstdDoubleFast.cs,ZstdLazy.cs,ZstdOpt.csZstdLdm.csEntropyCommon.cs,Bitstream.csZSTD_CCtx_s.cs,ZSTD_DCtx_s.cs, compression/decompression context structuresZstdmtCompress.cs,Pool.csXxhash.csfor checksumsHigh-Level API
Unwrap()methods and dictionary supportWrap()methodsSafeCctxHandleandSafeDctxHandlefor safe resource managementJobThreadPool,SynchronizationWrapper,UnmanagedObject,Constants,BitOperationsDependency Removal
ZstdSharp.Portpackage reference fromSharpCompress.csprojCommon/Zip/ZipFilePart.cs: Changed namespace fromZstdSharptoSharpCompress.Compressors.ZStandardCompressors/LZMA/Registry.cs: Updated namespace usageWriters/Zip/ZipWriter.cs: Changednew ZstdSharp.CompressionStream(...)tonew CompressionStream(...)Bug Fixes and Improvements
Thread.VolatileRead→Volatile.ReadinZstdDecompressBlock.csZstandardConstants.cs394fd2e) for CSharpier 1.2.3 and other updatesBuild Status
✅ Project builds successfully on all targets (net48, net8.0, net10.0)
✅ No warnings or errors
✅ No external ZstdSharp dependency required
✅ Code formatted with CSharpier 1.2.3
Files Changed
SharpCompress now has a complete, self-contained ZStandard implementation.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.