Merge commit '53151723e377b9c43f876e20d7f27a17993256c8'

* commit '53151723e377b9c43f876e20d7f27a17993256c8':
  avio: K&R formatting cosmetics

Conflicts:
	libavformat/avio.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-10-28 12:17:57 +01:00
commit 0436ffc294

View File

@ -42,8 +42,10 @@ URLProtocol *ffurl_protocol_next(URLProtocol *prev)
static const char *urlcontext_to_name(void *ptr)
{
URLContext *h = (URLContext *)ptr;
if(h->prot) return h->prot->name;
else return "NULL";
if (h->prot)
return h->prot->name;
else
return "NULL";
}
static void *urlcontext_child_next(void *obj, void *prev)
@ -68,7 +70,6 @@ static const AVClass *urlcontext_child_class_next(const AVClass *prev)
if (p->priv_data_class)
return p->priv_data_class;
return NULL;
}
static const AVOption options[] = { { NULL } };
@ -82,12 +83,12 @@ const AVClass ffurl_context_class = {
};
/*@}*/
const char *avio_enum_protocols(void **opaque, int output)
{
URLProtocol *p;
*opaque = ffurl_protocol_next(*opaque);
if (!(p = *opaque)) return NULL;
if (!(p = *opaque))
return NULL;
if ((output && p->url_write) || (!output && p->url_read))
return p->name;
return avio_enum_protocols(opaque, output);
@ -102,7 +103,8 @@ int ffurl_register_protocol(URLProtocol *protocol, int size)
protocol = temp;
}
p = &first_protocol;
while (*p != NULL) p = &(*p)->next;
while (*p != NULL)
p = &(*p)->next;
*p = protocol;
protocol->next = NULL;
return 0;
@ -197,14 +199,17 @@ static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
int ffurl_connect(URLContext *uc, AVDictionary **options)
{
int err =
uc->prot->url_open2 ? uc->prot->url_open2(uc, uc->filename, uc->flags, options) :
uc->prot->url_open2 ? uc->prot->url_open2(uc,
uc->filename,
uc->flags,
options) :
uc->prot->url_open(uc, uc->filename, uc->flags);
if (err)
return err;
uc->is_connected = 1;
//We must be careful here as ffurl_seek() could be slow, for example for http
if( (uc->flags & AVIO_FLAG_WRITE)
|| !strcmp(uc->prot->name, "file"))
/* We must be careful here as ffurl_seek() could be slow,
* for example for http */
if ((uc->flags & AVIO_FLAG_WRITE) || !strcmp(uc->prot->name, "file"))
if (!uc->is_streamed && ffurl_seek(uc, 0, SEEK_SET) < 0)
uc->is_streamed = 1;
return 0;
@ -232,7 +237,8 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags,
is_dos_path(filename))
strcpy(proto_str, "file");
else
av_strlcpy(proto_str, filename, FFMIN(proto_len+1, sizeof(proto_str)));
av_strlcpy(proto_str, filename,
FFMIN(proto_len + 1, sizeof(proto_str)));
if ((ptr = strchr(proto_str, ',')))
*ptr = '\0';
@ -271,8 +277,11 @@ fail:
return ret;
}
static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int size, int size_min,
int (*transfer_func)(URLContext *h, unsigned char *buf, int size))
static inline int retry_transfer_wrapper(URLContext *h, uint8_t *buf,
int size, int size_min,
int (*transfer_func)(URLContext *h,
uint8_t *buf,
int size))
{
int ret, len;
int fast_retries = 5;
@ -348,7 +357,8 @@ int ffurl_closep(URLContext **hh)
{
URLContext *h= *hh;
int ret = 0;
if (!h) return 0; /* can happen when ffurl_open fails */
if (!h)
return 0; /* can happen when ffurl_open fails */
if (h->is_connected && h->prot->url_close)
ret = h->prot->url_close(h);