summaryrefslogtreecommitdiffstats
path: root/stream/stream.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-11-07 15:28:50 +0100
committerwm4 <wm4@nowhere>2019-11-07 22:53:13 +0100
commitd3479018db4c8d61b2dca497a547615f02c2a42d (patch)
treefcedb02bdd42538337d540311bca4fe4c852f089 /stream/stream.c
parentf850d82e656a9add1bd286f901f18c5213580606 (diff)
downloadmpv-d3479018db4c8d61b2dca497a547615f02c2a42d.tar.bz2
mpv-d3479018db4c8d61b2dca497a547615f02c2a42d.tar.xz
stream: change buffer argument types from char* to void*
This is slightly better, although not much, and ultimately doesn't matter. The public API in stream_cb.h also uses char*, but can't change that.
Diffstat (limited to 'stream/stream.c')
-rw-r--r--stream/stream.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/stream/stream.c b/stream/stream.c
index 504d217b46..1f77a5dd1e 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -538,7 +538,7 @@ static bool stream_read_more(struct stream *s, int forward)
// Read between 1..buf_size bytes of data, return how much data has been read.
// Return 0 on EOF, error, or if buf_size was 0.
-int stream_read_partial(stream_t *s, char *buf, int buf_size)
+int stream_read_partial(stream_t *s, void *buf, int buf_size)
{
assert(s->buf_cur <= s->buf_end);
assert(buf_size >= 0);
@@ -562,14 +562,14 @@ int stream_read_char_fallback(stream_t *s)
return stream_read_partial(s, &c, 1) ? c : -256;
}
-int stream_read(stream_t *s, char *mem, int total)
+int stream_read(stream_t *s, void *mem, int total)
{
int len = total;
while (len > 0) {
int read = stream_read_partial(s, mem, len);
if (read <= 0)
break; // EOF
- mem += read;
+ mem = (char *)mem + read;
len -= read;
}
total -= len;
@@ -578,13 +578,13 @@ int stream_read(stream_t *s, char *mem, int total)
// Like stream_read(), but do not advance the current position. This may resize
// the buffer to satisfy the read request.
-int stream_read_peek(stream_t *s, void* buf, int buf_size)
+int stream_read_peek(stream_t *s, void *buf, int buf_size)
{
while (stream_read_more(s, buf_size)) {}
return ring_copy(s, buf, buf_size, s->buf_cur);
}
-int stream_write_buffer(stream_t *s, unsigned char *buf, int len)
+int stream_write_buffer(stream_t *s, void *buf, int len)
{
if (!s->write_buffer)
return -1;
@@ -594,7 +594,7 @@ int stream_write_buffer(stream_t *s, unsigned char *buf, int len)
if (w <= 0)
return -1;
s->pos += w;
- buf += w;
+ buf = (char *)buf + w;
len -= w;
}
return orig_len;