diff options
author | Max Kellermann <max@duempel.org> | 2009-01-30 00:58:03 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-30 00:58:03 +0100 |
commit | 32d6d4499e315a5a2f224beaa54faad03ff80a16 (patch) | |
tree | 069be90398bd1eb284c60f40731a8c8100afccab /src/input_stream.c | |
parent | 82cfce76eb5787f1a24151f6a3840a999ed82659 (diff) |
input_stream: make seek(), buffer() optional
Make those two methods optional to implement, and let input_stream.c
provide fallbacks. The buffer() method will be removed one day, and
there is now only one implementation left (input_curl.c).
Diffstat (limited to 'src/input_stream.c')
-rw-r--r-- | src/input_stream.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/input_stream.c b/src/input_stream.c index b25f3bf40..4375db948 100644 --- a/src/input_stream.c +++ b/src/input_stream.c @@ -86,6 +86,7 @@ input_stream_open(struct input_stream *is, const char *url) assert(is->plugin->close != NULL); assert(is->plugin->read != NULL); assert(is->plugin->eof != NULL); + assert(!is->seekable || is->plugin->seek != NULL); return true; } @@ -97,6 +98,9 @@ input_stream_open(struct input_stream *is, const char *url) bool input_stream_seek(struct input_stream *is, off_t offset, int whence) { + if (is->plugin->seek == NULL) + return false; + return is->plugin->seek(is, offset, whence); } @@ -133,5 +137,8 @@ bool input_stream_eof(struct input_stream *is) int input_stream_buffer(struct input_stream *is) { + if (is->plugin->buffer == NULL) + return 0; + return is->plugin->buffer(is); } |