struct btr_buffer_reference *br, *wbr = NULL;
int num_refs; /* including wrap buffer */
char *buf, *buf1 = NULL, *buf2 = NULL;
- size_t sz, sz1 = 0, sz2 = 0;
+ size_t sz, sz1 = 0, sz2 = 0, wb_consumed = 0;
br = get_first_input_br(btrn);
if (!br || br_available_bytes(br) >= dest_size)
wbr = br;
if (sz >= dest_size)
return;
+ wb_consumed = br->consumed;
continue;
}
if (!buf1) {
assert(buf2 + sz2 == buf);
sz2 += sz;
next:
- if (sz1 + sz2 >= dest_size)
+ if (sz1 + sz2 >= dest_size + wb_consumed)
break;
}
if (!buf2) /* nothing to do */