Lines Matching refs:encode
401 } encode; member
461 ctx->encode.bufsize = BROTLI_DEFAULT_BUFSIZE; in bio_brotli_new()
462 ctx->encode.state = BrotliEncoderCreateInstance(brotli_alloc, brotli_free, NULL); in bio_brotli_new()
463 if (ctx->encode.state == NULL) in bio_brotli_new()
465 ctx->encode.mode = BROTLI_DEFAULT_MODE; in bio_brotli_new()
474 BrotliEncoderDestroyInstance(ctx->encode.state); in bio_brotli_new()
490 BrotliEncoderDestroyInstance(ctx->encode.state); in bio_brotli_free()
491 OPENSSL_free(ctx->encode.buf); in bio_brotli_free()
590 if (ctx->encode.done) in bio_brotli_write()
594 if (ctx->encode.buf == NULL) { in bio_brotli_write()
595 ctx->encode.buf = OPENSSL_malloc(ctx->encode.bufsize); in bio_brotli_write()
596 if (ctx->encode.buf == NULL) { in bio_brotli_write()
600 ctx->encode.ptr = ctx->encode.buf; in bio_brotli_write()
601 ctx->encode.count = 0; in bio_brotli_write()
602 ctx->encode.next_out = ctx->encode.buf; in bio_brotli_write()
603 ctx->encode.avail_out = ctx->encode.bufsize; in bio_brotli_write()
606 ctx->encode.next_in = (unsigned char *)in; in bio_brotli_write()
607 ctx->encode.avail_in = (size_t)inl; in bio_brotli_write()
610 while (ctx->encode.count > 0) { in bio_brotli_write()
611 ret = BIO_write(next, ctx->encode.ptr, ctx->encode.count); in bio_brotli_write()
614 int tot = inl - ctx->encode.avail_in; in bio_brotli_write()
621 ctx->encode.ptr += ret; in bio_brotli_write()
622 ctx->encode.count -= ret; in bio_brotli_write()
626 if (ctx->encode.avail_in == 0 && !BrotliEncoderHasMoreOutput(ctx->encode.state)) in bio_brotli_write()
632 ctx->encode.ptr = ctx->encode.buf; in bio_brotli_write()
633 ctx->encode.next_out = ctx->encode.buf; in bio_brotli_write()
634 ctx->encode.avail_out = ctx->encode.bufsize; in bio_brotli_write()
636 …otliEncoderCompressStream(ctx->encode.state, BROTLI_OPERATION_FLUSH, &ctx->encode.avail_in, (const… in bio_brotli_write()
637 &ctx->encode.avail_out, &ctx->encode.next_out, NULL); in bio_brotli_write()
643 ctx->encode.count = ctx->encode.bufsize - ctx->encode.avail_out; in bio_brotli_write()
657 if (ctx->encode.buf == NULL || (ctx->encode.done && ctx->encode.count == 0)) in bio_brotli_flush()
662 ctx->encode.next_in = NULL; in bio_brotli_flush()
663 ctx->encode.avail_in = 0; in bio_brotli_flush()
666 while (ctx->encode.count > 0) { in bio_brotli_flush()
667 ret = BIO_write(next, ctx->encode.ptr, ctx->encode.count); in bio_brotli_flush()
672 ctx->encode.ptr += ret; in bio_brotli_flush()
673 ctx->encode.count -= ret; in bio_brotli_flush()
675 if (ctx->encode.done) in bio_brotli_flush()
681 ctx->encode.ptr = ctx->encode.buf; in bio_brotli_flush()
682 ctx->encode.next_out = ctx->encode.buf; in bio_brotli_flush()
683 ctx->encode.avail_out = ctx->encode.bufsize; in bio_brotli_flush()
685 …brret = BrotliEncoderCompressStream(ctx->encode.state, BROTLI_OPERATION_FINISH, &ctx->encode.avail… in bio_brotli_flush()
686 … (const uint8_t**)&ctx->encode.next_in, &ctx->encode.avail_out, &ctx->encode.next_out, NULL); in bio_brotli_flush()
692 if (!BrotliEncoderHasMoreOutput(ctx->encode.state) && ctx->encode.avail_in == 0) in bio_brotli_flush()
693 ctx->encode.done = 1; in bio_brotli_flush()
694 ctx->encode.count = ctx->encode.bufsize - ctx->encode.avail_out; in bio_brotli_flush()
712 ctx->encode.count = 0; in bio_brotli_ctrl()
713 ctx->encode.done = 0; in bio_brotli_ctrl()
727 obs = ctx->encode.bufsize; in bio_brotli_ctrl()
750 if (obs > 0 && obs != ctx->encode.bufsize) { in bio_brotli_ctrl()
752 if (ctx->encode.buf != NULL) { in bio_brotli_ctrl()
753 tmp = OPENSSL_realloc(ctx->encode.buf, obs); in bio_brotli_ctrl()
756 ctx->encode.buf = tmp; in bio_brotli_ctrl()
758 ctx->encode.bufsize = obs; in bio_brotli_ctrl()
770 if (BrotliEncoderHasMoreOutput(ctx->encode.state)) in bio_brotli_ctrl()