diff options
| author | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-03-28 16:27:54 +1100 |
|---|---|---|
| committer | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-03-28 16:30:38 +1100 |
| commit | 4ad97bd1527c6ccb2f31c61e9da33f2900379c04 (patch) | |
| tree | 04ce34ae274b280c500797caaf308681fae62182 /bridges/stdio | |
| parent | 99c82d92180a7c1b6a1d3393d91f9fef0369edb5 (diff) | |
fix(bridges): Create new file stream moved to stdio bridge
Diffstat (limited to 'bridges/stdio')
| -rw-r--r-- | bridges/stdio/stream.c | 17 | ||||
| -rw-r--r-- | bridges/stdio/stream.h | 8 |
2 files changed, 25 insertions, 0 deletions
diff --git a/bridges/stdio/stream.c b/bridges/stdio/stream.c new file mode 100644 index 0000000..72cee46 --- /dev/null +++ b/bridges/stdio/stream.c @@ -0,0 +1,17 @@ +#include "../bridges/stdio/stream.h" + +size_t ff_file_read(void *ptr, size_t size, void *user) +{ + FILE *f = (FILE *)user; + return fread(ptr, size, 1, f); +} + +ff_stream ff_create_file_stream(FILE *f) +{ + ff_stream stream; + stream.read = ff_file_read; + stream.user = (void *)f; + return stream; +} + +// Memory stream coming soon
\ No newline at end of file diff --git a/bridges/stdio/stream.h b/bridges/stdio/stream.h new file mode 100644 index 0000000..1ae2dbc --- /dev/null +++ b/bridges/stdio/stream.h @@ -0,0 +1,8 @@ +#include <stdio.h> +#include <tinyff/stream.h> + +// Default reads for common types (just FILE for now, memory later) +size_t ff_file_read(void *ptr, size_t size, void *user); + +// Stream creation helpers +ff_stream ff_create_file_stream(FILE *f);
\ No newline at end of file |
