int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size) { int len; len = s->buf_end - s->buf_ptr; if (len == 0) { fill_buffer(s); len = s->buf_end - s->buf_ptr; } if (len > size) len = size; memcpy(buf, s->buf_ptr, len); s->buf_ptr += len; return len; }