From 8af4ee6f415fe316894e4423235dfc4ee70d8cbb Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 4 Jun 2023 15:40:29 +0200 Subject: libio: move splice function from ostream to istream It touches internals of the istream, particularly the buffer, but not of the ostream. It really belongs to istream_t. Signed-off-by: David Oberhollenzer --- lib/io/src/ostream.c | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'lib/io/src/ostream.c') diff --git a/lib/io/src/ostream.c b/lib/io/src/ostream.c index da0b7b3..35f98d4 100644 --- a/lib/io/src/ostream.c +++ b/lib/io/src/ostream.c @@ -33,36 +33,3 @@ int ostream_append_sparse(ostream_t *strm, size_t size) return strm->append_sparse(strm, size); } - -sqfs_s32 ostream_append_from_istream(ostream_t *out, istream_t *in, - sqfs_u32 size) -{ - sqfs_s32 total = 0; - size_t diff; - - if (size > 0x7FFFFFFF) - size = 0x7FFFFFFF; - - while (size > 0) { - if (in->buffer_offset >= in->buffer_used) { - if (istream_precache(in)) - return -1; - - if (in->buffer_used == 0) - break; - } - - diff = in->buffer_used - in->buffer_offset; - if (diff > size) - diff = size; - - if (out->append(out, in->buffer + in->buffer_offset, diff)) - return -1; - - in->buffer_offset += diff; - size -= diff; - total += diff; - } - - return total; -} -- cgit v1.2.3