diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-04-15 16:42:09 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-04-19 19:47:58 +0200 |
commit | 59d96941f0285a501989d5f2c9b69be0a1393ed5 (patch) | |
tree | 8a8df3842d20ac6543309dc4063376bf50580944 /libavformat/file.c | |
parent | 490a022d86ef1c506a79744c5a95368af356fc69 (diff) | |
download | ffmpeg-59d96941f0285a501989d5f2c9b69be0a1393ed5.tar.gz |
avio: remove AVIO_* access symbols in favor of new AVIO_FLAG_* symbols
Make AVIO_FLAG_ access constants work as flags, and in particular fix
the behavior of functions (such as avio_check()) which expect them to
be flags rather than modes.
This breaks API.
Diffstat (limited to 'libavformat/file.c')
-rw-r--r-- | libavformat/file.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libavformat/file.c b/libavformat/file.c index 1dcb2c8ac5..6a3ed5acb0 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -60,9 +60,9 @@ static int file_open(URLContext *h, const char *filename, int flags) av_strstart(filename, "file:", &filename); - if (flags & AVIO_RDWR) { + if (flags & AVIO_FLAG_WRITE && flags & AVIO_FLAG_READ) { access = O_CREAT | O_TRUNC | O_RDWR; - } else if (flags & AVIO_WRONLY) { + } else if (flags & AVIO_FLAG_WRITE) { access = O_CREAT | O_TRUNC | O_WRONLY; } else { access = O_RDONLY; @@ -102,9 +102,8 @@ static int file_check(URLContext *h, int mask) if (ret < 0) return AVERROR(errno); - ret |= st.st_mode&S_IRUSR ? mask&AVIO_RDONLY : 0; - ret |= st.st_mode&S_IWUSR ? mask&AVIO_WRONLY : 0; - ret |= st.st_mode&S_IWUSR && st.st_mode&S_IRUSR ? mask&AVIO_RDWR : 0; + ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ : 0; + ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0; return ret; } @@ -132,7 +131,7 @@ static int pipe_open(URLContext *h, const char *filename, int flags) fd = strtol(filename, &final, 10); if((filename == final) || *final ) {/* No digits found, or something like 10ab */ - if (flags & AVIO_WRONLY) { + if (flags & AVIO_FLAG_WRITE) { fd = 1; } else { fd = 0; |