-1
zlib에서 gzip footer를 출력하려면 어떻게해야합니까? 현재 나 자신을하고 있지만 zlib이 나를 위해 할 수 있다면 좋을 것입니다.zlib에서 gzip footer를 어떻게 출력합니까?
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());
}
내 잘못, 나는 어떻게 든 헤더 만 할 것이라고 생각했습니다. 나 자신도 헤더를 사용하기 전에, +16 기능이 추가 된 시점을 잘 모르겠습니다. BTW, 관련없는 문제에 관해서도 @ [email protected]로 이메일을 보내 셨습니다. 그 주소가 맞습니까? 16이라는 이름의 상수를 사용하는 것도 좋습니다. – XTF