如何让 zlib 输出 gzip 页脚
How do I have zlib output the gzip footer?
如何
让 zlib 为我输出 gzip 页脚?我目前正在自己做,但如果 zlib 能为我做就好了。
shared_data xcc_z::gzip(data_ref s)
{
z_stream stream;
stream.zalloc = NULL;
stream.zfree = NULL;
stream.opaque = NULL;
if (deflateInit2(&stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 16 + MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY))
{
assert(false);
return {};
}
shared_data d(deflateBound(&stream, s.size()) + 8);
stream.next_in = const_cast<unsigned char*>(s.data());
stream.avail_in = s.size();
stream.next_out = d.data();
stream.avail_out = d.size() - 8;
deflate(&stream, Z_FINISH);
deflateEnd(&stream);
unsigned char* w = stream.next_out;
w = write_int_le(4, w, crc32(crc32(0, NULL, 0), s.data(), s.size()));
w = write_int_le(4, w, s.size());
return d.substr(0, w - d.data());
}
为什么你认为它没有?您的代码在 zlib 已经编写的预告片之后附加了一个无用的第二个预告片。
相关文章:
- QTableView:endMoveRows在模型中重置水平页眉大小
- 如何在 setup() 函数中使用数字引脚转动电机?
- 确保内存映射页位于内存中
- 如何获取引脚 4 的值,以便也发送到从站并使用 I2C 显示?
- ZLib GZIP Returning Z_BUF_ERROR(-5)
- mmap 中的长度是字节数还是页数?
- 堆分配对于大型块中的分页是否更有效?
- 直接显示 - 无法使用设置模式设置静止引脚
- 当命令失败时,gzip 会在 C++ 中返回错误代码吗?
- 如何使用 CTypes 将 wchar_t** - 以空结尾的 UNICODE 字符串数组 - 返回到 Python 脚
- 该书第252页的错别字" a complete guide to c++"?
- Tesseract/Lebonica处理单页和多页图像的正确方法
- 如何在 Linux 中获取本地代码页?
- 如何从 C 文件将引脚排列与 esp8266 一起使用?
- 如何在嵌入式平台中管理不同引脚输出板的代码,以实现更好的HAL管理
- 如何让 zlib 输出 gzip 页脚
- 如何从 PDF 文件中查找页眉页脚
- 如何使用 C++ 自动化将页眉或页脚插入 Word 文档
- 是否有任何方法可以使用libpoppler分别访问页眉、页脚和页面内容
- 使用libCurl POST添加未知的页眉和页脚