aboutsummaryrefslogtreecommitdiff
path: root/src/decoder/dsdlib.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-24 19:14:40 +0100
committerMax Kellermann <max@duempel.org>2013-01-26 01:24:01 +0100
commit0273cd44b0b50d5d320ce88cc1472e0d8ee8e529 (patch)
tree7c493850ab07deddd637ca0b5e8b3476e40a68fc /src/decoder/dsdlib.c
parent3203a7dd8ce8db6afcc54d68d63b4f4af7dc4c7f (diff)
input_stream: forward-declare the struct
Hide the definition from C code, to prepare the transition to C++.
Diffstat (limited to 'src/decoder/dsdlib.c')
-rw-r--r--src/decoder/dsdlib.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/decoder/dsdlib.c b/src/decoder/dsdlib.c
index c788184e..d3043fb0 100644
--- a/src/decoder/dsdlib.c
+++ b/src/decoder/dsdlib.c
@@ -64,24 +64,24 @@ bool
dsdlib_skip_to(struct decoder *decoder, struct input_stream *is,
goffset offset)
{
- if (is->seekable)
+ if (input_stream_is_seekable(is))
return input_stream_seek(is, offset, SEEK_SET, NULL);
- if (is->offset > offset)
+ if (input_stream_get_offset(is) > offset)
return false;
char buffer[8192];
- while (is->offset < offset) {
+ while (input_stream_get_offset(is) < offset) {
size_t length = sizeof(buffer);
- if (offset - is->offset < (goffset)length)
- length = offset - is->offset;
+ if (offset - input_stream_get_offset(is) < (goffset)length)
+ length = offset - input_stream_get_offset(is);
size_t nbytes = decoder_read(decoder, is, buffer, length);
if (nbytes == 0)
return false;
}
- assert(is->offset == offset);
+ assert(input_stream_get_offset(is) == offset);
return true;
}
@@ -97,7 +97,7 @@ dsdlib_skip(struct decoder *decoder, struct input_stream *is,
if (delta == 0)
return true;
- if (is->seekable)
+ if (input_stream_is_seekable(is))
return input_stream_seek(is, delta, SEEK_CUR, NULL);
char buffer[8192];
@@ -139,10 +139,12 @@ dsdlib_tag_id3(struct input_stream *is,
id3_length_t count;
/* Prevent broken files causing problems */
- if (is->offset >= is->size)
+ const goffset size = input_stream_get_size(is);
+ const goffset offset = input_stream_get_offset(is);
+ if (offset >= size)
return;
- count = is->size - is->offset;
+ count = size - offset;
/* Check and limit id3 tag size to prevent a stack overflow */
if (count == 0 || count > 4096)