aboutsummaryrefslogtreecommitdiff
path: root/include/io
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-04 15:40:29 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-04 15:40:29 +0200
commit8af4ee6f415fe316894e4423235dfc4ee70d8cbb (patch)
treeeb0cb6e236276e3bfa39aff7c7b2ec771ee8d171 /include/io
parent723306c417b3b0f8e6a3904906d6c5612cace432 (diff)
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 <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/io')
-rw-r--r--include/io/istream.h16
-rw-r--r--include/io/ostream.h17
2 files changed, 16 insertions, 17 deletions
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