From 6b776c61da26428ca67abec919c8a186a276ca66 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 26 Oct 2012 17:58:19 +0100 Subject: [PATCH 1/6] buffersink: remove stray semicolon after function definition Signed-off-by: Mans Rullgard --- libavfilter/buffersink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index 73af25dc36..c68b909d57 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -57,7 +57,7 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *buf) link->cur_buf = NULL; return 0; -}; +} int av_buffersink_read(AVFilterContext *ctx, AVFilterBufferRef **buf) { From 67a68dcec2271336c859d1fbd8f40c268f54ec8a Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 26 Oct 2012 22:25:37 +0100 Subject: [PATCH 2/6] af_channelmap: remove stray enum declaration Signed-off-by: Mans Rullgard --- libavfilter/af_channelmap.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c index 8c49d10386..f70b48102c 100644 --- a/libavfilter/af_channelmap.c +++ b/libavfilter/af_channelmap.c @@ -124,7 +124,6 @@ static av_cold int channelmap_init(AVFilterContext *ctx, const char *args) ChannelMapContext *s = ctx->priv; int ret; char *mapping; - enum mode; int map_entries = 0; char buf[256]; enum MappingMode mode; From 9efbfe57e082b0f42bf0c830a4fdc6b80d2b13ca Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 26 Oct 2012 19:33:59 +0100 Subject: [PATCH 3/6] network: use HAVE_THREADS instead of local hack HAVE_THREADS is set in config.h if pthreads or w32threads is available, which presumably the proper condition here. Also fixes undefined behaviour in preprocessor directives. Signed-off-by: Mans Rullgard --- libavformat/network.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/libavformat/network.c b/libavformat/network.c index 5b2b958c83..fe17bdf2eb 100644 --- a/libavformat/network.c +++ b/libavformat/network.c @@ -22,9 +22,7 @@ #include "libavcodec/internal.h" #include "libavutil/mem.h" -#define THREADS (HAVE_PTHREADS || (defined(WIN32) && !defined(__MINGW32CE__))) - -#if THREADS +#if HAVE_THREADS #if HAVE_PTHREADS #include #else @@ -35,7 +33,7 @@ #if CONFIG_OPENSSL #include static int openssl_init; -#if THREADS +#if HAVE_THREADS #include #include "libavutil/avutil.h" pthread_mutex_t *openssl_mutexes; @@ -56,7 +54,7 @@ static unsigned long openssl_thread_id(void) #endif #if CONFIG_GNUTLS #include -#if THREADS && GNUTLS_VERSION_NUMBER <= 0x020b00 +#if HAVE_THREADS && GNUTLS_VERSION_NUMBER <= 0x020b00 #include #include #undef malloc @@ -72,7 +70,7 @@ void ff_tls_init(void) if (!openssl_init) { SSL_library_init(); SSL_load_error_strings(); -#if THREADS +#if HAVE_THREADS if (!CRYPTO_get_locking_callback()) { int i; openssl_mutexes = av_malloc(sizeof(pthread_mutex_t) * CRYPTO_num_locks()); @@ -88,7 +86,7 @@ void ff_tls_init(void) openssl_init++; #endif #if CONFIG_GNUTLS -#if THREADS && GNUTLS_VERSION_NUMBER < 0x020b00 +#if HAVE_THREADS && GNUTLS_VERSION_NUMBER < 0x020b00 if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P) == 0) gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); #endif @@ -103,7 +101,7 @@ void ff_tls_deinit(void) #if CONFIG_OPENSSL openssl_init--; if (!openssl_init) { -#if THREADS +#if HAVE_THREADS if (CRYPTO_get_locking_callback() == openssl_lock) { int i; CRYPTO_set_locking_callback(NULL); From be2efe0c7b6a8188988d7de5da236d794312b5bb Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 26 Oct 2012 19:46:37 +0100 Subject: [PATCH 4/6] udp: use socklen_t where appropriate getsockname() takes a pointer to socklen_t which is not necessarily int. Signed-off-by: Mans Rullgard --- libavformat/udp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/udp.c b/libavformat/udp.c index e848ecdcc8..373a4c97a8 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -257,7 +257,7 @@ static int udp_set_url(struct sockaddr_storage *addr, } static int udp_socket_create(UDPContext *s, struct sockaddr_storage *addr, - int *addr_len, const char *localaddr) + socklen_t *addr_len, const char *localaddr) { int udp_fd = -1; struct addrinfo *res0 = NULL, *res = NULL; @@ -389,7 +389,7 @@ static int udp_open(URLContext *h, const char *uri, int flags) const char *p; char buf[256]; struct sockaddr_storage my_addr; - int len; + socklen_t len; int reuse_specified = 0; int i, include = 0, num_sources = 0; char *sources[32]; From cc64ec570c92fe39db3f1db8c877a8cc70e3b668 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 26 Oct 2012 21:53:31 +0100 Subject: [PATCH 5/6] avserver: use socklen_t where appropriate Various socket functions expect a pointer to socklen_t which is not necessarily int. Signed-off-by: Mans Rullgard --- avserver.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/avserver.c b/avserver.c index 994edcd04c..f9d85d8d3e 100644 --- a/avserver.c +++ b/avserver.c @@ -799,7 +799,8 @@ static void http_send_too_busy_reply(int fd) static void new_connection(int server_fd, int is_rtsp) { struct sockaddr_in from_addr; - int fd, len; + socklen_t len; + int fd; HTTPContext *c = NULL; len = sizeof(from_addr); @@ -1717,7 +1718,8 @@ static int http_parse_request(HTTPContext *c) case REDIR_SDP: { uint8_t *sdp_data; - int sdp_data_size, len; + int sdp_data_size; + socklen_t len; struct sockaddr_in my_addr; q += snprintf(q, c->buffer_size, @@ -2991,7 +2993,8 @@ static void rtsp_cmd_describe(HTTPContext *c, const char *url) char path1[1024]; const char *path; uint8_t *content; - int content_length, len; + int content_length; + socklen_t len; struct sockaddr_in my_addr; /* find which url is asked */ From 4521645b1aee9e9ad8f5cea7b2392cd5f6ffcd26 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 26 Oct 2012 18:42:29 +0100 Subject: [PATCH 6/6] avio: fix pointer type mismatches in avio_enum_protocols() Signed-off-by: Mans Rullgard --- libavformat/avio.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavformat/avio.c b/libavformat/avio.c index 45ee86688f..a43b241399 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -85,11 +85,11 @@ const AVClass ffurl_context_class = { const char *avio_enum_protocols(void **opaque, int output) { - URLProtocol **p = opaque; - *p = ffurl_protocol_next(*p); - if (!*p) return NULL; - if ((output && (*p)->url_write) || (!output && (*p)->url_read)) - return (*p)->name; + URLProtocol *p; + *opaque = ffurl_protocol_next(*opaque); + if (!(p = *opaque)) return NULL; + if ((output && p->url_write) || (!output && p->url_read)) + return p->name; return avio_enum_protocols(opaque, output); }