#include <ZstdCompressor.h>
|
| static void * | _zstdalloc (void *opaque, size_t size) |
| static void * | _zipalloc (void *opaque, UINT items, UINT size) |
| static void | _zipfree (void *opaque, void *address) |
|
| enum | CompressionLevel { levelDefault = 0x7FFFFFFE
, levelStore = 0
, levelFastest = 1
, levelBest = 0x7FFFFFFF
} |
| enum | CompressionMethod {
methodStore = 0
, methodDeflate = 8
, methodBzip2 = 12
, methodZstd = 93
,
methodWinZipAes = 99
} |
| enum | CompressorType { typeDeflate = 1
, typeBzip2
, typePPMd
, typeZstd
} |
| typedef CZipArray< COffsetsPair * > | CZipOffsetsPairsArray |
| static CZipCompressor * | CreateCompressor (WORD uMethod, CZipStorage *pStorage) |
| static bool | IsCompressionSupported (WORD uCompressionMethod) |
| ZIP_SIZE_TYPE | m_uComprLeft |
| | The number of bytes left to compress.
|
| DWORD | m_uCrc32 |
| | The CRC32 file checksum.
|
| ZIP_SIZE_TYPE | m_uUncomprLeft |
| | The number of bytes left to decompress.
|
| bool | m_bDecompressionDone |
| CZipAutoBuffer | m_pBuffer |
| | A buffer that receives compressed data or provides data for decompression.
|
| CZipCryptograph * | m_pCryptograph |
| | The current cryptograph.
|
| CZipFileHeader * | m_pFile |
| | The file header being compressed or decompressed.
|
| CZipStorage * | m_pStorage |
| | The current storage object.
|
◆ CZstdCompressor()
| ZipArchiveLib::CZstdCompressor::CZstdCompressor |
( |
CZipStorage * | pStorage | ) |
|
Initializes a new instance of the CZstdCompressor class.
- Parameters
-
| pStorage | The current storage object. |
◆ _zstdalloc()
| void * ZipArchiveLib::CZstdCompressor::_zstdalloc |
( |
void * | opaque, |
|
|
size_t | size ) |
|
inlinestaticprotected |
Custom memory allocation function for zstd.
- Parameters
-
| opaque | Opaque pointer passed to the allocation function. |
| size | The size of memory to allocate. |
- Returns
- Pointer to the allocated memory.
◆ CanProcess()
| bool ZipArchiveLib::CZstdCompressor::CanProcess |
( |
WORD | uMethod | ) |
|
|
inlinevirtual |
Returns the value indicating whether the current CZipCompressor object supports the given compression method.
- Parameters
-
- Returns
true, if the compression method is supported; false otherwise.
Implements CZipCompressor.
◆ Compress()
| void ZipArchiveLib::CZstdCompressor::Compress |
( |
const void * | pBuffer, |
|
|
DWORD | uSize ) |
|
virtual |
◆ CompressionLevelToNative()
| int ZipArchiveLib::CZstdCompressor::CompressionLevelToNative |
( |
CompressionLevel | iLevel | ) |
|
|
virtual |
Converts a generic compression level to the compressor's native level.
- Parameters
-
| iLevel | The generic compression level. |
- Returns
- The native compression level for this compressor.
Implements CZipCompressor.
◆ ConvertInternalError()
| int ZipArchiveLib::CZstdCompressor::ConvertInternalError |
( |
int | iErr | ) |
const |
|
inlineprotectedvirtual |
Converts a Zstandard internal error code to a ZipArchive Library error code.
- Parameters
-
| iErr | A Zstandard function return value cast to int. When an error occurs, Zstandard returns (size_t)-error_enum_value, which becomes negative when cast to int. |
- Returns
- A ZipArchive Library error code in the range [CZipException::zstdErrorMin, CZipException::zstdErrorMax] that preserves the original error information.
- Note
- Zstandard encodes errors as ((size_t)-error_enum_value), e.g., ZSTD_error_GENERIC (1) becomes (size_t)-1. When cast to int, this becomes -1. Subtracting this negative value from zstdErrorMin (which is equivalent to adding its absolute value) stores the error enum value offset from zstdErrorMin.
Reimplemented from CZipCompressor.
◆ Decompress()
| DWORD ZipArchiveLib::CZstdCompressor::Decompress |
( |
void * | pBuffer, |
|
|
DWORD | uSize ) |
|
virtual |
Decompresses the given data.
- Parameters
-
| pBuffer | The buffer that receives the decompressed data. |
| uSize | The size of pBuffer. |
- Returns
- The number of bytes decompressed and written to pBuffer.
- Note
- This method should be called repeatedly until it returns
0.
- See also
- InitDecompression
-
FinishDecompression
Implements CZipCompressor.
◆ FinishCompression()
| void ZipArchiveLib::CZstdCompressor::FinishCompression |
( |
bool | bAfterException | ) |
|
The method called at the end of the compression process.
- Parameters
-
| bAfterException | Set to true, if an exception occurred before or to false otherwise. |
◆ FinishDecompression()
| void ZipArchiveLib::CZstdCompressor::FinishDecompression |
( |
bool | bAfterException | ) |
|
The method called at the end of the decompression process.
- Parameters
-
| bAfterException | Set to true, if an exception occurred before or to false otherwise. |
◆ GetOptions()
◆ InitCompression()
The method called when a new file is opened for compression.
- Parameters
-
◆ InitDecompression()
◆ IsCodeErrorOK()
| bool ZipArchiveLib::CZstdCompressor::IsCodeErrorOK |
( |
int | iErr | ) |
const |
|
inlineprotectedvirtual |
◆ UpdateOptions()
Updates the current options with the new options.
- Parameters
-
| pOptions | The new options to apply. |
- See also
- CZstdCompressor::COptions
The documentation for this class was generated from the following file: