30#include <compressapi.h>
41 uint32_t orig_len_nbo;
46 if (dst == NULL || dst_len == NULL || src == NULL || src_len == 0)
57 orig_len_nbo = htonl((uint32_t)src_len);
61 if (!CreateCompressor(COMPRESS_ALGORITHM_MSZIP | COMPRESS_RAW, NULL, &h))
69 block_size = (ULONG)src_len;
75 (void)SetCompressorInformation(h,
76 COMPRESS_INFORMATION_CLASS_BLOCK_SIZE,
103 DECOMPRESSOR_HANDLE h;
104 uint32_t orig_len_nbo;
110 if (dst == NULL || dst_len == NULL || src == NULL
118 orig_len = ntohl(orig_len_nbo);
120 if (*dst_len < (
size_t)orig_len)
126 if (!CreateDecompressor(COMPRESS_ALGORITHM_MSZIP | COMPRESS_RAW, NULL, &h))
132 if (orig_len > 32768U)
134 block_size = orig_len;
140 (void)SetDecompressorInformation(h,
141 COMPRESS_INFORMATION_CLASS_BLOCK_SIZE,
151 CloseDecompressor(h);
158 *dst_len = (size_t)out_len;
#define POTR_COMPRESS_HEADER_SIZE
圧縮ペイロード先頭に付加する元サイズフィールドのバイト数。
int potr_decompress(uint8_t *dst, size_t *dst_len, const uint8_t *src, size_t src_len)
圧縮データを解凍します。
int potr_compress(uint8_t *dst, size_t *dst_len, const uint8_t *src, size_t src_len)
データを圧縮します。