aboutsummaryrefslogtreecommitdiffstats
path: root/src/byte_source.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-05-10 20:59:45 +0200
committerDavid Robillard <d@drobilla.net>2018-11-25 22:12:46 +0100
commit29fefcad4d5f891e2d4325c482d4242d530aef4a (patch)
tree16ed0dcf9384f221f6e80d14a19b35b61f543ff4 /src/byte_source.h
parent3a0be6d0e6ec005daf6bbac4570ea124b00cfe53 (diff)
downloadserd-29fefcad4d5f891e2d4325c482d4242d530aef4a.tar.gz
serd-29fefcad4d5f891e2d4325c482d4242d530aef4a.tar.bz2
serd-29fefcad4d5f891e2d4325c482d4242d530aef4a.zip
Hide fopen wrapper and use reader interface consistently
Diffstat (limited to 'src/byte_source.h')
-rw-r--r--src/byte_source.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/byte_source.h b/src/byte_source.h
index a6596a27..51ea346b 100644
--- a/src/byte_source.h
+++ b/src/byte_source.h
@@ -23,6 +23,8 @@
#include <stddef.h>
#include <stdio.h>
+typedef int (*SerdStreamCloseFunc)(void*);
+
typedef struct {
const char* filename;
unsigned line;
@@ -32,6 +34,7 @@ typedef struct {
typedef struct {
SerdReadFunc read_func; ///< Read function (e.g. fread)
SerdStreamErrorFunc error_func; ///< Error function (e.g. ferror)
+ SerdStreamCloseFunc close_func; ///< Function for closing stream
void* stream; ///< Stream (e.g. FILE)
size_t page_size; ///< Number of bytes to read at a time
Cursor cur; ///< Cursor for error reporting
@@ -45,17 +48,13 @@ typedef struct {
} SerdByteSource;
SerdStatus
-serd_byte_source_open_file(SerdByteSource* source,
- FILE* file,
- bool bulk);
-
-SerdStatus
serd_byte_source_open_string(SerdByteSource* source, const char* utf8);
SerdStatus
serd_byte_source_open_source(SerdByteSource* source,
SerdReadFunc read_func,
SerdStreamErrorFunc error_func,
+ SerdStreamCloseFunc close_func,
void* stream,
const char* name,
size_t page_size);