Mercurial > libavformat.hg
comparison aviobuf.c @ 5320:db1e4c61789a libavformat
Make url_resetbuf() assert on wrong flags passed and make it static on next
version bump.
See thread: [FFmpeg-devel] & vs. &&
Date: Mon, 12 Oct 2009 14:21:06 +0200
author | benoit |
---|---|
date | Tue, 20 Oct 2009 06:40:01 +0000 |
parents | 53245f639fe5 |
children | 26c471598b2f |
comparison
equal
deleted
inserted
replaced
5319:86c32a27f69a | 5320:db1e4c61789a |
---|---|
26 #include <stdarg.h> | 26 #include <stdarg.h> |
27 | 27 |
28 #define IO_BUFFER_SIZE 32768 | 28 #define IO_BUFFER_SIZE 32768 |
29 | 29 |
30 static void fill_buffer(ByteIOContext *s); | 30 static void fill_buffer(ByteIOContext *s); |
31 #if LIBAVFORMAT_VERSION_MAJOR >= 53 | |
32 static int url_resetbuf(ByteIOContext *s, int flags); | |
33 #endif | |
31 | 34 |
32 int init_put_byte(ByteIOContext *s, | 35 int init_put_byte(ByteIOContext *s, |
33 unsigned char *buffer, | 36 unsigned char *buffer, |
34 int buffer_size, | 37 int buffer_size, |
35 int write_flag, | 38 int write_flag, |
581 s->buf_ptr = buffer; | 584 s->buf_ptr = buffer; |
582 url_resetbuf(s, s->write_flag ? URL_WRONLY : URL_RDONLY); | 585 url_resetbuf(s, s->write_flag ? URL_WRONLY : URL_RDONLY); |
583 return 0; | 586 return 0; |
584 } | 587 } |
585 | 588 |
589 #if LIBAVFORMAT_VERSION_MAJOR < 53 | |
586 int url_resetbuf(ByteIOContext *s, int flags) | 590 int url_resetbuf(ByteIOContext *s, int flags) |
587 { | 591 #else |
592 static int url_resetbuf(ByteIOContext *s, int flags) | |
593 #endif | |
594 { | |
595 #if LIBAVFORMAT_VERSION_MAJOR < 53 | |
588 URLContext *h = s->opaque; | 596 URLContext *h = s->opaque; |
589 if ((flags & URL_RDWR) || (h && h->flags != flags && !h->flags & URL_RDWR)) | 597 if ((flags & URL_RDWR) || (h && h->flags != flags && !h->flags & URL_RDWR)) |
590 return AVERROR(EINVAL); | 598 return AVERROR(EINVAL); |
599 #else | |
600 assert(flags == URL_WRONLY || flags == URL_RDONLY); | |
601 #endif | |
591 | 602 |
592 if (flags & URL_WRONLY) { | 603 if (flags & URL_WRONLY) { |
593 s->buf_end = s->buffer + s->buffer_size; | 604 s->buf_end = s->buffer + s->buffer_size; |
594 s->write_flag = 1; | 605 s->write_flag = 1; |
595 } else { | 606 } else { |