From e811851deba9c45f3d9b3c5b4ad5eaa7945382d5 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 12 Jun 2023 20:14:44 +0200 Subject: Mass rename istream_t/ostream_t with sqfs_ prefix istream_t becomes sqfs_istream_t and ostream_t becomes sqfs_ostream_t Signed-off-by: David Oberhollenzer --- include/io/dir_iterator.h | 4 ++-- include/io/file.h | 20 +++++++++++--------- include/io/istream.h | 35 +++++++++++++++++++---------------- include/io/mem.h | 5 +++-- include/io/ostream.h | 14 ++++++++------ include/io/std.h | 8 ++++---- include/io/xfrm.h | 12 ++++++------ 7 files changed, 53 insertions(+), 45 deletions(-) (limited to 'include/io') diff --git a/include/io/dir_iterator.h b/include/io/dir_iterator.h index cc64680..152eb93 100644 --- a/include/io/dir_iterator.h +++ b/include/io/dir_iterator.h @@ -73,11 +73,11 @@ typedef struct dir_iterator_t { * to read from it. * * @param it A pointer to the iterator itself. - * @param out Returns a pointer to a @ref istream_t on success. + * @param out Returns a pointer to a @ref sqfs_istream_t on success. * * @return Zero on success, negative @ref SQFS_ERROR value on failure. */ - int (*open_file_ro)(struct dir_iterator_t *it, istream_t **out); + int (*open_file_ro)(struct dir_iterator_t *it, sqfs_istream_t **out); /** * @brief Read extended attributes associated with the current entry diff --git a/include/io/file.h b/include/io/file.h index d4f6fc1..1072b6a 100644 --- a/include/io/file.h +++ b/include/io/file.h @@ -25,7 +25,7 @@ extern "C" { /** * @brief Create an input stream for an OS native file handle. * - * @memberof istream_t + * @memberof sqfs_istream_t * * The functions takes up ownership of the file handle and takes care * of cleaning it up. On failure, the handle remains usable, and ownership @@ -36,12 +36,13 @@ extern "C" { * * @return A pointer to an output stream on success, NULL on failure. */ -SQFS_INTERNAL istream_t *istream_open_handle(const char *path, os_file_t fd); +SQFS_INTERNAL +sqfs_istream_t *istream_open_handle(const char *path, os_file_t fd); /** * @brief Create an output stream that writes to an OS native file handle. * - * @memberof ostream_t + * @memberof sqfs_ostream_t * * If the flag SQFS_FILE_OPEN_NO_SPARSE is set, the underlying implementation * always writes chunks of zero bytes when passing a NULL pointer to append. @@ -54,24 +55,25 @@ SQFS_INTERNAL istream_t *istream_open_handle(const char *path, os_file_t fd); * * @return A pointer to an output stream on success, NULL on failure. */ -SQFS_INTERNAL ostream_t *ostream_open_handle(const char *path, os_file_t hnd, - int flags); +SQFS_INTERNAL sqfs_ostream_t *ostream_open_handle(const char *path, + os_file_t hnd, + int flags); /** * @brief Create an input stream that reads from a file. * - * @memberof istream_t + * @memberof sqfs_istream_t * * @param path A path to the file to open or create. * * @return A pointer to an output stream on success, NULL on failure. */ -SQFS_INTERNAL istream_t *istream_open_file(const char *path); +SQFS_INTERNAL sqfs_istream_t *istream_open_file(const char *path); /** * @brief Create an output stream that writes to a file. * - * @memberof ostream_t + * @memberof sqfs_ostream_t * * If the file does not yet exist, it is created. If it does exist this * function fails, unless the flag SQFS_FILE_OPEN_OVERWRITE is set, in which @@ -87,7 +89,7 @@ SQFS_INTERNAL istream_t *istream_open_file(const char *path); * * @return A pointer to an output stream on success, NULL on failure. */ -SQFS_INTERNAL ostream_t *ostream_open_file(const char *path, int flags); +SQFS_INTERNAL sqfs_ostream_t *ostream_open_file(const char *path, int flags); #ifdef __cplusplus } diff --git a/include/io/istream.h b/include/io/istream.h index 90d6e0d..f4ffcb2 100644 --- a/include/io/istream.h +++ b/include/io/istream.h @@ -10,14 +10,16 @@ #include "sqfs/predef.h" #include "io/ostream.h" +typedef struct sqfs_istream_t sqfs_istream_t; + /** - * @struct istream_t + * @interface sqfs_istream_t * * @extends sqfs_object_t * * @brief A sequential, read-only data stream. */ -typedef struct istream_t { +struct sqfs_istream_t { sqfs_object_t base; /** @@ -32,7 +34,7 @@ typedef struct istream_t { * Higher level functions like @ref istream_read (providing a * Unix read() style API) are built on top of this primitive. * - * @param strm A pointer to an istream_t implementation. + * @param strm A pointer to an sqfs_istream_t implementation. * @param out Returns a pointer into an internal buffer on success. * @param size Returns the number of bytes available in the buffer. * @param want A number of bytes that the reader would like to have. @@ -42,7 +44,7 @@ typedef struct istream_t { * @return Zero on success, a negative error code on failure, * a postive number on EOF. */ - int (*get_buffered_data)(struct istream_t *strm, const sqfs_u8 **out, + int (*get_buffered_data)(sqfs_istream_t *strm, const sqfs_u8 **out, size_t *size, size_t want); /** @@ -52,10 +54,10 @@ typedef struct istream_t { * forcing get_buffered_data to return data afterwards and potentially * try to load more data. * - * @param strm A pointer to an istream_t implementation. + * @param strm A pointer to an sqfs_istream_t implementation. * @param count The number of bytes used up. */ - void (*advance_buffer)(struct istream_t *strm, size_t count); + void (*advance_buffer)(sqfs_istream_t *strm, size_t count); /** * @brief Get the underlying filename of an input stream. @@ -64,8 +66,8 @@ typedef struct istream_t { * * @return A string holding the underlying filename. */ - const char *(*get_filename)(struct istream_t *strm); -} istream_t; + const char *(*get_filename)(sqfs_istream_t *strm); +}; enum { ISTREAM_LINE_LTRIM = 0x01, @@ -80,7 +82,7 @@ extern "C" { /** * @brief Read a line of text from an input stream * - * @memberof istream_t + * @memberof sqfs_istream_t * * The line returned is allocated using malloc and must subsequently be * freed when it is no longer needed. The line itself is always null-terminated @@ -103,13 +105,13 @@ extern "C" { * @return Zero on success, a negative value on error, a positive value if * end-of-file was reached without reading any data. */ -SQFS_INTERNAL int istream_get_line(istream_t *strm, char **out, +SQFS_INTERNAL int istream_get_line(sqfs_istream_t *strm, char **out, size_t *line_num, int flags); /** * @brief Read data from an input stream * - * @memberof istream_t + * @memberof sqfs_istream_t * * @param strm A pointer to an input stream. * @param data A buffer to read into. @@ -118,24 +120,25 @@ SQFS_INTERNAL int istream_get_line(istream_t *strm, char **out, * @return The number of bytes actually read on success, -1 on failure, * 0 on end-of-file. */ -SQFS_INTERNAL sqfs_s32 istream_read(istream_t *strm, void *data, size_t size); +SQFS_INTERNAL sqfs_s32 istream_read(sqfs_istream_t *strm, + void *data, size_t size); /** * @brief Skip over a number of bytes in an input stream. * - * @memberof istream_t + * @memberof sqfs_istream_t * * @param strm A pointer to an input stream. * @param size The number of bytes to seek forward. * * @return Zero on success, -1 on failure. */ -SQFS_INTERNAL int istream_skip(istream_t *strm, sqfs_u64 size); +SQFS_INTERNAL int istream_skip(sqfs_istream_t *strm, sqfs_u64 size); /** * @brief Dump data from an input stream to an output stream * - * @memberof istream_t + * @memberof sqfs_istream_t * * @param in A pointer to an input stream to read from. * @param out A pointer to an output stream to append to. @@ -144,7 +147,7 @@ SQFS_INTERNAL int istream_skip(istream_t *strm, sqfs_u64 size); * @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_INTERNAL sqfs_s32 istream_splice(sqfs_istream_t *in, sqfs_ostream_t *out, sqfs_u32 size); #ifdef __cplusplus diff --git a/include/io/mem.h b/include/io/mem.h index 1efd007..c848ef0 100644 --- a/include/io/mem.h +++ b/include/io/mem.h @@ -13,8 +13,9 @@ extern "C" { #endif -SQFS_INTERNAL istream_t *istream_memory_create(const char *name, size_t bufsz, - const void *data, size_t size); +SQFS_INTERNAL +sqfs_istream_t *istream_memory_create(const char *name, size_t bufsz, + const void *data, size_t size); #ifdef __cplusplus } diff --git a/include/io/ostream.h b/include/io/ostream.h index 7a57e48..d1781d2 100644 --- a/include/io/ostream.h +++ b/include/io/ostream.h @@ -9,14 +9,16 @@ #include "sqfs/predef.h" +typedef struct sqfs_ostream_t sqfs_ostream_t; + /** - * @struct ostream_t + * @interface sqfs_ostream_t * * @extends sqfs_object_t * * @brief An append-only data stream. */ -typedef struct ostream_t { +struct sqfs_ostream_t { sqfs_object_t base; /** @@ -29,7 +31,7 @@ typedef struct ostream_t { * * @return Zero on success, -1 on failure. */ - int (*append)(struct ostream_t *strm, const void *data, size_t size); + int (*append)(sqfs_ostream_t *strm, const void *data, size_t size); /** * @brief Process all pending, buffered data and flush it to disk. @@ -43,7 +45,7 @@ typedef struct ostream_t { * * @return Zero on success, -1 on failure. */ - int (*flush)(struct ostream_t *strm); + int (*flush)(sqfs_ostream_t *strm); /** * @brief Get the underlying filename of a output stream. @@ -52,7 +54,7 @@ typedef struct ostream_t { * * @return A string holding the underlying filename. */ - const char *(*get_filename)(struct ostream_t *strm); -} ostream_t; + const char *(*get_filename)(sqfs_ostream_t *strm); +}; #endif /* IO_OSTREAM_H */ diff --git a/include/io/std.h b/include/io/std.h index 805bebd..3a8bbf8 100644 --- a/include/io/std.h +++ b/include/io/std.h @@ -17,20 +17,20 @@ extern "C" { /** * @brief Create an input stream that reads from standard input. * - * @memberof istream_t + * @memberof sqfs_istream_t * * @return A pointer to an input stream on success, NULL on failure. */ -SQFS_INTERNAL istream_t *istream_open_stdin(void); +SQFS_INTERNAL sqfs_istream_t *istream_open_stdin(void); /** * @brief Create an output stream that writes to standard output. * - * @memberof ostream_t + * @memberof sqfs_ostream_t * * @return A pointer to an output stream on success, NULL on failure. */ -SQFS_INTERNAL ostream_t *ostream_open_stdout(void); +SQFS_INTERNAL sqfs_ostream_t *ostream_open_stdout(void); #ifdef __cplusplus } diff --git a/include/io/xfrm.h b/include/io/xfrm.h index 3e601ea..c54bc9f 100644 --- a/include/io/xfrm.h +++ b/include/io/xfrm.h @@ -18,7 +18,7 @@ extern "C" { /** * @brief Create an input stream that transparently decodes data. * - * @memberof istream_t + * @memberof sqfs_istream_t * * This function creates an input stream that wraps an underlying input stream * that is encoded/compressed and transparently decodes the data when reading @@ -29,13 +29,13 @@ extern "C" { * * @return A pointer to an input stream on success, NULL on failure. */ -SQFS_INTERNAL istream_t *istream_xfrm_create(istream_t *strm, - xfrm_stream_t *xfrm); +SQFS_INTERNAL sqfs_istream_t *istream_xfrm_create(sqfs_istream_t *strm, + xfrm_stream_t *xfrm); /** * @brief Create an output stream that transparently encodes data. * - * @memberof ostream_t + * @memberof sqfs_ostream_t * * This function creates an output stream that transparently encodes * (e.g. compresses) all data appended to it and writes it to an @@ -46,8 +46,8 @@ SQFS_INTERNAL istream_t *istream_xfrm_create(istream_t *strm, * * @return A pointer to an output stream on success, NULL on failure. */ -SQFS_INTERNAL ostream_t *ostream_xfrm_create(ostream_t *strm, - xfrm_stream_t *xfrm); +SQFS_INTERNAL sqfs_ostream_t *ostream_xfrm_create(sqfs_ostream_t *strm, + xfrm_stream_t *xfrm); #ifdef __cplusplus } -- cgit v1.2.3