diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-09-06 16:16:00 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-09-06 16:16:00 +0200 |
commit | 3b8c11b4d9f967a907c89797279d164b423cc9ed (patch) | |
tree | b5429d7a792d0157d6d8a9b001d7becb7ffd5aa1 /source4/librpc/ndr/ndr_compression.c | |
parent | 79cc502e5d065a9a700f46d004873b0a6fac1130 (diff) | |
download | samba-3b8c11b4d9f967a907c89797279d164b423cc9ed.tar.gz samba-3b8c11b4d9f967a907c89797279d164b423cc9ed.tar.bz2 samba-3b8c11b4d9f967a907c89797279d164b423cc9ed.zip |
ndr_compression: use deflateReset() together with defalteSetDictionary()
metze
(This used to be commit dcc57512b030995d9b186c7a6cb3b304d5680867)
Diffstat (limited to 'source4/librpc/ndr/ndr_compression.c')
-rw-r--r-- | source4/librpc/ndr/ndr_compression.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/source4/librpc/ndr/ndr_compression.c b/source4/librpc/ndr/ndr_compression.c index 0b33d40c24..a92877ccc2 100644 --- a/source4/librpc/ndr/ndr_compression.c +++ b/source4/librpc/ndr/ndr_compression.c @@ -219,14 +219,6 @@ static enum ndr_err_code ndr_push_compression_mszip_chunk(struct ndr_push *ndrpu zError(z_ret), z_ret); } - } else { - /* TODO: keep the window */ - z_ret = deflateReset(z); - if (z_ret != Z_OK) { - return ndr_push_error(ndrpush, NDR_ERR_COMPRESSION, - "Bad delateReset2 error %s(%d) (PUSH)", - zError(z_ret), z_ret); - } } /* call deflate untill we get Z_STREAM_END or an error */ @@ -248,11 +240,28 @@ static enum ndr_err_code ndr_push_compression_mszip_chunk(struct ndr_push *ndrpu comp_chunk_size = 2 + z->total_out; + z_ret = deflateReset(z); + if (z_ret != Z_OK) { + return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION, + "Bad deflateReset error %s(%d) (PULL)", + zError(z_ret), z_ret); + } + + z_ret = deflateSetDictionary(z, plain_chunk.data, plain_chunk.length); + if (z_ret != Z_OK) { + return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION, + "Bad deflateSetDictionary error %s(%d) (PULL)", + zError(z_ret), z_ret); + } + tmp_offset = ndrpush->offset; ndrpush->offset = comp_chunk_size_offset; NDR_CHECK(ndr_push_uint32(ndrpush, NDR_SCALARS, comp_chunk_size)); ndrpush->offset = tmp_offset; + DEBUG(10,("MSZIP comp plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n", + plain_chunk.length, plain_chunk.length, comp_chunk_size, comp_chunk_size)); + ndrpush->offset += comp_chunk_size; return NDR_ERR_SUCCESS; } |