History

Fix standalone compilation of pipe protocol.

file_check() is not only used by the file protocol, adjust #ifdef accordingly.

Diego Biurrun committed 15 years ago

Commit 87995411 parent 3d269051 file · +13 −13Browse files

Unified · Split

libavformat/file.c+13−13
@@ -51,6 +51,19 @@ static int file_get_handle(URLContext *h) · 50 unmodified lines
5151 return (intptr_t) h->priv_data;
5252 }
5353
54+static int file_check(URLContext *h, int mask)
55+{
56+ struct stat st;
57+ int ret = stat(h->filename, &st);
58+ if (ret < 0)
59+ return AVERROR(errno);
60+
61+ ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ : 0;
62+ ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0;
63+
64+ return ret;
65+}
66+
5467 #if CONFIG_FILE_PROTOCOL
5568
5669 static int file_open(URLContext *h, const char *filename, int flags)
@@ -95,19 +108,6 @@ static int file_close(URLContext *h) · 38 unmodified lines
95108 return close(fd);
96109 }
97110
98−static int file_check(URLContext *h, int mask)
99−{
100− struct stat st;
101− int ret = stat(h->filename, &st);
102− if (ret < 0)
103− return AVERROR(errno);
104−
105− ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ : 0;
106− ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0;
107−
108− return ret;
109−}
110−
111111 URLProtocol ff_file_protocol = {
112112 .name = "file",
113113 .url_open = file_open,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t