Lines Matching refs:state

214 	struct private_data *state;
222 state = (struct private_data *)calloc(sizeof(*state), 1);
224 if (state == NULL || out_block == NULL) {
226 free(state);
233 self->data = state;
234 state->out_block_size = out_block_size;
235 state->out_block = out_block;
252 state->maxcode_bits = code & 0x1f;
253 state->maxcode = (1 << state->maxcode_bits);
254 state->use_reset_code = code & 0x80;
257 state->free_ent = 256;
258 state->stackp = state->stack;
259 if (state->use_reset_code)
260 state->free_ent++;
261 state->bits = 9;
262 state->section_end_code = (1<<state->bits) - 1;
263 state->oldcode = -1;
265 state->prefix[code] = 0;
266 state->suffix[code] = code;
280 struct private_data *state;
284 state = (struct private_data *)self->data;
285 if (state->end_of_stream) {
289 p = start = (unsigned char *)state->out_block;
290 end = start + state->out_block_size;
292 while (p < end && !state->end_of_stream) {
293 if (state->stackp > state->stack) {
294 *p++ = *--state->stackp;
298 state->end_of_stream = ret;
324 struct private_data *state = (struct private_data *)self->data;
326 free(state->out_block);
327 free(state);
339 struct private_data *state = (struct private_data *)self->data;
345 code = newcode = getbits(self, state->bits);
354 if ((code == 256) && state->use_reset_code) {
362 int skip_bytes = state->bits -
363 (state->bytes_in_section % state->bits);
364 skip_bytes %= state->bits;
365 state->bits_avail = 0; /* Discard rest of this byte. */
372 state->bytes_in_section = 0;
373 state->bits = 9;
374 state->section_end_code = (1 << state->bits) - 1;
375 state->free_ent = 257;
376 state->oldcode = -1;
380 if (code > state->free_ent
381 || (code == state->free_ent && state->oldcode < 0)) {
389 if (code >= state->free_ent) {
390 *state->stackp++ = state->finbyte;
391 code = state->oldcode;
396 *state->stackp++ = state->suffix[code];
397 code = state->prefix[code];
399 *state->stackp++ = state->finbyte = code;
402 code = state->free_ent;
403 if (code < state->maxcode && state->oldcode >= 0) {
404 state->prefix[code] = state->oldcode;
405 state->suffix[code] = state->finbyte;
406 ++state->free_ent;
408 if (state->free_ent > state->section_end_code) {
409 state->bits++;
410 state->bytes_in_section = 0;
411 if (state->bits == state->maxcode_bits)
412 state->section_end_code = state->maxcode;
414 state->section_end_code = (1 << state->bits) - 1;
418 state->oldcode = newcode;
430 struct private_data *state = (struct private_data *)self->data;
438 while (state->bits_avail < n) {
439 if (state->avail_in <= 0) {
440 if (state->consume_unnotified) {
442 state->consume_unnotified);
443 state->consume_unnotified = 0;
445 state->next_in
450 if (ret < 0 || state->next_in == NULL)
452 state->consume_unnotified = state->avail_in = ret;
454 state->bit_buffer |= *state->next_in++ << state->bits_avail;
455 state->avail_in--;
456 state->bits_avail += 8;
457 state->bytes_in_section++;
460 code = state->bit_buffer;
461 state->bit_buffer >>= n;
462 state->bits_avail -= n;