Lines Matching defs:ctx
80 hex_decode_init(hex_decode_ctx_t *ctx, int length, isc_buffer_t *target)
82 ctx->digits = 0;
83 ctx->length = length;
84 ctx->target = target;
88 hex_decode_char(hex_decode_ctx_t *ctx, int c) {
93 ctx->val[ctx->digits++] = (int)(s - hex);
94 if (ctx->digits == 2) {
97 num = (ctx->val[0] << 4) + (ctx->val[1]);
98 RETERR(mem_tobuffer(ctx->target, &num, 1));
99 if (ctx->length >= 0) {
100 if (ctx->length == 0)
103 ctx->length -= 1;
105 ctx->digits = 0;
111 hex_decode_finish(hex_decode_ctx_t *ctx) {
112 if (ctx->length > 0)
114 if (ctx->digits != 0)
121 hex_decode_ctx_t ctx;
126 hex_decode_init(&ctx, length, target);
128 while (ctx.length != 0) {
141 RETERR(hex_decode_char(&ctx, tr->base[i]));
143 if (ctx.length < 0)
145 RETERR(hex_decode_finish(&ctx));
151 hex_decode_ctx_t ctx;
153 hex_decode_init(&ctx, -1, target);
160 RETERR(hex_decode_char(&ctx, c));
162 RETERR(hex_decode_finish(&ctx));