aboutsummaryrefslogtreecommitdiffstats
path: root/include/serd/serd.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-10-09 13:44:31 -0400
committerDavid Robillard <d@drobilla.net>2022-01-28 21:57:07 -0500
commitcbf01be4126cbc0f6d80364a7e0b6ad777a7d8ae (patch)
tree20cd2919e0d4c47caa346123c5701daa70a05ac3 /include/serd/serd.h
parent5ea7c0d763685c23dc6933e273dfa11eec5bec14 (diff)
downloadserd-cbf01be4126cbc0f6d80364a7e0b6ad777a7d8ae.tar.gz
serd-cbf01be4126cbc0f6d80364a7e0b6ad777a7d8ae.tar.bz2
serd-cbf01be4126cbc0f6d80364a7e0b6ad777a7d8ae.zip
Fix handling of deferred write errors that happen when closing
Diffstat (limited to 'include/serd/serd.h')
-rw-r--r--include/serd/serd.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h
index d606f4bb..35d31a57 100644
--- a/include/serd/serd.h
+++ b/include/serd/serd.h
@@ -2201,8 +2201,8 @@ serd_node_to_syntax(const SerdNode* SERD_NONNULL node,
/// An input stream that produces bytes
typedef struct {
void* SERD_NULLABLE stream; ///< Opaque parameter for functions
- SerdReadFunc SERD_NULLABLE read; ///< Read bytes to input
- SerdErrorFunc SERD_NONNULL error; ///< Stream error accessor
+ SerdReadFunc SERD_NONNULL read; ///< Read bytes from input
+ SerdErrorFunc SERD_NULLABLE error; ///< Stream error accessor
SerdCloseFunc SERD_NULLABLE close; ///< Close input
} SerdInputStream;
@@ -2468,7 +2468,8 @@ serd_buffer_close(void* SERD_NONNULL stream);
/// An output stream that receives bytes
typedef struct {
void* SERD_NULLABLE stream; ///< Opaque parameter for functions
- SerdWriteFunc SERD_NULLABLE write; ///< Write bytes to output
+ SerdWriteFunc SERD_NONNULL write; ///< Write bytes to output
+ SerdErrorFunc SERD_NULLABLE error; ///< Stream error accessor
SerdCloseFunc SERD_NULLABLE close; ///< Close output
} SerdOutputStream;
@@ -2476,6 +2477,7 @@ typedef struct {
Open a stream that writes to a provided function.
@param write_func Function to write output.
+ @param error_func Function used to detect errors.
@param close_func Function to close the stream after writing is done.
@param stream Opaque stream parameter for write_func and close_func.
@@ -2484,6 +2486,7 @@ typedef struct {
SERD_CONST_API
SerdOutputStream
serd_open_output_stream(SerdWriteFunc SERD_NONNULL write_func,
+ SerdErrorFunc SERD_NULLABLE error_func,
SerdCloseFunc SERD_NULLABLE close_func,
void* SERD_NULLABLE stream);
@@ -2519,7 +2522,8 @@ serd_open_output_file(const char* SERD_NONNULL path);
This will call the close function, and reset the stream internally so that
no further writes can be made. For convenience, this is safe to call on
- NULL, and safe to call several times on the same output.
+ NULL, and safe to call several times on the same output. Failure is
+ returned in both of those cases.
*/
SERD_API
SerdStatus