- if (inbuf_len == 0) {
- if (*fn->fc->input_error < 0 && ppd->prebuffered >= 0)
- goto prebuffer_end;
- return 0;
- }
- if (ppd->prebuffered < 0) {
- size_t copy = PARA_MIN(inbuf_len, fn->bufsize - fn->loaded);
- memcpy(fn->buf + fn->loaded, inbuf, copy);
- fn->loaded += copy;
- return copy;
- }
- if (ppd->prebuffered + inbuf_len > fn->bufsize) {
- fn->bufsize = PARA_MAX(2 * fn->bufsize,
- ppd->prebuffered + inbuf_len);
- fn->buf = para_realloc(fn->buf, fn->bufsize);
- }
- memcpy(fn->buf + ppd->prebuffered, inbuf, inbuf_len);
- if (ppd->prebuffered == 0) {