uint8_t *dict;
size_t dict_size;
} mszip;
- };
+ } alg;
};
static voidpf ndr_zlib_alloc(voidpf opaque, uInt items, uInt size)
DATA_BLOB plain_chunk;
uint32_t plain_chunk_offset;
uint32_t plain_chunk_size;
- z_stream *z = state->mszip.z;
+ z_stream *z = state->alg.mszip.z;
int z_ret;
plain_chunk_size = decompressed_len;
* uncompressed output as dictionnary.
*/
- if (state->mszip.dict_size) {
- z_ret = inflateSetDictionary(z, state->mszip.dict, state->mszip.dict_size);
+ if (state->alg.mszip.dict_size) {
+ z_ret = inflateSetDictionary(z, state->alg.mszip.dict, state->alg.mszip.dict_size);
if (z_ret != Z_OK) {
return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
"zlib inflateSetDictionary error %s (%d) %s (PULL)",
* we can just store that instead of copying the memory over
* the dict temp buffer.
*/
- state->mszip.dict = plain_chunk.data;
- state->mszip.dict_size = plain_chunk.length;
+ state->alg.mszip.dict = plain_chunk.data;
+ state->alg.mszip.dict_size = plain_chunk.length;
z_ret = inflateReset(z);
if (z_ret != Z_OK) {
comp_chunk.data[0] = 'C';
comp_chunk.data[1] = 'K';
- z = state->mszip.z;
+ z = state->alg.mszip.z;
z->next_in = plain_chunk.data;
z->avail_in = plain_chunk.length;
z->total_in = 0;
* same CFFOLDER as a dictionnary for the compression.
*/
- if (state->mszip.dict_size) {
- z_ret = deflateSetDictionary(z, state->mszip.dict, state->mszip.dict_size);
+ if (state->alg.mszip.dict_size) {
+ z_ret = deflateSetDictionary(z, state->alg.mszip.dict, state->alg.mszip.dict_size);
if (z_ret != Z_OK) {
return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
"zlib deflateSetDictionary error %s (%d) %s (PUSH)",
zError(z_ret), z_ret, z->msg);
}
- if (plain_chunk.length > talloc_array_length(state->mszip.dict)) {
+ if (plain_chunk.length > talloc_array_length(state->alg.mszip.dict)) {
return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
"zlib dict buffer is too big (PUSH)");
}
* still going to been valid for the lifetime of the
* compressions state object.
*/
- memcpy(state->mszip.dict, plain_chunk.data, plain_chunk.length);
- state->mszip.dict_size = plain_chunk.length;
+ memcpy(state->alg.mszip.dict, plain_chunk.data, plain_chunk.length);
+ state->alg.mszip.dict_size = plain_chunk.length;
DEBUG(9,("MSZIP comp plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
(unsigned int)plain_chunk.length,
z->zfree = ndr_zlib_free;
z->opaque = mem_ctx;
- state->mszip.z = z;
- state->mszip.dict_size = 0;
+ state->alg.mszip.z = z;
+ state->alg.mszip.dict_size = 0;
/* pre-alloc dictionnary */
- state->mszip.dict = talloc_array(mem_ctx, uint8_t, 0x8000);
- NDR_ERR_HAVE_NO_MEMORY(state->mszip.dict);
+ state->alg.mszip.dict = talloc_array(mem_ctx, uint8_t, 0x8000);
+ NDR_ERR_HAVE_NO_MEMORY(state->alg.mszip.dict);
return NDR_ERR_SUCCESS;
}
return;
}
- TALLOC_FREE(state->mszip.z);
- TALLOC_FREE(state->mszip.dict);
+ TALLOC_FREE(state->alg.mszip.z);
+ TALLOC_FREE(state->alg.mszip.dict);
}
break;
case NDR_COMPRESSION_MSZIP_CAB:
NDR_CHECK(generic_mszip_init(ndr, s));
- z_ret = inflateInit2(s->mszip.z, -MAX_WBITS);
+ z_ret = inflateInit2(s->alg.mszip.z, -MAX_WBITS);
if (z_ret != Z_OK) {
return ndr_pull_error(ndr, NDR_ERR_COMPRESSION,
"zlib inflateinit2 error %s (%d) %s (PULL)",
- zError(z_ret), z_ret, s->mszip.z->msg);
+ zError(z_ret), z_ret, s->alg.mszip.z->msg);
}
break;
default:
break;
case NDR_COMPRESSION_MSZIP_CAB:
NDR_CHECK(generic_mszip_init(ndr, s));
- z_ret = deflateInit2(s->mszip.z,
+ z_ret = deflateInit2(s->alg.mszip.z,
Z_DEFAULT_COMPRESSION,
Z_DEFLATED,
-MAX_WBITS,
if (z_ret != Z_OK) {
return ndr_push_error(ndr, NDR_ERR_COMPRESSION,
"zlib inflateinit2 error %s (%d) %s (PUSH)",
- zError(z_ret), z_ret, s->mszip.z->msg);
+ zError(z_ret), z_ret, s->alg.mszip.z->msg);
}
break;
default: