tls_gnutls: Add missing includes for the gcrypt thread safety callbacks

Message ID 1432801857-67983-1-git-send-email-martin@martin.st
State Committed
Headers show

Commit Message

Martin Storsjö May 28, 2015, 8:30 a.m.
This fixes building with gcrypt-backed gnutls versions, broken
in 57cde2b180.
---
 libavformat/tls_gnutls.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

wm4 May 28, 2015, 8:38 a.m. | #1
On Thu, 28 May 2015 11:30:57 +0300
Martin Storsjö <martin@martin.st> wrote:

> This fixes building with gcrypt-backed gnutls versions, broken
> in 57cde2b180.
> ---
>  libavformat/tls_gnutls.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c
> index 1d3f57c..4fe3b39 100644
> --- a/libavformat/tls_gnutls.c
> +++ b/libavformat/tls_gnutls.c
> @@ -36,6 +36,12 @@
>  #include "libavutil/parseutils.h"
>  
>  #if HAVE_THREADS && GNUTLS_VERSION_NUMBER <= 0x020b00
> +#if HAVE_PTHREADS
> +#include <pthread.h>
> +#else
> +#include "compat/w32pthreads.h"
> +#endif
> +
>  #include <gcrypt.h>
>  GCRY_THREAD_OPTION_PTHREAD_IMPL;
>  #endif

I'd suggest including libavutil/thread.h instead. (tls_openssl.c uses
this, but I forgot it for tls_gnutls.c.)
Martin Storsjö May 28, 2015, 8:48 a.m. | #2
On Thu, 28 May 2015, wm4 wrote:

> On Thu, 28 May 2015 11:30:57 +0300
> Martin Storsjö <martin@martin.st> wrote:
>
>> This fixes building with gcrypt-backed gnutls versions, broken
>> in 57cde2b180.
>> ---
>>  libavformat/tls_gnutls.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>> 
>> diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c
>> index 1d3f57c..4fe3b39 100644
>> --- a/libavformat/tls_gnutls.c
>> +++ b/libavformat/tls_gnutls.c
>> @@ -36,6 +36,12 @@
>>  #include "libavutil/parseutils.h"
>>
>>  #if HAVE_THREADS && GNUTLS_VERSION_NUMBER <= 0x020b00
>> +#if HAVE_PTHREADS
>> +#include <pthread.h>
>> +#else
>> +#include "compat/w32pthreads.h"
>> +#endif
>> +
>>  #include <gcrypt.h>
>>  GCRY_THREAD_OPTION_PTHREAD_IMPL;
>>  #endif
>
> I'd suggest including libavutil/thread.h instead. (tls_openssl.c uses
> this, but I forgot it for tls_gnutls.c.)

Thanks, amended in that way locally. Ok with that change, I assume?

// Martin
wm4 May 28, 2015, 8:59 a.m. | #3
On Thu, 28 May 2015 11:48:49 +0300 (EEST)
Martin Storsjö <martin@martin.st> wrote:

> On Thu, 28 May 2015, wm4 wrote:
> 
> > On Thu, 28 May 2015 11:30:57 +0300
> > Martin Storsjö <martin@martin.st> wrote:
> >
> >> This fixes building with gcrypt-backed gnutls versions, broken
> >> in 57cde2b180.
> >> ---
> >>  libavformat/tls_gnutls.c | 6 ++++++
> >>  1 file changed, 6 insertions(+)
> >> 
> >> diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c
> >> index 1d3f57c..4fe3b39 100644
> >> --- a/libavformat/tls_gnutls.c
> >> +++ b/libavformat/tls_gnutls.c
> >> @@ -36,6 +36,12 @@
> >>  #include "libavutil/parseutils.h"
> >>
> >>  #if HAVE_THREADS && GNUTLS_VERSION_NUMBER <= 0x020b00
> >> +#if HAVE_PTHREADS
> >> +#include <pthread.h>
> >> +#else
> >> +#include "compat/w32pthreads.h"
> >> +#endif
> >> +
> >>  #include <gcrypt.h>
> >>  GCRY_THREAD_OPTION_PTHREAD_IMPL;
> >>  #endif
> >
> > I'd suggest including libavutil/thread.h instead. (tls_openssl.c uses
> > this, but I forgot it for tls_gnutls.c.)
> 
> Thanks, amended in that way locally. Ok with that change, I assume?
> 

Of course.

Patch

diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c
index 1d3f57c..4fe3b39 100644
--- a/libavformat/tls_gnutls.c
+++ b/libavformat/tls_gnutls.c
@@ -36,6 +36,12 @@ 
 #include "libavutil/parseutils.h"
 
 #if HAVE_THREADS && GNUTLS_VERSION_NUMBER <= 0x020b00
+#if HAVE_PTHREADS
+#include <pthread.h>
+#else
+#include "compat/w32pthreads.h"
+#endif
+
 #include <gcrypt.h>
 GCRY_THREAD_OPTION_PTHREAD_IMPL;
 #endif