-
- if(len)
- {
- unsigned read_len = ctx->io->read(cbuf, len);
- if(ctx->position<ctx->buf_max)
- {
- unsigned copy_len = min(ctx->buf_max-ctx->position, read_len);
- copy(cbuf, cbuf+copy_len, ctx->buffer+ctx->position);
- ctx->buf_fill += copy_len;
- }
- ret += read_len;
- ctx->position += read_len;
- }
-
- return ret;