int ch=*--(bd->in);
bd->pending <<= 8;
bd->pending |= ch; /* already decoded */
+ bd->npending += 5;
}
uint32_t dnsdomaindec_getbits(struct dnsbitdec *bd, int nbits)
{
}
int dnsbitdec_restbytes(struct dnsbitdec *bd, uint8_t outbuf[MAX_DOMAIN_BYTES])
{
+ uint8_t *out;
for (;;) {
-
+ if (bd->npending >= 8) {
+ *out++ = bd->pending;
+ bd->pending >>= 8;
+ bd->npending -= 8;
+ }
+ if (bd->in == bd->databuf) {
+ /* that's all the input */
+ return out - outbuf;
+ }
+ inputchar(bd);
+ }
+}
/* returns pointer into caller-supplied buffer; we have used
* bytes from the result to the end (so the caller needs to remember
* the buffer len to know what the encoded length is */
+fixme needs to add mylabels too