diff options
| author | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-03-29 08:11:26 +1100 |
|---|---|---|
| committer | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-03-29 08:11:26 +1100 |
| commit | 5d3fdcdfabb30a69cd7c701bfd573e9bc4fd219d (patch) | |
| tree | f917dddb06bc6e44f6916957d42d8174812e6971 /include/bridges/stdio | |
| parent | 3c44b526652c820a085e9733df70543cdd0f535a (diff) | |
feat(bridges): Move bridges to include folder
Diffstat (limited to 'include/bridges/stdio')
| -rw-r--r-- | include/bridges/stdio/stream.c | 17 | ||||
| -rw-r--r-- | include/bridges/stdio/stream.h | 8 |
2 files changed, 25 insertions, 0 deletions
diff --git a/include/bridges/stdio/stream.c b/include/bridges/stdio/stream.c new file mode 100644 index 0000000..72cee46 --- /dev/null +++ b/include/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/include/bridges/stdio/stream.h b/include/bridges/stdio/stream.h new file mode 100644 index 0000000..1ae2dbc --- /dev/null +++ b/include/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 |
