@@ -111,17 +111,18 @@ const AVClass *ff_urlcontext_child_class_iterate(void **iter)
const char *avio_enum_protocols(void **opaque, int output)
{
- const URLProtocol **p = *opaque;
+ const char* ret = NULL;
+ intptr_t i;
- p = p ? p + 1 : url_protocols;
- *opaque = p;
- if (!*p) {
- *opaque = NULL;
- return NULL;
+ for (i = (intptr_t)*opaque; url_protocols[i]; i++) {
+ const URLProtocol *p = url_protocols[i];
+ if ((output && p->url_write) || (!output && p->url_read)) {
+ ret = p->name;
+ break;
+ }
}
- if ((output && (*p)->url_write) || (!output && (*p)->url_read))
- return (*p)->name;
- return avio_enum_protocols(opaque, output);
+ *opaque = (void*)(uintptr_t)(url_protocols[i] ? i + 1 : i);
+ return ret;
}
const AVClass *avio_protocol_get_class(const char *name)