Lines Matching defs:ctx
89 hex_decode_init(hex_decode_ctx_t *ctx, int length, isc_buffer_t *target)
91 ctx->digits = 0;
92 ctx->length = length;
93 ctx->target = target;
97 hex_decode_char(hex_decode_ctx_t *ctx, int c) {
102 ctx->val[ctx->digits++] = s - hex;
103 if (ctx->digits == 2) {
106 num = (ctx->val[0] << 4) + (ctx->val[1]);
107 RETERR(mem_tobuffer(ctx->target, &num, 1));
108 if (ctx->length >= 0) {
109 if (ctx->length == 0)
112 ctx->length -= 1;
114 ctx->digits = 0;
120 hex_decode_finish(hex_decode_ctx_t *ctx) {
121 if (ctx->length > 0)
123 if (ctx->digits != 0)
130 hex_decode_ctx_t ctx;
135 hex_decode_init(&ctx, length, target);
137 while (ctx.length != 0) {
150 RETERR(hex_decode_char(&ctx, tr->base[i]));
152 if (ctx.length < 0)
154 RETERR(hex_decode_finish(&ctx));
160 hex_decode_ctx_t ctx;
162 hex_decode_init(&ctx, -1, target);
169 RETERR(hex_decode_char(&ctx, c));
171 RETERR(hex_decode_finish(&ctx));