summaryrefslogtreecommitdiffstats
path: root/stream/stream.h
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-03-10 02:14:30 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-03-10 02:35:02 +0200
commitbc1d0ca37d9bdfd69a945043650e0246ffeb5f94 (patch)
tree8269c9cbc1df72afb5715b77669698a0781f6250 /stream/stream.h
parentf7cc4152f7c55808c5dd6bbd49c216c9345eb686 (diff)
parente9a5e7f667d1b0c0dec0053ad9ec6f7bc3162b60 (diff)
downloadmpv-bc1d0ca37d9bdfd69a945043650e0246ffeb5f94.tar.bz2
mpv-bc1d0ca37d9bdfd69a945043650e0246ffeb5f94.tar.xz
Merge svn changes up to r30798
Diffstat (limited to 'stream/stream.h')
-rw-r--r--stream/stream.h25
1 files changed, 1 insertions, 24 deletions
diff --git a/stream/stream.h b/stream/stream.h
index c02961f1df..3690dc46aa 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -269,30 +269,7 @@ inline static int stream_read(stream_t *s,char* mem,int total){
return total;
}
-inline static unsigned char* stream_read_line(stream_t *s,unsigned char* mem, int max) {
- int len;
- unsigned char* end,*ptr = mem;
- do {
- len = s->buf_len-s->buf_pos;
- // try to fill the buffer
- if(len <= 0 &&
- (!cache_stream_fill_buffer(s) ||
- (len = s->buf_len-s->buf_pos) <= 0)) break;
- end = (unsigned char*) memchr((void*)(s->buffer+s->buf_pos),'\n',len);
- if(end) len = end - (s->buffer+s->buf_pos) + 1;
- if(len > 0 && max > 1) {
- int l = len > max-1 ? max-1 : len;
- memcpy(ptr,s->buffer+s->buf_pos,l);
- max -= l;
- ptr += l;
- }
- s->buf_pos += len;
- } while(!end);
- if(s->eof && ptr == mem) return NULL;
- if(max > 0) ptr[0] = 0;
- return mem;
-}
-
+unsigned char* stream_read_line(stream_t *s,unsigned char* mem, int max);
inline static int stream_eof(stream_t *s){
return s->eof;