diff options
| author | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-04-14 11:08:31 +1000 |
|---|---|---|
| committer | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-04-14 11:08:31 +1000 |
| commit | d44fb19da9f3d06f8873958e10647d5f0eae7789 (patch) | |
| tree | 85267e3c00fdba72436cf2190ab976d5c2b80d44 | |
| parent | 9633099fc1ed7b2c8c4cfc3057a566665a4eaf5d (diff) | |
fix(stream): Stdio bridge write callback and const correctness
| -rw-r--r-- | include/bridges/stdio/stream_bridge.h | 2 | ||||
| -rw-r--r-- | include/tinyff/common.h | 2 | ||||
| -rw-r--r-- | include/tinyff/stream.h | 2 | ||||
| -rw-r--r-- | src/bridges/stdio/stream_bridge.c | 4 |
4 files changed, 5 insertions, 5 deletions
diff --git a/include/bridges/stdio/stream_bridge.h b/include/bridges/stdio/stream_bridge.h index 561fa8a..219b101 100644 --- a/include/bridges/stdio/stream_bridge.h +++ b/include/bridges/stdio/stream_bridge.h @@ -4,7 +4,7 @@ // Default reads for common types (just FILE for now, memory later) size_t ff_file_read(void *ptr, size_t size, void *user); -size_t ff_file_write(const void *ptr, size_t size, void *user); +size_t ff_file_write(const void *ptr, size_t size, const void *user); // Stream creation helpers ff_stream ff_create_file_stream(FILE *f);
\ No newline at end of file diff --git a/include/tinyff/common.h b/include/tinyff/common.h index 3653807..c22f595 100644 --- a/include/tinyff/common.h +++ b/include/tinyff/common.h @@ -62,7 +62,7 @@ typedef struct { typedef struct { // Debug settings - ff_stream* ff_debug_stream; + ff_stream ff_debug_stream; ff_flag ff_debug_enabled; // Allocation diff --git a/include/tinyff/stream.h b/include/tinyff/stream.h index 250767e..95c5884 100644 --- a/include/tinyff/stream.h +++ b/include/tinyff/stream.h @@ -4,7 +4,7 @@ #include <stddef.h> -#define FF_NULL_STREAM {0} +#define FF_NULL_STREAM (ff_stream){0} diff --git a/src/bridges/stdio/stream_bridge.c b/src/bridges/stdio/stream_bridge.c index ec56b1c..17a3191 100644 --- a/src/bridges/stdio/stream_bridge.c +++ b/src/bridges/stdio/stream_bridge.c @@ -9,7 +9,7 @@ size_t ff_file_read(void *ptr, size_t size, void *user) return fread(ptr, 1, size, f); } -size_t ff_file_write(const void *ptr, size_t size, void *user) +size_t ff_file_write(const void *ptr, size_t size, const void *user) { FILE *f = (FILE *)user; return fwrite(ptr, 1, size, f); @@ -19,7 +19,7 @@ ff_stream ff_create_file_stream(FILE *f) { ff_stream stream; stream.read = ff_file_read; - stream.write = NULL; + stream.write = ff_file_write; stream.user = (void *)f; return stream; } |
