Commit 2e5a91b3 authored by benoit's avatar benoit

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


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@20330 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent ab676d5c
...@@ -333,11 +333,13 @@ int url_fdopen(ByteIOContext **s, URLContext *h); ...@@ -333,11 +333,13 @@ int url_fdopen(ByteIOContext **s, URLContext *h);
/** @warning must be called before any I/O */ /** @warning must be called before any I/O */
int url_setbufsize(ByteIOContext *s, int buf_size); int url_setbufsize(ByteIOContext *s, int buf_size);
#if LIBAVFORMAT_VERSION_MAJOR < 53
/** Reset the buffer for reading or writing. /** Reset the buffer for reading or writing.
* @note Will drop any data currently in the buffer without transmitting it. * @note Will drop any data currently in the buffer without transmitting it.
* @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY * @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY
* to set up the buffer for writing. */ * to set up the buffer for writing. */
int url_resetbuf(ByteIOContext *s, int flags); int url_resetbuf(ByteIOContext *s, int flags);
#endif
/** @note when opened as read/write, the buffers are only used for /** @note when opened as read/write, the buffers are only used for
writing */ writing */
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
#define IO_BUFFER_SIZE 32768 #define IO_BUFFER_SIZE 32768
static void fill_buffer(ByteIOContext *s); static void fill_buffer(ByteIOContext *s);
#if LIBAVFORMAT_VERSION_MAJOR >= 53
static int url_resetbuf(ByteIOContext *s, int flags);
#endif
int init_put_byte(ByteIOContext *s, int init_put_byte(ByteIOContext *s,
unsigned char *buffer, unsigned char *buffer,
...@@ -583,11 +586,19 @@ int url_setbufsize(ByteIOContext *s, int buf_size) ...@@ -583,11 +586,19 @@ int url_setbufsize(ByteIOContext *s, int buf_size)
return 0; return 0;
} }
#if LIBAVFORMAT_VERSION_MAJOR < 53
int url_resetbuf(ByteIOContext *s, int flags) int url_resetbuf(ByteIOContext *s, int flags)
#else
static int url_resetbuf(ByteIOContext *s, int flags)
#endif
{ {
#if LIBAVFORMAT_VERSION_MAJOR < 53
URLContext *h = s->opaque; URLContext *h = s->opaque;
if ((flags & URL_RDWR) || (h && h->flags != flags && !h->flags & URL_RDWR)) if ((flags & URL_RDWR) || (h && h->flags != flags && !h->flags & URL_RDWR))
return AVERROR(EINVAL); return AVERROR(EINVAL);
#else
assert(flags == URL_WRONLY || flags == URL_RDONLY);
#endif
if (flags & URL_WRONLY) { if (flags & URL_WRONLY) {
s->buf_end = s->buffer + s->buffer_size; s->buf_end = s->buffer + s->buffer_size;
......
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