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 --- include/io/istream.h | 16 ++++++++++++++++ include/io/ostream.h | 17 ----------------- 2 files changed, 16 insertions(+), 17 deletions(-) (limited to 'include/io') diff --git a/include/io/istream.h b/include/io/istream.h index 9c34678..7adb204 100644 --- a/include/io/istream.h +++ b/include/io/istream.h @@ -8,6 +8,7 @@ #define IO_ISTREAM_H #include "sqfs/predef.h" +#include "io/ostream.h" /** * @struct istream_t @@ -127,6 +128,21 @@ SQFS_INLINE const char *istream_get_filename(istream_t *strm) */ SQFS_INTERNAL int istream_skip(istream_t *strm, sqfs_u64 size); +/** + * @brief Dump data from an input stream to an output stream + * + * @memberof istream_t + * + * @param in A pointer to an input stream to read from. + * @param out A pointer to an output stream to append to. + * @param size The number of bytes to copy over. + * + * @return The number of bytes copied on success, -1 on failure, + * 0 on end-of-file. + */ +SQFS_INTERNAL sqfs_s32 istream_splice(istream_t *in, ostream_t *out, + sqfs_u32 size); + #ifdef __cplusplus } #endif diff --git a/include/io/ostream.h b/include/io/ostream.h index c1602ab..9cc37ad 100644 --- a/include/io/ostream.h +++ b/include/io/ostream.h @@ -8,7 +8,6 @@ #define IO_OSTREAM_H #include "sqfs/predef.h" -#include "io/istream.h" /** * @struct ostream_t @@ -104,22 +103,6 @@ SQFS_INLINE const char *ostream_get_filename(ostream_t *strm) return strm->get_filename(strm); } -/** - * @brief Read data from an input stream and append it to an output stream - * - * @memberof ostream_t - * - * @param out A pointer to an output stream to append to. - * @param in A pointer to an input stream to read from. - * @param size The number of bytes to copy over. - * - * @return The number of bytes copied on success, -1 on failure, - * 0 on end-of-file. - */ -SQFS_INTERNAL sqfs_s32 ostream_append_from_istream(ostream_t *out, - istream_t *in, - sqfs_u32 size); - #ifdef __cplusplus } #endif -- cgit v1.2.3