mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
[PR #1052] Move ZstdSharp into SharpCompress - Complete Integration #1476
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?
Original Pull Request: https://github.com/adamhathcock/sharpcompress/pull/1052
State: closed
Merged: Yes
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.