Commit ed708360 authored by Max Kellermann's avatar Max Kellermann

DecoderBuffer: convert pointer to reference

parent a68e52c2
...@@ -27,13 +27,13 @@ ...@@ -27,13 +27,13 @@
struct DecoderBuffer { struct DecoderBuffer {
Decoder *decoder; Decoder *decoder;
InputStream *is; InputStream &is;
DynamicFifoBuffer<uint8_t> buffer; DynamicFifoBuffer<uint8_t> buffer;
DecoderBuffer(Decoder *_decoder, InputStream &_is, DecoderBuffer(Decoder *_decoder, InputStream &_is,
size_t _size) size_t _size)
:decoder(_decoder), is(&_is), buffer(_size) {} :decoder(_decoder), is(_is), buffer(_size) {}
}; };
DecoderBuffer * DecoderBuffer *
...@@ -56,7 +56,7 @@ decoder_buffer_free(DecoderBuffer *buffer) ...@@ -56,7 +56,7 @@ decoder_buffer_free(DecoderBuffer *buffer)
const InputStream & const InputStream &
decoder_buffer_get_stream(const DecoderBuffer *buffer) decoder_buffer_get_stream(const DecoderBuffer *buffer)
{ {
return *buffer->is; return buffer->is;
} }
void void
...@@ -73,7 +73,7 @@ decoder_buffer_fill(DecoderBuffer *buffer) ...@@ -73,7 +73,7 @@ decoder_buffer_fill(DecoderBuffer *buffer)
/* buffer is full */ /* buffer is full */
return false; return false;
size_t nbytes = decoder_read(buffer->decoder, *buffer->is, size_t nbytes = decoder_read(buffer->decoder, buffer->is,
w.data, w.size); w.data, w.size);
if (nbytes == 0) if (nbytes == 0)
/* end of file, I/O error or decoder command /* end of file, I/O error or decoder command
...@@ -128,5 +128,5 @@ decoder_buffer_skip(DecoderBuffer *buffer, size_t nbytes) ...@@ -128,5 +128,5 @@ decoder_buffer_skip(DecoderBuffer *buffer, size_t nbytes)
buffer->buffer.Clear(); buffer->buffer.Clear();
nbytes -= r.size; nbytes -= r.size;
return decoder_skip(buffer->decoder, *buffer->is, nbytes); return decoder_skip(buffer->decoder, buffer->is, nbytes);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment